]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/arm/cpu/arm720t/start.S
Merge branch 'master' of git://git.denx.de/u-boot-microblaze
[karo-tx-uboot.git] / arch / arm / cpu / arm720t / start.S
index da0e61e6daa559494f9d712b443359bb4d0e24bc..3b97e804a6b641275d00f62538ee3ec5aaf5d949 100644 (file)
@@ -1,8 +1,8 @@
 /*
  *  armboot - Startup Code for ARM720 CPU-core
  *
- *  Copyright (c) 2001 Marius Gröger <mag@sysgo.de>
- *  Copyright (c) 2002 Alex Züpke <azu@sysgo.de>
+ *  Copyright (c) 2001 Marius Gröger <mag@sysgo.de>
+ *  Copyright (c) 2002 Alex Züpke <azu@sysgo.de>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -91,6 +91,10 @@ _bss_start_ofs:
 
 .globl _bss_end_ofs
 _bss_end_ofs:
+       .word __bss_end__ - _start
+
+.globl _end_ofs
+_end_ofs:
        .word _end - _start
 
 #ifdef CONFIG_USE_IRQ
@@ -156,31 +160,30 @@ relocate_code:
        mov     r4, r0  /* save addr_sp */
        mov     r5, r1  /* save addr of gd */
        mov     r6, r2  /* save addr of destination */
-       mov     r7, r2  /* save addr of destination */
 
        /* Set up the stack                                                 */
 stack_setup:
        mov     sp, r4
 
        adr     r0, _start
-       ldr     r2, _TEXT_BASE
+       cmp     r0, r6
+       beq     clear_bss               /* skip relocation */
+       mov     r1, r6                  /* r1 <- scratch for copy_loop */
        ldr     r3, _bss_start_ofs
        add     r2, r0, r3              /* r2 <- source end address         */
-       cmp     r0, r6
-       beq     clear_bss
 
 copy_loop:
        ldmia   r0!, {r9-r10}           /* copy from source address [r0]    */
-       stmia   r6!, {r9-r10}           /* copy to   target address [r1]    */
+       stmia   r1!, {r9-r10}           /* copy to   target address [r1]    */
        cmp     r0, r2                  /* until source end address [r2]    */
        blo     copy_loop
 
-#ifndef CONFIG_PRELOADER
+#ifndef CONFIG_SPL_BUILD
        /*
         * fix .rel.dyn relocations
         */
        ldr     r0, _TEXT_BASE          /* r0 <- Text base */
-       sub     r9, r7, r0              /* r9 <- relocation offset */
+       sub     r9, r6, r0              /* r9 <- relocation offset */
        ldr     r10, _dynsym_start_ofs  /* r10 <- sym table ofs */
        add     r10, r10, r0            /* r10 <- sym table in FLASH */
        ldr     r2, _rel_dyn_start_ofs  /* r2 <- rel dyn start ofs */
