]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
common/board_f: Initialized global data for generic board
authorYork Sun <yorksun@freescale.com>
Sat, 3 May 2014 00:28:04 +0000 (17:28 -0700)
committerTom Rini <trini@ti.com>
Mon, 12 May 2014 19:20:05 +0000 (15:20 -0400)
Some platforms (tested on mpc85xx, mpc86xx) use global data before calling
function baord_inti_f(). The data should not be cleared later. Any arch
which uses global data in generic board board_init_f() should define
CONFIG_SYS_GENERIC_GLOBAL_DATA.

Signed-off-by: York Sun <yorksun@freescale.com>
CC: Scott Wood <scottwood@freescale.com>
CC: Simon Glass <sjg@chromium.org>
CC: Albert ARIBAUD <albert.u.boot@aribaud.net>
Acked-by: Simon Glass <sjg@chromium.org>
README
arch/arc/include/asm/config.h
arch/arm/include/asm/config.h
arch/mips/include/asm/config.h
arch/sandbox/include/asm/config.h
common/board_f.c

diff --git a/README b/README
index 61c2caca3168188d29c12ed61910c9edcac58b94..5f895520e828abc2ecfd0199372fa4187a9da0bf 100644 (file)
--- a/README
+++ b/README
@@ -451,6 +451,12 @@ The following options need to be configured:
                supported, core will start to execute uboot when wakes up.
 
 - Generic CPU options:
+               CONFIG_SYS_GENERIC_GLOBAL_DATA
+               Defines global data is initialized in generic board board_init_f().
+               If this macro is defined, global data is created and cleared in
+               generic board board_init_f(). Without this macro, architecture/board
+               should initialize global data before calling board_init_f().
+
                CONFIG_SYS_BIG_ENDIAN, CONFIG_SYS_LITTLE_ENDIAN
 
                Defines the endianess of the CPU. Implementation of those
index 5761def1e7188ace3f8c9dfa53b920909717141c..3d331cc970d87698a7f07fba8502f319d524dab8 100644 (file)
@@ -7,6 +7,8 @@
 #ifndef __ASM_ARC_CONFIG_H_
 #define __ASM_ARC_CONFIG_H_
 
+#define CONFIG_SYS_GENERIC_GLOBAL_DATA
+
 #define CONFIG_LMB
 
 #endif /*__ASM_ARC_CONFIG_H_ */
index abf79e5c9ed230c6cb64bfb3d7a8e705253ad115..2a20a770bcd38102f3b94d91f318162eaa24683b 100644 (file)
@@ -7,6 +7,8 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
+#define CONFIG_SYS_GENERIC_GLOBAL_DATA
+
 #define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
index 3a891ba62727511706291cf292b0fb23b7ec2a02..1c8a42bd2f6ea8233e019100ea4560be5ef17984 100644 (file)
@@ -7,6 +7,8 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
+#define CONFIG_SYS_GENERIC_GLOBAL_DATA
+
 #define CONFIG_LMB
 #define CONFIG_SYS_BOOT_RAMDISK_HIGH
 
index ec7729eb4ccbf44a5d74e0c220c22e46897208ae..6c1bff99c2bf3ced2ae666c8023f70e6cdc0adc3 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef _ASM_CONFIG_H_
 #define _ASM_CONFIG_H_
 
+#define CONFIG_SYS_GENERIC_GLOBAL_DATA
 #define CONFIG_SANDBOX_ARCH
 
 /* Used by drivers/spi/sandbox_spi.c and arch/sandbox/include/asm/state.h */
index aea6bff55519a5b82e0ff037c5451b0d620406bf..b6be386a7f71294b8c46398327a1b195714be06f 100644 (file)
@@ -961,20 +961,22 @@ static init_fnc_t init_sequence_f[] = {
 
 void board_init_f(ulong boot_flags)
 {
-#ifndef CONFIG_X86
+#ifdef CONFIG_SYS_GENERIC_GLOBAL_DATA
+       /*
+        * For some archtectures, global data is initialized and used before
+        * calling this function. The data should be preserved. For others,
+        * CONFIG_SYS_GENERIC_GLOBAL_DATA should be defined and use the stack
+        * here to host global data until relocation.
+        */
        gd_t data;
 
        gd = &data;
-#endif
 
        /*
         * Clear global data before it is accessed at debug print
         * in initcall_run_list. Otherwise the debug print probably
         * get the wrong vaule of gd->have_console.
         */
-#if !defined(CONFIG_CPM2) && !defined(CONFIG_MPC512X) && \
-               !defined(CONFIG_MPC83xx) && !defined(CONFIG_MPC85xx) && \
-               !defined(CONFIG_MPC86xx) && !defined(CONFIG_X86)
        zero_global_data();
 #endif