summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-04-29 03:15:18 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-04-29 03:15:18 +0000
commit893180d47d7dd606e208987d57b95b29a57dfcc0 (patch)
tree496e51501a5ba42a96afa5acdb9b19582777bbfc
parent2a180e80398a7915b7fd2fdc6cf404b6fd019fbd (diff)
downloadrockbox-893180d47d7dd606e208987d57b95b29a57dfcc0.tar.gz
rockbox-893180d47d7dd606e208987d57b95b29a57dfcc0.zip
as3525v2: crashless cpufreq switching
delays after modifying the registers seems not to be needed moving RAM operation (cpu_frequency variable) before modifying the register also seems to help git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25754 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/system-as3525.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c
index 2b3e163611..47cb465c62 100644
--- a/firmware/target/arm/as3525/system-as3525.c
+++ b/firmware/target/arm/as3525/system-as3525.c
@@ -453,34 +453,29 @@ void set_cpu_frequency(long frequency)
void set_cpu_frequency(long frequency)
{
int oldstatus = disable_irq_save();
- int delay;
+
+ /* We only have 2 settings */
+ cpu_frequency = (frequency == CPUFREQ_MAX) ? frequency : CPUFREQ_NORMAL;
if(frequency == CPUFREQ_MAX)
{
/* Change PCLK while FCLK is low, so it doesn't go too high */
CGU_PERI = (CGU_PERI & ~(0xF << 2)) | (AS3525_PCLK_DIV0 << 2);
- delay = 40; while(delay--) asm("nop");
-
CGU_PROC = ((AS3525_FCLK_POSTDIV << 4) |
(AS3525_FCLK_PREDIV << 2) |
AS3525_FCLK_SEL);
}
else
{
- frequency = CPUFREQ_NORMAL; /* We only have 2 settings */
-
CGU_PROC = ((AS3525_FCLK_POSTDIV_UNBOOSTED << 4) |
(AS3525_FCLK_PREDIV << 2) |
AS3525_FCLK_SEL);
/* Change PCLK after FCLK is low, so it doesn't go too high */
CGU_PERI = (CGU_PERI & ~(0xF << 2)) | (AS3525_PCLK_DIV0_UNBOOSTED << 2);
- delay = 40; while(delay--) asm("nop");
}
- cpu_frequency = frequency;
-
restore_irq(oldstatus);
}
#endif