eSDHC host had bit eSDHC_IRQSTAT[3] to indicate that DMA (SDMA or ADMA)
transfer has failed. So enable this bit detecting and its interrupt.

Signed-off-by: Haijun Zhang <haijun.zh...@freescale.com>
---
 drivers/mmc/host/sdhci-of-esdhc.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-esdhc.c 
b/drivers/mmc/host/sdhci-of-esdhc.c
index e328252..86809c0 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -24,6 +24,9 @@
 
 #define VENDOR_V_22    0x12
 #define VENDOR_V_23    0x13
+
+#define ESDHC_INT_DMA_ERROR    0x10000000
+
 static u32 esdhc_readl(struct sdhci_host *host, int reg)
 {
        u32 ret;
@@ -238,6 +241,21 @@ static void esdhc_of_platform_init(struct sdhci_host *host)
                host->quirks &= ~SDHCI_QUIRK_NO_BUSY_IRQ;
 }
 
+static void esdhc_get_pltfm_irq(struct sdhci_host *host, u32 *irq)
+{
+       *irq |= ESDHC_INT_DMA_ERROR;
+}
+
+static void esdhc_pltfm_irq_handler(struct sdhci_host *host, u32 intmask)
+{
+       if (intmask & (ESDHC_INT_DMA_ERROR | SDHCI_INT_ADMA_ERROR)) {
+               host->data->error = -EIO;
+               pr_err("%s: ADMA error\n", mmc_hostname(host->mmc));
+               sdhci_show_adma_error(host);
+               esdhci_of_adma_workaround(host, intmask);
+       }
+}
+
 static int esdhc_pltfm_bus_width(struct sdhci_host *host, int width)
 {
        u32 ctrl;
@@ -273,6 +291,8 @@ static const struct sdhci_ops sdhci_esdhc_ops = {
        .enable_dma = esdhc_of_enable_dma,
        .get_max_clock = esdhc_of_get_max_clock,
        .get_min_clock = esdhc_of_get_min_clock,
+       .get_platform_irq = esdhc_get_pltfm_irq,
+       .handle_platform_irq = esdhc_pltfm_irq_handler,
        .platform_init = esdhc_of_platform_init,
 #ifdef CONFIG_PM
        .platform_suspend = esdhc_of_suspend,
-- 
1.8.0


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

Reply via email to