From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 02/12] ARM: ep93xx: vision_ep9307: Use MMC CD and RO GPIO
Date: Fri, 26 Jul 2013 09:54:37 +0000 [thread overview]
Message-ID: <1818634.2aPQusYJQq@avalon> (raw)
In-Reply-To: <ADE657CA350FB648AAC2C43247A983F0021DAC5C20AC@AUSP01VMBX24.collaborationhost.net>
Hi Hartley,
On Thursday 25 July 2013 19:19:52 H Hartley Sweeten wrote:
> On Thursday, July 25, 2013 4:27 PM, Laurent Pinchart wrote:
> > Pass the CD and RO GPIO numbers to the MMC SPI driver and remove the
> > custom .get_cd() and .get_ro() callback functions.
> >
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> >
> > arch/arm/mach-ep93xx/vision_ep9307.c | 56 +++---------------------------
> > 1 file changed, 4 insertions(+), 52 deletions(-)
> >
> > diff --git a/arch/arm/mach-ep93xx/vision_ep9307.c
> > b/arch/arm/mach-ep93xx/vision_ep9307.c index 605956f..ab94dc5 100644
> > --- a/arch/arm/mach-ep93xx/vision_ep9307.c
> > +++ b/arch/arm/mach-ep93xx/vision_ep9307.c
> > @@ -224,62 +224,14 @@ static struct ep93xx_spi_chip_ops
> > vision_spi_flash_hw = {>
> > #define VISION_SPI_MMC_WP EP93XX_GPIO_LINE_F(0)
> > #define VISION_SPI_MMC_CD EP93XX_GPIO_LINE_EGPIO15
> >
> > -static struct gpio vision_spi_mmc_gpios[] = {
> > - { VISION_SPI_MMC_WP, GPIOF_DIR_IN, "mmc_spi:wp" },
> > - { VISION_SPI_MMC_CD, GPIOF_DIR_IN, "mmc_spi:cd" },
> > -};
> > -
> > -static int vision_spi_mmc_init(struct device *pdev,
> > - irqreturn_t (*func)(int, void *), void *pdata)
> > -{
> > - int err;
> > -
> > - err = gpio_request_array(vision_spi_mmc_gpios,
> > - ARRAY_SIZE(vision_spi_mmc_gpios));
> > - if (err)
> > - return err;
> > -
> > - err = gpio_set_debounce(VISION_SPI_MMC_CD, 1);
> > - if (err)
> > - goto exit_err;
>
> I tested this and it _kind_ of works.
>
> The card detect is a bit flaky due to the gpio interrupt debounce not being
> enabled.
>
> The only way I can see to fix this is add the following to this patch:
>
> @@ -233,8 +233,31 @@ static struct mmc_spi_platform_data vision_spi_mmc_data
> = { .caps2 = MMC_CAP2_RO_ACTIVE_HIGH,
> };
>
> +static int vision_spi_mmc_enable_cd_debounce(struct spi_device *spi)
> +{
> + int ret;
> +
> + ret = gpio_request_one(VISION_SPI_MMC_CD, GPIOF_DIR_IN,
> spi->modalias);
> + if (ret)
> + return ret;
> +
> + ret = gpio_set_debounce(VISION_SPI_MMC_CD, 1);
> + if (ret)
> + return ret;
> +
> + gpio_free(VISION_SPI_MMC_CD);
> +
> + return 0;
> +}
> +
> static int vision_spi_mmc_hw_setup(struct spi_device *spi)
> {
> + int ret;
> +
> + ret = vision_spi_mmc_enable_cd_debounce(spi);
> + if (ret)
> + return ret;
> +
> return gpio_request_one(VISION_SPI_MMC_CS, GPIOF_INIT_HIGH,
> spi->modalias);
> }
What about extending the mmc_spi and MMC core with GPIO debounce support ? The
mmc_spi driver would get a new cd_gpio_debounce field, which would be passed
to mmc_gpio_request_cd(). I can cook up a patch.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2013-07-26 9:54 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-25 23:26 [PATCH 00/12] Remove platform callbacks from mmc_spi, sh_mmcif and sh_mobile_sdhi drivers Laurent Pinchart
2013-07-25 23:26 ` [PATCH 01/12] mmc: mmc_spi: Support CD/RO GPIOs Laurent Pinchart
2013-07-25 23:45 ` Ryan Mallon
2013-07-26 0:04 ` Laurent Pinchart
2013-07-26 0:23 ` Ryan Mallon
2013-07-26 9:51 ` Laurent Pinchart
2013-07-25 23:26 ` [PATCH 02/12] ARM: ep93xx: vision_ep9307: Use MMC CD and RO GPIO Laurent Pinchart
2013-07-25 23:33 ` H Hartley Sweeten
2013-07-26 0:19 ` H Hartley Sweeten
2013-07-26 9:54 ` Laurent Pinchart [this message]
2013-07-26 16:26 ` H Hartley Sweeten
2013-07-25 23:26 ` [PATCH 03/12] sh: ecovec24: Use MMC/SDHI " Laurent Pinchart
2013-07-25 23:26 ` [PATCH 04/12] sh: ecovec24: Remove mmcif .down_pwr() callback Laurent Pinchart
2013-07-25 23:26 ` [PATCH 05/12] sh: ecovec24: Remove MMCIF and SDHI .set_pwr() callbacks Laurent Pinchart
2013-07-25 23:26 ` [PATCH 06/12] mmc: mmc_spi: Remove platform data .get_cd() and .get_ro() callbacks Laurent Pinchart
2013-07-25 23:26 ` [PATCH 07/12] mmc: sh_mmcif: Remove .down_pwr() callback from platform data Laurent Pinchart
2013-07-25 23:26 ` [PATCH 08/12] mmc: sh_mmcif: Remove .set_pwr() " Laurent Pinchart
2013-07-25 23:26 ` [PATCH 09/12] mmc: sh_mobile_sdhi: Remove .get_cd() " Laurent Pinchart
2013-07-25 23:26 ` [PATCH 10/12] mmc: sh_mobile_sdhi: Remove .set_pwr() " Laurent Pinchart
2013-07-25 23:26 ` [PATCH 11/12] mmc: tmio-mmc: Remove .get_cd() " Laurent Pinchart
2013-07-25 23:26 ` [PATCH 12/12] mmc: tmio-mmc: Remove .set_pwr() " Laurent Pinchart
2013-07-25 23:37 ` [PATCH 00/12] Remove platform callbacks from mmc_spi, sh_mmcif and sh_mobile_sdhi drivers Ryan Mallon
2013-07-26 7:01 ` Guennadi Liakhovetski
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=1818634.2aPQusYJQq@avalon \
--to=laurent.pinchart@ideasonboard.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).