From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Subject: [PATCH 2/3] ARM: i.MX: boot: interpret reserved boot as forced serial
Date: Mon, 27 Apr 2020 09:13:50 +0200 [thread overview]
Message-ID: <20200427071351.467859-2-ahmad@a3f.at> (raw)
In-Reply-To: <20200427071351.467859-1-ahmad@a3f.at>
`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>
---
arch/arm/mach-imx/boot.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index 3ff297d46e47..f8d4f8cfa27f 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_is_mx6ul() || cpu_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:
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-04-27 7:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-27 7:13 [PATCH 1/3] ARM: i.MX: boot: correctly handle SRC_SBMR1 override via SRC_GPR9 Ahmad Fatoum
2020-04-27 7:13 ` Ahmad Fatoum [this message]
2020-04-27 7:13 ` [PATCH 3/3] ARM: i.MX6: boot: handle i.MX6UL differences Ahmad Fatoum
2020-04-27 8:07 ` [PATCH 1/3] ARM: i.MX: boot: correctly handle SRC_SBMR1 override via SRC_GPR9 Sascha Hauer
2020-04-27 8:28 ` Ahmad Fatoum
2020-05-08 6:41 ` Ahmad Fatoum
2020-05-08 12:07 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200427071351.467859-2-ahmad@a3f.at \
--to=ahmad@a3f.at \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox