[PATCH 1/2] imx: Add SPI NOR A/B switching support

fedor.ross at ifm.com fedor.ross at ifm.com
Thu Apr 23 13:54:42 CEST 2026


From: Marek Vasut <marex at nabladev.com>

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 at nabladev.com>
Signed-off-by: Fedor Ross <fedor.ross at ifm.com>
---
 arch/arm/mach-imx/image-container.c | 10 ++++++++++
 arch/arm/mach-imx/imx9/scmi/soc.c   | 13 +++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/arch/arm/mach-imx/image-container.c b/arch/arm/mach-imx/image-container.c
index 7bfcc9d7e9d..eeea0b80b39 100644
--- a/arch/arm/mach-imx/image-container.c
+++ b/arch/arm/mach-imx/image-container.c
@@ -204,6 +204,8 @@ static int get_dev_container_size(void *dev, int dev_type, unsigned long offset,
 	return ret;
 }
 
+extern u8 imx95_detect_secondary_image_boot(void);
+
 static bool check_secondary_cnt_set(unsigned long *set_off)
 {
 #if IS_ENABLED(CONFIG_ARCH_IMX8)
@@ -227,6 +229,14 @@ static bool check_secondary_cnt_set(unsigned long *set_off)
 	}
 #endif
 
+#if IS_ENABLED(CONFIG_IMX95)
+	u8 img_set_sel = imx95_detect_secondary_image_boot();
+
+	*set_off = img_set_sel ? 0x400000 : 0;
+
+	return !!img_set_sel;
+#endif
+
 	return false;
 }
 
diff --git a/arch/arm/mach-imx/imx9/scmi/soc.c b/arch/arm/mach-imx/imx9/scmi/soc.c
index fbee435786c..330b276b23a 100644
--- a/arch/arm/mach-imx/imx9/scmi/soc.c
+++ b/arch/arm/mach-imx/imx9/scmi/soc.c
@@ -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();

-- 
2.47.3



More information about the U-Boot mailing list