From d1afa6650434b1d6ebeba22a44c3e02a2e822798 Mon Sep 17 00:00:00 2001 From: Kory Maincent Date: Wed, 17 Sep 2025 16:17:35 +0200 Subject: [PATCH 1/2] Revert "board: st: stm32mp1: Clean env_get_location()" This reverts commit d37641c61ba212241c38e3fd22f0335fc0bebc96. Restore support for environment storage in EXT4 filesystem on eMMC boot. The previous cleanup incorrectly removed this fallback option which is needed for boards that store their environment in an EXT4 partition. This configuration is OS-specific rather than board-dependent and should remain as it is configurable via menuconfig. Even if it is not described in ST defconfigs people may have enabled it in their defconfig. Signed-off-by: Kory Maincent Reviewed-by: Patrice Chotard --- board/st/stm32mp1/stm32mp1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index ab7af69d472..cb5cab9f36a 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -751,6 +751,8 @@ enum env_location env_get_location(enum env_operation op, int prio) case BOOT_FLASH_EMMC: if (CONFIG_IS_ENABLED(ENV_IS_IN_MMC)) return ENVL_MMC; + else if (CONFIG_IS_ENABLED(ENV_IS_IN_EXT4)) + return ENVL_EXT4; else return ENVL_NOWHERE; From 8a2e75e6a1ca51bbd81eef36ffb26737adec316f Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 17 Sep 2025 14:31:30 +0200 Subject: [PATCH 2/2] stm32mp2: update register used by BL31 for boot parameter Use the ARM64 kernel booting register settings, defined in Linux documentation Documentation/arch/arm64/booting.rst: x0 = physical address of device tree blob (dtb) in system RAM. so kernel can replace U-Boot in FIP without modification of BL31. Use x0 for future TF-A version and keep x2 as fallback to be compatible with previous version of TF-A BL31. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- arch/arm/mach-stm32mp/stm32mp2/cpu.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-stm32mp/stm32mp2/cpu.c b/arch/arm/mach-stm32mp/stm32mp2/cpu.c index c3b87d7f981..e081dc605b8 100644 --- a/arch/arm/mach-stm32mp/stm32mp2/cpu.c +++ b/arch/arm/mach-stm32mp/stm32mp2/cpu.c @@ -92,13 +92,21 @@ uintptr_t get_stm32mp_bl2_dtb(void) } /* - * Save the FDT address provided by TF-A in r2 at boot time + * Save the FDT address provided by TF-A at boot time * This function is called from start.S */ -void save_boot_params(unsigned long r0, unsigned long r1, unsigned long r2, - unsigned long r3) +void save_boot_params(unsigned long x0, unsigned long x1, unsigned long x2, + unsigned long x3) { - nt_fw_dtb = r2; + /* use the ARM64 kernel booting register settings: + * x0 = physical address of device tree blob (dtb) in system RAM. + * so kernel can replace U-Boot in FIP wihtout BL31 modification + * else falback to x2 used in previous TF-A version + */ + if (x0) + nt_fw_dtb = x0; + else + nt_fw_dtb = x2; save_boot_params_ret(); }