Skip to content

Commit

Permalink
udoo_spl: Initialize the eSDHC controller in SPL
Browse files Browse the repository at this point in the history
Currently, imx6q udoo board fails to boot like this:

U-Boot SPL 2022.01-rc3-00061-g95ca715adad3 (Dec 18 2021 - 18:04:40 -0300)
Trying to boot from MMC1

The reason is that the eSDHC controller is not initialized in SPL.

Initialize the eSDHC controller in SPL via C code as DM is not
used in SPL.

Signed-off-by: Fabio Estevam <[email protected]>
Reviewed-by: Peter Robinson <[email protected]>
  • Loading branch information
fabioestevam authored and trini committed Jan 8, 2022
1 parent 47de135 commit 11907cb
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions board/udoo/udoo_spl.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,39 @@ void board_init_f(ulong dummy)
/* DDR initialization */
spl_dram_init();
}

#define USDHC3_CD_GPIO IMX_GPIO_NR(7, 0)

#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP | \
PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm | \
PAD_CTL_SRE_FAST | PAD_CTL_HYS)

static struct fsl_esdhc_cfg usdhc_cfg[2] = {
{USDHC3_BASE_ADDR},
};

static const iomux_v3_cfg_t usdhc3_pads[] = {
IOMUX_PADS(PAD_SD3_CLK__SD3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
IOMUX_PADS(PAD_SD3_CMD__SD3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
IOMUX_PADS(PAD_SD3_DAT0__SD3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
IOMUX_PADS(PAD_SD3_DAT1__SD3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
IOMUX_PADS(PAD_SD3_DAT2__SD3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
IOMUX_PADS(PAD_SD3_DAT3__SD3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
IOMUX_PADS(PAD_SD3_DAT5__GPIO7_IO00 | MUX_PAD_CTRL(NO_PAD_CTRL)),
};

int board_mmc_getcd(struct mmc *mmc)
{
return !gpio_get_value(USDHC3_CD_GPIO);
}

int board_mmc_init(struct bd_info *bis)
{
SETUP_IOMUX_PADS(usdhc3_pads);
usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
usdhc_cfg[0].max_bus_width = 4;
gpio_direction_input(USDHC3_CD_GPIO);

return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
}
#endif

0 comments on commit 11907cb

Please sign in to comment.