summaryrefslogtreecommitdiff
path: root/common/board_f.c
diff options
context:
space:
mode:
authorYork Sun <yorksun@freescale.com>2014-05-02 17:28:04 -0700
committerTom Rini <trini@ti.com>2014-05-12 15:20:05 -0400
commit2a1680e30e3fa8257b60cb9dbd7add32539ac470 (patch)
treecc8ddc1f7e452ba131820fd872833855f440d82d /common/board_f.c
parent7e18a1b9586e4d992f49bcd0728a93f8828b9f98 (diff)
common/board_f: Initialized global data for generic board
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>
Diffstat (limited to 'common/board_f.c')
-rw-r--r--common/board_f.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/common/board_f.c b/common/board_f.c
index aea6bff555..b6be386a7f 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -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