diff options
| author | Daniel Ankers <dan@weirdo.org.uk> | 2006-07-24 22:49:06 +0000 |
|---|---|---|
| committer | Daniel Ankers <dan@weirdo.org.uk> | 2006-07-24 22:49:06 +0000 |
| commit | 943ff8dc67049846a6e2bb3501a90e378e05e556 (patch) | |
| tree | 1c887260c03bd2da60fd0aa6be8f5435b3f73ff7 | |
| parent | a91cb24dec67fc71505f1df9a70809cf7ca314f4 (diff) | |
| download | rockbox-943ff8dc67049846a6e2bb3501a90e378e05e556.zip rockbox-943ff8dc67049846a6e2bb3501a90e378e05e556.tar.gz rockbox-943ff8dc67049846a6e2bb3501a90e378e05e556.tar.bz2 rockbox-943ff8dc67049846a6e2bb3501a90e378e05e556.tar.xz | |
Implement frequency scaling on iPod 3Gs - FS #5686
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10313 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/export/config-ipod3g.h | 2 | ||||
| -rw-r--r-- | firmware/system.c | 33 |
2 files changed, 34 insertions, 1 deletions
diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index b3b5d14..d0d2d06 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h @@ -98,7 +98,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 "ipod" #define BOOTFILE "rockbox." BOOTFILE_EXT diff --git a/firmware/system.c b/firmware/system.c index 846a443..1874c04 100644 --- a/firmware/system.c +++ b/firmware/system.c @@ -1307,7 +1307,38 @@ static void ipod_init_cache(void) outl(0x3, 0xcf004024); } +#endif + +#ifdef HAVE_ADJUSTABLE_CPU_FREQ +void set_cpu_frequency(long frequency) +{ + unsigned long postmult; + + if (frequency == CPUFREQ_NORMAL) + postmult = CPUFREQ_NORMAL_MULT; + else if (frequency == CPUFREQ_MAX) + postmult = CPUFREQ_MAX_MULT; + else + postmult = CPUFREQ_DEFAULT_MULT; + cpu_frequency = frequency; + outl(0x02, 0xcf005008); + outl(0x55, 0xcf00500c); + outl(0x6000, 0xcf005010); + + /* Clock frequency = (24/8)*postmult */ + outl(8, 0xcf005018); + outl(postmult, 0xcf00501c); + + outl(0xe000, 0xcf005010); + + /* Wait for PLL relock? */ + udelay(2000); + + /* Select PLL as clock source? */ + outl(0xa8, 0xcf00500c); +} +#elif !defined(BOOTLOADER) static void ipod_set_cpu_speed(void) { outl(0x02, 0xcf005008); @@ -1340,7 +1371,9 @@ void system_init(void) outl(-1, 0xcf00101c); outl(-1, 0xcf001028); outl(-1, 0xcf001038); +#ifndef HAVE_ADJUSTABLE_CPU_FREQ ipod_set_cpu_speed(); +#endif ipod_init_cache(); #endif } |