[PATCH 4/4 v2] mmc: sdhci-esdhc-imx: Workaround for SD dat1 glitch causes system panic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: RichardZhu <richard.zhu@xxxxxxxxxx>

Some SD cards insertions will cause a glitch on SD dat1
which is also a card interrupt signal. Thus the wrongly
generated card interrupt will make system panic because
there's no registered sdio interrupt handler.
This patch fixes this issue.

Note: This is a workaround for i.MX6 version 1.0 silicon. It's
      fixed in hardware in version 1.1 silicon.

Signed-off-by: Tony Lin <tony.lin@xxxxxxxxxxxxx>
Signed-off-by: RichardZhu <richard.zhu@xxxxxxxxxx>
CC: Wolfram Sang <w.sang@xxxxxxxxxxxxxx>
CC: Philipp Ahmann <pahmann@xxxxxxxxxxxxxx>
---
v2: * Update the comment with "the following problem"
    * Remove merge error "if (!is_imx25_esdhc(imx_data))"

Note: Patches 1 - 3 of this series are not changed and therefore not re-sent.
      They are still unchanged:
      http://marc.info/?l=linux-mmc&m=133664296609699&w=3

 drivers/mmc/host/sdhci-esdhc-imx.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index a13e75b..f2e17e1 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -486,6 +486,7 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)
 	struct clk *clk;
 	int err;
 	struct pltfm_imx_data *imx_data;
+	u32 reg;
 
 	host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata);
 	if (IS_ERR(host))
@@ -513,6 +514,20 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)
 	clk_prepare_enable(clk);
 	pltfm_host->clk = clk;
 
+	/* disable card interrupt enable bit, and clear status bit
+	 * the default value of this enable bit is 1, but it should
+	 * be 0 regarding to standard host controller spec 2.1.3.
+	 * if this bit is 1, it may cause the following problem.
+	 * there's dat1 glitch when some cards inserting into the slot,
+	 * thus wrongly generate a card interrupt that will cause
+	 * system panic because it lacks of sdio handler
+	 * following code will solve the problem.
+	 */
+	reg = sdhci_readl(host, SDHCI_INT_ENABLE);
+	reg &= ~SDHCI_INT_CARD_INT;
+	sdhci_writel(host, reg, SDHCI_INT_ENABLE);
+	sdhci_writel(host, SDHCI_INT_CARD_INT, SDHCI_INT_STATUS);
+
 	host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
 
 	if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data))
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux