Skip to content

Commit d6a1f86

Browse files
Magnus Dammcjb
authored andcommitted
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>
1 parent 1f7d681 commit d6a1f86

1 file changed

Lines changed: 28 additions & 11 deletions

File tree

‎drivers/mmc/host/sh_mobile_sdhi.c‎

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
6262
struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
6363
struct tmio_mmc_host *host;
6464
char clk_name[8];
65-
int irq, ret;
65+
int i, irq, ret;
6666

6767
priv = kzalloc(sizeof(struct sh_mobile_sdhi), GFP_KERNEL);
6868
if (priv == NULL) {
@@ -116,16 +116,27 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
116116
if (ret < 0)
117117
goto eprobe;
118118

119-
irq = platform_get_irq(pdev, 0);
120-
if (irq < 0) {
121-
ret = irq;
122-
goto eirq;
119+
for (i = 0; i < 3; i++) {
120+
irq = platform_get_irq(pdev, i);
121+
if (irq < 0) {
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+
}
123139
}
124-
125-
ret = request_irq(irq, tmio_mmc_irq, 0, dev_name(&pdev->dev), host);
126-
if (ret)
127-
goto eirq;
128-
129140
dev_info(&pdev->dev, "%s base at 0x%08lx clock rate %u MHz\n",
130141
mmc_hostname(host->mmc), (unsigned long)
131142
(platform_get_resource(pdev,IORESOURCE_MEM, 0)->start),
@@ -148,8 +159,14 @@ static int sh_mobile_sdhi_remove(struct platform_device *pdev)
148159
struct mmc_host *mmc = platform_get_drvdata(pdev);
149160
struct tmio_mmc_host *host = mmc_priv(mmc);
150161
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+
}
151169

152-
free_irq(platform_get_irq(pdev, 0), host);
153170
tmio_mmc_host_remove(host);
154171
clk_disable(priv->clk);
155172
clk_put(priv->clk);

0 commit comments

Comments
 (0)