]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
imx: Add SPI NOR A/B switching support
authorMarek Vasut <marex@nabladev.com>
Mon, 27 Apr 2026 13:32:50 +0000 (15:32 +0200)
committerFabio Estevam <festevam@gmail.com>
Fri, 15 May 2026 20:31:39 +0000 (17:31 -0300)
Query the SM via SCMI, obtain rom_passover_t->img_set_sel and based on
that, add 0 or 0x400000 offset (A or B copy offset) to boot container
read address.

Signed-off-by: Marek Vasut <marex@nabladev.com>
Signed-off-by: Fedor Ross <fedor.ross@ifm.com>
arch/arm/include/asm/arch-imx9/sys_proto.h
arch/arm/mach-imx/image-container.c
arch/arm/mach-imx/imx9/scmi/soc.c

index dead7a99a6645989b435d2c8e678ef10d18c4e18..73df8715f22bef64d9765b3b4a98307e567575ca 100644 (file)
@@ -23,6 +23,8 @@ int low_drive_freq_update(void *blob);
 enum imx9_soc_voltage_mode soc_target_voltage_mode(void);
 int get_reset_reason(bool sys, bool lm);
 
+u8 imx95_detect_secondary_image_boot(void);
+
 #define is_voltage_mode(mode) (soc_target_voltage_mode() == (mode))
 
 #endif
index 7bfcc9d7e9d4f358886d27f3b418d9c60486baf3..63cf85963165be6e7e69cf65a4a5206ebcf93387 100644 (file)
@@ -225,9 +225,15 @@ static bool check_secondary_cnt_set(unsigned long *set_off)
                        }
                }
        }
-#endif
+#elif IS_ENABLED(CONFIG_IMX95)
+       u8 img_set_sel = imx95_detect_secondary_image_boot();
+
+       *set_off = img_set_sel ? 0x400000 : 0;
 
+       return !!img_set_sel;
+#else
        return false;
+#endif
 }
 
 static unsigned long get_boot_device_offset(void *dev, int dev_type)
index fbee435786cd69ae68ffc3a9018c6b7610265d95..330b276b23a7306816e5f9cc6a83f3f23478f311 100644 (file)
@@ -745,6 +745,19 @@ void build_info(void)
        puts("\n");
 }
 
+#if IS_ENABLED(CONFIG_IMX95)
+u8 imx95_detect_secondary_image_boot(void)
+{
+       rom_passover_t rdata = { 0 };
+       int ret = scmi_get_rom_data(&rdata);
+
+       if (!ret)
+               return rdata.img_set_sel;
+
+       return 0;
+}
+#endif
+
 int arch_misc_init(void)
 {
        build_info();