From a0319d2beef4789c743132fae313718f6e6a4b20 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Tue, 12 Nov 2019 10:19:55 +0100 Subject: ARM: stm32mp: add stm32mp_cpu_lowlevel_init with stack set up When barebox is invoked out of the TF-A v2.1, it's started with sp, r0, r1, r2 all equal to zero. To use the new RAM size calculating stm32mp1_barebox_entry, we need to have a stack to handle spillage. Add a stm32mp_cpu_lowlevel_init wrapper around arm_cpu_lowlevel_init, which additionally configures a 64 byte stack after the end of the barebox binary. This should be enough to help us through the RAM size calculation. If not, compression will fail because of data corruption and stack size can be increased as necessary. Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- arch/arm/mach-stm32mp/include/mach/entry.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-stm32mp/include/mach/entry.h b/arch/arm/mach-stm32mp/include/mach/entry.h index 703712a9ee..92e15b5cf4 100644 --- a/arch/arm/mach-stm32mp/include/mach/entry.h +++ b/arch/arm/mach-stm32mp/include/mach/entry.h @@ -1,7 +1,18 @@ #ifndef _STM32MP_MACH_ENTRY_H_ #define _STM32MP_MACH_ENTRY_H_ -#include +#include +#include + +static __always_inline void stm32mp_cpu_lowlevel_init(void) +{ + unsigned long stack_top; + arm_cpu_lowlevel_init(); + + stack_top = (unsigned long)__image_end + get_runtime_offset() + 64; + stack_top = ALIGN(stack_top, 16); + arm_setup_stack(stack_top); +} void __noreturn stm32mp1_barebox_entry(void *boarddata); -- cgit v1.2.3