SUPERH platform development
 help / color / mirror / Atom feed
* [PATCH 05/10] ARM: shmobile: r8a7790: Register GPIO devices
@ 2013-04-08  9:36 Laurent Pinchart
  2013-04-08 12:06 ` Sergei Shtylyov
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Laurent Pinchart @ 2013-04-08  9:36 UTC (permalink / raw)
  To: linux-sh

Move GPIOs handling from the PFC device to separate GPIO devices.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 arch/arm/mach-shmobile/setup-r8a7790.c | 35 +++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index 49de2d5..eeef5f6 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -23,6 +23,7 @@
 #include <linux/kernel.h>
 #include <linux/of_platform.h>
 #include <linux/serial_sci.h>
+#include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_data/irq-renesas-irqc.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
@@ -31,13 +32,45 @@
 
 static const struct resource pfc_resources[] = {
 	DEFINE_RES_MEM(0xe6060000, 0x250),
-	DEFINE_RES_MEM(0xe6050000, 0x5050),
 };
 
+#define R8A7790_GPIO(idx)						\
+static struct resource r8a7790_gpio##idx##_resources[] = {		\
+	DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50),		\
+	DEFINE_RES_IRQ(gic_spi(4 + (idx))),				\
+};									\
+									\
+static struct gpio_rcar_config r8a7790_gpio##idx##_platform_data = {	\
+	.gpio_base	= 32 * (idx),					\
+	.irq_base	= 0,						\
+	.number_of_pins	= 32,						\
+	.pctl_name	= "pfc-r8a7790",				\
+};									\
+
+R8A7790_GPIO(0);
+R8A7790_GPIO(1);
+R8A7790_GPIO(2);
+R8A7790_GPIO(3);
+R8A7790_GPIO(4);
+R8A7790_GPIO(5);
+
+#define r8a7790_register_gpio(idx)					\
+	platform_device_register_resndata(&platform_bus, "gpio_rcar", idx, \
+		r8a7790_gpio##idx##_resources,				\
+		ARRAY_SIZE(r8a7790_gpio##idx##_resources),		\
+		&r8a7790_gpio##idx##_platform_data,			\
+		sizeof(r8a7790_gpio##idx##_platform_data))
+
 void __init r8a7790_pinmux_init(void)
 {
 	platform_device_register_simple("pfc-r8a7790", -1, pfc_resources,
 					ARRAY_SIZE(pfc_resources));
+	r8a7790_register_gpio(0);
+	r8a7790_register_gpio(1);
+	r8a7790_register_gpio(2);
+	r8a7790_register_gpio(3);
+	r8a7790_register_gpio(4);
+	r8a7790_register_gpio(5);
 }
 
 #define SCIF_COMMON(scif_type, baseaddr, irq)			\
-- 
1.8.1.5


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

* Re: [PATCH 05/10] ARM: shmobile: r8a7790: Register GPIO devices
  2013-04-08  9:36 [PATCH 05/10] ARM: shmobile: r8a7790: Register GPIO devices Laurent Pinchart
@ 2013-04-08 12:06 ` Sergei Shtylyov
  2013-04-08 22:53 ` Laurent Pinchart
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Sergei Shtylyov @ 2013-04-08 12:06 UTC (permalink / raw)
  To: linux-sh

Hello.

On 08-04-2013 13:36, Laurent Pinchart wrote:

> Move GPIOs handling from the PFC device to separate GPIO devices.

> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>   arch/arm/mach-shmobile/setup-r8a7790.c | 35 +++++++++++++++++++++++++++++++++-
>   1 file changed, 34 insertions(+), 1 deletion(-)

> diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
> index 49de2d5..eeef5f6 100644
> --- a/arch/arm/mach-shmobile/setup-r8a7790.c
> +++ b/arch/arm/mach-shmobile/setup-r8a7790.c
[...]
> @@ -31,13 +32,45 @@
>
>   static const struct resource pfc_resources[] = {
>   	DEFINE_RES_MEM(0xe6060000, 0x250),
> -	DEFINE_RES_MEM(0xe6050000, 0x5050),
>   };
>
> +#define R8A7790_GPIO(idx)						\
> +static struct resource r8a7790_gpio##idx##_resources[] = {		\
> +	DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50),		\
> +	DEFINE_RES_IRQ(gic_spi(4 + (idx))),				\

    Aren't we supposed to abandon the use of gic_spi() for gic_iid() now?

WBR, Sergei


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

* Re: [PATCH 05/10] ARM: shmobile: r8a7790: Register GPIO devices
  2013-04-08  9:36 [PATCH 05/10] ARM: shmobile: r8a7790: Register GPIO devices Laurent Pinchart
  2013-04-08 12:06 ` Sergei Shtylyov
