From 8204cd76a77d2ea06729661c04d439d3af5b75e4 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Fri, 7 Apr 2006 12:16:27 +0000 Subject: [PATCH] iPod: Enable dynamic CPU frequency changing on the 4G (both greyscale and colour) and the first generation mini git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9548 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/config-ipod4g.h | 2 +- firmware/export/config-ipodcolor.h | 2 +- firmware/export/config-ipodmini.h | 2 +- firmware/system.c | 16 ++++++++++++++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index 7e428de68f..d4d4f28629 100644 --- a/firmware/export/config-ipod4g.h +++ b/firmware/export/config-ipod4g.h @@ -94,7 +94,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/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h index 9cbc058d8f..a48bde5f4b 100644 --- a/firmware/export/config-ipodcolor.h +++ b/firmware/export/config-ipodcolor.h @@ -93,7 +93,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/export/config-ipodmini.h b/firmware/export/config-ipodmini.h index 4514bcb471..1cb18a7a89 100644 --- a/firmware/export/config-ipodmini.h +++ b/firmware/export/config-ipodmini.h @@ -94,7 +94,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 efa0a06190..c957ad98b5 100644 --- a/firmware/system.c +++ b/firmware/system.c @@ -1224,11 +1224,27 @@ void set_cpu_frequency(long frequency) /* Clock frequency = (24/8)*postmult */ outl(0xaa020000 | 8 | (postmult << 8), 0x60006034); + /* Wait for PLL relock? */ udelay(2000); /* Select PLL as clock source? */ outl((inl(0x60006020) & 0x0fffff0f) | 0x20000070, 0x60006020); + +#if defined(IPOD_COLOR) || defined(IPOD_4G) || defined(IPOD_MINI) + /* We don't know why the timer interrupt gets disabled on the PP5020 + based ipods, but without the following line, the 4Gs will freeze + when CPU frequency changing is enabled. + + Note also that a simple "CPU_INT_EN = TIMER1_MASK;" (as used + elsewhere to enable interrupts) doesn't work, we need "|=". + + It's not needed on the PP5021 and PP5022 ipods. + */ + + /* unmask interrupt source */ + CPU_INT_EN |= TIMER1_MASK; +#endif } #elif !defined(BOOTLOADER) void ipod_set_cpu_frequency(void)