linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] emev2: GPIOLIB: Enable support for OF
       [not found] ` <1377623069-32678-2-git-send-email-ian.molton@codethink.co.uk>
@ 2013-08-29 17:41   ` Linus Walleij
  2013-08-30  3:47     ` Simon Horman
  0 siblings, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2013-08-29 17:41 UTC (permalink / raw)
  To: Ian Molton; +Cc: linux-gpio@vger.kernel.org, linux-sh@vger.kernel.org

On Tue, Aug 27, 2013 at 7:04 PM, Ian Molton <ian.molton@codethink.co.uk> wrote:

> Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>
> ---
>  drivers/gpio/gpio-em.c |    1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
> index 5cba855..279821e 100644
> --- a/drivers/gpio/gpio-em.c
> +++ b/drivers/gpio/gpio-em.c
> @@ -303,6 +303,7 @@ static int em_gio_probe(struct platform_device *pdev)
>         }
>
>         gpio_chip = &p->gpio_chip;
> +       gpio_chip->of_node = pdev->dev.of_node;

This doesn't work on non-DT compiles.

Look at struct gpio_chip:

#if defined(CONFIG_OF_GPIO)
        /*
         * If CONFIG_OF is enabled, then all GPIO controllers described in the
         * device tree automatically may have an OF translation
         */
        struct device_node *of_node;
        int of_gpio_n_cells;
        int (*of_xlate)(struct gpio_chip *gc,
                        const struct of_phandle_args *gpiospec, u32 *flags);
#endif

Either the statement needs to be inside #ifdef CONFIG_OF_GPIO
or the Emma driver need to select OF_GPIO in its Kconfig
entry.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] emev2: GPIOLIB: Enable support for OF
  2013-08-29 17:41   ` [PATCH] emev2: GPIOLIB: Enable support for OF Linus Walleij
@ 2013-08-30  3:47     ` Simon Horman
  2013-08-30  7:48       ` Linus Walleij
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Horman @ 2013-08-30  3:47 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Ian Molton, linux-gpio@vger.kernel.org, linux-sh@vger.kernel.org

On Thu, Aug 29, 2013 at 07:41:42PM +0200, Linus Walleij wrote:
> On Tue, Aug 27, 2013 at 7:04 PM, Ian Molton <ian.molton@codethink.co.uk> wrote:
> 
> > Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>
> > ---
> >  drivers/gpio/gpio-em.c |    1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
> > index 5cba855..279821e 100644
> > --- a/drivers/gpio/gpio-em.c
> > +++ b/drivers/gpio/gpio-em.c
> > @@ -303,6 +303,7 @@ static int em_gio_probe(struct platform_device *pdev)
> >         }
> >
> >         gpio_chip = &p->gpio_chip;
> > +       gpio_chip->of_node = pdev->dev.of_node;
> 
> This doesn't work on non-DT compiles.
> 
> Look at struct gpio_chip:
> 
> #if defined(CONFIG_OF_GPIO)
>         /*
>          * If CONFIG_OF is enabled, then all GPIO controllers described in the
>          * device tree automatically may have an OF translation
>          */
>         struct device_node *of_node;
>         int of_gpio_n_cells;
>         int (*of_xlate)(struct gpio_chip *gc,
>                         const struct of_phandle_args *gpiospec, u32 *flags);
> #endif
> 
> Either the statement needs to be inside #ifdef CONFIG_OF_GPIO
> or the Emma driver need to select OF_GPIO in its Kconfig
> entry.

This may be somewhat naieve, but it seems to me that the latter would be a
better choice at this stage because AFIK the only in-tree emev2 board is
the kzm9d and it uses USE_OF.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] emev2: GPIOLIB: Enable support for OF
  2013-08-30  3:47     ` Simon Horman
@ 2013-08-30  7:48       ` Linus Walleij
  2013-09-02 15:44         ` (unknown), Ian Molton
  0 siblings, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2013-08-30  7:48 UTC (permalink / raw)
  To: Simon Horman
  Cc: Ian Molton, linux-gpio@vger.kernel.org, linux-sh@vger.kernel.org

On Fri, Aug 30, 2013 at 5:47 AM, Simon Horman <horms@verge.net.au> wrote:
> On Thu, Aug 29, 2013 at 07:41:42PM +0200, Linus Walleij wrote:

>> Either the statement needs to be inside #ifdef CONFIG_OF_GPIO
>> or the Emma driver need to select OF_GPIO in its Kconfig
>> entry.
>
> This may be somewhat naieve, but it seems to me that the latter would be a
> better choice at this stage because AFIK the only in-tree emev2 board is
> the kzm9d and it uses USE_OF.

I think you're right. Ian can you cook a patch that also selects
OF_GPIO for this controller in Kconfig?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 7+ messages in thread

* (unknown), 
  2013-08-30  7:48       ` Linus Walleij
@ 2013-09-02 15:44         ` Ian Molton
  2013-09-02 15:44           ` [PATCH] emev2: GPIOLIB: Enable support for OF Ian Molton
  0 siblings, 1 reply; 7+ messages in thread
From: Ian Molton @ 2013-09-02 15:44 UTC (permalink / raw)
  To: linus.walleij; +Cc: horms, linux-gpio

