mmc: fsl_esdhc_imx: add HS400 Enhanced strobe support
authorPeng Fan <peng.fan@nxp.com>
Wed, 10 Jul 2019 09:35:26 +0000 (09:35 +0000)
committerPeng Fan <peng.fan@nxp.com>
Mon, 15 Jul 2019 02:30:09 +0000 (10:30 +0800)
Implement set_enhanced_strobe hook for fsl_esdhc_imx,
,in esdhc_set_timing and esdhc_change_pinstate, also handle HS400_ES.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/mmc/fsl_esdhc_imx.c

index 0d2587982cddff0fe5ab28e51e4f90eb5560a53a..51d22256522b699a23d798771b4b7e883fdd576f 100644 (file)
@@ -703,6 +703,7 @@ static int esdhc_change_pinstate(struct udevice *dev)
        case UHS_SDR104:
        case MMC_HS_200:
        case MMC_HS_400:
+       case MMC_HS_400_ES:
                ret = pinctrl_select_state(dev, "state_200mhz");
                break;
        default:
@@ -773,6 +774,7 @@ static int esdhc_set_timing(struct mmc *mmc)
                writel(mixctrl, &regs->mixctrl);
                break;
        case MMC_HS_400:
+       case MMC_HS_400_ES:
                mixctrl |= MIX_CTRL_DDREN | MIX_CTRL_HS400_EN;
                writel(mixctrl, &regs->mixctrl);
                esdhc_set_strobe_dll(mmc);
@@ -1594,6 +1596,21 @@ static int fsl_esdhc_set_ios(struct udevice *dev)
        return esdhc_set_ios_common(priv, &plat->mmc);
 }
 
+#if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT)
+static int fsl_esdhc_set_enhanced_strobe(struct udevice *dev)
+{
+       struct fsl_esdhc_priv *priv = dev_get_priv(dev);
+       struct fsl_esdhc *regs = priv->esdhc_regs;
+       u32 m;
+
+       m = readl(&regs->mixctrl);
+       m |= MIX_CTRL_HS400_ES;
+       writel(m, &regs->mixctrl);
+
+       return 0;
+}
+#endif
+
 static const struct dm_mmc_ops fsl_esdhc_ops = {
        .get_cd         = fsl_esdhc_get_cd,
        .send_cmd       = fsl_esdhc_send_cmd,
@@ -1601,6 +1618,9 @@ static const struct dm_mmc_ops fsl_esdhc_ops = {
 #ifdef MMC_SUPPORTS_TUNING
        .execute_tuning = fsl_esdhc_execute_tuning,
 #endif
+#if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT)
+       .set_enhanced_strobe = fsl_esdhc_set_enhanced_strobe,
+#endif
 };
 #endif