diff mbox series

[U-Boot,03/14] armV7R: K3: j721e: Allow using SPL BSS pre-relocation

Message ID 20190522183707.19326-4-lokeshvutla@ti.com
State Superseded
Delegated to: Tom Rini
Headers show
Series arm: k3: arm64: Initial support Texas Instrument's J721E Platform | expand

Commit Message

Lokesh Vutla May 22, 2019, 6:36 p.m. UTC
From: Andreas Dannenberg <dannenberg@ti.com>

In order to be able to use more advanced driver functionality which often
relies on having BSS initialized during early boot prior to relocation
several things need to be in place:

1) Memory needs to be available for BSS to use. For this, we locate BSS
   at the top of the MCU SRAM area, with the stack starting right below
2) We need to zero-initialize BSS ourselves which will we do during
3) We would also like to skip the implicit zero-initialization as part of
   SPL relocation, so that already initialized variables will carry over
   post-relocation. We will do this with a separate commit by turning on
   the respective CONFIG option.

In this commit we only zero-initialize BSS. Assignment of SP will be
done in the environment setup.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
 arch/arm/mach-k3/j721e_init.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series


diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index d798aed481..6da4cf6d22 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -24,6 +24,13 @@  void board_init_f(ulong dummy)
 #ifdef CONFIG_CPU_V7R
+	/*
+	 * When running SPL on R5 we are using SRAM for BSS to have global
+	 * data etc. working prior to relocation. Since this means we need
+	 * to self-manage BSS, clear that section now.
+	 */
+	memset(__bss_start, 0, __bss_end - __bss_start);
 	/* Init DM early */