* [PATCH 04/04] mmc: sdhi: support up to 4 interrupt sources
@ 2011-05-02 15:14 Magnus Damm
2011-05-02 22:19 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: Magnus Damm @ 2011-05-02 15:14 UTC (permalink / raw)
To: linux-sh
From: Magnus Damm <damm@opensource.se>
Convert the SDHI code to support more than a single
interrupt source. Needed to support hardware that
uses GIC instead of INTC as interrupt controller.
Will also allow us to remove the irq forwarding
workaround from the INTC code in the future.
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Magnus Damm <damm@opensource.se>
---
This is based on this patch from Simon Horman:
"[PATCH 1/2] mmc: tmio: Allow SDHI MMC to use multiple IRQ vectors"
drivers/mmc/host/sh_mobile_sdhi.c | 36 +++++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
--- 0004/drivers/mmc/host/sh_mobile_sdhi.c
+++ work/drivers/mmc/host/sh_mobile_sdhi.c 2011-05-02 23:49:25.000000000 +0900
@@ -62,7 +62,7 @@ static int __devinit sh_mobile_sdhi_prob
struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
struct tmio_mmc_host *host;
char clk_name[8];
- int irq, ret;
+ int i, irq, ret;
priv = kzalloc(sizeof(struct sh_mobile_sdhi), GFP_KERNEL);
if (priv = NULL) {
@@ -116,13 +116,25 @@ static int __devinit sh_mobile_sdhi_prob
if (ret < 0)
goto eprobe;
- irq = platform_get_irq(pdev, 0);
- if (irq < 0)
- goto eirq;
-
- ret = request_irq(irq, tmio_mmc_irq, 0, dev_name(&pdev->dev), host);
- if (ret)
- goto eirq;
+ for (i = 0; i < 3; i++) {
+ irq = platform_get_irq(pdev, i);
+ if (irq < 0) {
+ if (i)
+ continue;
+ else
+ goto eirq;
+ }
+ ret = request_irq(irq, tmio_mmc_irq, 0,
+ dev_name(&pdev->dev), host);
+ if (ret) {
+ while (--i > 0) {
+ irq = platform_get_irq(pdev, i);
+ if (irq >= 0)
+ free_irq(irq, host);
+ }
+ goto eirq;
+ }
+ }
dev_info(&pdev->dev, "%s base at 0x%08lx clock rate %u MHz\n",
mmc_hostname(host->mmc), (unsigned long)
@@ -147,8 +159,14 @@ static int sh_mobile_sdhi_remove(struct
struct mmc_host *mmc = platform_get_drvdata(pdev);
struct tmio_mmc_host *host = mmc_priv(mmc);
struct sh_mobile_sdhi *priv = container_of(host->pdata, struct sh_mobile_sdhi, mmc_data);
+ int i, irq;
+
+ for (i = 0; i < 3; i++) {
+ irq = platform_get_irq(pdev, i);
+ if (irq >= 0)
+ free_irq(irq, host);
+ }
- free_irq(platform_get_irq(pdev, 0), host);
tmio_mmc_host_remove(host);
clk_disable(priv->clk);
clk_put(priv->clk);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 04/04] mmc: sdhi: support up to 4 interrupt sources
2011-05-02 15:14 [PATCH 04/04] mmc: sdhi: support up to 4 interrupt sources Magnus Damm
@ 2011-05-02 22:19 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2011-05-02 22:19 UTC (permalink / raw)
To: linux-sh
On Tue, May 03, 2011 at 12:14:54AM +0900, Magnus Damm wrote:
> From: Magnus Damm <damm@opensource.se>
>
> Convert the SDHI code to support more than a single
> interrupt source. Needed to support hardware that
> uses GIC instead of INTC as interrupt controller.
>
> Will also allow us to remove the irq forwarding
> workaround from the INTC code in the future.
Hi Magnus,
this looks correct to me.
Guennadi suggested not having arbitary '3's in the code
and using a constant instead. I think that comment applies
to this code as much as my previous patch.
>
> Signed-off-by: Simon Horman <horms@verge.net.au>
I didn't sign this off.
> Signed-off-by: Magnus Damm <damm@opensource.se>
> ---
>
> This is based on this patch from Simon Horman:
> "[PATCH 1/2] mmc: tmio: Allow SDHI MMC to use multiple IRQ vectors"
>
> drivers/mmc/host/sh_mobile_sdhi.c | 36 +++++++++++++++++++++++++++---------
> 1 file changed, 27 insertions(+), 9 deletions(-)
>
> --- 0004/drivers/mmc/host/sh_mobile_sdhi.c
> +++ work/drivers/mmc/host/sh_mobile_sdhi.c 2011-05-02 23:49:25.000000000 +0900
> @@ -62,7 +62,7 @@ static int __devinit sh_mobile_sdhi_prob
> struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
> struct tmio_mmc_host *host;
> char clk_name[8];
> - int irq, ret;
> + int i, irq, ret;
>
> priv = kzalloc(sizeof(struct sh_mobile_sdhi), GFP_KERNEL);
> if (priv = NULL) {
> @@ -116,13 +116,25 @@ static int __devinit sh_mobile_sdhi_prob
> if (ret < 0)
> goto eprobe;
>
> - irq = platform_get_irq(pdev, 0);
> - if (irq < 0)
> - goto eirq;
> -
> - ret = request_irq(irq, tmio_mmc_irq, 0, dev_name(&pdev->dev), host);
> - if (ret)
> - goto eirq;
> + for (i = 0; i < 3; i++) {
> + irq = platform_get_irq(pdev, i);
> + if (irq < 0) {
> + if (i)
> + continue;
> + else
> + goto eirq;
> + }
> + ret = request_irq(irq, tmio_mmc_irq, 0,
> + dev_name(&pdev->dev), host);
> + if (ret) {
> + while (--i > 0) {
> + irq = platform_get_irq(pdev, i);
> + if (irq >= 0)
> + free_irq(irq, host);
> + }
> + goto eirq;
> + }
> + }
>
> dev_info(&pdev->dev, "%s base at 0x%08lx clock rate %u MHz\n",
> mmc_hostname(host->mmc), (unsigned long)
> @@ -147,8 +159,14 @@ static int sh_mobile_sdhi_remove(struct
> struct mmc_host *mmc = platform_get_drvdata(pdev);
> struct tmio_mmc_host *host = mmc_priv(mmc);
> struct sh_mobile_sdhi *priv = container_of(host->pdata, struct sh_mobile_sdhi, mmc_data);
> + int i, irq;
> +
> + for (i = 0; i < 3; i++) {
> + irq = platform_get_irq(pdev, i);
> + if (irq >= 0)
> + free_irq(irq, host);
> + }
>
> - free_irq(platform_get_irq(pdev, 0), host);
> tmio_mmc_host_remove(host);
> clk_disable(priv->clk);
> clk_put(priv->clk);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-05-02 22:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-02 15:14 [PATCH 04/04] mmc: sdhi: support up to 4 interrupt sources Magnus Damm
2011-05-02 22:19 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox