Skip to contentSkip to conversation

Restore imx8mn_bsh_smm_s2 properly booting

RFC PATCH Superseded Dario Binacchi 1 participant 5 messages May 15, 2025

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Restore imx8mn_bsh_smm_s2 properly booting

Commits [1] and [2] broke the booting of the BSH SMM S2 board. The patches in this series restore proper booting.

[1] 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options")
[2] dda454e933c6 ("serial: mxc: Support bulk enabling clocks")

(no changes since v1)

Dario Binacchi (4):
spl: Kconfig: support U-Boot load from raw NAND
imx: spl_imx_romapi: support raw NAND sector
configs: imx8mn_bsh_smm_s2: load U-Boot from raw NAND
serial: mxc: restore booting for imx8mn_bsh_smm_s2

 arch/arm/mach-imx/spl_imx_romapi.c  |  8 +++-----
 common/spl/Kconfig                  | 15 +++++++++++++++
 configs/imx8mn_bsh_smm_s2_defconfig |  2 ++
 drivers/serial/serial_mxc.c         | 23 ++++++++++++++++-------
 4 files changed, 36 insertions(+), 12 deletions(-)
Signature · 4 lines
2.43.0

base-commit: 1b5e435102aa29a665119430196cb366ce36a01b
branch: bsh-s2-break
#1 lore raw

RFC PATCH v2 1/4 spl: Kconfig: support U-Boot load from raw NAND

Commit 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options") breaks the boot of the BSH SMM S2 board. As stated in the commit itself, "Some boards use this value even though MMC is not enabled in SPL, for example imx8mn_bsh_smm_s2".

Support load of the U-Boot image from raw NAND sector. This is equivalent to load from MMC raw sector.

Fixes 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options")

---

Changes in v2:
- Add SPL_NAND_RAW_U_BOOT_USE_SECTOR and SPL_NAND_RAW_U_BOOT_SECTOR

 common/spl/Kconfig | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
common/spl/Kconfig +15 -0
index aa3a85eea54d..77cf04d38ed0 100644
@@ -974,6 +974,21 @@ config SPL_NAND_SUPPORT
 	  This enables the drivers in drivers/mtd/nand/raw as part of an SPL
 	  build.
 
+config SPL_NAND_RAW_U_BOOT_USE_SECTOR
+	bool "NAND raw mode: by sector"
+	depends on SPL_NAND_SUPPORT
+	select SPL_LOAD_BLOCK
+	help
+	  Use sector number for specifying U-Boot location on NAND in
+	  raw mode.
+
+config SPL_NAND_RAW_U_BOOT_SECTOR
+	hex "Address on the NAND to load U-Boot from"
+	depends on SPL_NAND_RAW_U_BOOT_USE_SECTOR
+	help
+	  Address on the NAND to load U-Boot from, when the NAND is being used
+	  in raw mode. Units: NAND disk sectors (1 sector = 512 bytes).
+
 config SPL_NAND_RAW_ONLY
 	bool "Support to boot only raw u-boot.bin images"
 	depends on SPL_NAND_SUPPORT
Signature · 1 line
2.43.0
#2 lore raw

RFC PATCH v2 2/4 imx: spl_imx_romapi: support raw NAND sector

In reply to Dario Binacchi

Commit 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options") breaks the boot of the BSH SMM S2 board. As stated in the dropped comment, "Some boards use this value even though MMC is not enabled in SPL, for example imx8mn_bsh_smm_s2".

Support load of the U-Boot image from raw NAND sector.

Fixes 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options")

---

(no changes since v1)

 arch/arm/mach-imx/spl_imx_romapi.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
