diff mbox series

[U-Boot,v2,2/3] ARM: imx6: DHCOM i.MX6 PDK: spl: Add eMMC initialization to SPL code

Message ID 20191029121759.3582464-2-ch@denx.de
State Accepted
Commit 5c47bf7195767d45049fd2482bc75fccbbfe7055
Delegated to: Stefano Babic
Headers show
Series [U-Boot,v2,1/3] ARM: imx6: DHCOM i.MX6 PDK: fix board_boot_modes emmc entry | expand

Commit Message

Claudius Heine Oct. 29, 2019, 12:17 p.m. UTC
In order for 'bmode emmc' to work, the eMMC needs to be initialized in the
SPL. This change initializes the eMMC as BOOT_DEVICE_MMC1 (index=0).

Signed-off-by: Claudius Heine <ch@denx.de>
---
 board/dhelectronics/dh_imx6/dh_imx6_spl.c | 26 +++++++++++++++++++++++
 1 file changed, 26 insertions(+)

Comments

Stefano Babic Nov. 4, 2019, 8:54 a.m. UTC | #1
> In order for 'bmode emmc' to work, the eMMC needs to be initialized in the
> SPL. This change initializes the eMMC as BOOT_DEVICE_MMC1 (index=0).
> Signed-off-by: Claudius Heine <ch@denx.de>

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/board/dhelectronics/dh_imx6/dh_imx6_spl.c b/board/dhelectronics/dh_imx6/dh_imx6_spl.c
index 1b7acc8df7..f2c3ac3e28 100644
--- a/board/dhelectronics/dh_imx6/dh_imx6_spl.c
+++ b/board/dhelectronics/dh_imx6/dh_imx6_spl.c
@@ -476,6 +476,32 @@  static void setup_iomux_uart(void)
 	SETUP_IOMUX_PADS(uart1_pads);
 }
 
+#ifdef CONFIG_FSL_USDHC
+struct fsl_esdhc_cfg usdhc_cfg[1] = {
+	{USDHC4_BASE_ADDR},
+};
+
+int board_mmc_get_env_dev(int devno)
+{
+	return devno - 1;
+}
+
+int board_mmc_getcd(struct mmc *mmc)
+{
+	return 1; /* eMMC/uSDHC4 is always present */
+}
+
+int board_mmc_init(bd_t *bis)
+{
+	SETUP_IOMUX_PADS(usdhc4_pads);
+	usdhc_cfg[0].esdhc_base = USDHC4_BASE_ADDR;
+	usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
+	usdhc_cfg[0].max_bus_width = 8;
+
+	return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
+}
+#endif
+
 /* USB */
 static iomux_v3_cfg_t const usb_pads[] = {
 	IOMUX_PADS(PAD_GPIO_1__USB_OTG_ID	| MUX_PAD_CTRL(NO_PAD_CTRL)),