public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: grygorii.strashko@ti•com (Grygorii Strashko)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v2] gpio: davinci: fix gpio selection for OF
Date: Wed, 5 Mar 2014 15:12:57 +0200	[thread overview]
Message-ID: <531722D9.9020904@ti.com> (raw)
In-Reply-To: <1394018461-757-1-git-send-email-holler@ahsoftware.de>

Hi Alexander,

On 03/05/2014 01:21 PM, Alexander Holler wrote:
> The driver missed an of_xlate function to translate gpio numbers
> as found in the DT to the correct chip and number.
>
> While there I've set #gpio_cells to a fixed value of 2.
>
> I've used gpio-pxa.c as template for those changes and tested my changes
> successfully on a da850 board using entries for gpio-leds in a DT. So I didn't
> reinvent the wheel but just copied and tested stuff.
>
> Thanks to Grygorii Strashko for the hint to the existing code in gpio-pxa.
>
> Signed-off-by: Alexander Holler <holler@ahsoftware•de>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti•com>

Looks good to me now. Thanks.

> ---
>   drivers/gpio/gpio-davinci.c | 24 ++++++++++++++++++++++++
>   1 file changed, 24 insertions(+)
>
>   Changes in v2: replaced static variables by indirections.
>
> diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
> index 7629b4f..92574a0 100644
> --- a/drivers/gpio/gpio-davinci.c
> +++ b/drivers/gpio/gpio-davinci.c
> @@ -172,6 +172,27 @@ of_err:
>   	return NULL;
>   }
>
> +#ifdef CONFIG_OF_GPIO
> +static int davinci_gpio_of_xlate(struct gpio_chip *gc,
> +			     const struct of_phandle_args *gpiospec,
> +			     u32 *flags)
> +{
> +	struct davinci_gpio_controller *chips = dev_get_drvdata(gc->dev);
> +	struct davinci_gpio_platform_data *pdata = dev_get_platdata(gc->dev);
> +
> +	if (gpiospec->args[0] > pdata->ngpio)
> +		return -EINVAL;
> +
> +	if (gc != &chips[gpiospec->args[0] / 32].chip)
> +		return -EINVAL;
> +
> +	if (flags)
> +		*flags = gpiospec->args[1];
> +
> +	return gpiospec->args[0] % 32;
> +}
> +#endif
> +
>   static int davinci_gpio_probe(struct platform_device *pdev)
>   {
>   	int i, base;
> @@ -236,6 +257,9 @@ static int davinci_gpio_probe(struct platform_device *pdev)
>   			chips[i].chip.ngpio = 32;
>
>   #ifdef CONFIG_OF_GPIO
> +		chips[i].chip.of_gpio_n_cells = 2;
> +		chips[i].chip.of_xlate = davinci_gpio_of_xlate;
> +		chips[i].chip.dev = dev;
>   		chips[i].chip.of_node = dev->of_node;
>   #endif
>   		spin_lock_init(&chips[i].lock);
>

  reply	other threads:[~2014-03-05 13:12 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5315ED51.1000006@ti.com>
2014-03-04 22:06 ` [PATCH] gpio: davinci: fix gpio selection for OF Alexander Holler
2014-03-05  2:27   ` Linus Walleij
2014-03-05 10:43   ` Grygorii Strashko
2014-03-05 11:21     ` [PATCH v2] " Alexander Holler
2014-03-05 13:12       ` Grygorii Strashko [this message]
2014-03-11 10:15       ` Linus Walleij
2014-03-14 10:08         ` Alexander Holler
2014-03-14 11:02           ` Linus Walleij
2014-03-14 12:38             ` Alexander Holler
2014-03-14 13:54               ` Linus Walleij
2014-03-14 18:33                 ` Alexander Holler
2014-03-14 19:52                   ` Linus Walleij
2014-03-15  7:37                     ` Alexander Holler
2014-03-17 13:29             ` Sekhar Nori
2014-03-17 14:05               ` Linus Walleij
2014-03-18  8:37                 ` Sekhar Nori
2014-03-18  9:45                   ` Alexander Holler
2014-03-18 10:54                     ` Sekhar Nori
2014-03-21  8:28                     ` Linus Walleij
2014-03-21  8:59                       ` Alexander Holler
2014-03-17 14:11               ` Alexander Holler
2014-03-17 14:13                 ` Linus Walleij
2014-03-17 15:04               ` Grygorii Strashko

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=531722D9.9020904@ti.com \
    --to=grygorii.strashko@ti$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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