ppc4xx: Consolidate pci_master_init() function
[oweals/u-boot.git] / cpu / mpc83xx / start.S
index beebc9951c5fe2ea48927214c142e38e915fa175..ee4b8624aaa58bdf47a9742ae9b25cf02b1c17de 100644 (file)
@@ -200,9 +200,23 @@ boot_cold: /* time t 3 */
        nop
 boot_warm: /* time t 5 */
        mfmsr   r5                      /* save msr contents    */
+
+       /* 83xx manuals prescribe a specific sequence for updating IMMRBAR. */
+       bl      1f
+1:     mflr    r7
+
        lis     r3, CONFIG_SYS_IMMR@h
        ori     r3, r3, CONFIG_SYS_IMMR@l
+
+       lwz     r6, IMMRBAR(r4)
+       isync
+
        stw     r3, IMMRBAR(r4)
+       lwz     r6, 0(r7)               /* Arbitrary external load */
+       isync
+
+       lwz     r6, IMMRBAR(r3)
+       isync
 
        /* Initialise the E300 processor core           */
        /*------------------------------------------*/
@@ -212,9 +226,7 @@ boot_warm: /* time t 5 */
         * is loaded.  Wait for the rest before branching
         * to another flash page.
         */
-       addi    r7, r3, 0x50b0
-1:     dcbi    0, r7
-       lwz     r6, 0(r7)
+1:     lwz     r6, 0x50b0(r3)
        andi.   r6, r6, 1
        beq     1b
 #endif
@@ -945,16 +957,18 @@ in_ram:
        sub     r11,r3,r11
        addi    r3,r3,-4
 1:     lwzu    r0,4(r3)
+       cmpwi   r0,0
+       beq-    2f
        add     r0,r0,r11
        stw     r0,0(r3)
-       bdnz    1b
+2:     bdnz    1b
 
 #ifndef CONFIG_NAND_SPL
        /*
         * Now adjust the fixups and the pointers to the fixups
         * in case we need to move ourselves again.
         */
-2:     li      r0,__fixup_entries@sectoff@l
+       li      r0,__fixup_entries@sectoff@l
        lwz     r3,GOT(_FIXUP_TABLE_)
        cmpwi   r0,0
        mtctr   r0