summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2015-10-01 18:13:47 +0000
committerJohn Crispin <john@openwrt.org>2015-10-01 18:13:47 +0000
commite1b1b0cbfd64322c5206ae5f970345990fbf36d4 (patch)
tree12740dfd38a357c5c61c816fe74e1ce168c00d6e
parent9e1268b1684fb32f846123653a401fd3716fed1f (diff)
downloadmtk-20170518-e1b1b0cbfd64322c5206ae5f970345990fbf36d4.zip
mtk-20170518-e1b1b0cbfd64322c5206ae5f970345990fbf36d4.tar.gz
mtk-20170518-e1b1b0cbfd64322c5206ae5f970345990fbf36d4.tar.bz2
ralink: the mmc driver can now handle CD lines that are active low
Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 47074
-rw-r--r--target/linux/ramips/patches-3.18/0053-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch18
1 files changed, 14 insertions, 4 deletions
diff --git a/target/linux/ramips/patches-3.18/0053-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch b/target/linux/ramips/patches-3.18/0053-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch
index 686c643..a368813 100644
--- a/target/linux/ramips/patches-3.18/0053-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch
+++ b/target/linux/ramips/patches-3.18/0053-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch
@@ -25,7 +25,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
-@@ -773,3 +773,5 @@ config MMC_SUNXI
+@@ -773,3 +773,5 @@
help
This selects support for the SD/MMC Host Controller on
Allwinner sunxi SoCs.
@@ -1760,7 +1760,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
--- /dev/null
+++ b/drivers/mmc/host/mtk-mmc/sd.c
-@@ -0,0 +1,3050 @@
+@@ -0,0 +1,3060 @@
+/* Copyright Statement:
+ *
+ * This software/firmware and related documentation ("MediaTek Software") are
@@ -1919,6 +1919,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+static int mtk_sw_poll;
+
++static int cd_active_low = 1;
++
+//=================================
+#define PERI_MSDC0_PDN (15)
+//#define PERI_MSDC1_PDN (16)
@@ -2337,7 +2339,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ inserted = hw->get_cd_status();
+ } else {
+ status = sdr_read32(MSDC_PS);
-+ inserted = (status & MSDC_PS_CDSTS) ? 0 : 1;
++ if (cd_active_low)
++ inserted = (status & MSDC_PS_CDSTS) ? 0 : 1;
++ else
++ inserted = (status & MSDC_PS_CDSTS) ? 1 : 0;
+ }
+
+#if 0
@@ -4081,7 +4086,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+#if 0
+ present = host->card_inserted; /* why not read from H/W: Fix me*/
+#else
-+ present = (sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 0 : 1;
++ // CD
++ if (cd_active_low)
++ present = (sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 0 : 1;
++ else
++ present = (sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 1 : 0;
+ host->card_inserted = present;
+#endif
+ spin_unlock_irqrestore(&host->lock, flags);
@@ -4534,6 +4543,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ if ((hw->flags & MSDC_SDIO_IRQ) || (hw->flags & MSDC_EXT_SDIO_IRQ))
+ mmc->caps |= MMC_CAP_SDIO_IRQ; /* yes for sdio */
+
++ cd_active_low = !of_property_read_bool(pdev->dev.of_node, "mediatek,cd-high");
+ mtk_sw_poll = of_property_read_bool(pdev->dev.of_node, "mediatek,cd-poll");
+
+ if (mtk_sw_poll)