mmc: fsl_esdhc: fix ddr mode settings
PATCH 1/1 mmc: fsl_esdhc: fix ddr mode settings
When sd/mmc work at DDR mode, like HS400/HS400ES/DDR52/DDR50 mode, the output clock rate is half of the internal clock rate. But first need set DDR_EN bit first , then hardware will automatically divide the usdhc clock.
The mixctrl register exits on new i.MX SoC since i.MX6, so add CONFIG check.
Signed-off-by Peng Fan <[email protected]>
--- drivers/mmc/fsl_esdhc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/mmc/fsl_esdhc.c +13 -0
@@ -625,6 +625,19 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)int sdhc_clk = priv->sdhc_clk;uint clk; +/* +* For ddr mode, usdhc need to enable DDR mode first, +* after select this DDR mode, usdhc will automatically +* divide the usdhc clock +*/ +if (CONFIG_IS_ENABLED (ARCH_MX6 ) ||CONFIG_IS_ENABLED (ARCH_MX7 ) || +CONFIG_IS_ENABLED (ARCH_MX7ULP ) ||CONFIG_IS_ENABLED (ARCH_IMX8 ) || +CONFIG_IS_ENABLED (ARCH_IMX8M )) { +if (mmc->ddr_mode) +writel (readl (®s->mixctrl) |MIX_CTRL_DDREN , + ®s->mixctrl); + } +if (clock < mmc->cfg->f_min) clock = mmc->cfg->f_min;
Signature · 1 line
2.16.4