diff options
| author | Thom Johansen <thomj@rockbox.org> | 2005-12-17 19:11:43 +0000 |
|---|---|---|
| committer | Thom Johansen <thomj@rockbox.org> | 2005-12-17 19:11:43 +0000 |
| commit | 5cc73474633f0f33e0b9f6a55cd8831df9bec906 (patch) | |
| tree | 9da9136765cdfd38620d7df6e51ab9ce59160bb4 | |
| parent | 8bf079ffc148e44cfebd4c8cd1c73e778aae45fa (diff) | |
| download | rockbox-5cc73474633f0f33e0b9f6a55cd8831df9bec906.zip rockbox-5cc73474633f0f33e0b9f6a55cd8831df9bec906.tar.gz rockbox-5cc73474633f0f33e0b9f6a55cd8831df9bec906.tar.bz2 rockbox-5cc73474633f0f33e0b9f6a55cd8831df9bec906.tar.xz | |
Raise iPod CPU frequency and enable cache and add function needed for button driver.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8257 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/export/system.h | 5 | ||||
| -rw-r--r-- | firmware/system.c | 45 |
2 files changed, 50 insertions, 0 deletions
diff --git a/firmware/export/system.h b/firmware/export/system.h index e4de588..40e3884 100644 --- a/firmware/export/system.h +++ b/firmware/export/system.h @@ -34,6 +34,11 @@ extern long cpu_frequency; #define outl(a,b) (*(volatile unsigned long *) (b) = (a)) #define inb(a) (*(volatile unsigned char *) (a)) #define outb(a,b) (*(volatile unsigned char *) (b) = (a)) +static inline void udelay(unsigned usecs) +{ + unsigned start = inl(0x60005010); + while ((inl(0x60005010) - start) < usecs); +} #endif #ifdef HAVE_ADJUSTABLE_CPU_FREQ diff --git a/firmware/system.c b/firmware/system.c index 2c7c6f3..cbc009a 100644 --- a/firmware/system.c +++ b/firmware/system.c @@ -1117,6 +1117,49 @@ void irq(void) ipod_4g_button_int(); } +/* TODO: The following two function have been lifted straight from IPL, and + hence have a lot of numeric addresses used straight. I'd like to use + #defines for these, but don't know what most of them are for or even what + they should be named. Because of this I also have no way of knowing how + to extend the funtions to do alternate cache configurations and/or + some other CPU frequency scaling. */ + +static void ipod_init_cache(void) +{ + unsigned i; + + /* cache init mode? */ + outl(0x4, 0x6000C000); + + /* PP5002 has 8KB cache */ + for (i = 0xf0004000; i < 0xf0006000; i += 16) { + outl(0x0, i); + } + + outl(0x0, 0xf000f040); + outl(0x3fc0, 0xf000f044); + + /* enable cache */ + outl(0x1, 0x6000C000); + + for (i = 0x10000000; i < 0x10002000; i += 16) + inb(i); +} + +static void ipod_set_cpu_speed(void) +{ + outl(inl(0x70000020) | (1<<30), 0x70000020); + + /* Set run state to 24MHz */ + outl((inl(0x60006020) & 0x0fffff0f) | 0x20000020, 0x60006020); + + /* 75 MHz (24/8)*25 */ + outl(0xaa021908, 0x60006034); + udelay(2000); + + outl((inl(0x60006020) & 0x0fffff0f) | 0x20000070, 0x60006020); +} + void system_init(void) { /* disable all irqs */ @@ -1127,6 +1170,8 @@ void system_init(void) outl(-1, 0x60001038); outl(-1, 0x60001028); outl(-1, 0x6000101c); + ipod_set_cpu_speed(); + ipod_init_cache(); } void system_reboot(void) |