Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.

My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
diff --git a/firmware/export/config/sansaclipplus.h b/firmware/export/config/sansaclipplus.h
index 55eacd2..c654de7 100644
--- a/firmware/export/config/sansaclipplus.h
+++ b/firmware/export/config/sansaclipplus.h
@@ -188,7 +188,7 @@
 #define CONFIG_LED LED_VIRTUAL

 /* Define this if you have adjustable CPU frequency */
-//#define HAVE_ADJUSTABLE_CPU_FREQ
+#define HAVE_ADJUSTABLE_CPU_FREQ

 #define BOOTFILE_EXT    "sansa"
 #define BOOTFILE        "rockbox." BOOTFILE_EXT
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c
index dbbe1a1..3f71c25 100644
--- a/firmware/target/arm/as3525/system-as3525.c
+++ b/firmware/target/arm/as3525/system-as3525.c
@@ -460,6 +460,7 @@ void set_cpu_frequency(long frequency)
 void set_cpu_frequency(long frequency)
 {
     int oldstatus = disable_irq_save();
+    int cgu_proc, cgu_peri;

     /* We only have 2 settings */
     cpu_frequency = (frequency == CPUFREQ_MAX) ? frequency : CPUFREQ_NORMAL;
@@ -467,22 +468,28 @@ void set_cpu_frequency(long frequency)
     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);
+        cgu_peri = (CGU_PERI & ~(0xF << 2)) | (AS3525_PCLK_DIV0 << 2);

-        CGU_PROC = ((AS3525_FCLK_POSTDIV << 4) |
+        cgu_proc = ((AS3525_FCLK_POSTDIV << 4) |
                     (AS3525_FCLK_PREDIV  << 2) |
                     AS3525_FCLK_SEL);
     }
     else
     {
-        CGU_PROC = ((AS3525_FCLK_POSTDIV_UNBOOSTED << 4) |
+        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);
+        cgu_peri = (CGU_PERI & ~(0xF << 2)) | (AS3525_PCLK_DIV0_UNBOOSTED << 2);
     }

+    asm(
+        "stmia %[reg], {%[proc], %[peri]}  \n"
+        : /* no output */
+        : [proc]"r"(cgu_proc), [peri]"r"(cgu_peri), [reg]"r"(CGU_PROC)
+    );
+
     restore_irq(oldstatus);
 }
 #endif