[patch 09/15] MMC: Allow card-detect to be on an non-IRQ capable pin on the S3C24XX

From: Ben Dooks
Date: Fri Jun 06 2008 - 11:58:16 EST


Add support to the S3C24XX MMC driver to have the card detect be on
a pin that is not IRQ capable.

Signed-off-by: Ben Dooks <ben-linux@xxxxxxxxx>

Index: linux-2.6.26-rc5-q/drivers/mmc/host/s3cmci.c
===================================================================
--- linux-2.6.26-rc5-q.orig/drivers/mmc/host/s3cmci.c 2008-06-06 15:46:32.000000000 +0100
+++ linux-2.6.26-rc5-q/drivers/mmc/host/s3cmci.c 2008-06-06 15:46:34.000000000 +0100
@@ -1150,8 +1150,6 @@ static int s3cmci_probe(struct platform_
host->pio_active = XFER_NONE;

host->dma = S3CMCI_DMA;
- host->irq_cd = s3c2410_gpio_getirq(host->pdata->gpio_detect);
- s3c2410_gpio_cfgpin(host->pdata->gpio_detect, S3C2410_GPIO_IRQ);

host->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!host->mem) {
@@ -1193,15 +1191,23 @@ static int s3cmci_probe(struct platform_

disable_irq(host->irq);

- s3c2410_gpio_cfgpin(host->pdata->gpio_detect, S3C2410_GPIO_IRQ);
- set_irq_type(host->irq_cd, IRQT_BOTHEDGE);
+ host->irq_cd = s3c2410_gpio_getirq(host->pdata->gpio_detect);

- if (request_irq(host->irq_cd, s3cmci_irq_cd, 0, DRIVER_NAME, host)) {
- dev_err(&pdev->dev,
- "failed to request card detect interrupt.\n");
+ if (host->irq_cd >= 0) {
+ set_irq_type(host->irq_cd, IRQT_BOTHEDGE);

- ret = -ENOENT;
- goto probe_free_irq;
+ if (request_irq(host->irq_cd, s3cmci_irq_cd,
+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, DRIVER_NAME, host)) {
+ dev_err(&pdev->dev,
+ "failed to request card detect interrupt.\n");
+
+ ret = -ENOENT;
+ goto probe_free_irq;
+ }
+ } else {
+ dev_warn(&pdev->dev, "host detect has no irq available\n");
+ s3c2410_gpio_cfgpin(host->pdata->gpio_detect,
+ S3C2410_GPIO_INPUT);
}

if (host->pdata->gpio_wprotect)
@@ -1264,7 +1270,8 @@ static int s3cmci_probe(struct platform_
clk_put(host->clk);

probe_free_irq_cd:
- free_irq(host->irq_cd, host);
+ if (host->irq_cd >= 0)
+ free_irq(host->irq_cd, host);

probe_free_irq:
free_irq(host->irq, host);
@@ -1290,8 +1297,11 @@ static int s3cmci_remove(struct platform
clk_disable(host->clk);
clk_put(host->clk);
s3c2410_dma_free(S3CMCI_DMA, &s3cmci_dma_client);
- free_irq(host->irq_cd, host);
+
+ if (host->irq_cd >= 0)
+ free_irq(host->irq_cd, host);
free_irq(host->irq, host);
+
iounmap(host->base);
release_mem_region(host->mem->start, RESSIZE(host->mem));
mmc_free_host(mmc);

--
Ben (ben@xxxxxxxxx, http://www.fluff.org/)

'a smiley only costs 4 bytes'
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/