From 893180d47d7dd606e208987d57b95b29a57dfcc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Thu, 29 Apr 2010 03:15:18 +0000 Subject: [PATCH] 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 --- firmware/target/arm/as3525/system-as3525.c | 11 +++-------- 1 file 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