[U-Boot] [PATCH v2 01/10] powerpc: mpc8xx: initialisation of global data

Christophe Leroy christophe.leroy at c-s.fr
Fri Mar 2 09:32:25 UTC 2018


Global data pointer has to be initialised
Global data area has to be zeroised

Signed-off-by: Christophe Leroy <christophe.leroy at c-s.fr>
---
 arch/powerpc/cpu/mpc8xx/cpu_init.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/powerpc/cpu/mpc8xx/cpu_init.c b/arch/powerpc/cpu/mpc8xx/cpu_init.c
index dc601a12976..3c9c4b19753 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu_init.c
@@ -12,6 +12,8 @@
 #include <commproc.h>
 #include <asm/io.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 /*
  * Breath some life into the CPU...
  *
@@ -24,6 +26,10 @@ void cpu_init_f(immap_t __iomem *immr)
 	memctl8xx_t __iomem *memctl = &immr->im_memctl;
 	ulong reg;
 
+	gd = (gd_t *)(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
+	/* Clear initial global data */
+	memset((void *)gd, 0, sizeof(*gd));
+
 	/* SYPCR - contains watchdog control (11-9) */
 
 	out_be32(&immr->im_siu_conf.sc_sypcr, CONFIG_SYS_SYPCR);
-- 
2.13.3



More information about the U-Boot mailing list