@ 2013-04-08 22:53 ` Laurent Pinchart
  2013-04-09  8:40 ` Simon Horman
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2013-04-08 22:53 UTC (permalink / raw)
  To: linux-sh

Hi Sergei,

On Monday 08 April 2013 16:06:59 Sergei Shtylyov wrote:
> On 08-04-2013 13:36, Laurent Pinchart wrote:
> > Move GPIOs handling from the PFC device to separate GPIO devices.
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >   arch/arm/mach-shmobile/setup-r8a7790.c | 35 +++++++++++++++++++++++++++-
> >   1 file changed, 34 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c
> > b/arch/arm/mach-shmobile/setup-r8a7790.c index 49de2d5..eeef5f6 100644
> > --- a/arch/arm/mach-shmobile/setup-r8a7790.c
> > +++ b/arch/arm/mach-shmobile/setup-r8a7790.c
> 
> [...]
> 
> > @@ -31,13 +32,45 @@
> >   static const struct resource pfc_resources[] = {
> >   	DEFINE_RES_MEM(0xe6060000, 0x250),
> > -	DEFINE_RES_MEM(0xe6050000, 0x5050),
> >   };
> > 
> > +#define R8A7790_GPIO(idx)						\
> > +static struct resource r8a7790_gpio##idx##_resources[] = {		\
> > +	DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50),		\
> > +	DEFINE_RES_IRQ(gic_spi(4 + (idx))),				\
> 
>     Aren't we supposed to abandon the use of gic_spi() for gic_iid() now?

I'll let the IRQ experts answer that. I've noticed that the index passed to 
gic_spi() matches the datasheet, and the other devices in the file use 
gic_spi(), so I went for gic_spi().

-- 
Regards,

Laurent Pinchart


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

* Re: [PATCH 05/10] ARM: shmobile: r8a7790: Register GPIO devices
  2013-04-08  9:36 [PATCH 05/10] ARM: shmobile: r8a7790: Register GPIO devices Laurent Pinchart
  2013-04-08 12:06 ` Sergei Shtylyov
  2013-04-08 22:53 ` Laurent Pinchart
@ 2013-04-09  8:40 ` Simon Horman
  2013-04-09  9:26 ` Kuninori Morimoto
  2013-04-09 12:13 ` Simon Horman
  4 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2013-04-09  8:40 UTC (permalink / raw)
  To: linux-sh

[ Cc Morimoto-san ]

On Tue, Apr 09, 2013 at 12:53:08AM +0200, Laurent Pinchart wrote:
> Hi Sergei,
> 
> On Monday 08 April 2013 16:06:59 Sergei Shtylyov wrote:
> > On 08-04-2013 13:36, Laurent Pinchart wrote:
> > > Move GPIOs handling from the PFC device to separate GPIO devices.
> > > 
> > > Signed-off-by: Laurent Pinchart
> > > <laurent.pinchart+renesas@ideasonboard.com>
> > > ---
> > > 
> > >   arch/arm/mach-shmobile/setup-r8a7790.c | 35 +++++++++++++++++++++++++++-
> > >   1 file changed, 34 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c
> > > b/arch/arm/mach-shmobile/setup-r8a7790.c index 49de2d5..eeef5f6 100644
> > > --- a/arch/arm/mach-shmobile/setup-r8a7790.c
> > > +++ b/arch/arm/mach-shmobile/setup-r8a7790.c
> > 
> > [...]
> > 
> > > @@ -31,13 +32,45 @@
> > >   static const struct resource pfc_resources[] = {
> > >   	DEFINE_RES_MEM(0xe6060000, 0x250),
> > > -	DEFINE_RES_MEM(0xe6050000, 0x5050),
> > >   };
> > > 
> > > +#define R8A7790_GPIO(idx)						\
> > > +static struct resource r8a7790_gpio##idx##_resources[] = {		\
> > > +	DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50),		\
> > > +	DEFINE_RES_IRQ(gic_spi(4 + (idx))),				\
> > 
> >     Aren't we supposed to abandon the use of gic_spi() for gic_iid() now?
> 
> I'll let the IRQ experts answer that. I've noticed that the index passed to 
> gic_spi() matches the datasheet, and the other devices in the file use 
> gic_spi(), so I went for gic_spi().

Morimoto-san, please advise.

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

* Re: [PATCH 05/10] ARM: shmobile: r8a7790: Register GPIO devices
  2013-04-08  9:36 [PATCH 05/10] ARM: shmobile: r8a7790: Register GPIO devices Laurent Pinchart
                   ` (2 preceding siblings ...)
  2013-04-09  8:40 ` Simon Horman
@ 2013-04-09  9:26 ` Kuninori Morimoto
  2013-04-09 12:13 ` Simon Horman
  4 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2013-04-09  9:26 UTC (permalink / raw)
  To: linux-sh


Hi Simon

> > > > +#define R8A7790_GPIO(idx)						\
> > > > +static struct resource r8a7790_gpio##idx##_resources[] = {		\
> > > > +	DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50),		\
> > > > +	DEFINE_RES_IRQ(gic_spi(4 + (idx))),				\
> > > 
> > >     Aren't we supposed to abandon the use of gic_spi() for gic_iid() now?
> > 
> > I'll let the IRQ experts answer that. I've noticed that the index passed to 
> > gic_spi() matches the datasheet, and the other devices in the file use 
> > gic_spi(), so I went for gic_spi().
> 
> Morimoto-san, please advise.

I can agree to Laurent.
R8A7790 datasheet is using GIC-SPI.

----
Best regards
---
Kuninori Morimoto

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

* Re: [PATCH 05/10] ARM: shmobile: r8a7790: Register GPIO devices
  2013-04-08  9:36 [PATCH 05/10] ARM: shmobile: r8a7790: Register GPIO devices Laurent Pinchart
                   ` (3 preceding siblings ...)
  2013-04-09  9:26 ` Kuninori Morimoto
@ 2013-04-09 12:13 ` Simon Horman
  4 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2013-04-09 12:13 UTC (permalink / raw)
  To: linux-sh

On 火,  4月 09, 2013 at 02:26:34午前 -0700, Kuninori Morimoto wrote:
> 
> Hi Simon
> 
> > > > > +#define R8A7790_GPIO(idx)						\
> > > > > +static struct resource r8a7790_gpio##idx##_resources[] = {		\
> > > > > +	DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50),		\
> > > > > +	DEFINE_RES_IRQ(gic_spi(4 + (idx))),				\
> > > > 
> > > >     Aren't we supposed to abandon the use of gic_spi() for gic_iid() now?
> > > 
> > > I'll let the IRQ experts answer that. I've noticed that the index passed to 
> > > gic_spi() matches the datasheet, and the other devices in the file use 
> > > gic_spi(), so I went for gic_spi().
> > 
> > Morimoto-san, please advise.
> 
> I can agree to Laurent.
> R8A7790 datasheet is using GIC-SPI.

Thanks.

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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-08  9:36 [PATCH 05/10] ARM: shmobile: r8a7790: Register GPIO devices Laurent Pinchart
2013-04-08 12:06 ` Sergei Shtylyov
2013-04-08 22:53 ` Laurent Pinchart
2013-04-09  8:40 ` Simon Horman
2013-04-09  9:26 ` Kuninori Morimoto
2013-04-09 12:13 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox