summaryrefslogtreecommitdiff
path: root/firmware/system.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/system.c')
-rw-r--r--firmware/system.c92
1 files changed, 91 insertions, 1 deletions
diff --git a/firmware/system.c b/firmware/system.c
index fc23edd6ef..df75fbb5a1 100644
--- a/firmware/system.c
+++ b/firmware/system.c
@@ -477,7 +477,7 @@ void (* const vbr[]) (void) __attribute__ ((section (".vectors"))) =
477 UIE,UIE,UIE,UIE,UIE,UIE,UIE,UIE, 477 UIE,UIE,UIE,UIE,UIE,UIE,UIE,UIE,
478 UIE,UIE,UIE,TIMER0,TIMER1,UIE,UIE,UIE, 478 UIE,UIE,UIE,TIMER0,TIMER1,UIE,UIE,UIE,
479 /* lvl 3 lvl 4 */ 479 /* lvl 3 lvl 4 */
480 480
481 TRAP0,TRAP1,TRAP2,TRAP3,TRAP4,TRAP5,TRAP6,TRAP7, 481 TRAP0,TRAP1,TRAP2,TRAP3,TRAP4,TRAP5,TRAP6,TRAP7,
482 TRAP8,TRAP9,TRAP10,TRAP11,TRAP12,TRAP13,TRAP14,TRAP15, 482 TRAP8,TRAP9,TRAP10,TRAP11,TRAP12,TRAP13,TRAP14,TRAP15,
483 483
@@ -1226,6 +1226,96 @@ int system_memory_guard(int newmode)
1226 (void)newmode; 1226 (void)newmode;
1227 return 0; 1227 return 0;
1228} 1228}
1229#elif CONFIG_CPU==PP5002
1230unsigned int ipod_hw_rev;
1231#ifndef BOOTLOADER
1232extern void TIMER1(void);
1233extern void ipod_3g_button_int(void);
1234
1235void irq(void)
1236{
1237 if (CPU_INT_STAT & TIMER1_MASK)
1238 TIMER1();
1239 else if (CPU_INT_STAT & GPIO_MASK)
1240 ipod_3g_button_int();
1241}
1242#endif
1243
1244/* TODO: The following two function have been lifted straight from IPL, and
1245 hence have a lot of numeric addresses used straight. I'd like to use
1246 #defines for these, but don't know what most of them are for or even what
1247 they should be named. Because of this I also have no way of knowing how
1248 to extend the funtions to do alternate cache configurations and/or
1249 some other CPU frequency scaling. */
1250
1251#ifndef BOOTLOADER
1252static void ipod_init_cache(void)
1253{
1254 int i =0;
1255/* Initialising the cache in the iPod bootloader prevents Rockbox from starting */
1256 outl(inl(0xcf004050) & ~0x700, 0xcf004050);
1257 outl(0x4000, 0xcf004020);
1258
1259 outl(0x2, 0xcf004024);
1260
1261 /* PP5002 has 8KB cache */
1262 for (i = 0xf0004000; i < 0xf0006000; i += 16) {
1263 outl(0x0, i);
1264 }
1265
1266 outl(0x0, 0xf000f020);
1267 outl(0x3fc0, 0xf000f024);
1268
1269 outl(0x3, 0xcf004024);
1270}
1271
1272static void ipod_set_cpu_speed(void)
1273{
1274 outl(0x02, 0xcf005008);
1275 outl(0x55, 0xcf00500c);
1276 outl(0x6000, 0xcf005010);
1277#if 1
1278 // 75 MHz (24/24 * 75) (default)
1279 outl(24, 0xcf005018);
1280 outl(75, 0xcf00501c);
1281#endif
1282
1283#if 0
1284 // 66 MHz (24/3 * 8)
1285 outl(3, 0xcf005018);
1286 outl(8, 0xcf00501c);
1287#endif
1288
1289 outl(0xe000, 0xcf005010);
1290
1291 udelay(2000);
1292
1293 outl(0xa8, 0xcf00500c);
1294}
1295#endif
1296
1297void system_init(void)
1298{
1299#ifndef BOOTLOADER
1300 ipod_hw_rev = (*((volatile unsigned long*)(0x01fffffc)));
1301 outl(-1, 0xcf00101c);
1302 outl(-1, 0xcf001028);
1303 outl(-1, 0xcf001038);
1304 ipod_set_cpu_speed();
1305 ipod_init_cache();
1306#endif
1307}
1308
1309void system_reboot(void)
1310{
1311 outl(inl(0xcf005030) | 0x4, 0xcf005030);
1312}
1313
1314int system_memory_guard(int newmode)
1315{
1316 (void)newmode;
1317 return 0;
1318}
1229 1319
1230#elif CONFIG_CPU==PNX0101 1320#elif CONFIG_CPU==PNX0101
1231 1321