linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Haijun Zhang <Haijun.Zhang@freescale.com>
To: linux-mmc@vger.kernel.org
Cc: cbouatmailru@gmail.com, cjb@laptop.org, scottwood@freescale.com,
	X.Xie@freescale.com, ulf.hansson@linaro.org,
	Haijun Zhang <Haijun.Zhang@freescale.com>
Subject: [PATCH 2/2] mmc:esdhc: Enable DMA err bit for eSDHC host
Date: Tue, 17 Sep 2013 13:28:30 +0800	[thread overview]
Message-ID: <1379395711-28462-1-git-send-email-Haijun.Zhang@freescale.com> (raw)

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.Zhang@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



             reply	other threads:[~2013-09-17  5:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-17  5:28 Haijun Zhang [this message]
2013-09-17  5:28 ` [PATCH 1/2] mmc:sdhc: Add vendor specific interrupt and handle routine Haijun Zhang
2013-10-21  9:20   ` Zhang Haijun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1379395711-28462-1-git-send-email-Haijun.Zhang@freescale.com \
    --to=haijun.zhang@freescale.com \
    --cc=X.Xie@freescale.com \
    --cc=cbouatmailru@gmail.com \
    --cc=cjb@laptop.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=scottwood@freescale.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).