/**************************************************************************** **************************************************************************** Program5200 : ****************************************************************************/ static const BDI_InitTypeT initList5200[] = { {BDI_INIT_PPC_WSPR, 8009 , 2000 }, // give reset time to complete {BDI_INIT_PPC_WMSR, 0x00000000, 0x00001002}, // MSR: ME,RI {BDI_INIT_PPC_WM32, 0x80000000, 0x0000f000}, // MBAR: internal registers at 0xf0000000 {BDI_INIT_PPC_WM32, 0xf000020c, 0x00000101}, // CDM-CFG: Divider: XLB(4),IPB(2),PCI(2) {BDI_INIT_PPC_WM32, 0xf0000210, 0x00000000}, // CDM-FDCFG: irda & usb clock disable {BDI_INIT_PPC_WM32, 0xf0000214, 0x000fffff}, // CDM-CLKEN: all clocks enabled {BDI_INIT_PPC_WM32, 0xf0000218, 0x00000000}, // CDM-OSCCFG: crystal on {BDI_INIT_PPC_WM32, 0xf000021c, 0x00000001}, // CDM-CCSCFG: no sleep modes, qreq from core {BDI_INIT_PPC_WM32, 0xf0000220, 0x01000000}, // CDM-SFTRST: softreset inactive {BDI_INIT_PPC_WM32, 0xf0000004, 0x0000fc00}, // CS0 start = 0xfc000000 {BDI_INIT_PPC_WM32, 0xf0000008, 0x0000ffff}, // CS0 stop = 0xffffffff {BDI_INIT_PPC_WM32, 0xF0000054, 0x00010001}, // CSE: enable CS0, disable CSBOOT {BDI_INIT_PPC_WM32, 0xf0000300, 0x0004db00}, // CS0CR: 32bit muxed, read/write {BDI_INIT_PPC_WM32, 0xf0000318, 0x01000000}, // CS CTL: ME set }; static int Program5200(void) { int result; int sector; DWORD addr; DWORD errorAddr; result = BDI_FlashSetType(BDI_FLASH_STRATAX16, 0x2000000, 0, 32, 0xf0008000); /* reset and init target */ result = BDI_TargetStartup(0, 10L << 8 | 0, /* MPC5200, 16 MHz JTAG clock */ sizeof initList5200 / sizeof initList5200[0], initList5200); /* unlock and erase small sectors */ addr = 0xfc000000; for (sector = 0; sector < 4; sector++) { printf("erasing sector 0x%08lx ... ", addr); result = BDI_SetLong(addr, 0x006000D0); result = BDI_SetLong(addr, 0x00D000D0); result = BDI_FlashEraseSector(addr); if (result != BDI_OKAY) return result; printf("passed\n"); addr += 0x10000; } /* for */ /* unlock and erase main sectors */ addr = 0xfc040000; for (sector = 0; sector < 4; sector++) { printf("erasing sector 0x%08lx ... ", addr); result = BDI_SetLong(addr, 0x006000D0); result = BDI_SetLong(addr, 0x00D000D0); result = BDI_FlashEraseSector(addr); if (result != BDI_OKAY) return result; printf("passed\n"); addr += 0x40000; } /* for */ printf("programming..."); result = BDI_FlashWriteBinary("u-boot", 0xfc000000, &errorAddr); if (result != BDI_OKAY) return result; printf("passed\n"); printf("verifing... "); result = BDI_VerifyBinary("u-boot", 0xfc000000, &errorAddr); printf("passed\n"); return result; } /* Program5200 */