[U-Boot] [PATCH 9/9] arm: Drop gdata global_data variable in SPL

Simon Glass sjg at chromium.org
Tue Dec 23 20:04:59 CET 2014


In SPL as in U-Boot proper, global_data should only be set up in one place
which is crt0.S. We should not use on global_data before board_init_f().
The pointer does not exist.

In fact there is no need for this anyway and it just contorts the early init
code for SPL. Drop it.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 arch/arm/include/asm/spl.h |  2 --
 arch/arm/lib/spl.c         | 16 ++++++----------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/arch/arm/include/asm/spl.h b/arch/arm/include/asm/spl.h
index 8acd7cd..e5dbab0 100644
--- a/arch/arm/include/asm/spl.h
+++ b/arch/arm/include/asm/spl.h
@@ -33,6 +33,4 @@ enum {
 /* Linker symbols. */
 extern char __bss_start[], __bss_end[];
 
-extern gd_t gdata;
-
 #endif
diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c
index c41850a..f130fa3 100644
--- a/arch/arm/lib/spl.c
+++ b/arch/arm/lib/spl.c
@@ -17,25 +17,21 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
- * WARNING: This is going away very soon. Don't use it and don't submit
- * pafches that rely on it. The global_data area is set up in crt0.S.
- */
-gd_t gdata __attribute__ ((section(".data")));
-
-/*
  * In the context of SPL, board_init_f must ensure that any clocks/etc for
  * DDR are enabled, ensure that the stack pointer is valid, clear the BSS
- * and call board_init_f.  We provide this version by default but mark it
+ * and call board_init_r.  We provide this version by default but mark it
  * as __weak to allow for platforms to do this in their own way if needed.
+ *
+ * Note that DRAM will not yet be set up, so this version will not normally
+ * be useful if BSS is located in DRAM.
  */
 void __weak board_init_f(ulong dummy)
 {
+	/* If overriding this function, set up DRAM here */
+
 	/* Clear the BSS. */
 	memset(__bss_start, 0, __bss_end - __bss_start);
 
-	/* TODO: Remove settings of the global data pointer here */
-	gd = &gdata;
-
 	board_init_r(NULL, 0);
 }
 
-- 
2.2.0.rc0.207.ga3a616c



More information about the U-Boot mailing list