ramips: mtk-mmc: mt76x8: check ESD_MODE before applying AGPIO_CFG
[openwrt/openwrt.git] / target / linux / ramips / files-4.14 / drivers / mmc / host / mtk-mmc / sd.c
index 4ced4b6605e196c3b1f5769e6472631fc52cfa52..cb0aa4231ab900ced8a36b2e1a19aedb8968c366 100644 (file)
@@ -2205,16 +2205,12 @@ static int msdc_drv_probe(struct platform_device *pdev)
        struct msdc_host *host;
        struct msdc_hw *hw;
        int ret;
-       u32 reg;
 
        //FIXME: this should be done by pinconf and not by the sd driver
-       if (ralink_soc == MT762X_SOC_MT7688 ||
-           ralink_soc == MT762X_SOC_MT7628AN) {
-               /* set EPHY pads to digital mode */
-               reg = sdr_read32((void __iomem *)(RALINK_SYSCTL_BASE + 0x3c));
-               reg |= 0x1e << 16;
-               sdr_write32((void __iomem *)(RALINK_SYSCTL_BASE + 0x3c), reg);
-       }
+       if ((ralink_soc == MT762X_SOC_MT7688 ||
+            ralink_soc == MT762X_SOC_MT7628AN) &&
+           (!(rt_sysc_r32(0x60) & BIT(15))))
+               rt_sysc_m32(0xf << 17, 0xf << 17, 0x3c);
 
        hw = &msdc0_hw;