diff mbox

[2/3] ARM: shmobile: r8a7790: Configure R-Car GPIO for IRQ_TYPE_EDGE_BOTH

Message ID 1368435233-8587-3-git-send-email-horms+renesas@verge.net.au (mailing list archive)
State New, archived
Headers show

Commit Message

Simon Horman May 13, 2013, 8:53 a.m. UTC
"gpio-rcar: Support IRQ_TYPE_EDGE_BOTH" adds support to the R-Car GPIO
driver for IRQ_TYPE_EDGE_BOTH. As hardware support for this feature is
not universal for all SoCs a flag, has_both_edge_trigger, has been
added to the platform data of the driver to allow this feature to be
enabled.

As the r8a7790 SoC hardware supports this feature enable it.

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

---

This patch has a build-time dependency on
"gpio-rcar: Add support for IRQ_TYPE_EDGE_BOTH".
---
 arch/arm/mach-shmobile/setup-r8a7790.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Laurent Pinchart May 13, 2013, 10:33 p.m. UTC | #1
Hi Simon,

On Monday 13 May 2013 17:53:52 Simon Horman wrote:
> "gpio-rcar: Support IRQ_TYPE_EDGE_BOTH" adds support to the R-Car GPIO
> driver for IRQ_TYPE_EDGE_BOTH. As hardware support for this feature is
> not universal for all SoCs a flag, has_both_edge_trigger, has been
> added to the platform data of the driver to allow this feature to be
> enabled.

What about moving this information to a platform ID table in the gpio-rcar 
driver ?

> As the r8a7790 SoC hardware supports this feature enable it.
> 
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> 
> ---
> 
> This patch has a build-time dependency on
> "gpio-rcar: Add support for IRQ_TYPE_EDGE_BOTH".
> ---
>  arch/arm/mach-shmobile/setup-r8a7790.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c
> b/arch/arm/mach-shmobile/setup-r8a7790.c index eeef5f6..b461d93 100644
> --- a/arch/arm/mach-shmobile/setup-r8a7790.c
> +++ b/arch/arm/mach-shmobile/setup-r8a7790.c
> @@ -45,6 +45,7 @@ static struct gpio_rcar_config
> r8a7790_gpio##idx##_platform_data = {	\ .irq_base	= 0,						
\
>  	.number_of_pins	= 32,						\
>  	.pctl_name	= "pfc-r8a7790",				\
> +	.has_both_edge_trigger = 1,					\
>  };									\
> 
>  R8A7790_GPIO(0);
Simon Horman May 14, 2013, 2:40 a.m. UTC | #2
On Tue, May 14, 2013 at 12:33:42AM +0200, Laurent Pinchart wrote:
> Hi Simon,
> 
> On Monday 13 May 2013 17:53:52 Simon Horman wrote:
> > "gpio-rcar: Support IRQ_TYPE_EDGE_BOTH" adds support to the R-Car GPIO
> > driver for IRQ_TYPE_EDGE_BOTH. As hardware support for this feature is
> > not universal for all SoCs a flag, has_both_edge_trigger, has been
> > added to the platform data of the driver to allow this feature to be
> > enabled.
> 
> What about moving this information to a platform ID table in the gpio-rcar 
> driver ?

Magnus, do you have an opinion on this?

> > As the r8a7790 SoC hardware supports this feature enable it.
> > 
> > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > 
> > ---
> > 
> > This patch has a build-time dependency on
> > "gpio-rcar: Add support for IRQ_TYPE_EDGE_BOTH".
> > ---
> >  arch/arm/mach-shmobile/setup-r8a7790.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c
> > b/arch/arm/mach-shmobile/setup-r8a7790.c index eeef5f6..b461d93 100644
> > --- a/arch/arm/mach-shmobile/setup-r8a7790.c
> > +++ b/arch/arm/mach-shmobile/setup-r8a7790.c
> > @@ -45,6 +45,7 @@ static struct gpio_rcar_config
> > r8a7790_gpio##idx##_platform_data = {	\ .irq_base	= 0,						
> \
> >  	.number_of_pins	= 32,						\
> >  	.pctl_name	= "pfc-r8a7790",				\
> > +	.has_both_edge_trigger = 1,					\
> >  };									\
> > 
> >  R8A7790_GPIO(0);
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Magnus Damm May 14, 2013, 6:01 a.m. UTC | #3
Hi Simon, Laurent,

