diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2008-11-26 16:46:12 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2008-11-26 16:46:12 +0000 |
commit | 97e907538ad8c51bf5467644ed12c695f7ce56f5 (patch) | |
tree | 9db1b335e973fe0ddab1ed0b2934e63b6efff570 /firmware/target/arm | |
parent | a39e4e9962109e77482d85609fbc452bd163e620 (diff) | |
download | rockbox-97e907538ad8c51bf5467644ed12c695f7ce56f5.tar.gz rockbox-97e907538ad8c51bf5467644ed12c695f7ce56f5.zip |
Sansa AMS: implement set_cpu_frequency()
Use a 24MHz peripheral clock instead of 64MHz for battery life
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19234 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/as3525/sansa-e200v2/system-target.h | 30 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-fuze/system-target.h | 30 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-m200v4/system-target.h | 30 | ||||
-rw-r--r-- | firmware/target/arm/as3525/system-as3525.c | 19 | ||||
-rw-r--r-- | firmware/target/arm/as3525/system-target.h (renamed from firmware/target/arm/as3525/sansa-clip/system-target.h) | 8 |
5 files changed, 19 insertions, 98 deletions
diff --git a/firmware/target/arm/as3525/sansa-e200v2/system-target.h b/firmware/target/arm/as3525/sansa-e200v2/system-target.h deleted file mode 100644 index 19ddd03b7c..0000000000 --- a/firmware/target/arm/as3525/sansa-e200v2/system-target.h +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 ?? | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef SYSTEM_TARGET_H | ||
22 | #define SYSTEM_TARGET_H | ||
23 | |||
24 | #include "system-arm.h" | ||
25 | |||
26 | #define CPUFREQ_MAX 250000000 | ||
27 | #define CPUFREQ_DEFAULT 250000000 | ||
28 | #define CPUFREQ_NORMAL 250000000 | ||
29 | |||
30 | #endif /* SYSTEM_TARGET_H */ | ||
diff --git a/firmware/target/arm/as3525/sansa-fuze/system-target.h b/firmware/target/arm/as3525/sansa-fuze/system-target.h deleted file mode 100644 index 553ce90846..0000000000 --- a/firmware/target/arm/as3525/sansa-fuze/system-target.h +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 ?? | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef SYSTEM_TARGET_H | ||
22 | #define SYSTEM_TARGET_H | ||
23 | |||
24 | #include "system-arm.h" | ||
25 | |||
26 | #define CPUFREQ_MAX 250000000 | ||
27 | #define CPUFREQ_DEFAULT 250000000 | ||
28 | #define CPUFREQ_NORMAL 250000000 | ||
29 | |||
30 | #endif /* SYSTEM_TARGET_H */ | ||
diff --git a/firmware/target/arm/as3525/sansa-m200v4/system-target.h b/firmware/target/arm/as3525/sansa-m200v4/system-target.h deleted file mode 100644 index dc9d77f3dc..0000000000 --- a/firmware/target/arm/as3525/sansa-m200v4/system-target.h +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 ?? | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef SYSTEM_TARGET_H | ||
22 | #define SYSTEM_TARGET_H | ||
23 | |||
24 | #include "system-arm.h" | ||
25 | |||
26 | #define CPUFREQ_MAX 250000000 | ||
27 | #define CPUFREQ_DEFAULT 250000000 | ||
28 | #define CPUFREQ_NORMAL 250000000 | ||
29 | |||
30 | #endif /* SYSTEM_TARGET_H */ | ||
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c index 10338ee148..bc3911afdf 100644 --- a/firmware/target/arm/as3525/system-as3525.c +++ b/firmware/target/arm/as3525/system-as3525.c | |||
@@ -219,6 +219,11 @@ void system_init(void) | |||
219 | while(!(CGU_INTCTRL & (1<<0))); /* wait until PLLA is locked */ | 219 | while(!(CGU_INTCTRL & (1<<0))); /* wait until PLLA is locked */ |
220 | 220 | ||
221 | CGU_PROC = (3<<2)|0x01; /* fclk = PLLA*5/8 = 240 MHz */ | 221 | CGU_PROC = (3<<2)|0x01; /* fclk = PLLA*5/8 = 240 MHz */ |
222 | #ifndef BOOTLOADER | ||
223 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
224 | set_cpu_frequency(CPUFREQ_DEFAULT); | ||
225 | #endif | ||
226 | #endif | ||
222 | 227 | ||
223 | asm volatile( | 228 | asm volatile( |
224 | "mov r0, #0 \n" | 229 | "mov r0, #0 \n" |
@@ -231,8 +236,6 @@ void system_init(void) | |||
231 | 236 | ||
232 | sdram_init(); | 237 | sdram_init(); |
233 | 238 | ||
234 | CGU_PERI |= (5<<2)|0x01; /* pclk = PLLA / 6 = 64 MHz */ | ||
235 | |||
236 | /* enable timer interface for TIMER1 & TIMER2 */ | 239 | /* enable timer interface for TIMER1 & TIMER2 */ |
237 | CGU_PERI |= CGU_TIMERIF_CLOCK_ENABLE; | 240 | CGU_PERI |= CGU_TIMERIF_CLOCK_ENABLE; |
238 | 241 | ||
@@ -264,11 +267,19 @@ int system_memory_guard(int newmode) | |||
264 | } | 267 | } |
265 | 268 | ||
266 | #ifndef BOOTLOADER | 269 | #ifndef BOOTLOADER |
267 | |||
268 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 270 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
269 | void set_cpu_frequency(long frequency) | 271 | void set_cpu_frequency(long frequency) |
270 | { | 272 | { |
271 | /* TODO */ | 273 | int divider = CPUFREQ_MAX / frequency; |
274 | |||
275 | if(divider > 16) | ||
276 | divider = 16; | ||
277 | else if(divider < 1) | ||
278 | divider = 1; | ||
279 | |||
280 | cpu_frequency = CPUFREQ_MAX / divider; | ||
281 | |||
282 | CGU_PROC &= ~(0xf << 4) /* clear divider bits */ ^ ((divider-1) << 4); | ||
272 | } | 283 | } |
273 | #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ | 284 | #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ |
274 | #endif /* BOOTLOADER */ | 285 | #endif /* BOOTLOADER */ |
diff --git a/firmware/target/arm/as3525/sansa-clip/system-target.h b/firmware/target/arm/as3525/system-target.h index dc9d77f3dc..2309b9790f 100644 --- a/firmware/target/arm/as3525/sansa-clip/system-target.h +++ b/firmware/target/arm/as3525/system-target.h | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2008 ?? | 10 | * Copyright (C) 2008 Rafaël Carré |
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 13 | * modify it under the terms of the GNU General Public License |
@@ -23,8 +23,8 @@ | |||
23 | 23 | ||
24 | #include "system-arm.h" | 24 | #include "system-arm.h" |
25 | 25 | ||
26 | #define CPUFREQ_MAX 250000000 | 26 | #define CPUFREQ_MAX 240000000 |
27 | #define CPUFREQ_DEFAULT 250000000 | 27 | #define CPUFREQ_DEFAULT 24000000 |
28 | #define CPUFREQ_NORMAL 250000000 | 28 | #define CPUFREQ_NORMAL 30000000 |
29 | 29 | ||
30 | #endif /* SYSTEM_TARGET_H */ | 30 | #endif /* SYSTEM_TARGET_H */ |