diff options
author | Magnus Damm <damm@opensource.se> | 2011-05-06 07:02:45 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2011-05-24 23:53:54 -0400 |
commit | d6a1f863433bdf3f8406dedfa33fa79ee9259db3 (patch) | |
tree | a514e8b4db8f8842c7bad2174708f8c690e279c1 /drivers/mmc/host/sh_mobile_sdhi.c | |
parent | 1f7d6819e56dda651a32b0193ff9e7929f62709f (diff) |
mmc: sdhi: support up to 3 interrupt sources
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>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/sh_mobile_sdhi.c')
-rw-r--r-- | drivers/mmc/host/sh_mobile_sdhi.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index 2bd235b744df..d264bbeb529b 100644 --- a/drivers/mmc/host/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c | |||
@@ -62,7 +62,7 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev) | |||
62 | struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; | 62 | struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; |
63 | struct tmio_mmc_host *host; | 63 | struct tmio_mmc_host *host; |
64 | char clk_name[8]; | 64 | char clk_name[8]; |
65 | int irq, ret; | 65 | int i, irq, ret; |
66 | 66 | ||
67 | priv = kzalloc(sizeof(struct sh_mobile_sdhi), GFP_KERNEL); | 67 | priv = kzalloc(sizeof(struct sh_mobile_sdhi), GFP_KERNEL); |
68 | if (priv == NULL) { | 68 | if (priv == NULL) { |
@@ -116,16 +116,27 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev) | |||
116 | if (ret < 0) | 116 | if (ret < 0) |
117 | goto eprobe; | 117 | goto eprobe; |
118 | 118 | ||
119 | irq = platform_get_irq(pdev, 0); | 119 | for (i = 0; i < 3; i++) { |
120 | if (irq < 0) { | 120 | irq = platform_get_irq(pdev, i); |
121 | ret = irq; | 121 | if (irq < 0) { |
122 | goto eirq; | 122 | if (i) { |
123 | continue; | ||
124 | } else { | ||
125 | ret = irq; | ||
126 | goto eirq; | ||
127 | } | ||
128 | } | ||
129 | ret = request_irq(irq, tmio_mmc_irq, 0, | ||
130 | dev_name(&pdev->dev), host); | ||
131 | if (ret) { | ||
132 | while (i--) { | ||
133 | irq = platform_get_irq(pdev, i); | ||
134 | if (irq >= 0) | ||
135 | free_irq(irq, host); | ||
136 | } | ||
137 | goto eirq; | ||
138 | } | ||
123 | } | 139 | } |
124 | |||
125 | ret = request_irq(irq, tmio_mmc_irq, 0, dev_name(&pdev->dev), host); | ||
126 | if (ret) | ||
127 | goto eirq; | ||
128 | |||
129 | dev_info(&pdev->dev, "%s base at 0x%08lx clock rate %u MHz\n", | 140 | dev_info(&pdev->dev, "%s base at 0x%08lx clock rate %u MHz\n", |
130 | mmc_hostname(host->mmc), (unsigned long) | 141 | mmc_hostname(host->mmc), (unsigned long) |
131 | (platform_get_resource(pdev,IORESOURCE_MEM, 0)->start), | 142 | (platform_get_resource(pdev,IORESOURCE_MEM, 0)->start), |
@@ -148,8 +159,14 @@ static int sh_mobile_sdhi_remove(struct platform_device *pdev) | |||
148 | struct mmc_host *mmc = platform_get_drvdata(pdev); | 159 | struct mmc_host *mmc = platform_get_drvdata(pdev); |
149 | struct tmio_mmc_host *host = mmc_priv(mmc); | 160 | struct tmio_mmc_host *host = mmc_priv(mmc); |
150 | struct sh_mobile_sdhi *priv = container_of(host->pdata, struct sh_mobile_sdhi, mmc_data); | 161 | struct sh_mobile_sdhi *priv = container_of(host->pdata, struct sh_mobile_sdhi, mmc_data); |
162 | int i, irq; | ||
163 | |||
164 | for (i = 0; i < 3; i++) { | ||
165 | irq = platform_get_irq(pdev, i); | ||
166 | if (irq >= 0) | ||
167 | free_irq(irq, host); | ||
168 | } | ||
151 | 169 | ||
152 | free_irq(platform_get_irq(pdev, 0), host); | ||
153 | tmio_mmc_host_remove(host); | 170 | tmio_mmc_host_remove(host); |
154 | clk_disable(priv->clk); | 171 | clk_disable(priv->clk); |
155 | clk_put(priv->clk); | 172 | clk_put(priv->clk); |