[U-Boot] [PATCH v2 1/3] mx6sabresd: Remove CONFIG_SPL_DM to decrease the SPL size

Currently the mx6qsabresd board does not boot:
U-Boot SPL 2019.07-rc2 (May 16 2019 - 14:28:55 -0300) Trying to boot from MMC1 spl: could not find mmc device 0. error: -19 SPL: failed to boot from all boot devices ### ERROR ### Please RESET the board ###
The reason for the boot failure is that that the SPL size got greater than the 68KB limit (4KB header + 64KB max size) as explained in include/configs/imx6_spl.h.
Remove the CONFIG_SPL_DM option, so that the SPL binary could fit into the allowed size and the board can boot again.
Signed-off-by: Fabio Estevam festevam@gmail.com --- Changes since v1: - Improve the commit log by explaining that the boot failure is caused by SPL size overflow
configs/mx6sabresd_defconfig | 1 - 1 file changed, 1 deletion(-)
diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig index d3ed3c4543..5c2d055561 100644 --- a/configs/mx6sabresd_defconfig +++ b/configs/mx6sabresd_defconfig @@ -65,7 +65,6 @@ CONFIG_SPL_MULTI_DTB_FIT=y CONFIG_SPL_OF_LIST="imx6dl-sabresd imx6q-sabresd imx6qp-sabresd" CONFIG_ENV_IS_IN_MMC=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -CONFIG_SPL_DM=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_BUF_ADDR=0x12000000 CONFIG_FASTBOOT_BUF_SIZE=0x10000000

With the conversion to DM we should select the pinctrl driver.
Signed-off-by: Fabio Estevam festevam@gmail.com --- Changes since v1: - None
configs/mx6sabresd_defconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig index 5c2d055561..f7ba632b2a 100644 --- a/configs/mx6sabresd_defconfig +++ b/configs/mx6sabresd_defconfig @@ -81,6 +81,8 @@ CONFIG_SF_DEFAULT_SPEED=20000000 CONFIG_SPI_FLASH_STMICRO=y CONFIG_PHYLIB=y CONFIG_MII=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_IMX6=y CONFIG_PCI=y CONFIG_DM_REGULATOR=y CONFIG_SPI=y

With the conversion to DM we should select the pinctrl driver. Signed-off-by: Fabio Estevam festevam@gmail.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

