mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH master] ARM: i.MX8MM bootsource: fix serial detection for QSPI boot source
Date: Fri, 19 Jan 2024 11:34:15 +0100	[thread overview]
Message-ID: <20240119103415.1101057-1-m.felsch@pengutronix.de> (raw)

From: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>

The current code override the serial download boot mode which is set in
case the BootROM decide to fallback due to an empty QSPI. This lead into
the wrong boot source detection and barebox will try to download the
rest of the image via QSPI instead of using the serial download mode.

Fix this by reorder the detection, first try the generic bootsource and
if this fails try to detect the QSPI boot mode. This is also how u-boot
does it in the first place.

Fixes: 7b55ababb40f ("ARM: i.MX8MM bootsource: fix QSPI boot source detection")
Signed-off-by: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 arch/arm/mach-imx/boot.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index c6134f35b659..153da835606c 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -711,15 +711,18 @@ void imx8mm_get_boot_source(enum bootsource *src, int *instance)
 		return;
 	}
 
+	addr = IMX8M_BOOT_SW_INFO_POINTER_ADDR_A0;
+
+	__imx7_get_boot_source(src, instance, addr, sbmr2);
+
+	if (*src != BOOTSOURCE_UNKNOWN)
+		return;
+
 	if (imx8mm_bootsource_qspi(sbmr1)) {
 		*src = BOOTSOURCE_SPI; /* Really: qspi */
 		*instance = 0;
 		return;
 	}
-
-	addr = IMX8M_BOOT_SW_INFO_POINTER_ADDR_A0;
-
-	__imx7_get_boot_source(src, instance, addr, sbmr2);
 }
 
 void imx8mm_boot_save_loc(void)
-- 
2.39.2




             reply	other threads:[~2024-01-19 10:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19 10:34 Marco Felsch [this message]
2024-01-22 10:23 ` 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=20240119103415.1101057-1-m.felsch@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --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