From: Anton Vorontsov <cbouatmailru@gmail.com>
To: Esben Haabendal <esbenhaabendal@gmail.com>
Cc: linux-mmc@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
David Brownell <dbrownell@users.sourceforge.net>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] of_mmc_spi: add card detect irq support
Date: Mon, 30 Aug 2010 20:11:02 +0400 [thread overview]
Message-ID: <20100830161102.GA20413@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <AANLkTik3rNpFCYDR7dxiFN_3dvxZmsSjt8PsoC415JM-@mail.gmail.com>
> of_mmc_spi: add card detect irq support
>
> Signed-off-by: Esben Haabendal <eha@doredevelopment.dk>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Thanks!
> ---
> .../powerpc/dts-bindings/mmc-spi-slot.txt | 9 ++++++-
> drivers/mmc/host/of_mmc_spi.c | 26 ++++++++++++++++++-
> 2 files changed, 32 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/powerpc/dts-bindings/mmc-spi-slot.txt b/Documentation/powerpc/dts-bindings/mmc-spi-slot.txt
> index c39ac28..89a0084 100644
> --- a/Documentation/powerpc/dts-bindings/mmc-spi-slot.txt
> +++ b/Documentation/powerpc/dts-bindings/mmc-spi-slot.txt
> @@ -7,8 +7,13 @@ Required properties:
> - voltage-ranges : two cells are required, first cell specifies minimum
> slot voltage (mV), second cell specifies maximum slot voltage (mV).
> Several ranges could be specified.
> -- gpios : (optional) may specify GPIOs in this order: Card-Detect GPIO,
> +
> +Optional properties:
> +- gpios : may specify GPIOs in this order: Card-Detect GPIO,
> Write-Protect GPIO.
> +- interrupts : the interrupt of a card detect interrupt.
> +- interrupt-parent : the phandle for the interrupt controller that
> + services interrupts for this device.
>
> Example:
>
> @@ -20,4 +25,6 @@ Example:
> &qe_pio_d 15 0>;
> voltage-ranges = <3300 3300>;
> spi-max-frequency = <50000000>;
> + interrupts = <42>;
> + interrupt-parent = <&PIC>;
> };
> diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c
> index 1247e5d..5530def 100644
> --- a/drivers/mmc/host/of_mmc_spi.c
> +++ b/drivers/mmc/host/of_mmc_spi.c
> @@ -34,6 +34,7 @@ enum {
> struct of_mmc_spi {
> int gpios[NUM_GPIOS];
> bool alow_gpios[NUM_GPIOS];
> + int detect_irq;
> struct mmc_spi_platform_data pdata;
> };
>
> @@ -61,6 +62,22 @@ static int of_mmc_spi_get_ro(struct device *dev)
> return of_mmc_spi_read_gpio(dev, WP_GPIO);
> }
>
> +static int of_mmc_spi_init(struct device *dev,
> + irqreturn_t (*irqhandler)(int, void *), void *mmc)
> +{
> + struct of_mmc_spi *oms = to_of_mmc_spi(dev);
> +
> + return request_threaded_irq(oms->detect_irq, NULL, irqhandler, 0,
> + dev_name(dev), mmc);
> +}
> +
> +static void of_mmc_spi_exit(struct device *dev, void *mmc)
> +{
> + struct of_mmc_spi *oms = to_of_mmc_spi(dev);
> +
> + free_irq(oms->detect_irq, mmc);
> +}
> +
> struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
> {
> struct device *dev = &spi->dev;
> @@ -121,8 +138,13 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi)
> if (gpio_is_valid(oms->gpios[WP_GPIO]))
> oms->pdata.get_ro = of_mmc_spi_get_ro;
>
> - /* We don't support interrupts yet, let's poll. */
> - oms->pdata.caps |= MMC_CAP_NEEDS_POLL;
> + oms->detect_irq = irq_of_parse_and_map(np, 0);
> + if (oms->detect_irq != NO_IRQ) {
> + oms->pdata.init = of_mmc_spi_init;
> + oms->pdata.exit = of_mmc_spi_exit;
> + } else {
> + oms->pdata.caps |= MMC_CAP_NEEDS_POLL;
> + }
>
> dev->platform_data = &oms->pdata;
> return dev->platform_data;
> --
> 1.7.1.1
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
next prev parent reply other threads:[~2010-08-30 16:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-30 12:04 [PATCH] of_mmc_spi: add card detect irq support Esben Haabendal
2010-08-30 13:29 ` Anton Vorontsov
2010-08-30 16:04 ` Esben Haabendal
2010-08-30 16:11 ` Anton Vorontsov [this message]
2010-08-30 16:38 ` David Brownell
2010-08-30 17:49 ` Grant Likely
2010-12-28 16:05 ` Anton Vorontsov
2011-03-08 3:52 ` Grant Likely
2010-08-30 17:46 ` Grant Likely
2010-08-31 6:14 ` Esben Haabendal
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=20100830161102.GA20413@oksana.dev.rtsoft.ru \
--to=cbouatmailru@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dbrownell@users.sourceforge.net \
--cc=esbenhaabendal@gmail.com \
--cc=linux-mmc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.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).