[PATCH 2/3] ARM: i.MX8M bootsource: pull imx6_bootsource_serial() out of __imx7_get_boot_source()

Sascha Hauer s.hauer at pengutronix.de
Thu Oct 20 00:58:25 PDT 2022


i.MX8MP and i.MX8MN will need a special variant of
imx6_bootsource_serial(), so pull the call to that function out of
__imx7_get_boot_source().

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/mach-imx/boot.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index 999bd3ab91..7b3334d5e2 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -497,11 +497,6 @@ static void __imx7_get_boot_source(enum bootsource *src, int *instance,
 {
 	const struct imx_boot_sw_info *info;
 
-	if (imx6_bootsource_serial(sbmr2)) {
-		*src = BOOTSOURCE_SERIAL;
-		return;
-	}
-
 	info = (const void *)(unsigned long)
 		readl(boot_sw_info_pointer_addr);
 
@@ -539,6 +534,11 @@ void imx7_get_boot_source(enum bootsource *src, int *instance)
 	void __iomem *src_base = IOMEM(MX7_SRC_BASE_ADDR);
 	uint32_t sbmr2 = readl(src_base + 0x70);
 
+	if (imx6_bootsource_serial(sbmr2)) {
+		*src = BOOTSOURCE_SERIAL;
+		return;
+	}
+
 	__imx7_get_boot_source(src, instance, IMX7_BOOT_SW_INFO_POINTER_ADDR,
 			       sbmr2);
 }
@@ -654,6 +654,11 @@ void imx8mq_get_boot_source(enum bootsource *src, int *instance)
 		IMX8M_BOOT_SW_INFO_POINTER_ADDR_A0 :
 		IMX8M_BOOT_SW_INFO_POINTER_ADDR_B0;
 
+	if (imx6_bootsource_serial(sbmr2)) {
+		*src = BOOTSOURCE_SERIAL;
+		return;
+	}
+
 	__imx7_get_boot_source(src, instance, addr, sbmr2);
 }
 
@@ -668,6 +673,11 @@ void imx8mm_get_boot_source(enum bootsource *src, int *instance)
 	void __iomem *src_base = IOMEM(MX8MM_SRC_BASE_ADDR);
 	uint32_t sbmr2 = readl(src_base + 0x70);
 
+	if (imx6_bootsource_serial(sbmr2)) {
+		*src = BOOTSOURCE_SERIAL;
+		return;
+	}
+
 	addr = IMX8M_BOOT_SW_INFO_POINTER_ADDR_A0;
 
 	__imx7_get_boot_source(src, instance, addr, sbmr2);
@@ -684,6 +694,11 @@ void imx8mp_get_boot_source(enum bootsource *src, int *instance)
 	void __iomem *src_base = IOMEM(MX8MP_SRC_BASE_ADDR);
 	uint32_t sbmr2 = readl(src_base + 0x70);
 
+	if (imx6_bootsource_serial(sbmr2)) {
+		*src = BOOTSOURCE_SERIAL;
+		return;
+	}
+
 	addr = IMX8M_BOOT_SW_INFO_POINTER_ADDR_A0;
 
 	__imx7_get_boot_source(src, instance, addr, sbmr2);
-- 
2.30.2




More information about the barebox mailing list