[PATCH v1 8/8] arm: socfpga: n5x: Update SPL data save and restore implementation
Chen Huei Lok
chen.huei.lok at altera.com
Wed Mar 18 04:23:23 CET 2026
Enable backup for data section to support warm reset as no SPL image
would be reloaded in warm reset.
Signed-off-by: Chen Huei Lok <chen.huei.lok at altera.com>
---
arch/arm/mach-socfpga/spl_n5x.c | 18 ++++++++++++++++++
configs/socfpga_n5x_defconfig | 2 +-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-socfpga/spl_n5x.c b/arch/arm/mach-socfpga/spl_n5x.c
index 97b3f8f1830..62b991e607f 100644
--- a/arch/arm/mach-socfpga/spl_n5x.c
+++ b/arch/arm/mach-socfpga/spl_n5x.c
@@ -22,11 +22,29 @@
DECLARE_GLOBAL_DATA_PTR;
+u32 reset_flag(void)
+{
+ /* Check rstmgr.stat for warm reset status */
+ u32 status = readl(SOCFPGA_RSTMGR_ADDRESS);
+
+ /* Check whether any L4 watchdogs or SDM had triggered warm reset */
+ u32 warm_reset_mask = RSTMGR_L4WD_MPU_WARMRESET_MASK;
+
+ if (status & warm_reset_mask)
+ return 0;
+
+ return 1;
+}
+
void board_init_f(ulong dummy)
{
int ret;
struct udevice *dev;
+#if defined(CONFIG_XPL_BUILD) && defined(CONFIG_SPL_RECOVER_DATA_SECTION)
+ spl_save_restore_data();
+#endif
+
ret = spl_early_init();
if (ret)
hang();
diff --git a/configs/socfpga_n5x_defconfig b/configs/socfpga_n5x_defconfig
index db43046a9f3..27e15a13659 100644
--- a/configs/socfpga_n5x_defconfig
+++ b/configs/socfpga_n5x_defconfig
@@ -4,7 +4,6 @@ CONFIG_ARCH_SOCFPGA=y
CONFIG_TEXT_BASE=0x200000
CONFIG_SYS_MALLOC_LEN=0x500000
CONFIG_NR_DRAM_BANKS=2
-CONFIG_SPL_LDSCRIPT="arch/arm/mach-socfpga/u-boot-spl-soc64.lds"
CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
CONFIG_SF_DEFAULT_MODE=0x2003
@@ -23,6 +22,7 @@ CONFIG_SYS_BOOTM_LEN=0x2000000
CONFIG_TARGET_SOCFPGA_N5X_SOCDK=y
CONFIG_IDENT_STRING="socfpga_n5x"
CONFIG_SPL_FS_FAT=y
+CONFIG_SPL_RECOVER_DATA_SECTION=y
CONFIG_REMAKE_ELF=y
CONFIG_FIT=y
CONFIG_SPL_FIT_SIGNATURE=y
--
2.19.0
More information about the U-Boot
mailing list