diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-09-05 15:34:34 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-09-05 15:34:34 +0000 |
commit | c196da2ceeddfc03a42e6a620aa08e3f583c8f0d (patch) | |
tree | 93fc7d4214af51ae689d02754a7192b36d94abe9 /firmware | |
parent | d71d537b17f8a3cf385a6523b4d22458831a4afe (diff) | |
download | rockbox-c196da2ceeddfc03a42e6a620aa08e3f583c8f0d.tar.gz rockbox-c196da2ceeddfc03a42e6a620aa08e3f583c8f0d.zip |
FS#11597 : decrease FCLK frequency when unboosted
FCLK is unused because we use fastbus clocking: CPU clock = PCLK
Base PCLK off PLLA and use the lowest frqeuency for FCLK (24MHz source,
maximum divider)
Save a bit of power, adjust Clipv1/e200v2/Fuzev1 current usage accordingly
Note: the power saving (in mA) is a bit less on e200v2/Fuzev1 than on Clipv1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28000 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/config/sansaclip.h | 2 | ||||
-rw-r--r-- | firmware/export/config/sansae200v2.h | 2 | ||||
-rw-r--r-- | firmware/export/config/sansafuze.h | 2 | ||||
-rw-r--r-- | firmware/target/arm/as3525/clock-target.h | 22 | ||||
-rw-r--r-- | firmware/target/arm/as3525/system-as3525.c | 18 |
5 files changed, 19 insertions, 27 deletions
diff --git a/firmware/export/config/sansaclip.h b/firmware/export/config/sansaclip.h index d43fa898b0..7427d623fb 100644 --- a/firmware/export/config/sansaclip.h +++ b/firmware/export/config/sansaclip.h | |||
@@ -154,7 +154,7 @@ | |||
154 | /* #define HAVE_POWEROFF_WHILE_CHARGING */ | 154 | /* #define HAVE_POWEROFF_WHILE_CHARGING */ |
155 | 155 | ||
156 | /* define current usage levels (based on battery bench) */ | 156 | /* define current usage levels (based on battery bench) */ |
157 | #define CURRENT_NORMAL 42 | 157 | #define CURRENT_NORMAL 37 |
158 | #define CURRENT_BACKLIGHT 13 | 158 | #define CURRENT_BACKLIGHT 13 |
159 | #define CURRENT_RECORD CURRENT_NORMAL | 159 | #define CURRENT_RECORD CURRENT_NORMAL |
160 | 160 | ||
diff --git a/firmware/export/config/sansae200v2.h b/firmware/export/config/sansae200v2.h index 1b7d76e650..03711990a9 100644 --- a/firmware/export/config/sansae200v2.h +++ b/firmware/export/config/sansae200v2.h | |||
@@ -158,7 +158,7 @@ | |||
158 | #define CONFIG_I2C I2C_AS3525 | 158 | #define CONFIG_I2C I2C_AS3525 |
159 | 159 | ||
160 | /* define current usage levels (based on battery bench) */ | 160 | /* define current usage levels (based on battery bench) */ |
161 | #define CURRENT_NORMAL 45 | 161 | #define CURRENT_NORMAL 44 |
162 | #define CURRENT_BACKLIGHT 30 | 162 | #define CURRENT_BACKLIGHT 30 |
163 | #define CURRENT_RECORD CURRENT_NORMAL | 163 | #define CURRENT_RECORD CURRENT_NORMAL |
164 | 164 | ||
diff --git a/firmware/export/config/sansafuze.h b/firmware/export/config/sansafuze.h index e2b3fa8aaa..2f0073fc53 100644 --- a/firmware/export/config/sansafuze.h +++ b/firmware/export/config/sansafuze.h | |||
@@ -162,7 +162,7 @@ | |||
162 | #define CONFIG_I2C I2C_AS3525 | 162 | #define CONFIG_I2C I2C_AS3525 |
163 | 163 | ||
164 | /* define current usage levels (based on battery bench) */ | 164 | /* define current usage levels (based on battery bench) */ |
165 | #define CURRENT_NORMAL 37 | 165 | #define CURRENT_NORMAL 35 |
166 | #define CURRENT_BACKLIGHT 30 | 166 | #define CURRENT_BACKLIGHT 30 |
167 | #define CURRENT_RECORD CURRENT_NORMAL | 167 | #define CURRENT_RECORD CURRENT_NORMAL |
168 | 168 | ||
diff --git a/firmware/target/arm/as3525/clock-target.h b/firmware/target/arm/as3525/clock-target.h index 7c388ad6c9..97d6edb3d1 100644 --- a/firmware/target/arm/as3525/clock-target.h +++ b/firmware/target/arm/as3525/clock-target.h | |||
@@ -139,7 +139,6 @@ | |||
139 | #define AS3525_FCLK_POSTDIV (CLK_DIV((AS3525_PLLA_FREQ*(8-AS3525_FCLK_PREDIV)/8), AS3525_FCLK_FREQ) - 1) /*div=1/(n+1)*/ | 139 | #define AS3525_FCLK_POSTDIV (CLK_DIV((AS3525_PLLA_FREQ*(8-AS3525_FCLK_PREDIV)/8), AS3525_FCLK_FREQ) - 1) /*div=1/(n+1)*/ |
140 | 140 | ||
141 | #if CONFIG_CPU == AS3525v2 | 141 | #if CONFIG_CPU == AS3525v2 |
142 | /* On as3525v2 we change fclk by writing to CGU_PROC */ | ||
143 | #define AS3525_FCLK_POSTDIV_UNBOOSTED (CLK_DIV((AS3525_PLLA_FREQ*(8-AS3525_FCLK_PREDIV)/8), CPUFREQ_NORMAL) - 1) /*div=1/(n+1) */ | 142 | #define AS3525_FCLK_POSTDIV_UNBOOSTED (CLK_DIV((AS3525_PLLA_FREQ*(8-AS3525_FCLK_PREDIV)/8), CPUFREQ_NORMAL) - 1) /*div=1/(n+1) */ |
144 | /* Since pclk is based on fclk, we need to change CGU_PERI as well */ | 143 | /* Since pclk is based on fclk, we need to change CGU_PERI as well */ |
145 | #define AS3525_PCLK_DIV0_UNBOOSTED (CLK_DIV(CPUFREQ_NORMAL, AS3525_DRAM_FREQ) - 1) /*div=1/(n+1)*/ | 144 | #define AS3525_PCLK_DIV0_UNBOOSTED (CLK_DIV(CPUFREQ_NORMAL, AS3525_DRAM_FREQ) - 1) /*div=1/(n+1)*/ |
@@ -164,21 +163,18 @@ | |||
164 | 163 | ||
165 | /* PCLK */ | 164 | /* PCLK */ |
166 | 165 | ||
167 | /* Figure out if we need to use asynchronous bus */ | 166 | #if CONFIG_CPU == AS3525 |
168 | #if ((CONFIG_CPU == AS3525) && (AS3525_FCLK_FREQ % AS3525_PCLK_FREQ)) | ||
169 | #define ASYNCHRONOUS_BUS /* Boosted mode asynchronous */ | ||
170 | #endif | ||
171 | |||
172 | #ifdef ASYNCHRONOUS_BUS | ||
173 | #define AS3525_PCLK_SEL AS3525_CLK_PLLA /* PLLA input for asynchronous */ | ||
174 | #define AS3525_PCLK_DIV0 (CLK_DIV(AS3525_PLLA_FREQ, AS3525_DRAM_FREQ) - 1)/*div=1/(n+1)*/ | ||
175 | #else /* ASYNCHRONOUS_BUS */ | ||
176 | #define AS3525_PCLK_SEL AS3525_CLK_FCLK /* Fclk input for synchronous */ | ||
177 | #define AS3525_PCLK_DIV0 (CLK_DIV(AS3525_FCLK_FREQ, AS3525_DRAM_FREQ) - 1) /*div=1/(n+1)*/ | ||
178 | #endif /* ASYNCHRONOUS_BUS */ | ||
179 | 167 | ||
168 | #define AS3525_PCLK_SEL AS3525_CLK_PLLA | ||
180 | /*unable to use AS3525_PCLK_DIV1 != 0 successfuly so far*/ | 169 | /*unable to use AS3525_PCLK_DIV1 != 0 successfuly so far*/ |
181 | #define AS3525_PCLK_DIV1 (CLK_DIV(AS3525_DRAM_FREQ, AS3525_PCLK_FREQ) - 1)/* div = 1/(n+1)*/ | 170 | #define AS3525_PCLK_DIV1 (CLK_DIV(AS3525_DRAM_FREQ, AS3525_PCLK_FREQ) - 1)/* div = 1/(n+1)*/ |
171 | #define AS3525_PCLK_DIV0 (CLK_DIV(AS3525_PLLA_FREQ, AS3525_DRAM_FREQ) - 1) /*div=1/(n+1)*/ | ||
172 | #else | ||
173 | |||
174 | #define AS3525_PCLK_SEL AS3525_CLK_FCLK | ||
175 | #define AS3525_PCLK_DIV0 (CLK_DIV(AS3525_FCLK_FREQ, AS3525_DRAM_FREQ) - 1) /*div=1/(n+1)*/ | ||
176 | |||
177 | #endif /* CONFIG_CPU */ | ||
182 | 178 | ||
183 | /* PCLK as Source */ | 179 | /* PCLK as Source */ |
184 | #define AS3525_DBOP_DIV (CLK_DIV(AS3525_PCLK_FREQ, AS3525_DBOP_FREQ) - 1) /*div=1/(n+1)*/ | 180 | #define AS3525_DBOP_DIV (CLK_DIV(AS3525_PCLK_FREQ, AS3525_DBOP_FREQ) - 1) /*div=1/(n+1)*/ |
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c index 50ce697656..01534abb3c 100644 --- a/firmware/target/arm/as3525/system-as3525.c +++ b/firmware/target/arm/as3525/system-as3525.c | |||
@@ -262,11 +262,7 @@ void system_init(void) | |||
262 | #endif | 262 | #endif |
263 | AS3525_PCLK_SEL); | 263 | AS3525_PCLK_SEL); |
264 | 264 | ||
265 | #if CONFIG_CPU == AS3525 | 265 | set_cpu_frequency(CPUFREQ_DEFAULT); |
266 | cpu_frequency = CPUFREQ_DEFAULT; /* fastbus */ | ||
267 | #else | ||
268 | cpu_frequency = CPUFREQ_MAX; | ||
269 | #endif | ||
270 | 266 | ||
271 | #if 0 /* the GPIO clock is already enabled by the dualboot function */ | 267 | #if 0 /* the GPIO clock is already enabled by the dualboot function */ |
272 | CGU_PERI |= CGU_GPIO_CLOCK_ENABLE; | 268 | CGU_PERI |= CGU_GPIO_CLOCK_ENABLE; |
@@ -367,16 +363,14 @@ void set_cpu_frequency(long frequency) | |||
367 | while(adc_read(ADC_CVDD) < 470); /* 470 * .0025 = 1.175V */ | 363 | while(adc_read(ADC_CVDD) < 470); /* 470 * .0025 = 1.175V */ |
368 | #endif /* HAVE_ADJUSTABLE_CPU_VOLTAGE */ | 364 | #endif /* HAVE_ADJUSTABLE_CPU_VOLTAGE */ |
369 | 365 | ||
366 | CGU_PROC = ((AS3525_FCLK_POSTDIV << 4) | | ||
367 | (AS3525_FCLK_PREDIV << 2) | | ||
368 | AS3525_FCLK_SEL); | ||
369 | |||
370 | asm volatile( | 370 | asm volatile( |
371 | "mrc p15, 0, r0, c1, c0 \n" | 371 | "mrc p15, 0, r0, c1, c0 \n" |
372 | |||
373 | #ifdef ASYNCHRONOUS_BUS | ||
374 | "orr r0, r0, #3<<30 \n" /* asynchronous bus clocking */ | ||
375 | #else | ||
376 | "bic r0, r0, #3<<30 \n" /* clear bus bits */ | 372 | "bic r0, r0, #3<<30 \n" /* clear bus bits */ |
377 | "orr r0, r0, #1<<30 \n" /* synchronous bus clocking */ | 373 | "orr r0, r0, #1<<30 \n" /* synchronous bus clocking */ |
378 | #endif | ||
379 | |||
380 | "mcr p15, 0, r0, c1, c0 \n" | 374 | "mcr p15, 0, r0, c1, c0 \n" |
381 | : : : "r0" ); | 375 | : : : "r0" ); |
382 | 376 | ||
@@ -390,6 +384,8 @@ void set_cpu_frequency(long frequency) | |||
390 | "mcr p15, 0, r0, c1, c0 \n" | 384 | "mcr p15, 0, r0, c1, c0 \n" |
391 | : : : "r0" ); | 385 | : : : "r0" ); |
392 | 386 | ||
387 | /* FCLK is unused so put it to the lowest freq we can */ | ||
388 | CGU_PROC = ((0xf << 4) | (0x3 << 2) | AS3525_CLK_MAIN); | ||
393 | 389 | ||
394 | #ifdef HAVE_ADJUSTABLE_CPU_VOLTAGE | 390 | #ifdef HAVE_ADJUSTABLE_CPU_VOLTAGE |
395 | /* Decreasing frequency so reduce voltage after change */ | 391 | /* Decreasing frequency so reduce voltage after change */ |