Patch updated to depend on OF_GPIO as suggested. The only other driver using
OF_GPIO depends, rather than selects the symbol, so I have also.

-Ian


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] emev2: GPIOLIB: Enable support for OF
  2013-09-02 15:44         ` (unknown), Ian Molton
@ 2013-09-02 15:44           ` Ian Molton
  2013-09-04  5:07             ` Simon Horman
  2013-09-19 13:34             ` Linus Walleij
  0 siblings, 2 replies; 7+ messages in thread
From: Ian Molton @ 2013-09-02 15:44 UTC (permalink / raw)
  To: linus.walleij; +Cc: horms, linux-gpio, Ian Molton

EMEV2 is now a DT platform, however the GPIO driver cannot be used
from a DT file since it does not fill out the of_node field in its
gpio_chip structure.

Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>
---
 drivers/gpio/Kconfig   |    2 +-
 drivers/gpio/gpio-em.c |    1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index b2450ba..58e043d 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -129,7 +129,7 @@ config GPIO_IT8761E
 
 config GPIO_EM
 	tristate "Emma Mobile GPIO"
-	depends on ARM
+	depends on ARM && OF_GPIO
 	help
 	  Say yes here to support GPIO on Renesas Emma Mobile SoCs.
 
diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
index 5cba855..279821e 100644
--- a/drivers/gpio/gpio-em.c
+++ b/drivers/gpio/gpio-em.c
@@ -303,6 +303,7 @@ static int em_gio_probe(struct platform_device *pdev)
 	}
 
 	gpio_chip = &p->gpio_chip;
+	gpio_chip->of_node = pdev->dev.of_node;
 	gpio_chip->direction_input = em_gio_direction_input;
 	gpio_chip->get = em_gio_get;
 	gpio_chip->direction_output = em_gio_direction_output;
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] emev2: GPIOLIB: Enable support for OF
  2013-09-02 15:44           ` [PATCH] emev2: GPIOLIB: Enable support for OF Ian Molton
@ 2013-09-04  5:07             ` Simon Horman
  2013-09-19 13:34             ` Linus Walleij
  1 sibling, 0 replies; 7+ messages in thread
From: Simon Horman @ 2013-09-04  5:07 UTC (permalink / raw)
  To: Ian Molton; +Cc: linus.walleij, linux-gpio, Magnus Damm

[ CC Magnus ]

On Mon, Sep 02, 2013 at 04:44:55PM +0100, Ian Molton wrote:
> EMEV2 is now a DT platform, however the GPIO driver cannot be used
> from a DT file since it does not fill out the of_node field in its
> gpio_chip structure.
> 
> Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>

I have no objections to this.

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>


> ---
>  drivers/gpio/Kconfig   |    2 +-
>  drivers/gpio/gpio-em.c |    1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index b2450ba..58e043d 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -129,7 +129,7 @@ config GPIO_IT8761E
>  
>  config GPIO_EM
>  	tristate "Emma Mobile GPIO"
> -	depends on ARM
> +	depends on ARM && OF_GPIO
>  	help
>  	  Say yes here to support GPIO on Renesas Emma Mobile SoCs.
>  
> diff --git a/drivers/gpio/gpio-em.c b/drivers/gpio/gpio-em.c
> index 5cba855..279821e 100644
> --- a/drivers/gpio/gpio-em.c
> +++ b/drivers/gpio/gpio-em.c
> @@ -303,6 +303,7 @@ static int em_gio_probe(struct platform_device *pdev)
>  	}
>  
>  	gpio_chip = &p->gpio_chip;
> +	gpio_chip->of_node = pdev->dev.of_node;
>  	gpio_chip->direction_input = em_gio_direction_input;
>  	gpio_chip->get = em_gio_get;
>  	gpio_chip->direction_output = em_gio_direction_output;
> -- 
> 1.7.10.4
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] emev2: GPIOLIB: Enable support for OF
  2013-09-02 15:44           ` [PATCH] emev2: GPIOLIB: Enable support for OF Ian Molton
  2013-09-04  5:07             ` Simon Horman
@ 2013-09-19 13:34             ` Linus Walleij
  1 sibling, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2013-09-19 13:34 UTC (permalink / raw)
  To: Ian Molton; +Cc: Simon Horman, linux-gpio@vger.kernel.org

On Mon, Sep 2, 2013 at 5:44 PM, Ian Molton <ian.molton@codethink.co.uk> wrote:

> EMEV2 is now a DT platform, however the GPIO driver cannot be used
> from a DT file since it does not fill out the of_node field in its
> gpio_chip structure.
>
> Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>

This v2 version applied with Simon's ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-09-19 13:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1377623069-32678-1-git-send-email-ian.molton@codethink.co.uk>
     [not found] ` <1377623069-32678-2-git-send-email-ian.molton@codethink.co.uk>
2013-08-29 17:41   ` [PATCH] emev2: GPIOLIB: Enable support for OF Linus Walleij
2013-08-30  3:47     ` Simon Horman
2013-08-30  7:48       ` Linus Walleij
2013-09-02 15:44         ` (unknown), Ian Molton
2013-09-02 15:44           ` [PATCH] emev2: GPIOLIB: Enable support for OF Ian Molton
2013-09-04  5:07             ` Simon Horman
2013-09-19 13:34             ` Linus Walleij

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).