@@ -191,10 +194,10 @@ fixloop:
        ldr     r0, [r2]                /* r0 <- location to fix up, IN FLASH! */
        add     r0, r0, r9              /* r0 <- location to fix up in RAM */
        ldr     r1, [r2, #4]
-       and     r8, r1, #0xff
-       cmp     r8, #23                 /* relative fixup? */
+       and     r7, r1, #0xff
+       cmp     r7, #23                 /* relative fixup? */
        beq     fixrel
-       cmp     r8, #2                  /* absolute fixup? */
+       cmp     r7, #2                  /* absolute fixup? */
        beq     fixabs
        /* ignore unknown type of fixup */
        b       fixnext
@@ -203,7 +206,7 @@ fixabs:
        mov     r1, r1, LSR #4          /* r1 <- symbol index in .dynsym */
        add     r1, r10, r1             /* r1 <- address of symbol in table */
        ldr     r1, [r1, #4]            /* r1 <- symbol value */
-       add     r1, r9                  /* r1 <- relocated sym addr */
+       add     r1, r1, r9              /* r1 <- relocated sym addr */
        b       fixnext
 fixrel:
        /* relative fix: increase location by offset */
@@ -217,22 +220,23 @@ fixnext:
 #endif
 
 clear_bss:
-#ifndef CONFIG_PRELOADER
+#ifndef CONFIG_SPL_BUILD
        ldr     r0, _bss_start_ofs
        ldr     r1, _bss_end_ofs
-       ldr     r3, _TEXT_BASE          /* Text base */
-       mov     r4, r7                  /* reloc addr */
+       mov     r4, r6                  /* reloc addr */
        add     r0, r0, r4
        add     r1, r1, r4
        mov     r2, #0x00000000         /* clear                            */
 
-clbss_l:str    r2, [r0]                /* clear loop...                    */
+clbss_l:cmp    r0, r1                  /* clear loop... */
+       bhs     clbss_e                 /* if reached end of bss, exit */
+       str     r2, [r0]
        add     r0, r0, #4
-       cmp     r0, r1
-       bne     clbss_l
+       b       clbss_l
+clbss_e:
 
        bl coloured_LED_init
-       bl red_LED_on
+       bl red_led_on
 #endif
 
 /*
@@ -245,7 +249,7 @@ clbss_l:str r2, [r0]                /* clear loop...                    */
        add     lr, lr, r9
        /* setup parameters for board_init_r */
        mov     r0, r5          /* gd_t */
-       mov     r1, r7          /* dest_addr */
+       mov     r1, r6          /* dest_addr */
        /* jump to it ... */
        mov     pc, lr
 
@@ -270,25 +274,7 @@ _dynsym_start_ofs:
  *************************************************************************
  */
 
-#if defined(CONFIG_IMPA7) || defined(CONFIG_EP7312) || defined(CONFIG_ARMADILLO)
-
-/* Interupt-Controller base addresses */
-INTMR1:                .word   0x80000280 @ 32 bit size
-INTMR2:                .word   0x80001280 @ 16 bit size
-INTMR3:                .word   0x80002280 @  8 bit size
-
-/* SYSCONs */
-SYSCON1:       .word   0x80000100
-SYSCON2:       .word   0x80001100
-SYSCON3:       .word   0x80002200
-
-#define CLKCTL        0x6  /* mask */
-#define CLKCTL_18      0x0  /* 18.432 MHz */
-#define CLKCTL_36      0x2  /* 36.864 MHz */
-#define CLKCTL_49      0x4  /* 49.152 MHz */
-#define CLKCTL_73      0x6  /* 73.728 MHz */
-
-#elif defined(CONFIG_LPC2292)
+#if defined(CONFIG_LPC2292)
 PLLCFG_ADR:    .word   PLLCFG
 PLLFEED_ADR:   .word   PLLFEED
 PLLCON_ADR:    .word   PLLCON
@@ -299,35 +285,7 @@ MEMMAP_ADR:        .word   MEMMAP
 #endif
 
 cpu_init_crit:
-#if defined(CONFIG_IMPA7) || defined(CONFIG_EP7312) || defined(CONFIG_ARMADILLO)
-
-       /*
-        * mask all IRQs by clearing all bits in the INTMRs
-        */
-       mov     r1, #0x00
-       ldr     r0, INTMR1
-       str     r1, [r0]
-       ldr     r0, INTMR2
-       str     r1, [r0]
-       ldr     r0, INTMR3
-       str     r1, [r0]
-
-       /*
-        * flush v4 I/D caches
-        */
-       mov     r0, #0
-       mcr     p15, 0, r0, c7, c7, 0   /* flush v3/v4 cache */
-       mcr     p15, 0, r0, c8, c7, 0   /* flush v4 TLB */
-
-       /*
-        * disable MMU stuff and caches
-        */
-       mrc     p15,0,r0,c1,c0
-       bic     r0, r0, #0x00002300     @ clear bits 13, 9:8 (--V- --RS)
-       bic     r0, r0, #0x0000008f     @ clear bits 7, 3:0 (B--- WCAM)
-       orr     r0, r0, #0x00000002     @ set bit 2 (A) Align
-       mcr     p15,0,r0,c1,c0
-#elif defined(CONFIG_NETARM)
+#if defined(CONFIG_NETARM)
        /*
         * prior to software reset : need to set pin PORTC4 to be *HRESET
         */
@@ -632,19 +590,7 @@ fiq:
 
 #endif
 
-#if defined(CONFIG_IMPA7) || defined(CONFIG_EP7312) || defined(CONFIG_ARMADILLO)
-       .align  5
-.globl reset_cpu
-reset_cpu:
-       mov     ip, #0
-       mcr     p15, 0, ip, c7, c7, 0           @ invalidate cache
-       mcr     p15, 0, ip, c8, c7, 0           @ flush TLB (v4)
-       mrc     p15, 0, ip, c1, c0, 0           @ get ctrl register
-       bic     ip, ip, #0x000f                 @ ............wcam
-       bic     ip, ip, #0x2100                 @ ..v....s........
-       mcr     p15, 0, ip, c1, c0, 0           @ ctrl register
-       mov     pc, r0
-#elif defined(CONFIG_NETARM)
+#if defined(CONFIG_NETARM)
        .align  5
 .globl reset_cpu
 reset_cpu: