From: Jeremie Samuel <jeremie.samuel.ext@parrot.com>
To: Chris Ball <cjb@laptop.org>
Cc: linux-mmc@vger.kernel.org, matthieu.castet@parrot.com,
gregor.boirie@parrot.com,
Jeremie Samuel <jeremie.samuel.ext@parrot.com>,
Anton Vorontsov <avorontsov@mvista.com>
Subject: [PATCH 4/8] sdhci: Use threaded IRQ handler
Date: Tue, 9 Jul 2013 17:44:08 +0200 [thread overview]
Message-ID: <1373384652-21958-5-git-send-email-jeremie.samuel.ext@parrot.com> (raw)
In-Reply-To: <1373384652-21958-1-git-send-email-jeremie.samuel.ext@parrot.com>
We only need atomic context to disable SDHCI interrupts, after that
we can run in a kernel thread.
Note that irq handler still grabs an irqsave spinlock, we'll deal
with it in a subsequent patch.
Patch based on: http://thread.gmane.org/gmane.linux.kernel.mmc/2579.
Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
Signed-off-by: Jeremie Samuel <jeremie.samuel.ext@parrot.com>
---
drivers/mmc/host/sdhci.c | 46 ++++++++++++++++++++++++++++------------------
1 file changed, 28 insertions(+), 18 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index ab635d5..21ef1e0 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2405,9 +2405,8 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
}
}
-static irqreturn_t sdhci_irq(int irq, void *dev_id)
+static irqreturn_t sdhci_irq_thread(int irq, void *dev_id)
{
- irqreturn_t result;
struct sdhci_host *host = dev_id;
u32 intmask, unexpected = 0;
int cardint = 0, max_loops = 16;
@@ -2423,15 +2422,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)
intmask = sdhci_readl(host, SDHCI_INT_STATUS);
- if (!intmask || intmask == 0xffffffff) {
- result = IRQ_NONE;
- goto out;
- }
-
again:
- DBG("*** %s got interrupt: 0x%08x\n",
- mmc_hostname(host->mmc), intmask);
-
if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) {
u32 present = sdhci_readl(host, SDHCI_PRESENT_STATE) &
SDHCI_CARD_PRESENT;
@@ -2491,12 +2482,10 @@ again:
sdhci_writel(host, intmask, SDHCI_INT_STATUS);
}
- result = IRQ_HANDLED;
-
intmask = sdhci_readl(host, SDHCI_INT_STATUS);
if (intmask && --max_loops)
goto again;
-out:
+
spin_unlock(&host->lock);
if (unexpected) {
@@ -2510,7 +2499,27 @@ out:
if (cardint)
mmc_signal_sdio_irq(host->mmc);
- return result;
+ intmask = sdhci_readl(host, SDHCI_INT_ENABLE);
+ sdhci_writel(host, intmask, SDHCI_SIGNAL_ENABLE);
+
+ return IRQ_HANDLED;
+}
+
+static irqreturn_t sdhci_irq(int irq, void *dev_id)
+{
+ struct sdhci_host *host = dev_id;
+ u32 intmask = sdhci_readl(host, SDHCI_INT_STATUS);
+
+ if (!intmask || intmask == 0xffffffff)
+ return IRQ_NONE;
+
+ /* Disable interrupts */
+ sdhci_writel(host, 0, SDHCI_SIGNAL_ENABLE);
+
+ DBG("*** %s got interrupt: 0x%08x\n",
+ mmc_hostname(host->mmc), intmask);
+
+ return IRQ_WAKE_THREAD;
}
/*****************************************************************************\
@@ -2597,8 +2606,9 @@ int sdhci_resume_host(struct sdhci_host *host)
}
if (!device_may_wakeup(mmc_dev(host->mmc))) {
- ret = request_irq(host->irq, sdhci_irq, IRQF_SHARED,
- mmc_hostname(host->mmc), host);
+ ret = request_threaded_irq(host->irq, sdhci_irq,
+ sdhci_irq_thread, IRQF_SHARED,
+ mmc_hostname(host->mmc), host);
if (ret)
return ret;
} else {
@@ -3213,8 +3223,8 @@ int sdhci_add_host(struct sdhci_host *host)
sdhci_tuning_timeout_work);
}
- ret = request_irq(host->irq, sdhci_irq, IRQF_SHARED,
- mmc_hostname(mmc), host);
+ ret = request_threaded_irq(host->irq, sdhci_irq, sdhci_irq_thread,
+ IRQF_SHARED, mmc_hostname(host->mmc), host);
if (ret) {
pr_err("%s: Failed to request IRQ %d: %d\n",
mmc_hostname(mmc), host->irq, ret);
--
1.7.10.4
next prev parent reply other threads:[~2013-07-09 15:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-09 15:44 [PATCH 0/8] sdhci: Move real work out of an atomic context Jeremie Samuel
2013-07-09 15:44 ` [PATCH 1/8] sdhci: Turn timeout timer into delayed work Jeremie Samuel
2013-07-09 15:44 ` [PATCH 2/8] sdhci: Turn tuning " Jeremie Samuel
2013-07-09 15:44 ` [PATCH 3/8] sdhci: Use work structs instead of tasklets Jeremie Samuel
2013-07-09 15:44 ` Jeremie Samuel [this message]
2013-07-09 15:44 ` [PATCH 5/8] sdhci: Delay led blinking Jeremie Samuel
2013-07-09 15:44 ` [PATCH 6/8] sdhci: Turn host->lock into a mutex Jeremie Samuel
2013-08-25 1:58 ` Chris Ball
2013-08-26 8:37 ` Jeremie Samuel
2013-07-09 15:44 ` [PATCH 7/8] sdhci: Get rid of mdelay()s where it is safe and makes sense Jeremie Samuel
2013-07-09 15:44 ` [PATCH 8/8] sdhci: Use jiffies instead of a timeout counter Jeremie Samuel
2013-07-09 15:52 ` [PATCH 0/8] sdhci: Move real work out of an atomic context Philip Rakity
2013-07-11 8:28 ` Jeremie Samuel
-- strict thread matches above, loose matches on Subject: below --
2013-10-16 16:20 Jeremie Samuel
2013-10-16 16:20 ` [PATCH 4/8] sdhci: Use threaded IRQ handler Jeremie Samuel
2013-05-24 16:00 [PATCH 0/8] sdhci: Move real work out of an atomic context Jeremie Samuel
2013-05-24 16:00 ` [PATCH 4/8] sdhci: Use threaded IRQ handler Jeremie Samuel
2010-07-14 13:07 [PATCH 0/8] sdhci: Move real work out of an atomic context Anton Vorontsov
2010-07-14 13:08 ` [PATCH 4/8] sdhci: Use threaded IRQ handler Anton Vorontsov
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=1373384652-21958-5-git-send-email-jeremie.samuel.ext@parrot.com \
--to=jeremie.samuel.ext@parrot.com \
--cc=avorontsov@mvista.com \
--cc=cjb@laptop.org \
--cc=gregor.boirie@parrot.com \
--cc=linux-mmc@vger.kernel.org \
--cc=matthieu.castet@parrot.com \
/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).