/**************************************************************************** **************************************************************************** Program8544 : Program the flash in the MPC8544-DS ****************************************************************************/ static const BDI_InitTypeT initList8544[] = { {BDI_INIT_PQ3_WSPR, 8002 , 500 }, // give reset time to complete // {BDI_INIT_PQ3_WSPR, 8003 , 0x00000000}, // Use Startup Mode HALT // Move the L2SRAM to the initial MMU page {BDI_INIT_PQ3_WM32, 0xFF720E44, 0x0000001C}, // L2ERRDIS: disable parity error {BDI_INIT_PQ3_WM32, 0xFF720000, 0x60010000}, // L2CTL {BDI_INIT_PQ3_WM32, 0xFF720100, 0xFFFC0000}, // L2SRBAR0: map to 0x0_FFFC0000 {BDI_INIT_PQ3_WM32, 0xFF720104, 0x00000000}, // L2SRBAREA0 {BDI_INIT_PQ3_WM32, 0xFF720000, 0xA0010000}, // L2CTL // load and execute some boot code (necessary for STARTUP HALT) // {BDI_INIT_PQ3_WM32, 0xfffffffc, 0x48000000}, // loop // {BDI_INIT_PQ3_EXEC, 0xfffffffc, 0x00000000}, // load TLB entries, helper code @ 0xfffff000 {BDI_INIT_PQ3_WM32, 0xfffff000, 0x7c0007a4}, // tlbwe {BDI_INIT_PQ3_WM32, 0xfffff004, 0x7c0004ac}, // msync {BDI_INIT_PQ3_WM32, 0xfffff008, 0x48000000}, // loop {BDI_INIT_PQ3_WSPR, 628 , 0x00000000}, // MAS4: {BDI_INIT_PQ3_WSPR, 630 , 0x00000000}, // MAS7: // 64 MB TLB1 #0 0xfc000000 - 0xffffffff {BDI_INIT_PQ3_WSPR, 624 , 0x10000000}, // MAS0: {BDI_INIT_PQ3_WSPR, 625 , 0x80000800}, // MAS1: {BDI_INIT_PQ3_WSPR, 626 , 0xfc00000a}, // MAS2: {BDI_INIT_PQ3_WSPR, 627 , 0xfc000015}, // MAS3: {BDI_INIT_PQ3_EXEC, 0xfffff000, 0x00000000}, // 64 MB TLB1 #1 0xe0000000 - 0xe3ffffff {BDI_INIT_PQ3_WSPR, 624 , 0x10010000}, // MAS0: {BDI_INIT_PQ3_WSPR, 625 , 0x80000800}, // MAS1: {BDI_INIT_PQ3_WSPR, 626 , 0xe000000a}, // MAS2: {BDI_INIT_PQ3_WSPR, 627 , 0xe0000015}, // MAS3: {BDI_INIT_PQ3_EXEC, 0xfffff000, 0x00000000}, // 16 MB TLB1 #2 0xf0000000 - 0xf0ffffff {BDI_INIT_PQ3_WSPR, 624 , 0x10020000}, // MAS0: {BDI_INIT_PQ3_WSPR, 625 , 0x80000700}, // MAS1: {BDI_INIT_PQ3_WSPR, 626 , 0xf0000008}, // MAS2: {BDI_INIT_PQ3_WSPR, 627 , 0xf0000015}, // MAS3: {BDI_INIT_PQ3_EXEC, 0xfffff000, 0x00000000}, // Remove the L2SRAM from the initial MMU page {BDI_INIT_PQ3_WM32, 0xFF720000, 0x20010000}, // L2CTL {BDI_INIT_PQ3_WM32, 0xFF720000, 0x20000000}, // L2CTL // Move CCSRBAR to 0xe0000000 {BDI_INIT_PQ3_WM32, 0xff700000, 0x000e0000}, // CCSRBAR to 0xe0000000 // Initialize LAWBAR's {BDI_INIT_PQ3_WM32, 0xe0000C08, 0x00000000}, // LAWBAR0 : @0x00000000 {BDI_INIT_PQ3_WM32, 0xe0000C10, 0x80f0001c}, // LAWAR0 : DDR/SDRAM 512MB {BDI_INIT_PQ3_WM32, 0xe0000C28, 0x000c0000}, // LAWBAR1 : @0xc0000000 {BDI_INIT_PQ3_WM32, 0xe0000C30, 0x8040001d}, // LAWAR1 : Local Bus 1GB // Setup Flash chip select {BDI_INIT_PQ3_WM32, 0xe0005004, 0xff806ff7}, // OR0 : Flash (boot bank) {BDI_INIT_PQ3_WM32, 0xe0005000, 0xff801001}, // BR0 : 8MB at 0xff800000 // Setup flash programming workspace in L2SRAM {BDI_INIT_PQ3_WM32, 0xe0020e44, 0x0000001c}, // L2ERRDIS: disable parity error {BDI_INIT_PQ3_WM32, 0xe0020000, 0x60010000}, // L2CTL {BDI_INIT_PQ3_WM32, 0xe0020100, 0xf0000000}, // L2SRBAR0: map to 0x0_F0000000 {BDI_INIT_PQ3_WM32, 0xe0020104, 0x00000000}, // L2SRBAREA0 {BDI_INIT_PQ3_WM32, 0xe0020000, 0xa0010000}, // ;L2CTL {BDI_INIT_PQ3_WSPR, 63 , 0xf0000000}, // IVPR to workspace {BDI_INIT_PQ3_WSPR, 415 , 0x00001500}, // IVOR15 : Debug exception {BDI_INIT_PQ3_WM32, 0xf0001500, 0x48000000}, // write valid instruction }; static int Program8544(void) { int result; int sector; DWORD addr; DWORD errorAddr; /* Flash type: S29GL064M, Workspace in L2SRAM */ result = BDI_FlashSetType(BDI_FLASH_MIRRORX16, 0x800000, 0, 16, 0xF0000000); /* reset and init target */ result = BDI_TargetStartup(0, 2L << 8 | 1, /* MPC8544, 16 MHz JTAG clock */ sizeof initList8544 / sizeof initList8544[0], initList8544); /* erase sectors */ addr = 0xFFC00000; for (sector = 0; sector <= 3; sector++) { printf("erasing sector 0x%08lx ... ", addr); result = BDI_FlashEraseSector(addr); if (result != BDI_OKAY) return result; printf("passed\n"); addr += 0x10000; } /* for */ /* programming */ printf("programming..."); result = BDI_FlashWriteBinary("E:/temp/dump256k.bin", 0xFFC00000, &errorAddr); if (result != BDI_OKAY) return result; printf("passed\n"); /* verifying */ printf("verifying... "); result = BDI_VerifyBinary("E:/temp/dump256k.bin", 0xFFC00000, &errorAddr); if (result != BDI_OKAY) return result; printf("passed\n"); return result; } /* Program8544 */