On Tue, May 14, 2013 at 11:40 AM, Simon Horman <horms@verge.net.au> wrote:
> On Tue, May 14, 2013 at 12:33:42AM +0200, Laurent Pinchart wrote:
>> Hi Simon,
>>
>> On Monday 13 May 2013 17:53:52 Simon Horman wrote:
>> > "gpio-rcar: Support IRQ_TYPE_EDGE_BOTH" adds support to the R-Car GPIO
>> > driver for IRQ_TYPE_EDGE_BOTH. As hardware support for this feature is
>> > not universal for all SoCs a flag, has_both_edge_trigger, has been
>> > added to the platform data of the driver to allow this feature to be
>> > enabled.
>>
>> What about moving this information to a platform ID table in the gpio-rcar
>> driver ?
>
> Magnus, do you have an opinion on this?

I don't mind so much as long as we:
a) can control things freely per driver instance
and
b) don't have to update all drivers for every new SoC

The current approach allows for that, so as an example if we can have
two slightly different GPIO hardware blocks then we can setup two GPIO
controller driver instances where the configuration can be selected
per-instance. Perhaps Laurent's proposal would allow for this too, I'm
not sure.

On top of that I'd like to avoid doing per-SoC string matching in
drivers. Those would force us to update every darn driver for every
new SoC. It is better to try to use a per-hardware device version in
the drivers and then configure each SoC to use the appropriate
version.

Thanks,

/ magnus
Laurent Pinchart May 14, 2013, 3:31 p.m. UTC | #4
Hi Magnus,

On Tuesday 14 May 2013 15:01:01 Magnus Damm wrote:
> On Tue, May 14, 2013 at 11:40 AM, Simon Horman <horms@verge.net.au> wrote:
> > On Tue, May 14, 2013 at 12:33:42AM +0200, Laurent Pinchart wrote:
> >> Hi Simon,
> >> 
> >> On Monday 13 May 2013 17:53:52 Simon Horman wrote:
> >> > "gpio-rcar: Support IRQ_TYPE_EDGE_BOTH" adds support to the R-Car GPIO
> >> > driver for IRQ_TYPE_EDGE_BOTH. As hardware support for this feature is
> >> > not universal for all SoCs a flag, has_both_edge_trigger, has been
> >> > added to the platform data of the driver to allow this feature to be
> >> > enabled.
> >> 
> >> What about moving this information to a platform ID table in the
> >> gpio-rcar driver ?
> > 
> > Magnus, do you have an opinion on this?
> 
> I don't mind so much as long as we:
> a) can control things freely per driver instance
> and
> b) don't have to update all drivers for every new SoC
> 
> The current approach allows for that, so as an example if we can have
> two slightly different GPIO hardware blocks then we can setup two GPIO
> controller driver instances where the configuration can be selected
> per-instance. Perhaps Laurent's proposal would allow for this too, I'm
> not sure.

I agree that parameters related to the instantiation of a GPIO IP core in a 
SoC should come from DT. Parameters related to the IP core version (usch as 
the ability to trigger on both edges) should in my opinion be computed by the 
GPIO driver based on the IP core version number.

> On top of that I'd like to avoid doing per-SoC string matching in drivers.
> Those would force us to update every darn driver for every new SoC. It is
> better to try to use a per-hardware device version in the drivers and then
> configure each SoC to use the appropriate version.

Agreed. Are the version numbers for the GPIO IP core available ?
diff mbox

Patch

diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index eeef5f6..b461d93 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -45,6 +45,7 @@  static struct gpio_rcar_config r8a7790_gpio##idx##_platform_data = {	\
 	.irq_base	= 0,						\
 	.number_of_pins	= 32,						\
 	.pctl_name	= "pfc-r8a7790",				\
+	.has_both_edge_trigger = 1,					\
 };									\
 
 R8A7790_GPIO(0);