summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2020-04-27 09:13:50 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-05-12 07:34:10 +0200
commit7a01db612ff1d8a285fe144a11c1f6a4fa4d7fe4 (patch)
treeedaa702ebb5119426565e267208bfacca5d85121 /arch/arm/mach-imx
parent7be1d2fc5209d5888be0e40991e777e57bfbd906 (diff)
downloadbarebox-7a01db612ff1d8a285fe144a11c1f6a4fa4d7fe4.tar.gz
barebox-7a01db612ff1d8a285fe144a11c1f6a4fa4d7fe4.tar.xz
ARM: i.MX: boot: interpret reserved boot as forced serial
`mw 0x20d8040 0x00000010; mw 0x20d8044 0x10000000; reset` issued on an i.MX6Q forces serial download mode, but there is no indication of that in the sbmr2 register, so barebox reports $bootsource=unknown. Similarly, `mw 0x20d8040 0x00000020; mw 0x20d8044 0x10000000; reset` forces an i.MX6UL into recovery mode after reset. Do as U-Boot does and interpret the (reserved) value in BOOT_CFG1(7, 4) for each SoC as serial download. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r--arch/arm/mach-imx/boot.c19
-rw-r--r--arch/arm/mach-imx/include/mach/imx6.h4
2 files changed, 19 insertions, 4 deletions
diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index 3ff297d46e..dc52266eb7 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -31,6 +31,7 @@
#include <mach/imx8mq-regs.h>
#include <mach/vf610-regs.h>
#include <mach/imx8mq.h>
+#include <mach/imx6.h>
static void
@@ -345,6 +346,13 @@ static bool imx6_bootsource_serial(uint32_t sbmr2)
!(sbmr2 & BT_FUSE_SEL));
}
+static bool imx6_bootsource_serial_forced(uint32_t bootmode)
+{
+ if (cpu_mx6_is_mx6ul() || cpu_mx6_is_mx6ull())
+ return bootmode == 2;
+ return bootmode == 1;
+}
+
static int __imx6_bootsource_serial_rom(uint32_t r)
{
return FIELD_GET(BOOT_CFG4(2, 0), r);
@@ -403,20 +411,23 @@ void imx6_get_boot_source(enum bootsource *src, int *instance)
{
void __iomem *src_base = IOMEM(MX6_SRC_BASE_ADDR);
uint32_t sbmr2 = readl(src_base + IMX6_SRC_SBMR2);
- uint32_t bootmode;
+ uint32_t bootmode, bootsrc;
bootmode = imx6_get_src_boot_mode(src_base);
if (imx6_bootsource_reserved(sbmr2))
return;
- if (imx6_bootsource_serial(sbmr2)) {
+ bootsrc = imx53_bootsource_internal(bootmode);
+
+ if (imx6_bootsource_serial(sbmr2) ||
+ imx6_bootsource_serial_forced(bootsrc)) {
*src = BOOTSOURCE_SERIAL;
return;
}
- switch (imx53_bootsource_internal(bootmode)) {
- case 2:
+ switch (bootsrc) {
+ case 2: /* unreachable for i.MX6UL(L) */
*src = BOOTSOURCE_HD;
break;
case 3:
diff --git a/arch/arm/mach-imx/include/mach/imx6.h b/arch/arm/mach-imx/include/mach/imx6.h
index 5560774de9..b65cdaaf40 100644
--- a/arch/arm/mach-imx/include/mach/imx6.h
+++ b/arch/arm/mach-imx/include/mach/imx6.h
@@ -28,6 +28,7 @@ void __noreturn imx6_pm_stby_poweroff(struct poweroff_handler *handler);
static inline int scu_get_core_count(void)
{
+#if __LINUX_ARM_ARCH__ <= 7
unsigned long base;
unsigned int ncores;
@@ -35,6 +36,9 @@ static inline int scu_get_core_count(void)
ncores = readl(base + SCU_CONFIG);
return (ncores & 0x03) + 1;
+#else
+ return 0;
+#endif
}
#define SI_REV_CPUTYPE(s) (((s) >> 16) & 0xff)