diff mbox series

[01/10] ARM: stm32: Add STM32MP13xx SPL Kconfig options

Message ID 20250512172149.150214-2-marek.vasut@mailbox.org
State New
Delegated to: Patrice Chotard
Headers show
Series ARM: stm32: Add STM32MP13xx SPL and OpTee-OS start support | expand

Commit Message

Marek Vasut May 12, 2025, 5:21 p.m. UTC
Introduce Kconfig options used by SPL on STM32MP13xx and isolate
the Kconfig options only used in case TFA BL2 is used as a SPL
behind CONFIG_TFABOOT dependency.

Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
---
Cc: Cheick Traore <cheick.traore@foss.st.com>
Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Cc: Gatien Chevallier <gatien.chevallier@foss.st.com>
Cc: Lionel Debieve <lionel.debieve@foss.st.com>
Cc: Pascal Zimmermann <pzimmermann@dh-electronics.com>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@dh-electronics.com
Cc: u-boot@lists.denx.de
Cc: uboot-stm32@st-md-mailman.stormreply.com
---
 arch/arm/mach-stm32mp/Kconfig     | 7 +++++--
 arch/arm/mach-stm32mp/Kconfig.13x | 3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)

Comments

Patrice CHOTARD May 27, 2025, 4:01 p.m. UTC | #1
On 5/12/25 19:21, Marek Vasut wrote:
> Introduce Kconfig options used by SPL on STM32MP13xx and isolate
> the Kconfig options only used in case TFA BL2 is used as a SPL
> behind CONFIG_TFABOOT dependency.
> 
> Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
> ---
> Cc: Cheick Traore <cheick.traore@foss.st.com>
> Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> Cc: Gatien Chevallier <gatien.chevallier@foss.st.com>
> Cc: Lionel Debieve <lionel.debieve@foss.st.com>
> Cc: Pascal Zimmermann <pzimmermann@dh-electronics.com>
> Cc: Patrice Chotard <patrice.chotard@foss.st.com>
> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: u-boot@dh-electronics.com
> Cc: u-boot@lists.denx.de
> Cc: uboot-stm32@st-md-mailman.stormreply.com
> ---
>  arch/arm/mach-stm32mp/Kconfig     | 7 +++++--
>  arch/arm/mach-stm32mp/Kconfig.13x | 3 ++-
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
> index 58250901101..3a0ca50e9d6 100644
> --- a/arch/arm/mach-stm32mp/Kconfig
> +++ b/arch/arm/mach-stm32mp/Kconfig
> @@ -40,16 +40,19 @@ choice
>  config STM32MP13X
>  	bool "Support STMicroelectronics STM32MP13x Soc"
>  	select ARCH_EARLY_INIT_R
> -	select ARM_SMCCC
> +	select ARM_SMCCC if TFABOOT
> +	select ARCH_SUPPORT_PSCI if !TFABOOT
> +	select BINMAN if !TFABOOT
>  	select CPU_V7A
>  	select CPU_V7_HAS_NONSEC
>  	select CPU_V7_HAS_VIRT
> -	select OF_BOARD
> +	select OF_BOARD if TFABOOT
>  	select OF_BOARD_SETUP
>  	select PINCTRL_STM32
>  	select STM32_RCC
>  	select STM32_RESET
>  	select STM32_SERIAL
> +	select SUPPORT_SPL if !TFABOOT
>  	select SYS_ARCH_TIMER
>  	imply CMD_NVEDIT_INFO
>  	imply OF_UPSTREAM
> diff --git a/arch/arm/mach-stm32mp/Kconfig.13x b/arch/arm/mach-stm32mp/Kconfig.13x
> index bc8b3f8cf77..cecf9e3b8c7 100644
> --- a/arch/arm/mach-stm32mp/Kconfig.13x
> +++ b/arch/arm/mach-stm32mp/Kconfig.13x
> @@ -20,7 +20,8 @@ config TARGET_ST_STM32MP13X
>  endchoice
>  
>  config TEXT_BASE
> -	default 0xC0000000
> +	default 0xC0000000 if TFABOOT
> +	default 0xC0100000 if !TFABOOT
>  
>  config PRE_CON_BUF_ADDR
>  	default 0xC0800000

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice
Patrick DELAUNAY June 3, 2025, 1:26 p.m. UTC | #2
Hi,

