diff mbox series

[v2,3/4] ARM: dts: armada-38x: Fix compatible string for gpios

Message ID 20220714183328.4137-3-pali@kernel.org (mailing list archive)
State New, archived
Headers show
Series [v2,1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms | expand

Commit Message

Pali Rohár July 14, 2022, 6:33 p.m. UTC
Armada 38x supports per CPU interrupts for gpios, like Armada XP. Pre-XP
variants like Armada 370 do not support per CPU interrupts for gpios.

So change compatible string for Armada 38x from "marvell,armada-370-gpio"
which indicates pre-XP variant to "marvell,armadaxp-gpio" which indicates
XP variant or new.

Driver gpio-mvebu.c which handles both pre-XP and XP variants already
provides support for per CPU interrupts on XP and newer variants.

Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: 7cb2acb3fbae ("ARM: dts: mvebu: Add PWM properties for armada-38x")
---
 arch/arm/boot/dts/armada-38x.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Uwe Kleine-König July 16, 2022, 2:40 p.m. UTC | #1
On Thu, Jul 14, 2022 at 08:33:27PM +0200, Pali Rohár wrote:
> Armada 38x supports per CPU interrupts for gpios, like Armada XP. Pre-XP
> variants like Armada 370 do not support per CPU interrupts for gpios.
> 
> So change compatible string for Armada 38x from "marvell,armada-370-gpio"
> which indicates pre-XP variant to "marvell,armadaxp-gpio" which indicates
> XP variant or new.
> 
> Driver gpio-mvebu.c which handles both pre-XP and XP variants already
> provides support for per CPU interrupts on XP and newer variants.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Fixes: 7cb2acb3fbae ("ARM: dts: mvebu: Add PWM properties for armada-38x")
> ---
>  arch/arm/boot/dts/armada-38x.dtsi | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
> index df3c8d1d8f64..9343de6947b3 100644
> --- a/arch/arm/boot/dts/armada-38x.dtsi
> +++ b/arch/arm/boot/dts/armada-38x.dtsi
> @@ -292,7 +292,7 @@
>  			};
>  
>  			gpio0: gpio@18100 {
> -				compatible = "marvell,armada-370-gpio",
> +				compatible = "marvell,armadaxp-gpio",
>  					     "marvell,orion-gpio";

If you can treat the XP variant as 370 and everything that is supposed
to work on 370 works then, then maybe the right incarnation is:

	compatible = "marvell,armadaxp-gpio", "marvell,armada-370-gpio", "marvell,orion-gpio";

?

Best regards
Uwe
Pali Rohár July 16, 2022, 2:50 p.m. UTC | #2
On Saturday 16 July 2022 16:40:28 Uwe Kleine-König wrote:
> On Thu, Jul 14, 2022 at 08:33:27PM +0200, Pali Rohár wrote:
> > Armada 38x supports per CPU interrupts for gpios, like Armada XP. Pre-XP
> > variants like Armada 370 do not support per CPU interrupts for gpios.
> > 
> > So change compatible string for Armada 38x from "marvell,armada-370-gpio"
> > which indicates pre-XP variant to "marvell,armadaxp-gpio" which indicates
> > XP variant or new.
> > 
> > Driver gpio-mvebu.c which handles both pre-XP and XP variants already
> > provides support for per CPU interrupts on XP and newer variants.
> > 
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > Fixes: 7cb2acb3fbae ("ARM: dts: mvebu: Add PWM properties for armada-38x")
> > ---
> >  arch/arm/boot/dts/armada-38x.dtsi | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
> > index df3c8d1d8f64..9343de6947b3 100644
> > --- a/arch/arm/boot/dts/armada-38x.dtsi
> > +++ b/arch/arm/boot/dts/armada-38x.dtsi
> > @@ -292,7 +292,7 @@
> >  			};
> >  
> >  			gpio0: gpio@18100 {
> > -				compatible = "marvell,armada-370-gpio",
> > +				compatible = "marvell,armadaxp-gpio",
> >  					     "marvell,orion-gpio";
> 
> If you can treat the XP variant as 370 and everything that is supposed
> to work on 370 works then, then maybe the right incarnation is:
> 
> 	compatible = "marvell,armadaxp-gpio", "marvell,armada-370-gpio", "marvell,orion-gpio";
> 
> ?

For pre-XP variants is "marvell,orion-gpio" enough and for XP + post-XP
is needed "marvell,armadaxp-gpio" (with possible "marvell,orion-gpio"
for backward compatibility).

So I do not see reason why to add "marvell,armada-370-gpio" nor what
value it brings.

> Best regards
> Uwe
> 
> -- 
> Pengutronix e.K.                           | Uwe Kleine-König            |
> Industrial Linux Solutions                 | https://www.pengutronix.de/ |
Uwe Kleine-König July 16, 2022, 3:07 p.m. UTC | #3
On Sat, Jul 16, 2022 at 04:50:19PM +0200, Pali Rohár wrote:
> On Saturday 16 July 2022 16:40:28 Uwe Kleine-König wrote:
> > On Thu, Jul 14, 2022 at 08:33:27PM +0200, Pali Rohár wrote:
> > > Armada 38x supports per CPU interrupts for gpios, like Armada XP. Pre-XP
> > > variants like Armada 370 do not support per CPU interrupts for gpios.
> > > 
> > > So change compatible string for Armada 38x from "marvell,armada-370-gpio"
> > > which indicates pre-XP variant to "marvell,armadaxp-gpio" which indicates
> > > XP variant or new.
> > > 
> > > Driver gpio-mvebu.c which handles both pre-XP and XP variants already
> > > provides support for per CPU interrupts on XP and newer variants.
> > > 
> > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > Fixes: 7cb2acb3fbae ("ARM: dts: mvebu: Add PWM properties for armada-38x")
> > > ---
> > >  arch/arm/boot/dts/armada-38x.dtsi | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
> > > index df3c8d1d8f64..9343de6947b3 100644
> > > --- a/arch/arm/boot/dts/armada-38x.dtsi
> > > +++ b/arch/arm/boot/dts/armada-38x.dtsi
> > > @@ -292,7 +292,7 @@
> > >  			};
> > >  
> > >  			gpio0: gpio@18100 {
> > > -				compatible = "marvell,armada-370-gpio",
> > > +				compatible = "marvell,armadaxp-gpio",
> > >  					     "marvell,orion-gpio";
> > 
> > If you can treat the XP variant as 370 and everything that is supposed
> > to work on 370 works then, then maybe the right incarnation is:
> > 
> > 	compatible = "marvell,armadaxp-gpio", "marvell,armada-370-gpio", "marvell,orion-gpio";
> > 
> > ?
> 
> For pre-XP variants is "marvell,orion-gpio" enough and for XP + post-XP
> is needed "marvell,armadaxp-gpio" (with possible "marvell,orion-gpio"
> for backward compatibility).
> 
> So I do not see reason why to add "marvell,armada-370-gpio" nor what
> value it brings.

If you boot an older kernel (i.e. one that doesn't support
marvell,armadaxp-gpio, but does support marvell,armada-370-gpio), it
will work better as there are relevant differences between
marvell,orion-gpio and marvell,armada-370-gpio. For example some
registers seem to have a different offset ...

Best regards
Uwe
Pali Rohár July 16, 2022, 4:09 p.m. UTC | #4
On Saturday 16 July 2022 17:07:51 Uwe Kleine-König wrote:
> On Sat, Jul 16, 2022 at 04:50:19PM +0200, Pali Rohár wrote:
> > On Saturday 16 July 2022 16:40:28 Uwe Kleine-König wrote:
> > > On Thu, Jul 14, 2022 at 08:33:27PM +0200, Pali Rohár wrote:
> > > > Armada 38x supports per CPU interrupts for gpios, like Armada XP. Pre-XP
> > > > variants like Armada 370 do not support per CPU interrupts for gpios.
> > > > 
> > > > So change compatible string for Armada 38x from "marvell,armada-370-gpio"
> > > > which indicates pre-XP variant to "marvell,armadaxp-gpio" which indicates
> > > > XP variant or new.
> > > > 
> > > > Driver gpio-mvebu.c which handles both pre-XP and XP variants already
> > > > provides support for per CPU interrupts on XP and newer variants.
> > > > 
> > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > > Fixes: 7cb2acb3fbae ("ARM: dts: mvebu: Add PWM properties for armada-38x")
> > > > ---
> > > >  arch/arm/boot/dts/armada-38x.dtsi | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
> > > > index df3c8d1d8f64..9343de6947b3 100644
> > > > --- a/arch/arm/boot/dts/armada-38x.dtsi
> > > > +++ b/arch/arm/boot/dts/armada-38x.dtsi
> > > > @@ -292,7 +292,7 @@
> > > >  			};
> > > >  
> > > >  			gpio0: gpio@18100 {
> > > > -				compatible = "marvell,armada-370-gpio",
> > > > +				compatible = "marvell,armadaxp-gpio",
> > > >  					     "marvell,orion-gpio";
> > > 
> > > If you can treat the XP variant as 370 and everything that is supposed
> > > to work on 370 works then, then maybe the right incarnation is:
> > > 
> > > 	compatible = "marvell,armadaxp-gpio", "marvell,armada-370-gpio", "marvell,orion-gpio";
> > > 
> > > ?
> > 
> > For pre-XP variants is "marvell,orion-gpio" enough and for XP + post-XP
> > is needed "marvell,armadaxp-gpio" (with possible "marvell,orion-gpio"
> > for backward compatibility).
> > 
> > So I do not see reason why to add "marvell,armada-370-gpio" nor what
> > value it brings.
> 
> If you boot an older kernel (i.e. one that doesn't support
> marvell,armadaxp-gpio, but does support marvell,armada-370-gpio), it

Is there such kernel version?

> will work better as there are relevant differences between
> marvell,orion-gpio and marvell,armada-370-gpio.

And if yes, do we really need this in DTS files for new kernel
versions? I can imagine that such change can be relevant for old LTS
kernel version, but not for new versions.

> For example some
> registers seem to have a different offset ...

armada-370-gpio is mapped to MVEBU_GPIO_SOC_VARIANT_ORION, so it will
get same offsets as orion-gpio. So no change.
Uwe Kleine-König July 25, 2022, 8:04 p.m. UTC | #5
Hello Pali,

On Sat, Jul 16, 2022 at 06:09:16PM +0200, Pali Rohár wrote:
> On Saturday 16 July 2022 17:07:51 Uwe Kleine-König wrote:
> > On Sat, Jul 16, 2022 at 04:50:19PM +0200, Pali Rohár wrote:
> > > On Saturday 16 July 2022 16:40:28 Uwe Kleine-König wrote:
> > > > On Thu, Jul 14, 2022 at 08:33:27PM +0200, Pali Rohár wrote:
> > > > > Armada 38x supports per CPU interrupts for gpios, like Armada XP. Pre-XP
> > > > > variants like Armada 370 do not support per CPU interrupts for gpios.
> > > > > 
> > > > > So change compatible string for Armada 38x from "marvell,armada-370-gpio"
> > > > > which indicates pre-XP variant to "marvell,armadaxp-gpio" which indicates
> > > > > XP variant or new.
> > > > > 
> > > > > Driver gpio-mvebu.c which handles both pre-XP and XP variants already
> > > > > provides support for per CPU interrupts on XP and newer variants.
> > > > > 
> > > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > > > Fixes: 7cb2acb3fbae ("ARM: dts: mvebu: Add PWM properties for armada-38x")
> > > > > ---
> > > > >  arch/arm/boot/dts/armada-38x.dtsi | 4 ++--
> > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
> > > > > index df3c8d1d8f64..9343de6947b3 100644
> > > > > --- a/arch/arm/boot/dts/armada-38x.dtsi
> > > > > +++ b/arch/arm/boot/dts/armada-38x.dtsi
> > > > > @@ -292,7 +292,7 @@
> > > > >  			};
> > > > >  
> > > > >  			gpio0: gpio@18100 {
> > > > > -				compatible = "marvell,armada-370-gpio",
> > > > > +				compatible = "marvell,armadaxp-gpio",
> > > > >  					     "marvell,orion-gpio";
> > > > 
> > > > If you can treat the XP variant as 370 and everything that is supposed
> > > > to work on 370 works then, then maybe the right incarnation is:
> > > > 
> > > > 	compatible = "marvell,armadaxp-gpio", "marvell,armada-370-gpio", "marvell,orion-gpio";
> > > > 
> > > > ?
> > > 
> > > For pre-XP variants is "marvell,orion-gpio" enough and for XP + post-XP
> > > is needed "marvell,armadaxp-gpio" (with possible "marvell,orion-gpio"
> > > for backward compatibility).
> > > 
> > > So I do not see reason why to add "marvell,armada-370-gpio" nor what
> > > value it brings.
> > 
> > If you boot an older kernel (i.e. one that doesn't support
> > marvell,armadaxp-gpio, but does support marvell,armada-370-gpio), it
> 
> Is there such kernel version?

Ah, I thought you added "marvell,armadaxp-gpio" with this patch series.

> > will work better as there are relevant differences between
> > marvell,orion-gpio and marvell,armada-370-gpio.
> 
> And if yes, do we really need this in DTS files for new kernel
> versions? I can imagine that such change can be relevant for old LTS
> kernel version, but not for new versions.
> 
> > For example some
> > registers seem to have a different offset ...
> 
> armada-370-gpio is mapped to MVEBU_GPIO_SOC_VARIANT_ORION, so it will
> get same offsets as orion-gpio. So no change.

OK, you're right, my assumptions were wrong. I'm convinced your change
is fine now:

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards
Uwe
Pali Rohár Aug. 31, 2022, 2:30 p.m. UTC | #6
On Monday 25 July 2022 22:04:17 Uwe Kleine-König wrote:
> Hello Pali,
> 
> On Sat, Jul 16, 2022 at 06:09:16PM +0200, Pali Rohár wrote:
> > On Saturday 16 July 2022 17:07:51 Uwe Kleine-König wrote:
> > > On Sat, Jul 16, 2022 at 04:50:19PM +0200, Pali Rohár wrote:
> > > > On Saturday 16 July 2022 16:40:28 Uwe Kleine-König wrote:
> > > > > On Thu, Jul 14, 2022 at 08:33:27PM +0200, Pali Rohár wrote:
> > > > > > Armada 38x supports per CPU interrupts for gpios, like Armada XP. Pre-XP
> > > > > > variants like Armada 370 do not support per CPU interrupts for gpios.
> > > > > > 
> > > > > > So change compatible string for Armada 38x from "marvell,armada-370-gpio"
> > > > > > which indicates pre-XP variant to "marvell,armadaxp-gpio" which indicates
> > > > > > XP variant or new.
> > > > > > 
> > > > > > Driver gpio-mvebu.c which handles both pre-XP and XP variants already
> > > > > > provides support for per CPU interrupts on XP and newer variants.
> > > > > > 
> > > > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > > > > Fixes: 7cb2acb3fbae ("ARM: dts: mvebu: Add PWM properties for armada-38x")
> > > > > > ---
> > > > > >  arch/arm/boot/dts/armada-38x.dtsi | 4 ++--
> > > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > > > 
> > > > > > diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
> > > > > > index df3c8d1d8f64..9343de6947b3 100644
> > > > > > --- a/arch/arm/boot/dts/armada-38x.dtsi
> > > > > > +++ b/arch/arm/boot/dts/armada-38x.dtsi
> > > > > > @@ -292,7 +292,7 @@
> > > > > >  			};
> > > > > >  
> > > > > >  			gpio0: gpio@18100 {
> > > > > > -				compatible = "marvell,armada-370-gpio",
> > > > > > +				compatible = "marvell,armadaxp-gpio",
> > > > > >  					     "marvell,orion-gpio";
> > > > > 
> > > > > If you can treat the XP variant as 370 and everything that is supposed
> > > > > to work on 370 works then, then maybe the right incarnation is:
> > > > > 
> > > > > 	compatible = "marvell,armadaxp-gpio", "marvell,armada-370-gpio", "marvell,orion-gpio";
> > > > > 
> > > > > ?
> > > > 
> > > > For pre-XP variants is "marvell,orion-gpio" enough and for XP + post-XP
> > > > is needed "marvell,armadaxp-gpio" (with possible "marvell,orion-gpio"
> > > > for backward compatibility).
> > > > 
> > > > So I do not see reason why to add "marvell,armada-370-gpio" nor what
> > > > value it brings.
> > > 
> > > If you boot an older kernel (i.e. one that doesn't support
> > > marvell,armadaxp-gpio, but does support marvell,armada-370-gpio), it
> > 
> > Is there such kernel version?
> 
> Ah, I thought you added "marvell,armadaxp-gpio" with this patch series.
> 
> > > will work better as there are relevant differences between
> > > marvell,orion-gpio and marvell,armada-370-gpio.
> > 
> > And if yes, do we really need this in DTS files for new kernel
> > versions? I can imagine that such change can be relevant for old LTS
> > kernel version, but not for new versions.
> > 
> > > For example some
> > > registers seem to have a different offset ...
> > 
> > armada-370-gpio is mapped to MVEBU_GPIO_SOC_VARIANT_ORION, so it will
> > get same offsets as orion-gpio. So no change.
> 
> OK, you're right, my assumptions were wrong. I'm convinced your change
> is fine now:
> 
> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> Best regards
> Uwe

Ok, are there any other objections with this patch series?
Pali Rohár Sept. 30, 2022, 11:34 p.m. UTC | #7
Gregory: ping

On Thursday 14 July 2022 20:33:27 Pali Rohár wrote:
> Armada 38x supports per CPU interrupts for gpios, like Armada XP. Pre-XP
> variants like Armada 370 do not support per CPU interrupts for gpios.
> 
> So change compatible string for Armada 38x from "marvell,armada-370-gpio"
> which indicates pre-XP variant to "marvell,armadaxp-gpio" which indicates
> XP variant or new.
> 
> Driver gpio-mvebu.c which handles both pre-XP and XP variants already
> provides support for per CPU interrupts on XP and newer variants.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Fixes: 7cb2acb3fbae ("ARM: dts: mvebu: Add PWM properties for armada-38x")
> ---
>  arch/arm/boot/dts/armada-38x.dtsi | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
> index df3c8d1d8f64..9343de6947b3 100644
> --- a/arch/arm/boot/dts/armada-38x.dtsi
> +++ b/arch/arm/boot/dts/armada-38x.dtsi
> @@ -292,7 +292,7 @@
>  			};
>  
>  			gpio0: gpio@18100 {
> -				compatible = "marvell,armada-370-gpio",
> +				compatible = "marvell,armadaxp-gpio",
>  					     "marvell,orion-gpio";
>  				reg = <0x18100 0x40>, <0x181c0 0x08>;
>  				reg-names = "gpio", "pwm";
> @@ -310,7 +310,7 @@
>  			};
>  
>  			gpio1: gpio@18140 {
> -				compatible = "marvell,armada-370-gpio",
> +				compatible = "marvell,armadaxp-gpio",
>  					     "marvell,orion-gpio";
>  				reg = <0x18140 0x40>, <0x181c8 0x08>;
>  				reg-names = "gpio", "pwm";
> -- 
> 2.20.1
>
Pali Rohár Oct. 9, 2022, 12:05 p.m. UTC | #8
PING

On Saturday 01 October 2022 01:34:53 Pali Rohár wrote:
> Gregory: ping
> 
> On Thursday 14 July 2022 20:33:27 Pali Rohár wrote:
> > Armada 38x supports per CPU interrupts for gpios, like Armada XP. Pre-XP
> > variants like Armada 370 do not support per CPU interrupts for gpios.
> > 
> > So change compatible string for Armada 38x from "marvell,armada-370-gpio"
> > which indicates pre-XP variant to "marvell,armadaxp-gpio" which indicates
> > XP variant or new.
> > 
> > Driver gpio-mvebu.c which handles both pre-XP and XP variants already
> > provides support for per CPU interrupts on XP and newer variants.
> > 
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > Fixes: 7cb2acb3fbae ("ARM: dts: mvebu: Add PWM properties for armada-38x")
> > ---
> >  arch/arm/boot/dts/armada-38x.dtsi | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
> > index df3c8d1d8f64..9343de6947b3 100644
> > --- a/arch/arm/boot/dts/armada-38x.dtsi
> > +++ b/arch/arm/boot/dts/armada-38x.dtsi
> > @@ -292,7 +292,7 @@
> >  			};
> >  
> >  			gpio0: gpio@18100 {
> > -				compatible = "marvell,armada-370-gpio",
> > +				compatible = "marvell,armadaxp-gpio",
> >  					     "marvell,orion-gpio";
> >  				reg = <0x18100 0x40>, <0x181c0 0x08>;
> >  				reg-names = "gpio", "pwm";
> > @@ -310,7 +310,7 @@
> >  			};
> >  
> >  			gpio1: gpio@18140 {
> > -				compatible = "marvell,armada-370-gpio",
> > +				compatible = "marvell,armadaxp-gpio",
> >  					     "marvell,orion-gpio";
> >  				reg = <0x18140 0x40>, <0x181c8 0x08>;
> >  				reg-names = "gpio", "pwm";
> > -- 
> > 2.20.1
> >
Pali Rohár Nov. 1, 2022, 10:44 p.m. UTC | #9
PING?

On Sunday 09 October 2022 14:05:58 Pali Rohár wrote:
> PING
> 
> On Saturday 01 October 2022 01:34:53 Pali Rohár wrote:
> > Gregory: ping
> > 
> > On Thursday 14 July 2022 20:33:27 Pali Rohár wrote:
> > > Armada 38x supports per CPU interrupts for gpios, like Armada XP. Pre-XP
> > > variants like Armada 370 do not support per CPU interrupts for gpios.
> > > 
> > > So change compatible string for Armada 38x from "marvell,armada-370-gpio"
> > > which indicates pre-XP variant to "marvell,armadaxp-gpio" which indicates
> > > XP variant or new.
> > > 
> > > Driver gpio-mvebu.c which handles both pre-XP and XP variants already
> > > provides support for per CPU interrupts on XP and newer variants.
> > > 
> > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > Fixes: 7cb2acb3fbae ("ARM: dts: mvebu: Add PWM properties for armada-38x")
> > > ---
> > >  arch/arm/boot/dts/armada-38x.dtsi | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
> > > index df3c8d1d8f64..9343de6947b3 100644
> > > --- a/arch/arm/boot/dts/armada-38x.dtsi
> > > +++ b/arch/arm/boot/dts/armada-38x.dtsi
> > > @@ -292,7 +292,7 @@
> > >  			};
> > >  
> > >  			gpio0: gpio@18100 {
> > > -				compatible = "marvell,armada-370-gpio",
> > > +				compatible = "marvell,armadaxp-gpio",
> > >  					     "marvell,orion-gpio";
> > >  				reg = <0x18100 0x40>, <0x181c0 0x08>;
> > >  				reg-names = "gpio", "pwm";
> > > @@ -310,7 +310,7 @@
> > >  			};
> > >  
> > >  			gpio1: gpio@18140 {
> > > -				compatible = "marvell,armada-370-gpio",
> > > +				compatible = "marvell,armadaxp-gpio",
> > >  					     "marvell,orion-gpio";
> > >  				reg = <0x18140 0x40>, <0x181c8 0x08>;
> > >  				reg-names = "gpio", "pwm";
> > > -- 
> > > 2.20.1
> > >
Gregory CLEMENT Nov. 28, 2022, 12:05 a.m. UTC | #10
Pali Rohár <pali@kernel.org> writes:

> Armada 38x supports per CPU interrupts for gpios, like Armada XP. Pre-XP
> variants like Armada 370 do not support per CPU interrupts for gpios.
>
> So change compatible string for Armada 38x from "marvell,armada-370-gpio"
> which indicates pre-XP variant to "marvell,armadaxp-gpio" which indicates
> XP variant or new.
>
> Driver gpio-mvebu.c which handles both pre-XP and XP variants already
> provides support for per CPU interrupts on XP and newer variants.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Fixes: 7cb2acb3fbae ("ARM: dts: mvebu: Add PWM properties for armada-38x")

Applied on mvebu/dt

Thanks,

Gregory
> ---
>  arch/arm/boot/dts/armada-38x.dtsi | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
> index df3c8d1d8f64..9343de6947b3 100644
> --- a/arch/arm/boot/dts/armada-38x.dtsi
> +++ b/arch/arm/boot/dts/armada-38x.dtsi
> @@ -292,7 +292,7 @@
>  			};
>  
>  			gpio0: gpio@18100 {
> -				compatible = "marvell,armada-370-gpio",
> +				compatible = "marvell,armadaxp-gpio",
>  					     "marvell,orion-gpio";
>  				reg = <0x18100 0x40>, <0x181c0 0x08>;
>  				reg-names = "gpio", "pwm";
> @@ -310,7 +310,7 @@
>  			};
>  
>  			gpio1: gpio@18140 {
> -				compatible = "marvell,armada-370-gpio",
> +				compatible = "marvell,armadaxp-gpio",
>  					     "marvell,orion-gpio";
>  				reg = <0x18140 0x40>, <0x181c8 0x08>;
>  				reg-names = "gpio", "pwm";
> -- 
> 2.20.1
>
Chris Packham Nov. 28, 2022, 8:24 p.m. UTC | #11
Hi Pali,

On 15/07/22 06:33, Pali Rohár wrote:
> Armada 38x supports per CPU interrupts for gpios, like Armada XP. Pre-XP
> variants like Armada 370 do not support per CPU interrupts for gpios.
>
> So change compatible string for Armada 38x from "marvell,armada-370-gpio"
> which indicates pre-XP variant to "marvell,armadaxp-gpio" which indicates
> XP variant or new.
>
> Driver gpio-mvebu.c which handles both pre-XP and XP variants already
> provides support for per CPU interrupts on XP and newer variants.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Fixes: 7cb2acb3fbae ("ARM: dts: mvebu: Add PWM properties for armada-38x")
> ---
>   arch/arm/boot/dts/armada-38x.dtsi | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
> index df3c8d1d8f64..9343de6947b3 100644
> --- a/arch/arm/boot/dts/armada-38x.dtsi
> +++ b/arch/arm/boot/dts/armada-38x.dtsi
> @@ -292,7 +292,7 @@
>   			};
>   
>   			gpio0: gpio@18100 {
> -				compatible = "marvell,armada-370-gpio",
> +				compatible = "marvell,armadaxp-gpio",
>   					     "marvell,orion-gpio";
>   				reg = <0x18100 0x40>, <0x181c0 0x08>;
>   				reg-names = "gpio", "pwm";

Currently when you specify the "marvell,armadaxp-gpio" compatible this 
causes the driver to expect the 2nd reg property to be the per-CPU 
interrupt registers. The code in question is

         /*
          * The Armada XP has a second range of registers for the
          * per-CPU registers
          */
         if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_ARMADAXP) {
                 base = devm_platform_ioremap_resource(pdev, 1);
                 if (IS_ERR(base))
                         return PTR_ERR(base);

                 mvchip->percpu_regs =
                         devm_regmap_init_mmio(&pdev->dev, base,
&mvebu_gpio_regmap_config);
                 if (IS_ERR(mvchip->percpu_regs))
                         return PTR_ERR(mvchip->percpu_regs);
         }

