diff options
-rw-r--r-- | firmware/target/arm/as3525/clock-target.h | 4 | ||||
-rw-r--r-- | firmware/target/arm/as3525/debug-as3525.c | 11 |
2 files changed, 7 insertions, 8 deletions
diff --git a/firmware/target/arm/as3525/clock-target.h b/firmware/target/arm/as3525/clock-target.h index c9b2ceb9a4..923f4e7c43 100644 --- a/firmware/target/arm/as3525/clock-target.h +++ b/firmware/target/arm/as3525/clock-target.h | |||
@@ -89,8 +89,8 @@ | |||
89 | 89 | ||
90 | /* FCLK */ | 90 | /* FCLK */ |
91 | #define AS3525_FCLK_SEL AS3525_CLK_PLLA | 91 | #define AS3525_FCLK_SEL AS3525_CLK_PLLA |
92 | #define AS3525_FCLK_PREDIV 0 /* div = (8-n)/8 acts strange when used!*/ | 92 | #define AS3525_FCLK_PREDIV 0 /* div = (8-n)/8 Enter manually & postdiv will be calculated*/ |
93 | #define AS3525_FCLK_POSTDIV (CLK_DIV(AS3525_PLLA_FREQ, AS3525_FCLK_FREQ) - 1) /*div=1/(n+1)*/ | 93 | #define AS3525_FCLK_POSTDIV (CLK_DIV((AS3525_PLLA_FREQ*(8-AS3525_FCLK_PREDIV)/8), AS3525_FCLK_FREQ) - 1) /*div=1/(n+1)*/ |
94 | 94 | ||
95 | /* PCLK */ | 95 | /* PCLK */ |
96 | #ifdef ASYNCHRONOUS_BUS | 96 | #ifdef ASYNCHRONOUS_BUS |
diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c index 8bd2ee1188..7585f76431 100644 --- a/firmware/target/arm/as3525/debug-as3525.c +++ b/firmware/target/arm/as3525/debug-as3525.c | |||
@@ -84,6 +84,8 @@ static unsigned read_cp15 (void) | |||
84 | int calc_freq(int clk) | 84 | int calc_freq(int clk) |
85 | { | 85 | { |
86 | int out_div; | 86 | int out_div; |
87 | unsigned int prediv = ((unsigned int)CGU_PROC>>2) & 0x3; | ||
88 | unsigned int postdiv = ((unsigned int)CGU_PROC>>4) & 0xf; | ||
87 | 89 | ||
88 | switch(clk) { | 90 | switch(clk) { |
89 | /* clk_main = clk_int = 24MHz oscillator */ | 91 | /* clk_main = clk_int = 24MHz oscillator */ |
@@ -119,14 +121,11 @@ int calc_freq(int clk) | |||
119 | case CLK_FCLK: | 121 | case CLK_FCLK: |
120 | switch(CGU_PROC & 3) { | 122 | switch(CGU_PROC & 3) { |
121 | case 0: | 123 | case 0: |
122 | return CLK_MAIN/ | 124 | return (CLK_MAIN * (8 - prediv)) / (8*(postdiv + 1)); |
123 | ((8/(8-((CGU_PROC>>2)& 0x3)))*(((CGU_PROC>>4)& 0xf) + 1)); | ||
124 | case 1: | 125 | case 1: |
125 | return calc_freq(CLK_PLLA)/ | 126 | return (calc_freq(CLK_PLLA) * (8 - prediv)) / (8*(postdiv + 1)); |
126 | ((8/(8-((CGU_PROC>>2)& 0x3)))*(((CGU_PROC>>4)& 0xf) + 1)); | ||
127 | case 2: | 127 | case 2: |
128 | return calc_freq(CLK_PLLB)/ | 128 | return (calc_freq(CLK_PLLB) * (8 - prediv)) / (8*(postdiv + 1)); |
129 | ((8/(8-((CGU_PROC>>2)& 0x3)))*(((CGU_PROC>>4)& 0xf) + 1)); | ||
130 | default: | 129 | default: |
131 | return 0; | 130 | return 0; |
132 | } | 131 | } |