From: Marco Felsch <m.felsch@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH v2 10/23] ARM: i.MX8MM bootsource: fix QSPI boot source detection
Date: Mon, 13 Mar 2023 14:41:49 +0100 [thread overview]
Message-ID: <20230228-v2023-02-0-topic-flexspi-v2-10-3d33126d2434@pengutronix.de> (raw)
In-Reply-To: <20230228-v2023-02-0-topic-flexspi-v2-0-3d33126d2434@pengutronix.de>
The ROM will not update the sw-info field, so we need to parse the
SBMR1. There is just one QSPI controller so set instance to 0 to avoid
bootsource_instance=unknown.
This ports u-boot commit:
| commit d4e84f24a6815957b3a218166f214ca9a1c4a7de
| Author: Peng Fan <peng.fan@nxp.com>
| Date: Thu May 17 15:15:59 2018 +0800
|
| imx8m: add QSPI boot dev
|
| When boot type could not be detected from rom sw info,
| read sbmr1 to detect, here we only use it to detect FLEXSPI
| boot, because ROM not update it in rom sw info.
|
| Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
arch/arm/mach-imx/boot.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/arch/arm/mach-imx/boot.c b/arch/arm/mach-imx/boot.c
index 6f6f7008be..c6134f35b6 100644
--- a/arch/arm/mach-imx/boot.c
+++ b/arch/arm/mach-imx/boot.c
@@ -243,6 +243,11 @@ static unsigned int imx8mp_get_bmod(uint32_t r)
return FIELD_GET(IMX8MP_SRC_SBMR_BMOD, r);
}
+static unsigned int imx8mm_get_bcfg(uint32_t r)
+{
+ return FIELD_GET(BOOT_CFG2(6, 4), r);
+}
+
static int imx53_bootsource_internal(uint32_t r)
{
return FIELD_GET(BOOT_CFG1(7, 4), r);
@@ -323,6 +328,7 @@ void imx53_boot_save_loc(void)
#define IMX6_SRC_GPR10 0x44
#define IMX6_BMOD_SERIAL 0b01
#define IMX6_BMOD_RESERVED 0b11
+#define IMX8MM_BCFG_FSPI 0b100
#define IMX8MP_BMOD_FUSES 0b0000
#define IMX8MP_BMOD_SERIAL 0b0001
#define IMX6_BMOD_FUSES 0b00
@@ -358,6 +364,11 @@ static bool imx8mp_bootsource_serial(uint32_t sbmr2)
!(sbmr2 & BT_FUSE_SEL));
}
+static bool imx8mm_bootsource_qspi(uint32_t sbmr1)
+{
+ return imx8mm_get_bcfg(sbmr1) == IMX8MM_BCFG_FSPI;
+}
+
static bool imx6_bootsource_serial_forced(uint32_t bootmode)
{
if (cpu_mx6_is_mx6ul() || cpu_mx6_is_mx6ull())
@@ -692,6 +703,7 @@ void imx8mm_get_boot_source(enum bootsource *src, int *instance)
{
unsigned long addr;
void __iomem *src_base = IOMEM(MX8MM_SRC_BASE_ADDR);
+ uint32_t sbmr1 = readl(src_base + 0x58);
uint32_t sbmr2 = readl(src_base + 0x70);
if (imx6_bootsource_serial(sbmr2)) {
@@ -699,6 +711,12 @@ void imx8mm_get_boot_source(enum bootsource *src, int *instance)
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);
--
2.30.2
next prev parent reply other threads:[~2023-03-13 13:43 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-13 13:41 [PATCH v2 00/23] FlexSPI image/boot/update support Marco Felsch
2023-03-13 13:41 ` [PATCH v2 01/23] spi: remove flash_platform_data support Marco Felsch
2023-03-13 13:41 ` [PATCH v2 02/23] bbu: make it possible to check multiple of-compatibles Marco Felsch
2023-04-04 7:04 ` Sascha Hauer
2023-04-04 8:01 ` Marco Felsch
2023-04-04 8:49 ` Sascha Hauer
2023-04-04 9:05 ` Marco Felsch
2023-03-13 13:41 ` [PATCH v2 03/23] ARM: i.MX8MM: add missing IMD_USED_OF image metadata entry Marco Felsch
2023-03-13 13:41 ` [PATCH v2 04/23] ARM: i.MX8MN: add missing IMD_USED_OF image metadata entries Marco Felsch
2023-03-13 13:41 ` [PATCH v2 05/23] mci: imx-esdhc-pbl: fix number of read blocks Marco Felsch
2023-03-13 13:41 ` [PATCH v2 06/23] mci: imx-esdhc-pbl: refactor the esdhc_load_image function Marco Felsch
2023-03-13 13:41 ` [PATCH v2 07/23] mci: imx-esdhc-pbl: move imx_load_image into common xload code Marco Felsch
2023-03-13 13:41 ` [PATCH v2 08/23] ARM: i.MX8M: Add QSPI image load support Marco Felsch
2023-03-13 13:41 ` [PATCH v2 09/23] ARM: i.MX bootsource: set QSPI instance Marco Felsch
2023-03-13 13:41 ` Marco Felsch [this message]
2023-03-13 13:41 ` [PATCH v2 11/23] ARM: i.MX8M: Add QSPI boot support Marco Felsch
2023-03-13 13:41 ` [PATCH v2 12/23] scripts: imx-image: convert flag variables into bool Marco Felsch
2023-03-13 13:41 ` [PATCH v2 13/23] scripts: imx-image: header_v2: factor out offset parameter Marco Felsch
2023-03-13 13:41 ` [PATCH v2 14/23] scripts: imx-image: header_v2: add header_len parameter Marco Felsch
2023-03-13 13:41 ` [PATCH v2 15/23] scripts: imx-image: add FlexSPI image support Marco Felsch
2023-03-13 13:41 ` [PATCH v2 16/23] filetype: add NXP FlexSPI filetype Marco Felsch
2023-03-13 13:41 ` [PATCH v2 17/23] ARM: i.MX: bbu: rename IMX_INTERNAL_FLAG_ERASE to IMX_BBU_FLAG_ERASE Marco Felsch
2023-03-13 13:41 ` [PATCH v2 18/23] ARM: i.MX: bbu: add filetype offset Marco Felsch
2023-03-13 13:41 ` [PATCH v2 19/23] ARM: i.MX: bbu: add FlexSPI update handler Marco Felsch
2023-03-13 13:41 ` [PATCH v2 20/23] ARM: i.MX8M: enable FlexSPI image support Marco Felsch
2023-03-13 13:42 ` [PATCH v2 21/23] ARM: i.MX8M: add qspi barebox and barebox-environment partitions Marco Felsch
2023-03-13 13:42 ` [PATCH v2 22/23] ARM: i.MX8M: add QSPI update handler Marco Felsch
2023-03-13 13:42 ` [PATCH v2 23/23] Documentation: i.MX8M: add EVK QSPI NOR barebox installation documentation Marco Felsch
2023-03-17 11:11 ` [PATCH v2 00/23] FlexSPI image/boot/update support 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=20230228-v2023-02-0-topic-flexspi-v2-10-3d33126d2434@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