]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/arm/cpu/sa1100/start.S
Merge branch 'u-boot-samsung/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / arch / arm / cpu / sa1100 / start.S
index 278c5008fb84079362a4145f078b9fb74a9af1fd..30d5a9021f63fe6a9007a4cb10aeba824aac6a9f 100644 (file)
@@ -4,7 +4,7 @@
  *  Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
  *  Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
  *  Copyright (C) 2000 Wolfgang Denk <wd@denx.de>
- *  Copyright (c) 2001 Alex Züpke <azu@sysgo.de>
+ *  Copyright (c) 2001 Alex Züpke <azu@sysgo.de>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
  * MA 02111-1307 USA
  */
 
-
+#include <asm-offsets.h>
 #include <config.h>
 #include <version.h>
 
-
 /*
  *************************************************************************
  *
@@ -73,23 +72,31 @@ _fiq:                       .word fiq
  *************************************************************************
  */
 
+.globl _TEXT_BASE
 _TEXT_BASE:
-       .word   TEXT_BASE
-
-.globl _armboot_start
-_armboot_start:
-       .word _start
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_TEXT_BASE)
+       .word   CONFIG_SPL_TEXT_BASE
+#else
+       .word   CONFIG_SYS_TEXT_BASE
+#endif
 
 /*
  * These are defined in the board-specific linker script.
+ * Subtracting _start from them lets the linker put their
+ * relative position in the executable instead of leaving
+ * them null.
  */
-.globl _bss_start
-_bss_start:
-       .word __bss_start
+.globl _bss_start_ofs
+_bss_start_ofs:
+       .word __bss_start - _start
+
+.globl _bss_end_ofs
+_bss_end_ofs:
+       .word __bss_end - _start
 
-.globl _bss_end
-_bss_end:
-       .word _end
+.globl _end_ofs
+_end_ofs:
+       .word _end - _start
 
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
@@ -103,6 +110,10 @@ FIQ_STACK_START:
        .word 0x0badc0de
 #endif
 
+/* IRQ stack memory (calculated at run-time) + 8 bytes */
+.globl IRQ_STACK_START_IN
+IRQ_STACK_START_IN:
+       .word   0x0badc0de
 
 /*
  * the actual reset code
@@ -114,7 +125,7 @@ reset:
         */
        mrs     r0,cpsr
        bic     r0,r0,#0x1f
-       orr     r0,r0,#0x13
+       orr     r0,r0,#0xd3
        msr     cpsr,r0
 
        /*
@@ -125,49 +136,14 @@ reset:
        bl      cpu_init_crit
 #endif
 
-#ifndef CONFIG_SKIP_RELOCATE_UBOOT
-relocate:                              /* relocate U-Boot to RAM           */
-       adr     r0, _start              /* r0 <- current position of code   */
-       ldr     r1, _TEXT_BASE          /* test if we run from flash or RAM */
-       cmp     r0, r1                  /* don't reloc during debug         */
-       beq     stack_setup
-
-       ldr     r2, _armboot_start
-       ldr     r3, _bss_start
-       sub     r2, r3, r2              /* r2 <- size of armboot            */
-       add     r2, r0, r2              /* r2 <- source end address         */
-
-copy_loop:
-       ldmia   r0!, {r3-r10}           /* copy from source address [r0]    */
-       stmia   r1!, {r3-r10}           /* copy to   target address [r1]    */
-       cmp     r0, r2                  /* until source end addreee [r2]    */
-       ble     copy_loop
-#endif /* CONFIG_SKIP_RELOCATE_UBOOT */
-
-       /* Set up the stack                                                 */
-stack_setup:
-       ldr     r0, _TEXT_BASE          /* upper 128 KiB: relocated uboot   */
-       sub     r0, r0, #CONFIG_SYS_MALLOC_LEN  /* malloc area                      */
-       sub     r0, r0, #CONFIG_SYS_GBL_DATA_SIZE /* bdinfo                        */
-#ifdef CONFIG_USE_IRQ
-       sub     r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
-#endif
-       sub     sp, r0, #12             /* leave 3 words for abort-stack    */
-
-clear_bss:
-       ldr     r0, _bss_start          /* find start of bss segment        */
-       ldr     r1, _bss_end            /* stop here                        */
-       mov     r2, #0x00000000         /* clear                            */
-
-clbss_l:str    r2, [r0]                /* clear loop...                    */
-       add     r0, r0, #4
-       cmp     r0, r1
-       ble     clbss_l
+       bl      _main
 
-       ldr     pc, _start_armboot
+/*------------------------------------------------------------------------------*/
 
-_start_armboot:        .word start_armboot
+       .globl  c_runtime_cpu_setup
+c_runtime_cpu_setup:
 
+       mov     pc, lr
 
 /*
  *************************************************************************
@@ -181,7 +157,7 @@ _start_armboot:     .word start_armboot
  */
 
 
-/* Interupt-Controller base address */
+/* Interrupt-Controller base address */
 IC_BASE:       .word   0x90050000
 #define ICMR   0x04
 
@@ -287,9 +263,7 @@ cpu_init_crit:
        stmia   sp, {r0 - r12}                  @ Calling r0-r12
        add     r8, sp, #S_PC
 
-       ldr     r2, _armboot_start
-       sub     r2, r2, #(CONFIG_STACKSIZE+CONFIG_SYS_MALLOC_LEN)
-       sub     r2, r2, #(CONFIG_SYS_GBL_DATA_SIZE+8)  @ set base 2 words into abort stack
+       ldr     r2, IRQ_STACK_START_IN
        ldmia   r2, {r2 - r4}                   @ get pc, cpsr, old_r0
        add     r0, sp, #S_FRAME_SIZE           @ restore sp_SVC
 
@@ -320,9 +294,7 @@ cpu_init_crit:
        .endm
 
        .macro get_bad_stack
-       ldr     r13, _armboot_start             @ setup our mode stack
-       sub     r13, r13, #(CONFIG_STACKSIZE+CONFIG_SYS_MALLOC_LEN)
-       sub     r13, r13, #(CONFIG_SYS_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
+       ldr     r13, IRQ_STACK_START_IN         @ setup our mode stack
 
        str     lr, [r13]                       @ save caller lr / spsr
        mrs     lr, spsr