[U-Boot,v2,01/10] powerpc: mpc8xx: initialisation of global data
diff mbox series

Message ID 10aff1afc661d1a12fc49bdefdc075c8e81bc3a8.1519976944.git.christophe.leroy@c-s.fr
State Superseded
Delegated to: Tom Rini
Headers show
Series
  • Powerpc: mpc8xx: cleanup before migration to DM model
Related show

Commit Message

Christophe Leroy March 2, 2018, 9:32 a.m. UTC
Global data pointer has to be initialised
Global data area has to be zeroised

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

Patch
diff mbox series

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);