On 5/12/25 19:21, Marek Vasut wrote:
> Introduce Kconfig options used by SPL on STM32MP13xx and isolate
> the Kconfig options only used in case TFA BL2 is used as a SPL
> behind CONFIG_TFABOOT dependency.
>
> Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
> ---
> Cc: Cheick Traore <cheick.traore@foss.st.com>
> Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> Cc: Gatien Chevallier <gatien.chevallier@foss.st.com>
> Cc: Lionel Debieve <lionel.debieve@foss.st.com>
> Cc: Pascal Zimmermann <pzimmermann@dh-electronics.com>
> Cc: Patrice Chotard <patrice.chotard@foss.st.com>
> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Sughosh Ganu <sughosh.ganu@linaro.org>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: u-boot@dh-electronics.com
> Cc: u-boot@lists.denx.de
> Cc: uboot-stm32@st-md-mailman.stormreply.com
> ---
>   arch/arm/mach-stm32mp/Kconfig     | 7 +++++--
>   arch/arm/mach-stm32mp/Kconfig.13x | 3 ++-
>   2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
> index 58250901101..3a0ca50e9d6 100644
> --- a/arch/arm/mach-stm32mp/Kconfig
> +++ b/arch/arm/mach-stm32mp/Kconfig
> @@ -40,16 +40,19 @@ choice
>   config STM32MP13X
>   	bool "Support STMicroelectronics STM32MP13x Soc"
>   	select ARCH_EARLY_INIT_R
> -	select ARM_SMCCC
> +	select ARM_SMCCC if TFABOOT
> +	select ARCH_SUPPORT_PSCI if !TFABOOT
> +	select BINMAN if !TFABOOT
>   	select CPU_V7A
>   	select CPU_V7_HAS_NONSEC
>   	select CPU_V7_HAS_VIRT
> -	select OF_BOARD
> +	select OF_BOARD if TFABOOT
>   	select OF_BOARD_SETUP
>   	select PINCTRL_STM32
>   	select STM32_RCC
>   	select STM32_RESET
>   	select STM32_SERIAL
> +	select SUPPORT_SPL if !TFABOOT
>   	select SYS_ARCH_TIMER
>   	imply CMD_NVEDIT_INFO
>   	imply OF_UPSTREAM
> diff --git a/arch/arm/mach-stm32mp/Kconfig.13x b/arch/arm/mach-stm32mp/Kconfig.13x
> index bc8b3f8cf77..cecf9e3b8c7 100644
> --- a/arch/arm/mach-stm32mp/Kconfig.13x
> +++ b/arch/arm/mach-stm32mp/Kconfig.13x
> @@ -20,7 +20,8 @@ config TARGET_ST_STM32MP13X
>   endchoice
>   
>   config TEXT_BASE
> -	default 0xC0000000
> +	default 0xC0000000 if TFABOOT
> +	default 0xC0100000 if !TFABOOT
>   
>   config PRE_CON_BUF_ADDR
>   	default 0xC0800000


I don't understood  why you modify TEXT_BASE here.

I expect to have the same base address for SPL or for TF-A boot even if 
we decide to change this address between STM32MP13 and STM32MP15.

the new address avoid potential issue on initial stack size as see on 
STM32MP15 (limited at 0x100000) and because we have no more issue with 
STM32CubeProgrammer (previously the flash-layout file was loaded by TF-A 
at 0xC0000000).

We don't change STM32MP15 just to avoid to break the compatibility...

The default memory is fully described here:

https://wiki.st.com/stm32mpu/wiki/How_to_configure_U-Boot_for_your_board#Before_relocation 


For STM32MP13 the default value are

1/ CONFIG_TEXT_BASE = 0xC0000000 (begin of DDR)

2/ CONFIG_CUSTOM_SYS_INIT_SP_ADDR = C0400000


You change the default STM32MP13 base address to keep the SAME description for you board ?

	CONFIG_SPL_LOAD_FIT=y
	CONFIG_SPL_LOAD_FIT_ADDRESS=0xc1000000

So FIT is loaded at the same address than U-Boot ?

FIT for STM32MP15 was managed with binman config in arch/arm/dts/stm32mp15xx-dhsom-u-boot.dtsi

			images {
				uboot {
					arch = "arm";
					compression = "none";
					description = "U-Boot (32-bit)";
					entry = <CONFIG_TEXT_BASE>;
					load = <CONFIG_TEXT_BASE>;
					type = "standalone";

					uboot-blob {
						filename = "u-boot-nodtb.bin";
						type = "blob-ext";
					};
				};

I don't sure it is the same for STM32MP13 after after your serie.....


Anyway I think the better solution to avoid a extra copy is to load FIT after final U-Boot location in DDR

CONFIG_SPL_LOAD_FIT_ADDRESS=0xc4000000

=> this address can be identical for STM32MP13 and STM32MP15

and to keep the the default value for CONFIG_TEXT_BASE
- 0xC0000000 for STM32MP13
- 0xC0100000 for STM32MP15

Regards

Patrick
diff mbox series

Patch

diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index 58250901101..3a0ca50e9d6 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -40,16 +40,19 @@  choice
 config STM32MP13X
 	bool "Support STMicroelectronics STM32MP13x Soc"
 	select ARCH_EARLY_INIT_R
-	select ARM_SMCCC
+	select ARM_SMCCC if TFABOOT
+	select ARCH_SUPPORT_PSCI if !TFABOOT
+	select BINMAN if !TFABOOT
 	select CPU_V7A
 	select CPU_V7_HAS_NONSEC
 	select CPU_V7_HAS_VIRT
-	select OF_BOARD
+	select OF_BOARD if TFABOOT
 	select OF_BOARD_SETUP
 	select PINCTRL_STM32
 	select STM32_RCC
 	select STM32_RESET
 	select STM32_SERIAL
+	select SUPPORT_SPL if !TFABOOT
 	select SYS_ARCH_TIMER
 	imply CMD_NVEDIT_INFO
 	imply OF_UPSTREAM
diff --git a/arch/arm/mach-stm32mp/Kconfig.13x b/arch/arm/mach-stm32mp/Kconfig.13x
index bc8b3f8cf77..cecf9e3b8c7 100644
--- a/arch/arm/mach-stm32mp/Kconfig.13x
+++ b/arch/arm/mach-stm32mp/Kconfig.13x
@@ -20,7 +20,8 @@  config TARGET_ST_STM32MP13X
 endchoice
 
 config TEXT_BASE
-	default 0xC0000000
+	default 0xC0000000 if TFABOOT
+	default 0xC0100000 if !TFABOOT
 
 config PRE_CON_BUF_ADDR
 	default 0xC0800000