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 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2008 ?? - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef SYSTEM_TARGET_H -#define SYSTEM_TARGET_H - -#include "system-arm.h" - -#define CPUFREQ_MAX 250000000 -#define CPUFREQ_DEFAULT 250000000 -#define CPUFREQ_NORMAL 250000000 - -#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 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2008 ?? - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef SYSTEM_TARGET_H -#define SYSTEM_TARGET_H - -#include "system-arm.h" - -#define CPUFREQ_MAX 250000000 -#define CPUFREQ_DEFAULT 250000000 -#define CPUFREQ_NORMAL 250000000 - -#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 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2008 ?? - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef SYSTEM_TARGET_H -#define SYSTEM_TARGET_H - -#include "system-arm.h" - -#define CPUFREQ_MAX 250000000 -#define CPUFREQ_DEFAULT 250000000 -#define CPUFREQ_NORMAL 250000000 - -#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) while(!(CGU_INTCTRL & (1<<0))); /* wait until PLLA is locked */ CGU_PROC = (3<<2)|0x01; /* fclk = PLLA*5/8 = 240 MHz */ +#ifndef BOOTLOADER +#ifdef HAVE_ADJUSTABLE_CPU_FREQ + set_cpu_frequency(CPUFREQ_DEFAULT); +#endif +#endif asm volatile( "mov r0, #0 \n" @@ -231,8 +236,6 @@ void system_init(void) sdram_init(); - CGU_PERI |= (5<<2)|0x01; /* pclk = PLLA / 6 = 64 MHz */ - /* enable timer interface for TIMER1 & TIMER2 */ CGU_PERI |= CGU_TIMERIF_CLOCK_ENABLE; @@ -264,11 +267,19 @@ int system_memory_guard(int newmode) } #ifndef BOOTLOADER - #ifdef HAVE_ADJUSTABLE_CPU_FREQ void set_cpu_frequency(long frequency) { - /* TODO */ + int divider = CPUFREQ_MAX / frequency; + + if(divider > 16) + divider = 16; + else if(divider < 1) + divider = 1; + + cpu_frequency = CPUFREQ_MAX / divider; + + CGU_PROC &= ~(0xf << 4) /* clear divider bits */ ^ ((divider-1) << 4); } #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ #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 @@ * \/ \/ \/ \/ \/ * $Id$ * - * Copyright (C) 2008 ?? + * Copyright (C) 2008 Rafaël Carré * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -23,8 +23,8 @@ #include "system-arm.h" -#define CPUFREQ_MAX 250000000 -#define CPUFREQ_DEFAULT 250000000 -#define CPUFREQ_NORMAL 250000000 +#define CPUFREQ_MAX 240000000 +#define CPUFREQ_DEFAULT 24000000 +#define CPUFREQ_NORMAL 30000000 #endif /* SYSTEM_TARGET_H */ |