From: Magnus Damm <magnus.damm@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: drzeus-wbsd@drzeus.cx, Magnus Damm <magnus.damm@gmail.com>,
ian@mnementh.co.uk, akpm@linux-foundation.org
Subject: [PATCH 05/05] tmio_mmc: Support multiple interrupts
Date: Wed, 11 Mar 2009 21:59:28 +0900 [thread overview]
Message-ID: <20090311125928.1563.26784.sendpatchset@rx1.opensource.se> (raw)
In-Reply-To: <20090311125845.1563.31960.sendpatchset@rx1.opensource.se>
From: Magnus Damm <damm@opensource.se>
Add support for tmio_mmc hardware configurations with
multiple interrupts. With this patch applied all interrupts
passed as platform data will be used by the driver.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
drivers/mmc/host/tmio_mmc.c | 58 ++++++++++++++++++++++++++++++++-----------
drivers/mmc/host/tmio_mmc.h | 1
2 files changed, 44 insertions(+), 15 deletions(-)
--- 0013/drivers/mmc/host/tmio_mmc.c
+++ work/drivers/mmc/host/tmio_mmc.c 2009-03-11 19:38:59.000000000 +0900
@@ -537,6 +537,45 @@ static struct mmc_host_ops tmio_mmc_ops
.get_ro = tmio_mmc_get_ro,
};
+static int tmio_mmc_hook_irqs(struct platform_device *dev, int hook)
+{
+ struct mmc_host *mmc = platform_get_drvdata(dev);
+ struct tmio_mmc_host *host = mmc_priv(mmc);
+ struct resource *res;
+ int ret = -ENXIO;
+ int q, m;
+ int k = 0;
+ int n = 0;
+
+ while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) {
+ for (n = res->start; hook && n <= res->end; n++) {
+ if (request_irq(n, tmio_mmc_irq, IRQF_DISABLED,
+ dev_name(&dev->dev), host))
+ goto rollback;
+
+ set_irq_type(n, IRQ_TYPE_EDGE_FALLING);
+ }
+ k++;
+ }
+
+ if (hook)
+ return k > 0 ? 0 : -ENOENT;
+
+ k--;
+ ret = 0;
+
+ rollback:
+ for (q = k; k >= 0; k--) {
+ for (m = n; m >= res->start; m--)
+ free_irq(m, host);
+
+ res = platform_get_resource(dev, IORESOURCE_IRQ, k - 1);
+ m = res->end;
+ }
+
+ return ret;
+}
+
#ifdef CONFIG_PM
static int tmio_mmc_suspend(struct platform_device *dev, pm_message_t state)
{
@@ -636,25 +675,16 @@ static int __devinit tmio_mmc_probe(stru
tmio_mmc_clk_stop(host);
reset(host);
- ret = platform_get_irq(dev, 0);
- if (ret >= 0)
- host->irq = ret;
- else
- goto unmap_cnf;
-
- disable_mmc_irqs(host->ctl, TMIO_MASK_ALL);
-
- ret = request_irq(host->irq, tmio_mmc_irq, IRQF_DISABLED, "tmio-mmc",
- host);
+ ret = tmio_mmc_hook_irqs(dev, 1);
if (ret)
goto unmap_cnf;
- set_irq_type(host->irq, IRQ_TYPE_EDGE_FALLING);
+ disable_mmc_irqs(host->ctl, TMIO_MASK_ALL);
mmc_add_host(mmc);
- printk(KERN_INFO "%s at 0x%08lx irq %d\n", mmc_hostname(host->mmc),
- (unsigned long)host->ctl, host->irq);
+ printk(KERN_INFO "%s at 0x%08lx\n", mmc_hostname(host->mmc),
+ (unsigned long)host->ctl);
/* Unmask the IRQs we want to know about */
enable_mmc_irqs(host->ctl, TMIO_MASK_IRQ);
@@ -681,7 +711,7 @@ static int __devexit tmio_mmc_remove(str
if (mmc) {
struct tmio_mmc_host *host = mmc_priv(mmc);
mmc_remove_host(mmc);
- free_irq(host->irq, host);
+ tmio_mmc_hook_irqs(dev, 0);
if (host->cnf)
iounmap(host->cnf);
iounmap(host->ctl);
--- 0001/drivers/mmc/host/tmio_mmc.h
+++ work/drivers/mmc/host/tmio_mmc.h 2009-03-11 19:38:03.000000000 +0900
@@ -112,7 +112,6 @@ struct tmio_mmc_host {
struct mmc_request *mrq;
struct mmc_data *data;
struct mmc_host *mmc;
- int irq;
/* pio related stuff */
struct scatterlist *sg_ptr;
next prev parent reply other threads:[~2009-03-11 13:02 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-11 12:58 [PATCH 00/05] tmio_mmc: Minor fixes and cnf/irq changes Magnus Damm
2009-03-11 12:58 ` [PATCH 01/05] tmio_mmc: Fix one off, use resource_size() in probe() Magnus Damm
2009-03-11 14:26 ` Ian Molton
2009-03-11 12:59 ` [PATCH 02/05] tmio_mmc: Fix use after free in remove() Magnus Damm
2009-03-11 14:28 ` Ian Molton
2009-03-11 12:59 ` [PATCH 03/05] tmio_mmc: Break out cnf area operations Magnus Damm
2009-03-11 14:39 ` Ian Molton
2009-03-12 2:13 ` Magnus Damm
2009-03-11 12:59 ` [PATCH 04/05] tmio_mmc: Make cnf area optional Magnus Damm
2009-03-11 12:59 ` Magnus Damm [this message]
2009-03-11 14:21 ` [PATCH 05/05] tmio_mmc: Support multiple interrupts Ian Molton
2009-03-12 1:45 ` Magnus Damm
2009-03-16 18:30 ` [PATCH 00/05] tmio_mmc: Minor fixes and cnf/irq changes Pierre Ossman
2009-03-18 1:58 ` Magnus Damm
2009-03-24 2:07 ` Ian Molton
2009-03-25 8:56 ` Magnus Damm
2009-03-31 2:51 ` Magnus Damm
2009-03-31 18:37 ` Ian Molton
2009-04-01 2:20 ` Magnus Damm
2009-04-01 19:00 ` Ian Molton
2009-03-24 2:00 ` Ian Molton
2009-03-24 20:05 ` Pierre Ossman
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=20090311125928.1563.26784.sendpatchset@rx1.opensource.se \
--to=magnus.damm@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=drzeus-wbsd@drzeus.cx \
--cc=ian@mnementh.co.uk \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome