]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
arm: armv8: Fix spl recover data section broken
authorYe Li <ye.li@nxp.com>
Fri, 12 Sep 2025 09:41:11 +0000 (17:41 +0800)
committerTom Rini <trini@konsulko.com>
Sat, 13 Sep 2025 23:59:23 +0000 (17:59 -0600)
SPL recover data section is broken which causes reboot failure on
some i.MX platforms (iMX8QM/iMX95).
The global variable cold_reboot_flag is assigned to weak reset_flag
function which always return 1, so restore never been executed in
warm reboot.

Fixes: 1c37e59bfbba ("arm: armv8: Improve SPL data save and restore implementation")
Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
arch/arm/cpu/armv8/spl_data.c
arch/arm/mach-socfpga/spl_agilex.c
arch/arm/mach-socfpga/spl_agilex5.c

index 492353c93dfbc3faf26c0f1fe73889cc6eaa12ad..f4009e89a9841379ad8835243661d09d2c1c3943 100644 (file)
@@ -11,15 +11,15 @@ char __data_save_end[0] __section(".__data_save_end");
 
 u32 cold_reboot_flag = 1;
 
-u32 __weak reset_flag(void)
+u32 __weak reset_flag(u32 flag)
 {
-       return 1;
+       return flag;
 }
 
 void spl_save_restore_data(void)
 {
        u32 data_size = __data_save_end - __data_save_start;
-       cold_reboot_flag = reset_flag();
+       cold_reboot_flag = reset_flag(cold_reboot_flag);
 
        if (cold_reboot_flag == 1) {
                /* Save data section to data_save section */
index 351848f16e665d4ca0ab0c01f370db32bf8e1c88..48f258a37b4b61f854bdd0b9a41430a2b0dde4f5 100644 (file)
@@ -24,7 +24,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-u32 reset_flag(void)
+u32 reset_flag(u32 flag)
 {
        /* Check rstmgr.stat for warm reset status */
        u32 status = readl(SOCFPGA_RSTMGR_ADDRESS);
index 2e3597e97eb143a1dbb3cbaa3587d4b1a559b473..1be347360f50dfc44ed92af56c7cc7e6992fb8a2 100644 (file)
@@ -21,7 +21,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-u32 reset_flag(void)
+u32 reset_flag(u32 flag)
 {
        /* Check rstmgr.stat for warm reset status */
        u32 status = readl(SOCFPGA_RSTMGR_ADDRESS);