]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
arm: Set up global data before board_init_f()
authorSimon Glass <sjg@chromium.org>
Fri, 11 Jul 2014 04:23:26 +0000 (22:23 -0600)
committerSimon Glass <sjg@chromium.org>
Mon, 4 Aug 2014 11:23:59 +0000 (05:23 -0600)
At present arm defines CONFIG_SYS_GENERIC_GLOBAL_DATA, meaning that
the global_data pointer is set up in board_init_f(). However it is
actually set up before this, it just isn't zeroed.

If we zero the global data before calling board_init_f() then we
don't need to define CONFIG_SYS_GENERIC_GLOBAL_DATA.

Make this change (on arm32 only) to simplify the init process. I
don't have the ability to test aarch64 yet.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Tom Rini <trini@ti.com>
arch/arm/include/asm/config.h
arch/arm/lib/crt0.S

index d3433dafd9f900e45dcf9445cf86f2de35749289..5f2a5f4ea9f0905cffb340d75eb9e01aa25d8162 100644 (file)
@@ -7,7 +7,9 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
+#ifdef __aarch64__
 #define CONFIG_SYS_GENERIC_GLOBAL_DATA
+#endif
 
 #define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
index dfc2de9a618830e4c06a6a85705c142334ae9d30..43aa2123be53482359409c4a9b5b755f38ca7c5b 100644 (file)
@@ -67,10 +67,19 @@ ENTRY(_main)
        ldr     sp, =(CONFIG_SYS_INIT_SP_ADDR)
 #endif
        bic     sp, sp, #7      /* 8-byte alignment for ABI compliance */
+       mov     r2, sp
        sub     sp, sp, #GD_SIZE        /* allocate one GD above SP */
        bic     sp, sp, #7      /* 8-byte alignment for ABI compliance */
        mov     r9, sp          /* GD is above SP */
+       mov     r1, sp
        mov     r0, #0
+clr_gd:
+       cmp     r1, r2                  /* while not at end of GD */
+       strlo   r0, [r1]                /* clear 32-bit GD word */
+       addlo   r1, r1, #4              /* move to next */
+       blo     clr_gd
+
+       /* mov r0, #0 not needed due to above code */
        bl      board_init_f
 
 #if ! defined(CONFIG_SPL_BUILD)