diff mbox series

[OpenWrt-Devel] ramips: mmc: Add back some non-mt7621 code that staging removed

Message ID 20180607173619.5210-1-rosenp@gmail.com
State Accepted
Delegated to: John Crispin
Headers show
Series [OpenWrt-Devel] ramips: mmc: Add back some non-mt7621 code that staging removed | expand

Commit Message

Rosen Penev June 7, 2018, 5:36 p.m. UTC
This reverts commit 8a570921b5ba49a2d3824f1220e4c53809063468.

This seems to have been accidentally reverted. This fixes mt7620 and
mt7628.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 .../files-4.14/drivers/mmc/host/mtk-mmc/sd.c   | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Comments

Daniel Golle June 7, 2018, 7:58 p.m. UTC | #1
On Thu, Jun 07, 2018 at 10:36:19AM -0700, Rosen Penev wrote:
> This reverts commit 8a570921b5ba49a2d3824f1220e4c53809063468.
> 
> This seems to have been accidentally reverted. This fixes mt7620 and
> mt7628.

Tested on MT7688AN (WrtNode2R), microSD now works.

> Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Daniel Golle <daniel@makrotopia.org>


> ---
>  .../files-4.14/drivers/mmc/host/mtk-mmc/sd.c   | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c
> index 2a032fcba1..97ae927d2d 100644
> --- a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c
> +++ b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c
> @@ -2209,7 +2209,23 @@ static int msdc_drv_probe(struct platform_device *pdev)
>  
>  	// Set the pins for sdxc to sdxc mode
>  	//FIXME: this should be done by pinctl and not by the sd driver
> -	reg = sdr_read32((void __iomem *)(RALINK_SYSCTL_BASE + 0x60)) & ~(0x3 << 18);
> +	if (ralink_soc == MT762X_SOC_MT7620A ||
> +	    ralink_soc == MT762X_SOC_MT7621AT) {
> +		reg = sdr_read32((void __iomem *)(RALINK_SYSCTL_BASE +
> +						  0x60)) & ~(0x3 << 18);
> +		if (ralink_soc == MT762X_SOC_MT7620A)
> +			reg |= 0x1 << 18;
> +	} else {
> +		reg = sdr_read32((void __iomem *)(RALINK_SYSCTL_BASE + 0x3c));
> +		reg |= 0x1e << 16;
> +		sdr_write32((void __iomem *)(RALINK_SYSCTL_BASE + 0x3c), reg);
> +		reg = sdr_read32((void __iomem *)(RALINK_SYSCTL_BASE +
> +						  0x60)) & ~(0x3 << 10);
> +#if defined(CONFIG_MTK_MMC_EMMC_8BIT)
> +		reg |= 0x3 << 26 | 0x3 << 28 | 0x3 << 30;
> +#endif
> +	}
> +
>  	sdr_write32((void __iomem *)(RALINK_SYSCTL_BASE + 0x60), reg);
>  
>  	hw = &msdc0_hw;
> -- 
> 2.17.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/listinfo/openwrt-devel
diff mbox series

Patch

diff --git a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c
index 2a032fcba1..97ae927d2d 100644
--- a/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c
+++ b/target/linux/ramips/files-4.14/drivers/mmc/host/mtk-mmc/sd.c
@@ -2209,7 +2209,23 @@  static int msdc_drv_probe(struct platform_device *pdev)
 
 	// Set the pins for sdxc to sdxc mode
 	//FIXME: this should be done by pinctl and not by the sd driver
-	reg = sdr_read32((void __iomem *)(RALINK_SYSCTL_BASE + 0x60)) & ~(0x3 << 18);
+	if (ralink_soc == MT762X_SOC_MT7620A ||
+	    ralink_soc == MT762X_SOC_MT7621AT) {
+		reg = sdr_read32((void __iomem *)(RALINK_SYSCTL_BASE +
+						  0x60)) & ~(0x3 << 18);
+		if (ralink_soc == MT762X_SOC_MT7620A)
+			reg |= 0x1 << 18;
+	} else {
+		reg = sdr_read32((void __iomem *)(RALINK_SYSCTL_BASE + 0x3c));
+		reg |= 0x1e << 16;
+		sdr_write32((void __iomem *)(RALINK_SYSCTL_BASE + 0x3c), reg);
+		reg = sdr_read32((void __iomem *)(RALINK_SYSCTL_BASE +
+						  0x60)) & ~(0x3 << 10);
+#if defined(CONFIG_MTK_MMC_EMMC_8BIT)
+		reg |= 0x3 << 26 | 0x3 << 28 | 0x3 << 30;
+#endif
+	}
+
 	sdr_write32((void __iomem *)(RALINK_SYSCTL_BASE + 0x60), reg);
 
 	hw = &msdc0_hw;