All of lore.kernel.org
 help / color / mirror / Atom feed
From: f.fainelli@gmail.com (Florian Fainelli)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/4] ARM: ep93xx: simone: let the mmc_spi driver handle the card detect
Date: Sun,  3 Sep 2017 10:43:45 -0700	[thread overview]
Message-ID: <20170903174347.6148-3-f.fainelli@gmail.com> (raw)
In-Reply-To: <20170903174347.6148-1-f.fainelli@gmail.com>

From: H Hartley Sweeten <hsweeten@visionengravers.com>

This board uses a GPIO for the MMC card detect. Let the mmc_spi
driver handle it instead of the platform code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/mach-ep93xx/simone.c | 54 +++----------------------------------------
 1 file changed, 3 insertions(+), 51 deletions(-)

diff --git a/arch/arm/mach-ep93xx/simone.c b/arch/arm/mach-ep93xx/simone.c
index c7a40f245892..1c353868f211 100644
--- a/arch/arm/mach-ep93xx/simone.c
+++ b/arch/arm/mach-ep93xx/simone.c
@@ -43,60 +43,12 @@ static struct ep93xxfb_mach_info __initdata simone_fb_info = {
 	.flags		= EP93XXFB_USE_SDCSN0 | EP93XXFB_PCLK_FALLING,
 };
 
-/*
- * GPIO lines used for MMC card detection.
- */
-#define MMC_CARD_DETECT_GPIO EP93XX_GPIO_LINE_EGPIO0
-
-/*
- * MMC card detection GPIO setup.
- */
-
-static int simone_mmc_spi_init(struct device *dev,
-	irqreturn_t (*irq_handler)(int, void *), void *mmc)
-{
-	unsigned int gpio = MMC_CARD_DETECT_GPIO;
-	int irq, err;
-
-	err = gpio_request(gpio, dev_name(dev));
-	if (err)
-		return err;
-
-	err = gpio_direction_input(gpio);
-	if (err)
-		goto fail;
-
-	irq = gpio_to_irq(gpio);
-	if (irq < 0)
-		goto fail;
-
-	err = request_irq(irq, irq_handler, IRQF_TRIGGER_FALLING,
-			  "MMC card detect", mmc);
-	if (err)
-		goto fail;
-
-	printk(KERN_INFO "%s: using irq %d for MMC card detection\n",
-	       dev_name(dev), irq);
-
-	return 0;
-fail:
-	gpio_free(gpio);
-	return err;
-}
-
-static void simone_mmc_spi_exit(struct device *dev, void *mmc)
-{
-	unsigned int gpio = MMC_CARD_DETECT_GPIO;
-
-	free_irq(gpio_to_irq(gpio), mmc);
-	gpio_free(gpio);
-}
-
 static struct mmc_spi_platform_data simone_mmc_spi_data = {
-	.init		= simone_mmc_spi_init,
-	.exit		= simone_mmc_spi_exit,
 	.detect_delay	= 500,
 	.ocr_mask	= MMC_VDD_32_33 | MMC_VDD_33_34,
+	.flags		= MMC_SPI_USE_CD_GPIO,
+	.cd_gpio	= EP93XX_GPIO_LINE_EGPIO0,
+	.cd_debounce	= 1,
 };
 
 static struct spi_board_info simone_spi_devices[] __initdata = {
-- 
2.11.0

  parent reply	other threads:[~2017-09-03 17:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-03 17:43 [PATCH v2 0/4] ARM: ep93xx: various updates Florian Fainelli
2017-09-03 17:43 ` [PATCH v2 1/4] ARM: ep93xx: switch to SPARSEMEM Florian Fainelli
2017-09-03 17:58   ` Alexander Sverdlin
2017-09-03 17:43 ` Florian Fainelli [this message]
2017-09-03 17:58   ` [PATCH v2 2/4] ARM: ep93xx: simone: let the mmc_spi driver handle the card detect Alexander Sverdlin
2017-09-03 17:43 ` [PATCH v2 3/4] ARM: ep93xx: tidy up TS-72xx Watchdog resources Florian Fainelli
2017-09-03 17:58   ` Alexander Sverdlin
2017-09-03 17:43 ` [PATCH v2 4/4] ARM: ep93xx: Add lm70 HWMON sensor to TS-72xx boards Florian Fainelli
2017-09-03 17:59   ` Alexander Sverdlin
2017-09-05  6:50 ` [PATCH v2 0/4] ARM: ep93xx: various updates Linus Walleij
2017-09-05 15:54   ` Hartley Sweeten

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=20170903174347.6148-3-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.