mx6cuboxi: enable support for OF_CONTROL and DM in SPL
Subsystems (2)
v3 cover mx6cuboxi: enable support for OF_CONTROL and DM in SPL
Make an additional step to add full DM support to mx6cuboxi, including its support for SPL
With this new configuration SPL image is 50 KB, higher than the 38 KB from the previous version, but it still under the 68 KB limit.
Changes in v3:
- Cleanup
Changes in v2:
- Fix board_boot_order to avoid pointing to a NAND device
- Fix board_boot_order to include MMC iomux
- Remove unused code
Walter Lozano (4):
mx6cuboxi: enable MMC and eMMC in DT for SPL
mx6cuboxi: customize board_boot_order to access eMMC
mx6cuboxi: enable OF_CONTROL and DM in SPL
mx6cuboxi: remove unused code
...qdl-hummingboard2-emmc-som-v15-u-boot.dtsi | 8 ++ board/solidrun/mx6cuboxi/mx6cuboxi.c | 113 ++++++++---------- configs/mx6cuboxi_defconfig | 3 + 3 files changed, 59 insertions(+), 65 deletions(-)
Signature · 1 line
2.20.1
PATCH v3 1/4 mx6cuboxi: enable MMC and eMMC in DT for SPL
--- .../dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/dts/imx6qdl-hummingboard2-emmc-som-v15-u-boot.dtsi +8 -0
@@ -34,3 +34,11 @@ &usdhc1 { status = "disabled"; }; + +&usdhc2 { + u-boot,dm-pre-reloc; +}; + +&usdhc3 { + u-boot,dm-pre-reloc; +};
Signature · 1 line
2.20.1
PATCH v3 1/4 mx6cuboxi: enable MMC and eMMC in DT for SPL
Quoted 1 line
Signed-off-by Walter Lozano <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v3 2/4 mx6cuboxi: customize board_boot_order to access eMMC
In reply to Walter LozanoIn SPL legacy code only one MMC device is created, based on BOOT_CFG register, which can be either SD or eMMC. In this context board_boot_order return always MMC1 when configure to boot from SD/eMMC. After switching to DM both SD and eMMC devices are created based on the information available on DT, but as board_boot_order only returns MMC1 is not possible to boot from eMMC.
This patch customizes board_boot_order taking into account BOOT_CFG register to point to correct MMC1 / MMC2 device. Additionally, handle IO mux for the desired boot device.
--- board/solidrun/mx6cuboxi/mx6cuboxi.c | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
board/solidrun/mx6cuboxi/mx6cuboxi.c +48 -0
@@ -624,6 +624,54 @@ int board_fit_config_name_match(const char *name)return strcmp (name, tmp_name); } +void board_boot_order (u32 *spl_boot_list) +{ +struct src *psrc = (struct src *)SRC_BASE_ADDR ; +unsigned int reg =readl (&psrc->sbmr1) >>11 ; +u32 boot_mode =imx6_src_get_boot_mode () &IMX6_BMODE_MASK ; +unsigned int bmode =readl (&src_base->sbmr2); + +/* If bmode is serial or USB phy is active, return serial */ +if (((bmode >>24 ) &0x03 ) ==0x01 ||is_usbotg_phy_active ()) { + spl_boot_list[0 ] =BOOT_DEVICE_BOARD ; +return ; + } + +switch (boot_mode >>IMX6_BMODE_SHIFT ) { +case IMX6_BMODE_SD : +case IMX6_BMODE_ESD : +case IMX6_BMODE_MMC : +case IMX6_BMODE_EMMC : +/* +* Upon reading BOOT_CFG register the following map is done: +* Bit 11 and 12 of BOOT_CFG register can determine the current +* mmc port +* 0x1 SD2 +* 0x2 SD3 +*/ + + reg &=0x3 ;/* Only care about bottom 2 bits */ +switch (reg) { +case 1 : +SETUP_IOMUX_PADS (usdhc2_pads); + spl_boot_list[0 ] =BOOT_DEVICE_MMC1 ; +break ; +case 2 : +SETUP_IOMUX_PADS (usdhc3_pads); + spl_boot_list[0 ] =BOOT_DEVICE_MMC2 ; +break ; + } +break ; +default : +/* By default use USB downloader */ + spl_boot_list[0 ] =BOOT_DEVICE_BOARD ; +break ; + } + +/* As a last resort, use serial downloader */ + spl_boot_list[1 ] =BOOT_DEVICE_BOARD ; +} +#ifdef CONFIG_SPL_BUILD #include <asm/arch/mx6-ddr.h> static const struct mx6dq_iomux_ddr_regs mx6q_ddr_ioregs = {
Signature · 1 line
2.20.1
PATCH v3 2/4 mx6cuboxi: customize board_boot_order to access eMMC
Quoted 10 lines
In SPL legacy code only one MMC device is created, based on
BOOT_CFGregister, which can be either SD or eMMC. In this contextboard_boot_orderreturn always MMC1 when configure to boot from SD/eMMC. After switching to DM both SD and eMMC devices are created based on the information available on DT, but asboard_boot_orderonly returns MMC1 is not possible to boot from eMMC.
This patch customizesboard_boot_ordertaking into accountBOOT_CFGregister to point to correct MMC1 / MMC2 device. Additionally, handle IO mux for the desired boot device.Signed-off-by Walter Lozano <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v3 3/4 mx6cuboxi: enable OF_CONTROL and DM in SPL
In reply to Walter LozanoIn order to take the beneficts of DT and DM in SPL, like reusing the code and avoid redundancy, enable SPL_OF_CONTROL, SPL_DM and SPL_DM_MMC.
With this new configuration SPL image is 50 KB, higher than the 38 KB from the previous version, but it still under the 68 KB limit.
--- configs/mx6cuboxi_defconfig | 3 +++ 1 file changed, 3 insertions(+)
configs/mx6cuboxi_defconfig +3 -0
@@ -25,6 +25,7 @@ CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="if hdmidet; then usb start; setenv stdin serial,usbkbd; setenv stdout serial,vga; setenv stderr serial,vga; else setenv stdin serial; setenv stdout serial; setenv stderr serial; fi;" CONFIG_BOUNCE_BUFFER=y CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_FS_EXT4=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_WATCHDOG_SUPPORT=y
@@ -37,6 +38,7 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_EXT4_WRITE=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y CONFIG_DEFAULT_DEVICE_TREE="imx6dl-hummingboard2-emmc-som-v15" CONFIG_OF_LIST="imx6dl-hummingboard2-emmc-som-v15 imx6q-hummingboard2-emmc-som-v15" CONFIG_MULTI_DTB_FIT=y
@@ -45,6 +47,7 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_DM=y +CONFIG_SPL_DM=y CONFIG_DWC_AHSATA=y CONFIG_DM_MMC=y CONFIG_FSL_USDHC=y
Signature · 1 line
2.20.1
PATCH v3 3/4 mx6cuboxi: enable OF_CONTROL and DM in SPL
Quoted 5 lines
In order to take the beneficts of DT and DM in SPL, like reusing the code and avoid redundancy, enable
SPL_OF_CONTROL,SPL_DMandSPL_DM_MMC. With this new configuration SPL image is 50 KB, higher than the 38 KB from the previous version, but it still under the 68 KB limit.Signed-off-by Walter Lozano <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v3 4/4 mx6cuboxi: remove unused code
In reply to Walter LozanoAfter enabling SPL_OF_CONTROL, SPL_DM and SPL_DM_MMC the MMC initialization code is not longer needed.
This patch removes the unused code.
--- board/solidrun/mx6cuboxi/mx6cuboxi.c | 65 ---------------------------- 1 file changed, 65 deletions(-)
board/solidrun/mx6cuboxi/mx6cuboxi.c +0 -65
@@ -162,76 +162,11 @@ static void setup_iomux_uart(void)SETUP_IOMUX_PADS (uart1_pads); } -static struct fsl_esdhc_cfg usdhc_cfg = { - .esdhc_base =USDHC2_BASE_ADDR , - .max_bus_width =4 , -}; - -static struct fsl_esdhc_cfg emmc_cfg = { - .esdhc_base =USDHC3_BASE_ADDR , - .max_bus_width =8 , -}; -int board_mmc_get_env_dev (int devno) {return devno; } -#define USDHC2_CD_GPIO IMX_GPIO_NR(1, 4) - -int board_mmc_getcd (struct mmc *mmc) -{ -struct fsl_esdhc_cfg *cfg = mmc->priv; -int ret =0 ; - -switch (cfg->esdhc_base) { -case USDHC2_BASE_ADDR : - ret = !gpio_get_value (USDHC2_CD_GPIO ); -break ; -case USDHC3_BASE_ADDR : - ret = (mmc_get_op_cond (mmc) <0 ) ?0 :1 ;/* eMMC/uSDHC3 has no CD GPIO */ -break ; - } - -return ret; -} - -static int mmc_init_spl (bd_t *bis) -{ -struct src *psrc = (struct src *)SRC_BASE_ADDR ; -unsigned reg =readl (&psrc->sbmr1) >>11 ; - -/* -* Upon reading BOOT_CFG register the following map is done: -* Bit 11 and 12 of BOOT_CFG register can determine the current -* mmc port -* 0x1 SD2 -* 0x2 SD3 -*/ -switch (reg &0x3 ) { -case 0x1 : -SETUP_IOMUX_PADS (usdhc2_pads); - usdhc_cfg.sdhc_clk =mxc_get_clock (MXC_ESDHC2_CLK ); - gd->arch.sdhc_clk = usdhc_cfg.sdhc_clk; -return fsl_esdhc_initialize (bis, &usdhc_cfg); -case 0x2 : -SETUP_IOMUX_PADS (usdhc3_pads); - emmc_cfg.sdhc_clk =mxc_get_clock (MXC_ESDHC3_CLK ); - gd->arch.sdhc_clk = emmc_cfg.sdhc_clk; -return fsl_esdhc_initialize (bis, &emmc_cfg); - } - -return -ENODEV ; -} - -int board_mmc_init (bd_t *bis) -{ -if (IS_ENABLED (CONFIG_SPL_BUILD )) -return mmc_init_spl (bis); - -return 0 ; -} -static iomux_v3_cfg_t const enet_pads[] = {IOMUX_PADS (PAD_ENET_MDIO__ENET_MDIO |MUX_PAD_CTRL (ENET_PAD_CTRL )),IOMUX_PADS (PAD_ENET_MDC__ENET_MDC |MUX_PAD_CTRL (ENET_PAD_CTRL )),
Signature · 1 line
2.20.1
PATCH v3 4/4 mx6cuboxi: remove unused code
Quoted 4 lines
After enabling
SPL_OF_CONTROL,SPL_DMandSPL_DM_MMCthe MMC initialization code is not longer needed.
This patch removes the unused code.Signed-off-by Walter Lozano <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================