[U-Boot,v3,01/15] powerpc, 8xx: initialisation global data
diff mbox series

Message ID 3625abbc67e5e115a771105737fd39124a33dc92.1520334961.git.christophe.leroy@c-s.fr
State Deferred
Delegated to: Tom Rini
Headers show
Series
  • Powerpc: mpc8xx: cleanup before migration to DM model
Related show

Commit Message

Christophe Leroy March 6, 2018, 12:06 p.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);