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.tar.gz rockbox-943ff8dc67049846a6e2bb3501a90e378e05e556.zip |
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 b3b5d14e85..d0d2d0664c 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h | |||
@@ -98,7 +98,7 @@ | |||
98 | #define CONFIG_LED LED_VIRTUAL | 98 | #define CONFIG_LED LED_VIRTUAL |
99 | 99 | ||
100 | /* Define this if you have adjustable CPU frequency */ | 100 | /* Define this if you have adjustable CPU frequency */ |
101 | //#define HAVE_ADJUSTABLE_CPU_FREQ | 101 | #define HAVE_ADJUSTABLE_CPU_FREQ |
102 | 102 | ||
103 | #define BOOTFILE_EXT "ipod" | 103 | #define BOOTFILE_EXT "ipod" |
104 | #define BOOTFILE "rockbox." BOOTFILE_EXT | 104 | #define BOOTFILE "rockbox." BOOTFILE_EXT |
diff --git a/firmware/system.c b/firmware/system.c index 846a4434f7..1874c0480e 100644 --- a/firmware/system.c +++ b/firmware/system.c | |||
@@ -1307,7 +1307,38 @@ static void ipod_init_cache(void) | |||
1307 | 1307 | ||
1308 | outl(0x3, 0xcf004024); | 1308 | outl(0x3, 0xcf004024); |
1309 | } | 1309 | } |
1310 | #endif | ||
1311 | |||
1312 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
1313 | void set_cpu_frequency(long frequency) | ||
1314 | { | ||
1315 | unsigned long postmult; | ||
1316 | |||
1317 | if (frequency == CPUFREQ_NORMAL) | ||
1318 | postmult = CPUFREQ_NORMAL_MULT; | ||
1319 | else if (frequency == CPUFREQ_MAX) | ||
1320 | postmult = CPUFREQ_MAX_MULT; | ||
1321 | else | ||
1322 | postmult = CPUFREQ_DEFAULT_MULT; | ||
1323 | cpu_frequency = frequency; | ||
1310 | 1324 | ||
1325 | outl(0x02, 0xcf005008); | ||
1326 | outl(0x55, 0xcf00500c); | ||
1327 | outl(0x6000, 0xcf005010); | ||
1328 | |||
1329 | /* Clock frequency = (24/8)*postmult */ | ||
1330 | outl(8, 0xcf005018); | ||
1331 | outl(postmult, 0xcf00501c); | ||
1332 | |||
1333 | outl(0xe000, 0xcf005010); | ||
1334 | |||
1335 | /* Wait for PLL relock? */ | ||
1336 | udelay(2000); | ||
1337 | |||
1338 | /* Select PLL as clock source? */ | ||
1339 | outl(0xa8, 0xcf00500c); | ||
1340 | } | ||
1341 | #elif !defined(BOOTLOADER) | ||
1311 | static void ipod_set_cpu_speed(void) | 1342 | static void ipod_set_cpu_speed(void) |
1312 | { | 1343 | { |
1313 | outl(0x02, 0xcf005008); | 1344 | outl(0x02, 0xcf005008); |
@@ -1340,7 +1371,9 @@ void system_init(void) | |||
1340 | outl(-1, 0xcf00101c); | 1371 | outl(-1, 0xcf00101c); |
1341 | outl(-1, 0xcf001028); | 1372 | outl(-1, 0xcf001028); |
1342 | outl(-1, 0xcf001038); | 1373 | outl(-1, 0xcf001038); |
1374 | #ifndef HAVE_ADJUSTABLE_CPU_FREQ | ||
1343 | ipod_set_cpu_speed(); | 1375 | ipod_set_cpu_speed(); |
1376 | #endif | ||
1344 | ipod_init_cache(); | 1377 | ipod_init_cache(); |
1345 | #endif | 1378 | #endif |
1346 | } | 1379 | } |