But with your code change resource[1] is pointing at the blink enable 
register not at the per-CPU interrupt register (offset 18800/18840).


> @@ -310,7 +310,7 @@
>   			};
>   
>   			gpio1: gpio@18140 {
> -				compatible = "marvell,armada-370-gpio",
> +				compatible = "marvell,armadaxp-gpio",
>   					     "marvell,orion-gpio";
>   				reg = <0x18140 0x40>, <0x181c8 0x08>;
>   				reg-names = "gpio", "pwm";
Klaus Kudielka Dec. 31, 2022, 7:18 a.m. UTC | #12
On Mon, 2022-11-28 at 01:05 +0100, Gregory CLEMENT wrote:
> Pali Rohár <pali@kernel.org> writes:
> 
> > Armada 38x supports per CPU interrupts for gpios, like Armada XP. Pre-XP
> > variants like Armada 370 do not support per CPU interrupts for gpios.
> > 
> > So change compatible string for Armada 38x from "marvell,armada-370-gpio"
> > which indicates pre-XP variant to "marvell,armadaxp-gpio" which indicates
> > XP variant or new.
> > 
> > Driver gpio-mvebu.c which handles both pre-XP and XP variants already
> > provides support for per CPU interrupts on XP and newer variants.
> > 
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > Fixes: 7cb2acb3fbae ("ARM: dts: mvebu: Add PWM properties for armada-38x")
> 
> Applied on mvebu/dt
> 
> Thanks,
> 
> Gregory

This patch made it into mainline, but unfortunately broke gpio interrupts on
Turris Omnia (Armada 385), with rather bad consequences. I have submitted a
regression report.

Link: https://lore.kernel.org/r/f24474e70c1a4e9692bd596ef6d97ceda9511245.camel@gmail.com/

I am happy to test potential fixes. The trivial one (getting the "reg"
properties right, as stated by Chris Packham) doesn't work, either.

A revert would solve the problem on the Omnia, for the time being.

Regards, Klaus

> > ---
> >  arch/arm/boot/dts/armada-38x.dtsi | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
> > index df3c8d1d8f64..9343de6947b3 100644
> > --- a/arch/arm/boot/dts/armada-38x.dtsi
> > +++ b/arch/arm/boot/dts/armada-38x.dtsi
> > @@ -292,7 +292,7 @@
> >                         };
> >  
> >                         gpio0: gpio@18100 {
> > -                               compatible = "marvell,armada-370-gpio",
> > +                               compatible = "marvell,armadaxp-gpio",
> >                                              "marvell,orion-gpio";
> >                                 reg = <0x18100 0x40>, <0x181c0 0x08>;
> >                                 reg-names = "gpio", "pwm";
> > @@ -310,7 +310,7 @@
> >                         };
> >  
> >                         gpio1: gpio@18140 {
> > -                               compatible = "marvell,armada-370-gpio",
> > +                               compatible = "marvell,armadaxp-gpio",
> >                                              "marvell,orion-gpio";
> >                                 reg = <0x18140 0x40>, <0x181c8 0x08>;
> >                                 reg-names = "gpio", "pwm";
> > -- 
> > 2.20.1
> > 
>
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
index df3c8d1d8f64..9343de6947b3 100644
--- a/arch/arm/boot/dts/armada-38x.dtsi
+++ b/arch/arm/boot/dts/armada-38x.dtsi
@@ -292,7 +292,7 @@ 
 			};
 
 			gpio0: gpio@18100 {
-				compatible = "marvell,armada-370-gpio",
+				compatible = "marvell,armadaxp-gpio",
 					     "marvell,orion-gpio";
 				reg = <0x18100 0x40>, <0x181c0 0x08>;
 				reg-names = "gpio", "pwm";
@@ -310,7 +310,7 @@ 
 			};
 
 			gpio1: gpio@18140 {
-				compatible = "marvell,armada-370-gpio",
+				compatible = "marvell,armadaxp-gpio",
 					     "marvell,orion-gpio";
 				reg = <0x18140 0x40>, <0x181c8 0x08>;
 				reg-names = "gpio", "pwm";