]> git.sur5r.net Git - u-boot/blobdiff - cpu/ppc4xx/start.S
Merge with /home/hs/U-Boot/u-boot-dev
[u-boot] / cpu / ppc4xx / start.S
index 003c5b6bf19cc9bf7ae1383eb9cc569aaf096257..647088f721a2eefe0beedce2780d33375a7eac6a 100644 (file)
@@ -42,7 +42,7 @@
 /*      LICENSED MATERIAL  -  PROGRAM PROPERTY OF I B M */
 /*------------------------------------------------------------------------------- */
 
-/*  U-Boot - Startup Code for IBM 4xx PowerPC based Embedded Boards
+/*  U-Boot - Startup Code for AMCC 4xx PowerPC based Embedded Boards
  *
  *
  *  The processor starts at 0xfffffffc and the code is executed
@@ -166,7 +166,7 @@ _start_440:
        mtspr   srr1,r0
        mtspr   csrr0,r0
        mtspr   csrr1,r0
-#if defined (CONFIG_440GX) /* NOTE: 440GX adds machine check status regs */
+#if defined(CONFIG_440GX) || defined(CONFIG_440SP) /* NOTE: 440GX adds machine check status regs */
        mtspr   mcsrr0,r0
        mtspr   mcsrr1,r0
        mfspr   r1, mcsr
@@ -340,23 +340,6 @@ _start:
        mtspr   tcr,r0                  /* disable all */
        mtspr   esr,r0                  /* clear exception syndrome register */
        mtxer   r0                      /* clear integer exception register */
-#if !defined(CONFIG_440GX)
-       lis     r1,0x0002               /* set CE bit (Critical Exceptions) */
-       ori     r1,r1,0x1000            /* set ME bit (Machine Exceptions) */
-       mtmsr   r1                      /* change MSR */
-#elif !defined(CONFIG_440EP) && !defined(CONFIG_440GR)
-       bl      __440gx_msr_set
-       b       __440gx_msr_continue
-
-__440gx_msr_set:
-       lis     r1, 0x0002              /* set CE bit (Critical Exceptions) */
-       ori     r1,r1,0x1000    /* set ME bit (Machine Exceptions) */
-       mtspr   srr1,r1
-       mflr    r1
-       mtspr   srr0,r1
-       rfi
-__440gx_msr_continue:
-#endif
 
        /*----------------------------------------------------------------*/
        /* Debug setup -- some (not very good) ice's need an event*/
@@ -394,7 +377,7 @@ __440gx_msr_continue:
        addi    r3,r3,32
        bdnz    ..d_ag
 #else
-#if defined (CONFIG_440GX)
+#if defined (CONFIG_440GX) || defined(CONFIG_440SP)
        mtdcr   l2_cache_cfg,r0         /* Ensure L2 Cache is off */
 #endif
        mtdcr   isram0_sb1cr,r0         /* Disable bank 1 */
@@ -409,7 +392,7 @@ __440gx_msr_continue:
        mtdcr   isram0_pmeg,r1
 
        lis     r1,0x8000               /* BAS = 8000_0000 */
-#if defined(CONFIG_440GX)
+#if defined(CONFIG_440GX) || defined(CONFIG_440SP)
        ori     r1,r1,0x0980            /* first 64k */
        mtdcr   isram0_sb0cr,r1
        lis     r1,0x8001
@@ -432,7 +415,6 @@ __440gx_msr_continue:
        /*----------------------------------------------------------------*/
        lis     r1,CFG_INIT_RAM_ADDR@h
        ori     r1,r1,CFG_INIT_SP_OFFSET@l
-
        li      r0,0
        stwu    r0,-4(r1)
        stwu    r0,-4(r1)               /* Terminate call chain */
@@ -444,6 +426,8 @@ __440gx_msr_continue:
        stw     r0,+12(r1)              /* Save return addr (underflow vect) */
 
        GET_GOT
+
+       bl      cpu_init_f      /* run low-level CPU init code     (from Flash) */
        bl      board_init_f
 
 #endif /* CONFIG_440 */
@@ -457,9 +441,6 @@ __440gx_msr_continue:
        mtspr   esr,r0                  /* clear Exception Syndrome Reg */
        mttcr   r0                      /* timer control register */
        mtexier r0                      /* disable all interrupts */
-       addi    r4,r0,0x1000            /* set ME bit (Machine Exceptions) */
-       oris    r4,r4,0x2               /* set CE bit (Critical Exceptions) */
-       mtmsr   r4                      /* change MSR */
        addis   r4,r0,0xFFFF            /* set r4 to 0xFFFFFFFF (status in the */
        ori     r4,r4,0xFFFF            /* dbsr is cleared by setting bits to 1) */
        mtdbsr  r4                      /* clear/reset the dbsr */
