Author: blogic
Date: 2015-10-02 12:52:43 +0200 (Fri, 02 Oct 2015)
New Revision: 47099

Modified:
   
branches/chaos_calmer/target/linux/ramips/patches-3.18/0053-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch
Log:
ralink: the mmc driver can now handle CD lines that are active low

Signed-off-by: John Crispin <[email protected]>

Backport of r47074

Modified: 
branches/chaos_calmer/target/linux/ramips/patches-3.18/0053-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch
===================================================================
--- 
branches/chaos_calmer/target/linux/ramips/patches-3.18/0053-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch
 2015-10-02 10:52:32 UTC (rev 47098)
+++ 
branches/chaos_calmer/target/linux/ramips/patches-3.18/0053-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch
 2015-10-02 10:52:43 UTC (rev 47099)
@@ -1760,7 +1760,7 @@
 +
 --- /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 @@
 +
 +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 @@
 +      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 @@
 +#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 @@
 +    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)
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to