arch/arm/mach-imx/spl_imx_romapi.c +3 -5
index 3982f4cca184..b7008df8e35a 100644
@@ -35,12 +35,10 @@ ulong __weak spl_romapi_get_uboot_base(u32 image_offset, u32 rom_bt_dev)
 {
 	u32 sector = 0;
 
-	/*
-	 * Some boards use this value even though MMC is not enabled in SPL, for
-	 * example imx8mn_bsh_smm_s2
-	 */
-#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
+#if IS_ENABLED(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR)
 	sector = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR;
+#elif IS_ENABLED(CONFIG_SPL_NAND_RAW_U_BOOT_USE_SECTOR)
+	sector = CONFIG_SPL_NAND_RAW_U_BOOT_SECTOR;
 #endif
 
 	return image_offset + sector * 512 - 0x8000;
Signature · 1 line
2.43.0
#3 lore raw

RFC PATCH v2 3/4 configs: imx8mn_bsh_smm_s2: load U-Boot from raw NAND

In reply to Dario Binacchi

Commit 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options") breaks the boot of the BSH SMM S2 board. Add options to load U-Boot from raw NAND sector.

Fixes 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options")

---

Changes in v2:
- Drop CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR.
- Add CONFIG_SPL_NAND_RAW_U_BOOT_USE_SECTOR and
CONFIG_SPL_NAND_RAW_U_BOOT_SECTOR options.

 configs/imx8mn_bsh_smm_s2_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/imx8mn_bsh_smm_s2_defconfig +2 -0
index 9ffcd3b221c3..1c11d4705419 100644
@@ -47,6 +47,8 @@ CONFIG_SPL_DMA=y
 CONFIG_SPL_I2C=y
 CONFIG_SPL_MTD=y
 CONFIG_SPL_NAND_SUPPORT=y
+CONFIG_SPL_NAND_RAW_U_BOOT_USE_SECTOR=y
+CONFIG_SPL_NAND_RAW_U_BOOT_SECTOR=0x300
 CONFIG_SPL_NAND_BASE=y
 CONFIG_SPL_NAND_IDENT=y
 CONFIG_SPL_POWER=y
Signature · 1 line
2.43.0
#4 lore raw

RFC PATCH v2 4/4 serial: mxc: restore booting for imx8mn_bsh_smm_s2

In reply to Dario Binacchi

The commit dda454e933c6 ("serial: mxc: Support bulk enabling clocks") breaks the booting of the BSH SMM S2 board.
Restore proper booting of the board even in case of failure of either clk_get_bulk() or clk_enable_bulk().

Fixes dda454e933c6 ("serial: mxc: Support bulk enabling clocks")

---

(no changes since v1)

 drivers/serial/serial_mxc.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/serial/serial_mxc.c +16 -7
index 28f4435d01dd..b09a5fe0f7a4 100644
@@ -310,22 +310,31 @@ int mxc_serial_setbrg(struct udevice *dev, int baudrate)
 	return 0;
 }
 
-static int mxc_serial_probe(struct udevice *dev)
+#if CONFIG_IS_ENABLED(CLK_CCF)
+static void mxc_serial_enable_clk_bulk(struct udevice *dev)
 {
 	struct mxc_serial_plat *plat = dev_get_plat(dev);
-#if CONFIG_IS_ENABLED(CLK_CCF)
 	int ret;
 
 	ret = clk_get_bulk(dev, &plat->clks);
 	if (ret)
-		return ret;
+		return;
 
-	ret = clk_enable_bulk(&plat->clks);
-	if (ret)
-		return ret;
+	clk_enable_bulk(&plat->clks);
+}
+#else
+static mxc_serial_enable_clk_bulk(struct udevice *dev)
+{
+}
 #endif
-	_mxc_serial_init(plat->reg, plat->use_dte);
 
+static int mxc_serial_probe(struct udevice *dev)
+{
+	struct mxc_serial_plat *plat = dev_get_plat(dev);
+
+	mxc_serial_enable_clk_bulk(dev);
+
+	_mxc_serial_init(plat->reg, plat->use_dte);
 	return 0;
 }
 
Signature · 1 line
2.43.0