From: jszhang@marvell.com (Jisheng Zhang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] mmc: sdhci: provide isr for card-detect interrupts
Date: Tue, 11 Apr 2017 18:20:56 +0800 [thread overview]
Message-ID: <20170411102056.2869-3-jszhang@marvell.com> (raw)
In-Reply-To: <20170411102056.2869-1-jszhang@marvell.com>
We found one issue on BG4CT platforms with GPIO for sdcar card detect
interrupt: remove sdcard when there's read write access to the sdcard,
sometimes the card remove event can't be handled for a long time, so
the system still think the sdcard is still plugged in. It turns out
that the sdhci_card_event() is missing in common slot gpio's card
detect isr.
We fix this issue by providing sdhci's own isr for card-detect
interrupts. In this own isr, we call sdhci_card_event() then process
the change of state.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
drivers/mmc/host/sdhci.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 63bc33a54d0d..b6c5021a5892 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2777,6 +2777,16 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)
return result;
}
+static irqreturn_t sdhci_cd_irq(int irq, void *dev_id)
+{
+ struct mmc_host *mmc = dev_id;
+ struct sdhci_host *host = mmc_priv(mmc);
+
+ mmc->ops->card_event(mmc);
+ mmc_detect_change(host->mmc, msecs_to_jiffies(200));
+ return IRQ_HANDLED;
+}
+
static irqreturn_t sdhci_thread_irq(int irq, void *dev_id)
{
struct sdhci_host *host = dev_id;
@@ -3617,6 +3627,8 @@ int __sdhci_add_host(struct sdhci_host *host)
sdhci_init(host, 0);
+ mmc_gpio_set_cd_isr(mmc, sdhci_cd_irq);
+
ret = request_threaded_irq(host->irq, sdhci_irq, sdhci_thread_irq,
IRQF_SHARED, mmc_hostname(mmc), host);
if (ret) {
--
2.11.0
next prev parent reply other threads:[~2017-04-11 10:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-11 10:20 [PATCH 0/2] provide isr for card-detect interrupts Jisheng Zhang
2017-04-11 10:20 ` [PATCH 1/2] mmc: slot-gpio: check cd_gpio before setting up cd_gpio_isr Jisheng Zhang
2017-04-11 10:20 ` Jisheng Zhang [this message]
2017-04-11 10:31 ` [PATCH 2/2] mmc: sdhci: provide isr for card-detect interrupts Adrian Hunter
2017-04-13 9:17 ` Jisheng Zhang
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=20170411102056.2869-3-jszhang@marvell.com \
--to=jszhang@marvell.com \
--cc=linux-arm-kernel@lists.infradead.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).