diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2020-02-12 16:30:25 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-02-19 08:30:31 +0100 |
commit | 2963bb8fa61b55a708943d6809aa0e41bf7d7fd6 (patch) | |
tree | c718a4536f6d42748c01e175086e968958f88cdf /arch/arm | |
parent | e42d463de2ce0c49576bac58c1ab8b1885294f9c (diff) | |
download | barebox-2963bb8fa61b55a708943d6809aa0e41bf7d7fd6.tar.gz barebox-2963bb8fa61b55a708943d6809aa0e41bf7d7fd6.tar.xz |
ARM: i.MX8M: Detect serial downloader mode correctly
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@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-imx/boot.c | 19 |
1 files 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) |