@@ -570,9 +551,6 @@ __440gx_msr_continue:
        mttcr   r4                      /* clear Timer Control Reg */
        mtxer   r4                      /* clear Fixed-Point Exception Reg */
        mtevpr  r4                      /* clear Exception Vector Prefix Reg */
-       addi    r4,r0,0x1000            /* set ME bit (Machine Exceptions) */
-       oris    r4,r4,0x0002            /* set CE bit (Critical Exceptions) */
-       mtmsr   r4                      /* change MSR */
        addi    r4,r0,(0xFFFF-0x10000)          /* set r4 to 0xFFFFFFFF (status in the */
                                        /* dbsr is cleared by setting bits to 1) */
        mtdbsr  r4                      /* clear/reset the dbsr */
@@ -975,12 +953,8 @@ invalidate_icache:
 invalidate_dcache:
        addi    r6,0,0x0000             /* clear GPR 6 */
        /* Do loop for # of dcache congruence classes. */
-#if defined(CONFIG_440GX) || defined(CONFIG_440EP) || defined(CONFIG_440GR)
        lis     r7, (CFG_DCACHE_SIZE / CFG_CACHELINE_SIZE / 2)@ha       /* TBS for large sized cache */
        ori     r7, r7, (CFG_DCACHE_SIZE / CFG_CACHELINE_SIZE / 2)@l
-#else
-       addi    r7,r0, (CFG_DCACHE_SIZE / CFG_CACHELINE_SIZE / 2)
-#endif
                                        /* NOTE: dccci invalidates both */
        mtctr   r7                      /* ways in the D cache */
 ..dcloop:
@@ -1001,15 +975,10 @@ flush_dcache:
        mtdccr  r10
 
        /* do loop for # of congruence classes. */
-#if defined(CONFIG_440GX) || defined(CONFIG_440EP) || defined(CONFIG_440GR)
        lis     r10,(CFG_DCACHE_SIZE / CFG_CACHELINE_SIZE / 2)@ha       /* TBS: for large cache sizes */
        ori     r10,r10,(CFG_DCACHE_SIZE / CFG_CACHELINE_SIZE / 2)@l
        lis     r11,(CFG_DCACHE_SIZE / 2)@ha /* D cache set size - 2 way sets */
        ori     r11,r11,(CFG_DCACHE_SIZE / 2)@l /* D cache set size - 2 way sets */
-#else
-       addi    r10,r0,(CFG_DCACHE_SIZE / CFG_CACHELINE_SIZE / 2)
-       addi    r11,r0,(CFG_DCACHE_SIZE / 2) /* D cache set size - 2 way sets */
-#endif
        mtctr   r10
        addi    r10,r0,(0xE000-0x10000) /* start at 0xFFFFE000 */
        add     r11,r10,r11             /* add to get to other side of cache line */
@@ -1229,12 +1198,19 @@ ppcSync:
        .globl  relocate_code
 relocate_code:
 #if defined(CONFIG_440EP) || defined(CONFIG_440GR)
-       dccci   0,0                         /* Invalidate data cache, now no longer our stack */
+       /*
+        * On some 440er platforms the cache is enabled in the first TLB (Boot-CS)
+        * to speed up the boot process. Now this cache needs to be disabled.
+        */
+       iccci   0,0                     /* Invalidate inst cache */
+       dccci   0,0                     /* Invalidate data cache, now no longer our stack */
        sync
-       addi    r1,r0,0x0000        /* Tlb entry #0 */
+       isync
+       addi    r1,r0,0x0000            /* TLB entry #0 */
        tlbre   r0,r1,0x0002            /* Read contents */
-       ori     r0,r0,0x0c00        /* Or in the inhibit, write through bit */
+       ori     r0,r0,0x0c00            /* Or in the inhibit, write through bit */
        tlbwe   r0,r1,0x0002            /* Save it out */
+       sync
        isync
 #endif
        mr      r1,  r3         /* Set new stack pointer                */
@@ -1436,6 +1412,24 @@ trap_init:
        cmplw   0, r7, r8
        blt     4b
 
+#if !defined(CONFIG_440_GX)
+       addi    r7,r0,0x1000            /* set ME bit (Machine Exceptions) */
+       oris    r7,r7,0x0002            /* set CE bit (Critical Exceptions) */
+       mtmsr   r7                      /* change MSR */
+#else
+       bl      __440gx_msr_set
+       b       __440gx_msr_continue
+
+__440gx_msr_set:
+       addi    r7,r0,0x1000            /* set ME bit (Machine Exceptions) */
+       oris    r7,r7,0x0002            /* set CE bit (Critical Exceptions) */
+       mtspr   srr1,r7
+       mflr    r7
+       mtspr   srr0,r7
+       rfi
+__440gx_msr_continue:
+#endif
+
        mtlr    r4                      /* restore link register        */
        blr