After the conversion to DM there is no need to have mmc initialization code inside U-Boot proper.
Remove the unneeded code.
Signed-off-by: Fabio Estevam festevam@gmail.com --- Changes since v1: - None
board/freescale/mx6sabresd/mx6sabresd.c | 44 ------------------------- 1 file changed, 44 deletions(-)
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c index 385a18e923..cdfc5ff77f 100644 --- a/board/freescale/mx6sabresd/mx6sabresd.c +++ b/board/freescale/mx6sabresd/mx6sabresd.c @@ -287,49 +287,6 @@ int board_mmc_getcd(struct mmc *mmc)
int board_mmc_init(bd_t *bis) { -#ifndef CONFIG_SPL_BUILD - int ret; - int i; - - /* - * According to the board_mmc_init() the following map is done: - * (U-Boot device node) (Physical Port) - * mmc0 SD2 - * mmc1 SD3 - * mmc2 eMMC - */ - for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) { - switch (i) { - case 0: - SETUP_IOMUX_PADS(usdhc2_pads); - gpio_request(USDHC2_CD_GPIO, "USDHC2 CD"); - gpio_direction_input(USDHC2_CD_GPIO); - usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK); - break; - case 1: - SETUP_IOMUX_PADS(usdhc3_pads); - gpio_request(USDHC3_CD_GPIO, "USDHC3 CD"); - gpio_direction_input(USDHC3_CD_GPIO); - usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK); - break; - case 2: - SETUP_IOMUX_PADS(usdhc4_pads); - usdhc_cfg[2].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK); - break; - default: - printf("Warning: you configured more USDHC controllers" - "(%d) then supported by the board (%d)\n", - i + 1, CONFIG_SYS_FSL_USDHC_NUM); - return -EINVAL; - } - - ret = fsl_esdhc_initialize(bis, &usdhc_cfg[i]); - if (ret) - return ret; - } - - return 0; -#else struct src *psrc = (struct src *)SRC_BASE_ADDR; unsigned reg = readl(&psrc->sbmr1) >> 11; /* @@ -363,7 +320,6 @@ int board_mmc_init(bd_t *bis) }
return fsl_esdhc_initialize(bis, &usdhc_cfg[0]); -#endif } #endif

After the conversion to DM there is no need to have mmc initialization code inside U-Boot proper. Remove the unneeded code. Signed-off-by: Fabio Estevam festevam@gmail.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic

On Tue, 2019-05-21 at 10:37 -0300, Fabio Estevam wrote:
Currently the mx6qsabresd board does not boot:
U-Boot SPL 2019.07-rc2 (May 16 2019 - 14:28:55 -0300) Trying to boot from MMC1 spl: could not find mmc device 0. error: -19 SPL: failed to boot from all boot devices ### ERROR ### Please RESET the board ###
The reason for the boot failure is that that the SPL size got greater than the 68KB limit (4KB header + 64KB max size) as explained in include/configs/imx6_spl.h.
Remove the CONFIG_SPL_DM option, so that the SPL binary could fit into the allowed size and the board can boot again.
Signed-off-by: Fabio Estevam festevam@gmail.com
Changes since v1:
- Improve the commit log by explaining that the boot failure
is caused by SPL size overflow
configs/mx6sabresd_defconfig | 1 - 1 file changed, 1 deletion(-)
diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig index d3ed3c4543..5c2d055561 100644 --- a/configs/mx6sabresd_defconfig +++ b/configs/mx6sabresd_defconfig @@ -65,7 +65,6 @@ CONFIG_SPL_MULTI_DTB_FIT=y CONFIG_SPL_OF_LIST="imx6dl-sabresd imx6q-sabresd imx6qp-sabresd" CONFIG_ENV_IS_IN_MMC=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -CONFIG_SPL_DM=y CONFIG_USB_FUNCTION_FASTBOOT=y CONFIG_FASTBOOT_BUF_ADDR=0x12000000 CONFIG_FASTBOOT_BUF_SIZE=0x10000000
Since we care about the SPL size, is there any reason why we have CONFIG_SPL_FS_EXT4?
AFAICS, u-boot.img is not on a filesystem, so why do we need ext2/3/4?
Thanks, Eze

Hi Ezequiel,
On Fri, May 24, 2019 at 6:31 PM Ezequiel Garcia ezequiel@collabora.com wrote:
Since we care about the SPL size, is there any reason why we have CONFIG_SPL_FS_EXT4?
AFAICS, u-boot.img is not on a filesystem, so why do we need ext2/3/4?
Yes, I will remove CONFIG_SPL_FS_EXT4 and CONFIG_SPL_I2C_SUPPORT=y in my next round of patches to reduce SPL size on mx6sabresd.
Thanks

On Fri, 2019-05-24 at 18:41 -0300, Fabio Estevam wrote:
Hi Ezequiel,
On Fri, May 24, 2019 at 6:31 PM Ezequiel Garcia ezequiel@collabora.com wrote:
Since we care about the SPL size, is there any reason why we have CONFIG_SPL_FS_EXT4?
AFAICS, u-boot.img is not on a filesystem, so why do we need ext2/3/4?
Yes, I will remove CONFIG_SPL_FS_EXT4 and CONFIG_SPL_I2C_SUPPORT=y in my next round of patches to reduce SPL size on mx6sabresd.
Perhaps instead of per-board, we can check the MX6 lot.
PS: Not needed on Wandboard either, and I found a way to move to TINY_MMC. Interestingly, and as we would expect, turning off EXT had more impact.

Currently the mx6qsabresd board does not boot: U-Boot SPL 2019.07-rc2 (May 16 2019 - 14:28:55 -0300) Trying to boot from MMC1 spl: could not find mmc device 0. error: -19 SPL: failed to boot from all boot devices ### ERROR ### Please RESET the board ### The reason for the boot failure is that that the SPL size got greater than the 68KB limit (4KB header + 64KB max size) as explained in include/configs/imx6_spl.h. Remove the CONFIG_SPL_DM option, so that the SPL binary could fit into the allowed size and the board can boot again. Signed-off-by: Fabio Estevam festevam@gmail.com
Applied to u-boot-imx, master, thanks !
Best regards, Stefano Babic
participants (3)
-
Ezequiel Garcia
-
Fabio Estevam
-
sbabic@denx.de