[PATCH 11/42] ARM: i.MX8M: Detect serial downloader mode correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



like the i.MX6 the i.MX7 and i.MX8M also have a SBMR2 register which
must be consulted for the BOOT_MODE[01] pins before internal bootmode
can be assumed.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 arch/arm/mach-imx/boot.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index 350355fb41..7d1af106d1 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -27,6 +27,7 @@
 #include <mach/imx53-regs.h>
 #include <mach/imx6-regs.h>
 #include <mach/imx7-regs.h>
+#include <mach/imx8mq-regs.h>
 #include <mach/vf610-regs.h>
 #include <mach/imx8mq.h>
 
@@ -444,10 +445,16 @@ struct imx_boot_sw_info {
 } __packed;
 
 static void __imx7_get_boot_source(enum bootsource *src, int *instance,
-				   unsigned long boot_sw_info_pointer_addr)
+				   unsigned long boot_sw_info_pointer_addr,
+				   uint32_t sbmr2)
 {
 	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);
 
@@ -477,7 +484,11 @@ static void __imx7_get_boot_source(enum bootsource *src, int *instance,
 
 void imx7_get_boot_source(enum bootsource *src, int *instance)
 {
-	__imx7_get_boot_source(src, instance, IMX7_BOOT_SW_INFO_POINTER_ADDR);
+	void __iomem *src_base = IOMEM(MX7_SRC_BASE_ADDR);
+	uint32_t sbmr2 = readl(src_base + 0x70);
+
+	__imx7_get_boot_source(src, instance, IMX7_BOOT_SW_INFO_POINTER_ADDR,
+			       sbmr2);
 }
 
 void imx7_boot_save_loc(void)
@@ -582,12 +593,14 @@ void vf610_boot_save_loc(void)
 void imx8mq_get_boot_source(enum bootsource *src, int *instance)
 {
 	unsigned long addr;
+	void __iomem *src_base = IOMEM(MX8MQ_SRC_BASE_ADDR);
+	uint32_t sbmr2 = readl(src_base + 0x70);
 
 	addr = (imx8mq_cpu_revision() == IMX_CHIP_REV_1_0) ?
 		IMX8M_BOOT_SW_INFO_POINTER_ADDR_A0 :
 		IMX8M_BOOT_SW_INFO_POINTER_ADDR_B0;
 
-	__imx7_get_boot_source(src, instance, addr);
+	__imx7_get_boot_source(src, instance, addr, sbmr2);
 }
 
 void imx8mq_boot_save_loc(void)
-- 
2.25.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux