summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2025-02-28 05:20:25 -0700
committerTom Rini <trini@konsulko.com>2025-03-13 10:36:10 -0600
commitffa98c08e8597ecb3668025ae881630f5664684e (patch)
tree40b8793e5be1c06801fb24468e64d9e3490dad5d
parentd6a53f523afea94fb20fe4f9babcd880833372f1 (diff)
spl: Use CONFIG_VAL() to obtain the SPL stack
Now that we have the same option for SPL and TPL, simplify the logic for determining the initial stack. Note that this changes behaviour as current SPL_STACK is a fallback for TPL. However, that was likely unintended and can be handled with Kconfig defaults if needed. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> Suggested-by: Tom Rini <trini@konsulko.com>
-rw-r--r--arch/arm/cpu/armv7/lowlevel_init.S4
-rw-r--r--arch/arm/cpu/armv7/start.S4
-rw-r--r--arch/arm/lib/crt0.S6
-rw-r--r--arch/arm/lib/crt0_64.S6
-rw-r--r--arch/riscv/cpu/start.S4
-rw-r--r--common/spl/Kconfig.tpl4
6 files changed, 12 insertions, 16 deletions
diff --git a/arch/arm/cpu/armv7/lowlevel_init.S b/arch/arm/cpu/armv7/lowlevel_init.S
index c2a0fe061a3..72b7b7d082c 100644
--- a/arch/arm/cpu/armv7/lowlevel_init.S
+++ b/arch/arm/cpu/armv7/lowlevel_init.S
@@ -26,8 +26,8 @@ WEAK(lowlevel_init)
/*
* Setup a temporary stack. Global data is not available yet.
*/
-#if defined(CONFIG_XPL_BUILD) && defined(CONFIG_SPL_HAVE_INIT_STACK)
- ldr sp, =CONFIG_SPL_STACK
+#if CONFIG_IS_ENABLED(HAVE_INIT_STACK)
+ ldr sp, =CONFIG_VAL(STACK)
#else
ldr sp, =SYS_INIT_SP_ADDR
#endif
diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index 3394db46953..959251957de 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -279,8 +279,8 @@ ENTRY(cpu_init_cp15)
orr r2, r4, r2 @ r2 has combined CPU variant + revision
/* Early stack for ERRATA that needs into call C code */
-#if defined(CONFIG_XPL_BUILD) && defined(CONFIG_SPL_HAVE_INIT_STACK)
- ldr r0, =(CONFIG_SPL_STACK)
+#if CONFIG_IS_ENABLED(HAVE_INIT_STACK)
+ ldr r0, =CONFIG_VAL(STACK)
#else
ldr r0, =(SYS_INIT_SP_ADDR)
#endif
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index 0248606906a..a50dde60e8b 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -100,10 +100,8 @@ ENTRY(_main)
* Set up initial C runtime environment and call board_init_f(0).
*/
-#if defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_HAVE_INIT_STACK)
- ldr r0, =(CONFIG_TPL_STACK)
-#elif defined(CONFIG_XPL_BUILD) && defined(CONFIG_SPL_HAVE_INIT_STACK)
- ldr r0, =(CONFIG_SPL_STACK)
+#if CONFIG_IS_ENABLED(HAVE_INIT_STACK)
+ ldr r0, =CONFIG_VAL(STACK)
#else
ldr r0, =(SYS_INIT_SP_ADDR)
#endif
diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
index 1b6782b06ed..30950ddaf9b 100644
--- a/arch/arm/lib/crt0_64.S
+++ b/arch/arm/lib/crt0_64.S
@@ -69,10 +69,8 @@ ENTRY(_main)
/*
* Set up initial C runtime environment and call board_init_f(0).
*/
-#if defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_HAVE_INIT_STACK)
- ldr x0, =(CONFIG_TPL_STACK)
-#elif defined(CONFIG_XPL_BUILD) && defined(CONFIG_SPL_HAVE_INIT_STACK)
- ldr x0, =(CONFIG_SPL_STACK)
+#if CONFIG_IS_ENABLED(HAVE_INIT_STACK)
+ ldr x0, =CONFIG_VAL(STACK)
#elif defined(CONFIG_INIT_SP_RELATIVE)
#if CONFIG_POSITION_INDEPENDENT
adrp x0, __bss_start /* x0 <- Runtime &__bss_start */
diff --git a/arch/riscv/cpu/start.S b/arch/riscv/cpu/start.S
index c8526dd82fd..7bafdfd390a 100644
--- a/arch/riscv/cpu/start.S
+++ b/arch/riscv/cpu/start.S
@@ -90,8 +90,8 @@ _start:
* Set stackpointer in internal/ex RAM to call board_init_f
*/
call_board_init_f:
-#if defined(CONFIG_XPL_BUILD) && defined(CONFIG_SPL_HAVE_INIT_STACK)
- li t0, CONFIG_SPL_STACK
+#if CONFIG_IS_ENABLED(HAVE_INIT_STACK)
+ li t0, CONFIG_VAL(STACK)
#else
li t0, SYS_INIT_SP_ADDR
#endif
diff --git a/common/spl/Kconfig.tpl b/common/spl/Kconfig.tpl
index 421352f9396..a535b61ecd3 100644
--- a/common/spl/Kconfig.tpl
+++ b/common/spl/Kconfig.tpl
@@ -138,8 +138,8 @@ config TPL_HAVE_INIT_STACK
bool "TPL requires a initial, fixed, stack-pointer location"
help
Enable if the TPL phase should not inherit its initial
- stack-pointer from the settings for U-Boot proper (or SPL if
- SPL_STACK is defined), but should set its own value.
+ stack-pointer from the settings for U-Boot proper, but should set its
+ own value.
config TPL_STACK
hex "Address of the initial stack-pointer for the TPL phase"