X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=target%2Flinux%2Framips%2Fpatches-3.18%2F0053-mmc-MIPS-ralink-add-sdhci-for-mt7620a-SoC.patch;h=2932eb6b0784bb9b58043e727b39c494644a6998;hb=7c4cc5fcf7deebbc747130ff0606edc294a14fd9;hp=2aab825d6e6d6010369e2ae223c7f7136a629bfe;hpb=9bc1e19b86106085c0d46b3e620139747499041a;p=openwrt.git 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 2aab825d6e..2932eb6b07 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 @@ -1760,7 +1760,7 @@ Signed-off-by: John Crispin + --- /dev/null +++ b/drivers/mmc/host/mtk-mmc/sd.c -@@ -0,0 +1,3047 @@ +@@ -0,0 +1,3060 @@ +/* Copyright Statement: + * + * This software/firmware and related documentation ("MediaTek Software") are @@ -1821,6 +1821,7 @@ Signed-off-by: John Crispin +#include +#include +#include ++#include + +#define MSDC_SMPL_FALLING (1) +#define MSDC_CD_PIN_EN (1 << 0) /* card detection pin is wired */ @@ -1916,6 +1917,10 @@ Signed-off-by: John Crispin +static struct msdc_regs *msdc_reg[HOST_MAX_NUM]; +#endif + ++static int mtk_sw_poll; ++ ++static int cd_active_low = 1; ++ +//================================= +#define PERI_MSDC0_PDN (15) +//#define PERI_MSDC1_PDN (16) @@ -2331,10 +2336,13 @@ Signed-off-by: John Crispin + spin_lock(&host->lock); + + if (hw->get_cd_status) { // NULL -+ inserted = hw->get_cd_status(); ++ 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 @@ -2401,7 +2409,7 @@ Signed-off-by: John Crispin + //u8 clksrc = hw->clk_src; + + if (!hz) { // set mmc system clock to 0 ? -+ ERR_MSG("set mclk to 0!!!"); ++ //ERR_MSG("set mclk to 0!!!"); + msdc_reset(); + return; + } @@ -3899,7 +3907,7 @@ Signed-off-by: John Crispin + + if (msdc_do_request(mmc,mrq)) { + if(host->hw->flags & MSDC_REMOVABLE && mrq->data && mrq->data->error) { -+ msdc_tune_request(mmc,mrq); ++ //msdc_tune_request(mmc,mrq); + } + } + @@ -4078,7 +4086,11 @@ Signed-off-by: John Crispin +#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); @@ -4148,10 +4160,9 @@ Signed-off-by: John Crispin + + /* card change interrupt */ + if (intsts & MSDC_INT_CDSC){ -+#if defined CONFIG_MTK_MMC_CD_POLL -+ return IRQ_HANDLED; -+#endif -+ IRQ_MSG("MSDC_INT_CDSC irq<0x%.8x>", intsts); ++ if (mtk_sw_poll) ++ return IRQ_HANDLED; ++ IRQ_MSG("MSDC_INT_CDSC irq<0x%.8x>", intsts); +#if 0 /* ---/+++ by chhung: fix slot mechanical bounce issue */ + tasklet_hi_schedule(&host->card_tasklet); +#else @@ -4532,9 +4543,11 @@ Signed-off-by: John Crispin + if ((hw->flags & MSDC_SDIO_IRQ) || (hw->flags & MSDC_EXT_SDIO_IRQ)) + mmc->caps |= MMC_CAP_SDIO_IRQ; /* yes for sdio */ + -+#if defined CONFIG_MTK_MMC_CD_POLL -+ mmc->caps |= MMC_CAP_NEEDS_POLL; -+#endif ++ 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) ++ mmc->caps |= MMC_CAP_NEEDS_POLL; + + /* MMC core transfer sizes tunable parameters */ +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,10,0)