public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Dooks <ben-linux@fluff.org>
To: linux-kernel@vger.kernel.org
Cc: Pierre Ossman <drzeus@drzeus.cx>,
	Harald Welte <laforge@openmoko.org>,
	Thomas Kleffel <tk@maintech.de>,
	Roman Moravcik <roman.moravcik@gmail.com>,
	Ben Dooks <ben-linux@fluff.org>
Subject: [patch 09/15] MMC: Allow card-detect to be on an non-IRQ capable pin on the S3C24XX
Date: Fri, 06 Jun 2008 16:51:26 +0100	[thread overview]
Message-ID: <20080606155526.269677007@fluff.org.uk> (raw)
In-Reply-To: 20080606155117.074799346@fluff.org.uk

[-- Attachment #1: simtec/s3c24xx-sdmmc-nocdirq.patch --]
[-- Type: text/plain, Size: 2485 bytes --]

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@fluff.org>

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@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

  parent reply	other threads:[~2008-06-06 15:58 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-06 15:51 [patch 00/15] S3C24XX SD/MMC driver series Ben Dooks
2008-06-06 15:51 ` [patch 01/15] MMC: S3C24XX MMC/SD driver. From: Thomas Kleffel <tk@maintech.de> Ben Dooks
2008-06-07  5:49   ` Andrew Morton
2008-06-07 12:22     ` Ben Dooks
2008-06-07 19:13       ` Andrew Morton
2008-06-07 19:50         ` Ben Dooks
2008-06-14 16:18   ` Pierre Ossman
2008-06-17 23:02     ` Ben Dooks
2008-06-06 15:51 ` [patch 02/15] MMC: S3C24XX MMC/SD driver write fixes From: Harald Welte <laforge@openmoko.org> Ben Dooks
2008-06-06 15:51 ` [patch 03/15] MMC: DMA free fix for S3C24XX SD/MMC driver From: OpenMoko SVN " Ben Dooks
2008-06-06 15:51 ` [patch 04/15] MMC: S3C24XX MMC/SD stop fix From: Thomas Kleffel <tk@maintech.de> Ben Dooks
2008-06-06 15:51 ` [patch 05/15] MMC: Fix S3C24XX IRQ enable during PIO transfers From: Roman Moracik <roman.moravcik@gmail.com> Ben Dooks
2008-06-14 16:20   ` Pierre Ossman
2008-06-06 15:51 ` [patch 06/15] MMC: Add platform data for S3C24XX MMC/SD driver Ben Dooks
2008-06-14 16:22   ` Pierre Ossman
2008-06-17 23:20     ` Ben Dooks
2008-06-06 15:51 ` [patch 07/15] MMC: Add support to invert S3C24XX write protect line Ben Dooks
2008-06-06 15:51 ` [patch 08/15] MMC: Ensure host->mrq->data is valid in S3C24XX driver Ben Dooks
2008-06-06 15:51 ` Ben Dooks [this message]
2008-06-14 16:24   ` [patch 09/15] MMC: Allow card-detect to be on an non-IRQ capable pin on the S3C24XX Pierre Ossman
2008-06-06 15:51 ` [patch 10/15] MMC: Fix s3c24xx driver s3c2410_dma_request() return code check Ben Dooks
2008-06-06 15:51 ` [patch 11/15] MMC: Fix the retcode in the S3C24XX MMC/SD driver Ben Dooks
2008-06-14 16:25   ` Pierre Ossman
2008-06-17 23:33     ` Ben Dooks
2008-06-06 15:51 ` [patch 12/15] MMC: S3C24XX MMC/SD driver fixes for sg_ access Ben Dooks
2008-06-06 15:51 ` [patch 13/15] MMC: s3cmci: Add MODULE_ALIAS() entries for the platform devices Ben Dooks
2008-06-06 15:51 ` [patch 14/15] MMC: Fix use of msecs where jiffies are needed Ben Dooks
2008-06-06 15:51 ` [patch 15/15] MMC: Add media presence detection to request handling Ben Dooks

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=20080606155526.269677007@fluff.org.uk \
    --to=ben-linux@fluff.org \
    --cc=drzeus@drzeus.cx \
    --cc=laforge@openmoko.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roman.moravcik@gmail.com \
    --cc=tk@maintech.de \
    /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