Restore imx8mn_bsh_smm_s2 properly booting
Subsystems (3)
v3 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")
Changes in v3:
- Drop patch 4/4 "serial: mxc: restore booting for imx8mn_bsh_smm_s2"
- Add patch 4/5 "board: bsh: imx8mn_bsh_smm_s2/s2pro: enlarge CONFIG_SPL_SYS_MALLOC_F_LEN"
- Add patch 5/5 "board: bsh: imx8mn_bsh_smm_s2/s2pro: let clock system enable UART clock"
Dario Binacchi (5):
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
board: bsh: imx8mn_bsh_smm_s2/s2pro: enlarge
CONFIG_SPL_SYS_MALLOC_F_LEN
board: bsh: imx8mn_bsh_smm_s2/s2pro: let clock system enable UART
clock
arch/arm/mach-imx/spl_imx_romapi.c | 8 +++----- board/bsh/imx8mn_smm_s2/spl.c | 2 -- common/spl/Kconfig | 15 +++++++++++++++ configs/imx8mn_bsh_smm_s2_defconfig | 3 ++- configs/imx8mn_bsh_smm_s2pro_defconfig | 1 - 5 files changed, 20 insertions(+), 9 deletions(-)
Signature · 4 lines
2.43.0 base-commit: eeb5ff1a468b2303efa9deb2483b5edbebb568c6 branch: bsh-s2-break
PATCH v3 1/5 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.
---
(no changes since v2)
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
@@ -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
PATCH v3 2/5 imx: spl_imx_romapi: support raw NAND sector
In reply to Dario BinacchiCommit 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.
---
(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
@@ -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
PATCH v3 3/5 configs: imx8mn_bsh_smm_s2: load U-Boot from raw NAND
In reply to Dario BinacchiCommit 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.
---
(no changes since v2)
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
@@ -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
PATCH v3 4/5 board: bsh: imx8mn_bsh_smm_s2/s2pro: enlarge CONFIG_SPL_SYS_MALLOC_F_LEN
In reply to Dario BinacchiThe commit dda454e933c6 ("serial: mxc: Support bulk enabling clocks") breaks the booting of the BSH SMM S2 board. The analysis of the issue revealed memory allocation failures during the registration of UART4 clocks as well as other peripherals. Increasing SYS_MALLOC_F_LEN to 0x10000 fixed the issue.
Dropping this option allows it to be set to the default value of CONFIG_SYS_MALLOC_F_LEN, which is set by default to 0x10000 on i.MX8M platforms.
---
(no changes since v1)
configs/imx8mn_bsh_smm_s2_defconfig | 1 - configs/imx8mn_bsh_smm_s2pro_defconfig | 1 - 2 files changed, 2 deletions(-)
configs/imx8mn_bsh_smm_s2_defconfig +0 -1
@@ -15,7 +15,6 @@ CONFIG_SYS_MONITOR_LEN=524288 CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL_STACK=0x980000 -CONFIG_SPL_SYS_MALLOC_F_LEN=0x2000 CONFIG_SPL_TEXT_BASE=0x912000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y CONFIG_SPL_BSS_START_ADDR=0x950000
configs/imx8mn_bsh_smm_s2pro_defconfig +0 -1
@@ -16,7 +16,6 @@ CONFIG_SPL_MMC=y CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL_STACK=0x980000 -CONFIG_SPL_SYS_MALLOC_F_LEN=0x2000 CONFIG_SPL_TEXT_BASE=0x912000 CONFIG_SPL_HAS_BSS_LINKER_SECTION=y CONFIG_SPL_BSS_START_ADDR=0x950000
Signature · 1 line
2.43.0
Re: [PATCH v3 4/5] board: bsh: imx8mn_bsh_smm_s2/s2pro: enlarge CONFIG_SPL_SYS_MALLOC_F_LEN
Hi Dario and Michael,
Quoted 27 lines · Dario Binacchi
The commit
dda454e933c6("serial: mxc: Support bulk enabling clocks") breaks the booting of the BSH SMM S2 board. The analysis of the issue revealed memory allocation failures during the registration of UART4 clocks as well as other peripherals. IncreasingSYS_MALLOC_F_LENto0x10000fixed the issue.Dropping this option allows it to be set to the default value of
CONFIG_SYS_MALLOC_F_LEN, which is set by default to0x10000on i.MX8M platforms.Co-developed-by Michael Trimarchi <[email protected]>Signed-off-by Michael Trimarchi <[email protected]>Signed-off-by Dario Binacchi <[email protected]>---
(no changes since v1)
configs/imx8mn_bsh_smm_s2_defconfig | 1 - configs/imx8mn_bsh_smm_s2pro_defconfig | 1 - 2 files changed, 2 deletions(-)configs/imx8mn_bsh_smm_s2_defconfig +0
-0
configs/imx8mn_bsh_smm_s2_defconfig CONFIG_SYS_MONITOR_LEN=524288 · line 18
Quoted 4 lines
configs/imx8mn_bsh_smm_s2_defconfig +0
-1@@ -15,7 +15,6 @@ CONFIG_SYS_MONITOR_LEN=524288 CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL_STACK=0x980000 -CONFIG_SPL_SYS_MALLOC_F_LEN=0x2000
Thanks for investigating this issue and getting to the root cause.
I'm adding Hugo to the Cc as the imx8mn_var_som_defconfig target also uses CONFIG_SPL_SYS_MALLOC_F_LEN=0x2000.
Hugo, please consider doing the same change on imx8mn_var_som_defconfig.
Re: [PATCH v3 4/5] board: bsh: imx8mn_bsh_smm_s2/s2pro: enlarge CONFIG_SPL_SYS_MALLOC_F_LEN
Quoted 38 lines · On Tue, 20 May 2025 09:11:26 -0300 Fabio Estevam <[email protected]> wrote:
Hi Dario and Michael,
Quoted 27 lines · Dario Binacchi
The commit
dda454e933c6("serial: mxc: Support bulk enabling clocks") breaks the booting of the BSH SMM S2 board. The analysis of the issue revealed memory allocation failures during the registration of UART4 clocks as well as other peripherals. IncreasingSYS_MALLOC_F_LENto0x10000fixed the issue.Dropping this option allows it to be set to the default value of
CONFIG_SYS_MALLOC_F_LEN, which is set by default to0x10000on i.MX8M platforms.Co-developed-by Michael Trimarchi <[email protected]>Signed-off-by Michael Trimarchi <[email protected]>Signed-off-by Dario Binacchi <[email protected]>---
(no changes since v1)
configs/imx8mn_bsh_smm_s2_defconfig | 1 - configs/imx8mn_bsh_smm_s2pro_defconfig | 1 - 2 files changed, 2 deletions(-)configs/imx8mn_bsh_smm_s2_defconfig +0
-0configs/imx8mn_bsh_smm_s2_defconfig CONFIG_SYS_MONITOR_LEN=524288 · line 18
Quoted 4 lines
configs/imx8mn_bsh_smm_s2_defconfig +0
-1@@ -15,7 +15,6 @@ CONFIG_SYS_MONITOR_LEN=524288 CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL_STACK=0x980000 -CONFIG_SPL_SYS_MALLOC_F_LEN=0x2000Thanks for investigating this issue and getting to the root cause.
Quoted 6 lines
Reviewed-by Fabio Estevam <[email protected]>I'm adding Hugo to the Cc as the
imx8mn_var_som_defconfigtarget also usesCONFIG_SPL_SYS_MALLOC_F_LEN=0x2000.Hugo, please consider doing the same change on
imx8mn_var_som_defconfig.
Hi Fabio,
sorry for the late response.
Yes, I also ran into the same problem and manually set CONFIG_SPL_SYS_MALLOC_F_LEN to 128kB, as was done in commit 52472504e9c4 ("rockchip: rk3568: Fix alloc space exhausted in SPL").
I have now tested with the default value of 64kB (0x10000) by removing CONFIG_SPL_SYS_MALLOC_F_LEN and it also works fine.
I will submit a patch for this.
Thank you,
Hugo.
PATCH v3 5/5 board: bsh: imx8mn_bsh_smm_s2/s2pro: let clock system enable UART clock
In reply to Dario BinacchiNow that the UART driver can enable the required clocks, remove the hard-coded clock enable.
---
Changes in v3:
- Drop patch 4/4 "serial: mxc: restore booting for imx8mn_bsh_smm_s2"
- Add patch 4/5 "board: bsh: imx8mn_bsh_smm_s2/s2pro: enlarge CONFIG_SPL_SYS_MALLOC_F_LEN"
- Add patch 5/5 "board: bsh: imx8mn_bsh_smm_s2/s2pro: let clock system enable UART clock"
board/bsh/imx8mn_smm_s2/spl.c | 2 -- 1 file changed, 2 deletions(-)
board/bsh/imx8mn_smm_s2/spl.c +0 -2
@@ -43,8 +43,6 @@ void spl_board_init(void)int board_early_init_f (void ) { -init_uart_clk (3 ); -if (IS_ENABLED (CONFIG_NAND_MXS )) {init_nand_clk (); }
Signature · 1 line
2.43.0
Quoted 6 lines · Dario Binacchi
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")
Applied the series, thanks.