linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms
@ 2022-07-14 11:55 Pali Rohár
  2022-07-14 11:55 ` [PATCH 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x Pali Rohár
                   ` (5 more replies)
  0 siblings, 6 replies; 26+ messages in thread
From: Pali Rohár @ 2022-07-14 11:55 UTC (permalink / raw)
  To: Thierry Reding, Uwe Kleine-König, Lee Jones, Linus Walleij,
	Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
	Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
	Marek Behún
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

pwm support incompatible with Armada 80x0/70x0 API is not only in
Armada 370, but also in Armada XP, 38x and 39x. So basically every non-A8K
platform. Fix check for pwm support appropriately.

Fixes: 85b7d8abfec7 ("gpio: mvebu: add pwm support for Armada 8K/7K")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/gpio/gpio-mvebu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 2db19cd640a4..70a22b68c034 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -793,8 +793,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
 	u32 offset;
 	u32 set;
 
-	if (of_device_is_compatible(mvchip->chip.of_node,
-				    "marvell,armada-370-gpio")) {
+	if (mvchip->soc_variant != MVEBU_GPIO_SOC_VARIANT_A8K) {
 		/*
 		 * There are only two sets of PWM configuration registers for
 		 * all the GPIO lines on those SoCs which this driver reserves
-- 
2.20.1


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

* [PATCH 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x
  2022-07-14 11:55 [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Pali Rohár
@ 2022-07-14 11:55 ` Pali Rohár
  2022-07-14 11:55 ` [PATCH 3/4] ARM: dts: armada-38x: Fix compatible string for gpios Pali Rohár
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 26+ messages in thread
From: Pali Rohár @ 2022-07-14 11:55 UTC (permalink / raw)
  To: Thierry Reding, Uwe Kleine-König, Lee Jones, Linus Walleij,
	Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
	Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
	Marek Behún
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

Armada 38x and Armada 39x should use compatible string "marvel,armadaxp-gpio".

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 Documentation/devicetree/bindings/gpio/gpio-mvebu.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt b/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt
index 0fc6700ed800..3bc8f5caf328 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt
@@ -10,7 +10,7 @@ Required properties:
     should be used for the Discovery MV78200.
 
     "marvel,armadaxp-gpio" should be used for all Armada XP SoCs
-    (MV78230, MV78260, MV78460).
+    (MV78230, MV78260, MV78460), Armada 38x and Armada 39x.
 
     "marvell,armada-8k-gpio" should be used for the Armada 7K and 8K
     SoCs (either from AP or CP), see
-- 
2.20.1


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

* [PATCH 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
  2022-07-14 11:55 [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Pali Rohár
  2022-07-14 11:55 ` [PATCH 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x Pali Rohár
@ 2022-07-14 11:55 ` Pali Rohár
  2022-07-14 11:55 ` [PATCH 4/4] ARM: dts: armada-39x: " Pali Rohár
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 26+ messages in thread
From: Pali Rohár @ 2022-07-14 11:55 UTC (permalink / raw)
  To: Thierry Reding, Uwe Kleine-König, Lee Jones, Linus Walleij,
	Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
	Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
	Marek Behún
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

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


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

* [PATCH 4/4] ARM: dts: armada-39x: Fix compatible string for gpios
  2022-07-14 11:55 [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Pali Rohár
  2022-07-14 11:55 ` [PATCH 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x Pali Rohár
  2022-07-14 11:55 ` [PATCH 3/4] ARM: dts: armada-38x: Fix compatible string for gpios Pali Rohár
@ 2022-07-14 11:55 ` Pali Rohár
  2022-07-14 13:14 ` [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Baruch Siach
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 26+ messages in thread
From: Pali Rohár @ 2022-07-14 11:55 UTC (permalink / raw)
  To: Thierry Reding, Uwe Kleine-König, Lee Jones, Linus Walleij,
	Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
	Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
	Marek Behún
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

Armada 39x supports per CPU interrupts for gpios, like Armada XP.

So add compatible string "marvell,armadaxp-gpio" for Armada 39x GPIO nodes.

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: d81a914fc630 ("ARM: dts: mvebu: armada-39x: add missing nodes describing GPIO's")
---
 arch/arm/boot/dts/armada-39x.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/armada-39x.dtsi b/arch/arm/boot/dts/armada-39x.dtsi
index e0b7c2099831..ef3a3859802c 100644
--- a/arch/arm/boot/dts/armada-39x.dtsi
+++ b/arch/arm/boot/dts/armada-39x.dtsi
@@ -213,7 +213,7 @@
 			};
 
 			gpio0: gpio@18100 {
-				compatible = "marvell,orion-gpio";
+				compatible = "marvell,armadaxp-gpio", "marvell,orion-gpio";
 				reg = <0x18100 0x40>;
 				ngpios = <32>;
 				gpio-controller;
@@ -227,7 +227,7 @@
 			};
 
 			gpio1: gpio@18140 {
-				compatible = "marvell,orion-gpio";
+				compatible = "marvell,armadaxp-gpio", "marvell,orion-gpio";
 				reg = <0x18140 0x40>;
 				ngpios = <28>;
 				gpio-controller;
-- 
2.20.1


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

* Re: [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms
  2022-07-14 11:55 [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Pali Rohár
                   ` (2 preceding siblings ...)
  2022-07-14 11:55 ` [PATCH 4/4] ARM: dts: armada-39x: " Pali Rohár
@ 2022-07-14 13:14 ` Baruch Siach
  2022-07-14 13:19 ` Andrew Lunn
  2022-07-14 18:33 ` [PATCH v2 " Pali Rohár
  5 siblings, 0 replies; 26+ messages in thread
From: Baruch Siach @ 2022-07-14 13:14 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Thierry Reding, Uwe Kleine-König, Lee Jones, Linus Walleij,
	Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
	Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
	Marek Behún, linux-pwm, linux-gpio, devicetree,
	linux-kernel, linux-arm-kernel

Hi Pali,

On Thu, Jul 14 2022, Pali Rohár wrote:
> pwm support incompatible with Armada 80x0/70x0 API is not only in
> Armada 370, but also in Armada XP, 38x and 39x. So basically every non-A8K
> platform. Fix check for pwm support appropriately.
>
> Fixes: 85b7d8abfec7 ("gpio: mvebu: add pwm support for Armada 8K/7K")
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  drivers/gpio/gpio-mvebu.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
> index 2db19cd640a4..70a22b68c034 100644
> --- a/drivers/gpio/gpio-mvebu.c
> +++ b/drivers/gpio/gpio-mvebu.c
> @@ -793,8 +793,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
>  	u32 offset;
>  	u32 set;
>  
> -	if (of_device_is_compatible(mvchip->chip.of_node,
> -				    "marvell,armada-370-gpio")) {
> +	if (mvchip->soc_variant != MVEBU_GPIO_SOC_VARIANT_A8K) {

The 'if' condition that follow the 'else' below become always true:

       } else if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) {

I would suggest to keep the '== MVEBU_GPIO_SOC_VARIANT_A8K' condition,
and reverse the if/else order, because positive logic is more readable.

There is also another 'else' below that is dead code with this patch.

baruch

>  		/*
>  		 * There are only two sets of PWM configuration registers for
>  		 * all the GPIO lines on those SoCs which this driver reserves


-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

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

* Re: [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms
  2022-07-14 11:55 [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Pali Rohár
                   ` (3 preceding siblings ...)
  2022-07-14 13:14 ` [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Baruch Siach
@ 2022-07-14 13:19 ` Andrew Lunn
  2022-07-14 18:33 ` [PATCH v2 " Pali Rohár
  5 siblings, 0 replies; 26+ messages in thread
From: Andrew Lunn @ 2022-07-14 13:19 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Thierry Reding, Uwe Kleine-König, Lee Jones, Linus Walleij,
	Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
	Gregory Clement, Sebastian Hesselbarth, Marek Behún,
	linux-pwm, linux-gpio, devicetree, linux-kernel,
	linux-arm-kernel

On Thu, Jul 14, 2022 at 01:55:12PM +0200, Pali Rohár wrote:
> pwm support incompatible with Armada 80x0/70x0 API is not only in
> Armada 370, but also in Armada XP, 38x and 39x. So basically every non-A8K
> platform. Fix check for pwm support appropriately.
> 
> Fixes: 85b7d8abfec7 ("gpio: mvebu: add pwm support for Armada 8K/7K")
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  drivers/gpio/gpio-mvebu.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
> index 2db19cd640a4..70a22b68c034 100644
> --- a/drivers/gpio/gpio-mvebu.c
> +++ b/drivers/gpio/gpio-mvebu.c
> @@ -793,8 +793,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
>  	u32 offset;
>  	u32 set;
>  
> -	if (of_device_is_compatible(mvchip->chip.of_node,
> -				    "marvell,armada-370-gpio")) {
> +	if (mvchip->soc_variant != MVEBU_GPIO_SOC_VARIANT_A8K) {
>  		/*
>  		 * There are only two sets of PWM configuration registers for
>  		 * all the GPIO lines on those SoCs which this driver reserves

The current code is:

        if (of_device_is_compatible(mvchip->chip.of_node,
                                    "marvell,armada-370-gpio")) {
                /*
                 * There are only two sets of PWM configuration registers for
                 * all the GPIO lines on those SoCs which this driver reserves
                 * for the first two GPIO chips. So if the resource is missing
                 * we can't treat it as an error.
                 */
                if (!platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm"))
                        return 0;
                offset = 0;
        } else if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) {
                int ret = of_property_read_u32(dev->of_node,
                                               "marvell,pwm-offset", &offset);
                if (ret < 0)
                        return 0;
        } else {
                return 0;
        }

With your change, don't we end up with:

	if (foo)
	    .....
	else if (!foo)
	    .....
	else
	    .....

The static analysers are going to complain about this.

    Andrew

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

* [PATCH v2 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms
  2022-07-14 11:55 [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Pali Rohár
                   ` (4 preceding siblings ...)
  2022-07-14 13:19 ` Andrew Lunn
@ 2022-07-14 18:33 ` Pali Rohár
  2022-07-14 18:33   ` [PATCH v2 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x Pali Rohár
                     ` (4 more replies)
  5 siblings, 5 replies; 26+ messages in thread
From: Pali Rohár @ 2022-07-14 18:33 UTC (permalink / raw)
  To: Thierry Reding, Uwe Kleine-König, Lee Jones, Linus Walleij,
	Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
	Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
	Marek Behún
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

pwm support incompatible with Armada 80x0/70x0 API is not only in
Armada 370, but also in Armada XP, 38x and 39x. So basically every non-A8K
platform. Fix check for pwm support appropriately.

Fixes: 85b7d8abfec7 ("gpio: mvebu: add pwm support for Armada 8K/7K")
Signed-off-by: Pali Rohár <pali@kernel.org>

---
Changes in v2:
* reverse the if/else order per Baruch request
---
 drivers/gpio/gpio-mvebu.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
index 2db19cd640a4..de1e7a1a76f2 100644
--- a/drivers/gpio/gpio-mvebu.c
+++ b/drivers/gpio/gpio-mvebu.c
@@ -793,8 +793,12 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
 	u32 offset;
 	u32 set;
 
-	if (of_device_is_compatible(mvchip->chip.of_node,
-				    "marvell,armada-370-gpio")) {
+	if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) {
+		int ret = of_property_read_u32(dev->of_node,
+					       "marvell,pwm-offset", &offset);
+		if (ret < 0)
+			return 0;
+	} else {
 		/*
 		 * There are only two sets of PWM configuration registers for
 		 * all the GPIO lines on those SoCs which this driver reserves
@@ -804,13 +808,6 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
 		if (!platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm"))
 			return 0;
 		offset = 0;
-	} else if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) {
-		int ret = of_property_read_u32(dev->of_node,
-					       "marvell,pwm-offset", &offset);
-		if (ret < 0)
-			return 0;
-	} else {
-		return 0;
 	}
 
 	if (IS_ERR(mvchip->clk))
-- 
2.20.1


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

* [PATCH v2 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x
  2022-07-14 18:33 ` [PATCH v2 " Pali Rohár
@ 2022-07-14 18:33   ` Pali Rohár
  2022-07-18 21:18     ` Rob Herring
  2022-07-14 18:33   ` [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios Pali Rohár
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 26+ messages in thread
From: Pali Rohár @ 2022-07-14 18:33 UTC (permalink / raw)
  To: Thierry Reding, Uwe Kleine-König, Lee Jones, Linus Walleij,
	Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
	Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
	Marek Behún
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

Armada 38x and Armada 39x should use compatible string "marvel,armadaxp-gpio".

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 Documentation/devicetree/bindings/gpio/gpio-mvebu.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt b/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt
index 0fc6700ed800..3bc8f5caf328 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-mvebu.txt
@@ -10,7 +10,7 @@ Required properties:
     should be used for the Discovery MV78200.
 
     "marvel,armadaxp-gpio" should be used for all Armada XP SoCs
-    (MV78230, MV78260, MV78460).
+    (MV78230, MV78260, MV78460), Armada 38x and Armada 39x.
 
     "marvell,armada-8k-gpio" should be used for the Armada 7K and 8K
     SoCs (either from AP or CP), see
-- 
2.20.1


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

* [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
  2022-07-14 18:33 ` [PATCH v2 " Pali Rohár
  2022-07-14 18:33   ` [PATCH v2 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x Pali Rohár
@ 2022-07-14 18:33   ` Pali Rohár
  2022-07-16 14:40     ` Uwe Kleine-König
                       ` (3 more replies)
  2022-07-14 18:33   ` [PATCH v2 4/4] ARM: dts: armada-39x: " Pali Rohár
                     ` (2 subsequent siblings)
  4 siblings, 4 replies; 26+ messages in thread
From: Pali Rohár @ 2022-07-14 18:33 UTC (permalink / raw)
  To: Thierry Reding, Uwe Kleine-König, Lee Jones, Linus Walleij,
	Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
	Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
	Marek Behún
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

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


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

* [PATCH v2 4/4] ARM: dts: armada-39x: Fix compatible string for gpios
  2022-07-14 18:33 ` [PATCH v2 " Pali Rohár
  2022-07-14 18:33   ` [PATCH v2 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x Pali Rohár
  2022-07-14 18:33   ` [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios Pali Rohár
@ 2022-07-14 18:33   ` Pali Rohár
  2022-11-28  0:05     ` Gregory CLEMENT
  2022-09-24 10:34   ` [PATCH v2 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Pali Rohár
  2022-09-26  7:20   ` Bartosz Golaszewski
  4 siblings, 1 reply; 26+ messages in thread
From: Pali Rohár @ 2022-07-14 18:33 UTC (permalink / raw)
  To: Thierry Reding, Uwe Kleine-König, Lee Jones, Linus Walleij,
	Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
	Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
	Marek Behún
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

Armada 39x supports per CPU interrupts for gpios, like Armada XP.

So add compatible string "marvell,armadaxp-gpio" for Armada 39x GPIO nodes.

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: d81a914fc630 ("ARM: dts: mvebu: armada-39x: add missing nodes describing GPIO's")
---
 arch/arm/boot/dts/armada-39x.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/armada-39x.dtsi b/arch/arm/boot/dts/armada-39x.dtsi
index e0b7c2099831..ef3a3859802c 100644
--- a/arch/arm/boot/dts/armada-39x.dtsi
+++ b/arch/arm/boot/dts/armada-39x.dtsi
@@ -213,7 +213,7 @@
 			};
 
 			gpio0: gpio@18100 {
-				compatible = "marvell,orion-gpio";
+				compatible = "marvell,armadaxp-gpio", "marvell,orion-gpio";
 				reg = <0x18100 0x40>;
 				ngpios = <32>;
 				gpio-controller;
@@ -227,7 +227,7 @@
 			};
 
 			gpio1: gpio@18140 {
-				compatible = "marvell,orion-gpio";
+				compatible = "marvell,armadaxp-gpio", "marvell,orion-gpio";
 				reg = <0x18140 0x40>;
 				ngpios = <28>;
 				gpio-controller;
-- 
2.20.1


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

* Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
  2022-07-14 18:33   ` [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios Pali Rohár
@ 2022-07-16 14:40     ` Uwe Kleine-König
  2022-07-16 14:50       ` Pali Rohár
  2022-09-30 23:34     ` Pali Rohár
                       ` (2 subsequent siblings)
  3 siblings, 1 reply; 26+ messages in thread
From: Uwe Kleine-König @ 2022-07-16 14:40 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Thierry Reding, Lee Jones, Linus Walleij, Bartosz Golaszewski,
	Rob Herring, Krzysztof Kozlowski, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Marek Behún, linux-pwm, linux-gpio,
	devicetree, linux-kernel, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 1600 bytes --]

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

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
  2022-07-16 14:40     ` Uwe Kleine-König
@ 2022-07-16 14:50       ` Pali Rohár
  2022-07-16 15:07         ` Uwe Kleine-König
  0 siblings, 1 reply; 26+ messages in thread
From: Pali Rohár @ 2022-07-16 14:50 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, Lee Jones, Linus Walleij, Bartosz Golaszewski,
	Rob Herring, Krzysztof Kozlowski, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Marek Behún, linux-pwm, linux-gpio,
	devicetree, linux-kernel, linux-arm-kernel

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/ |



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

* Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
  2022-07-16 14:50       ` Pali Rohár
@ 2022-07-16 15:07         ` Uwe Kleine-König
  2022-07-16 16:09           ` Pali Rohár
  0 siblings, 1 reply; 26+ messages in thread
From: Uwe Kleine-König @ 2022-07-16 15:07 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Thierry Reding, Lee Jones, Linus Walleij, Bartosz Golaszewski,
	Rob Herring, Krzysztof Kozlowski, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Marek Behún, linux-pwm, linux-gpio,
	devicetree, linux-kernel, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 2447 bytes --]

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

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
  2022-07-16 15:07         ` Uwe Kleine-König
@ 2022-07-16 16:09           ` Pali Rohár
  2022-07-25 20:04             ` Uwe Kleine-König
  0 siblings, 1 reply; 26+ messages in thread
From: Pali Rohár @ 2022-07-16 16:09 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, Lee Jones, Linus Walleij, Bartosz Golaszewski,
	Rob Herring, Krzysztof Kozlowski, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Marek Behún, linux-pwm, linux-gpio,
	devicetree, linux-kernel, linux-arm-kernel

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.

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

* Re: [PATCH v2 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x
  2022-07-14 18:33   ` [PATCH v2 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x Pali Rohár
@ 2022-07-18 21:18     ` Rob Herring
  0 siblings, 0 replies; 26+ messages in thread
From: Rob Herring @ 2022-07-18 21:18 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Linus Walleij, Krzysztof Kozlowski, Andrew Lunn, Thierry Reding,
	Sebastian Hesselbarth, Rob Herring, Marek Behún, devicetree,
	Gregory Clement, Uwe Kleine-König, linux-gpio, Lee Jones,
	Bartosz Golaszewski, linux-arm-kernel, linux-pwm, linux-kernel

On Thu, 14 Jul 2022 20:33:26 +0200, Pali Rohár wrote:
> Armada 38x and Armada 39x should use compatible string "marvel,armadaxp-gpio".
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  Documentation/devicetree/bindings/gpio/gpio-mvebu.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
  2022-07-16 16:09           ` Pali Rohár
@ 2022-07-25 20:04             ` Uwe Kleine-König
  2022-08-31 14:30               ` Pali Rohár
  0 siblings, 1 reply; 26+ messages in thread
From: Uwe Kleine-König @ 2022-07-25 20:04 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Thierry Reding, Lee Jones, Linus Walleij, Bartosz Golaszewski,
	Rob Herring, Krzysztof Kozlowski, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Marek Behún, linux-pwm, linux-gpio,
	devicetree, linux-kernel, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 3371 bytes --]

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

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
  2022-07-25 20:04             ` Uwe Kleine-König
@ 2022-08-31 14:30               ` Pali Rohár
  0 siblings, 0 replies; 26+ messages in thread
From: Pali Rohár @ 2022-08-31 14:30 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Thierry Reding, Lee Jones, Linus Walleij, Bartosz Golaszewski,
	Rob Herring, Krzysztof Kozlowski, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Marek Behún, linux-pwm, linux-gpio,
	devicetree, linux-kernel, linux-arm-kernel

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?

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

* Re: [PATCH v2 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms
  2022-07-14 18:33 ` [PATCH v2 " Pali Rohár
                     ` (2 preceding siblings ...)
  2022-07-14 18:33   ` [PATCH v2 4/4] ARM: dts: armada-39x: " Pali Rohár
@ 2022-09-24 10:34   ` Pali Rohár
  2022-09-26  7:20   ` Bartosz Golaszewski
  4 siblings, 0 replies; 26+ messages in thread
From: Pali Rohár @ 2022-09-24 10:34 UTC (permalink / raw)
  To: Thierry Reding, Uwe Kleine-König, Lee Jones, Linus Walleij,
	Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
	Andrew Lunn, Gregory Clement, Sebastian Hesselbarth,
	Marek Behún
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

PING?

On Thursday 14 July 2022 20:33:25 Pali Rohár wrote:
> pwm support incompatible with Armada 80x0/70x0 API is not only in
> Armada 370, but also in Armada XP, 38x and 39x. So basically every non-A8K
> platform. Fix check for pwm support appropriately.
> 
> Fixes: 85b7d8abfec7 ("gpio: mvebu: add pwm support for Armada 8K/7K")
> Signed-off-by: Pali Rohár <pali@kernel.org>
> 
> ---
> Changes in v2:
> * reverse the if/else order per Baruch request
> ---
>  drivers/gpio/gpio-mvebu.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c
> index 2db19cd640a4..de1e7a1a76f2 100644
> --- a/drivers/gpio/gpio-mvebu.c
> +++ b/drivers/gpio/gpio-mvebu.c
> @@ -793,8 +793,12 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
>  	u32 offset;
>  	u32 set;
>  
> -	if (of_device_is_compatible(mvchip->chip.of_node,
> -				    "marvell,armada-370-gpio")) {
> +	if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) {
> +		int ret = of_property_read_u32(dev->of_node,
> +					       "marvell,pwm-offset", &offset);
> +		if (ret < 0)
> +			return 0;
> +	} else {
>  		/*
>  		 * There are only two sets of PWM configuration registers for
>  		 * all the GPIO lines on those SoCs which this driver reserves
> @@ -804,13 +808,6 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
>  		if (!platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm"))
>  			return 0;
>  		offset = 0;
> -	} else if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K) {
> -		int ret = of_property_read_u32(dev->of_node,
> -					       "marvell,pwm-offset", &offset);
> -		if (ret < 0)
> -			return 0;
> -	} else {
> -		return 0;
>  	}
>  
>  	if (IS_ERR(mvchip->clk))
> -- 
> 2.20.1
> 

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

* Re: [PATCH v2 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms
  2022-07-14 18:33 ` [PATCH v2 " Pali Rohár
                     ` (3 preceding siblings ...)
  2022-09-24 10:34   ` [PATCH v2 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Pali Rohár
@ 2022-09-26  7:20   ` Bartosz Golaszewski
  4 siblings, 0 replies; 26+ messages in thread
From: Bartosz Golaszewski @ 2022-09-26  7:20 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Thierry Reding, Uwe Kleine-König, Lee Jones, Linus Walleij,
	Rob Herring, Krzysztof Kozlowski, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Marek Behún, linux-pwm, linux-gpio,
	devicetree, linux-kernel, linux-arm-kernel

On Thu, Jul 14, 2022 at 8:33 PM Pali Rohár <pali@kernel.org> wrote:
>
> pwm support incompatible with Armada 80x0/70x0 API is not only in
> Armada 370, but also in Armada XP, 38x and 39x. So basically every non-A8K
> platform. Fix check for pwm support appropriately.
>
> Fixes: 85b7d8abfec7 ("gpio: mvebu: add pwm support for Armada 8K/7K")
> Signed-off-by: Pali Rohár <pali@kernel.org>
>
> ---
> Changes in v2:
> * reverse the if/else order per Baruch request

Applied, thanks!

Bart

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

* Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
  2022-07-14 18:33   ` [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios Pali Rohár
  2022-07-16 14:40     ` Uwe Kleine-König
@ 2022-09-30 23:34     ` Pali Rohár
  2022-10-09 12:05       ` Pali Rohár
  2022-11-28  0:05     ` Gregory CLEMENT
  2022-11-28 20:24     ` Chris Packham
  3 siblings, 1 reply; 26+ messages in thread
From: Pali Rohár @ 2022-09-30 23:34 UTC (permalink / raw)
  To: Gregory Clement
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

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
> 

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

* Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
  2022-09-30 23:34     ` Pali Rohár
@ 2022-10-09 12:05       ` Pali Rohár
  2022-11-01 22:44         ` Pali Rohár
  0 siblings, 1 reply; 26+ messages in thread
From: Pali Rohár @ 2022-10-09 12:05 UTC (permalink / raw)
  To: Gregory Clement
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

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

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

* Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
  2022-10-09 12:05       ` Pali Rohár
@ 2022-11-01 22:44         ` Pali Rohár
  0 siblings, 0 replies; 26+ messages in thread
From: Pali Rohár @ 2022-11-01 22:44 UTC (permalink / raw)
  To: Gregory Clement
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

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

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

* Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
  2022-07-14 18:33   ` [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios Pali Rohár
  2022-07-16 14:40     ` Uwe Kleine-König
  2022-09-30 23:34     ` Pali Rohár
@ 2022-11-28  0:05     ` Gregory CLEMENT
  2022-12-31  7:18       ` Klaus Kudielka
  2022-11-28 20:24     ` Chris Packham
  3 siblings, 1 reply; 26+ messages in thread
From: Gregory CLEMENT @ 2022-11-28  0:05 UTC (permalink / raw)
  To: Pali Rohár, Thierry Reding, Uwe Kleine-König,
	Lee Jones, Linus Walleij, Bartosz Golaszewski, Rob Herring,
	Krzysztof Kozlowski, Andrew Lunn, Sebastian Hesselbarth,
	Marek Behún
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

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
>

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

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

* Re: [PATCH v2 4/4] ARM: dts: armada-39x: Fix compatible string for gpios
  2022-07-14 18:33   ` [PATCH v2 4/4] ARM: dts: armada-39x: " Pali Rohár
@ 2022-11-28  0:05     ` Gregory CLEMENT
  0 siblings, 0 replies; 26+ messages in thread
From: Gregory CLEMENT @ 2022-11-28  0:05 UTC (permalink / raw)
  To: Pali Rohár, Thierry Reding, Uwe Kleine-König,
	Lee Jones, Linus Walleij, Bartosz Golaszewski, Rob Herring,
	Krzysztof Kozlowski, Andrew Lunn, Sebastian Hesselbarth,
	Marek Behún
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

Pali Rohár <pali@kernel.org> writes:

> Armada 39x supports per CPU interrupts for gpios, like Armada XP.
>
> So add compatible string "marvell,armadaxp-gpio" for Armada 39x GPIO nodes.
>
> 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: d81a914fc630 ("ARM: dts: mvebu: armada-39x: add missing nodes describing GPIO's")

Applied on mvebu/dt

Thanks,

Gregory
> ---
>  arch/arm/boot/dts/armada-39x.dtsi | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/boot/dts/armada-39x.dtsi b/arch/arm/boot/dts/armada-39x.dtsi
> index e0b7c2099831..ef3a3859802c 100644
> --- a/arch/arm/boot/dts/armada-39x.dtsi
> +++ b/arch/arm/boot/dts/armada-39x.dtsi
> @@ -213,7 +213,7 @@
>  			};
>  
>  			gpio0: gpio@18100 {
> -				compatible = "marvell,orion-gpio";
> +				compatible = "marvell,armadaxp-gpio", "marvell,orion-gpio";
>  				reg = <0x18100 0x40>;
>  				ngpios = <32>;
>  				gpio-controller;
> @@ -227,7 +227,7 @@
>  			};
>  
>  			gpio1: gpio@18140 {
> -				compatible = "marvell,orion-gpio";
> +				compatible = "marvell,armadaxp-gpio", "marvell,orion-gpio";
>  				reg = <0x18140 0x40>;
>  				ngpios = <28>;
>  				gpio-controller;
> -- 
> 2.20.1
>

-- 
Gregory Clement, Bootlin
Embedded Linux and Kernel engineering
http://bootlin.com

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

* Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
  2022-07-14 18:33   ` [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios Pali Rohár
                       ` (2 preceding siblings ...)
  2022-11-28  0:05     ` Gregory CLEMENT
@ 2022-11-28 20:24     ` Chris Packham
  3 siblings, 0 replies; 26+ messages in thread
From: Chris Packham @ 2022-11-28 20:24 UTC (permalink / raw)
  To: Pali Rohár, Thierry Reding, Uwe Kleine-König,
	Lee Jones, Linus Walleij, Bartosz Golaszewski, Rob Herring,
	Krzysztof Kozlowski, Andrew Lunn, Gregory Clement,
	Sebastian Hesselbarth, Marek Behún
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

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";

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

* Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
  2022-11-28  0:05     ` Gregory CLEMENT
@ 2022-12-31  7:18       ` Klaus Kudielka
  0 siblings, 0 replies; 26+ messages in thread
From: Klaus Kudielka @ 2022-12-31  7:18 UTC (permalink / raw)
  To: Gregory CLEMENT, Pali Rohár, Thierry Reding,
	Uwe Kleine-König, Lee Jones, Linus Walleij,
	Bartosz Golaszewski, Rob Herring, Krzysztof Kozlowski,
	Andrew Lunn, Sebastian Hesselbarth, Marek Behún
  Cc: linux-pwm, linux-gpio, devicetree, linux-kernel, linux-arm-kernel

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


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

end of thread, other threads:[~2022-12-31  7:18 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14 11:55 [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Pali Rohár
2022-07-14 11:55 ` [PATCH 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x Pali Rohár
2022-07-14 11:55 ` [PATCH 3/4] ARM: dts: armada-38x: Fix compatible string for gpios Pali Rohár
2022-07-14 11:55 ` [PATCH 4/4] ARM: dts: armada-39x: " Pali Rohár
2022-07-14 13:14 ` [PATCH 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Baruch Siach
2022-07-14 13:19 ` Andrew Lunn
2022-07-14 18:33 ` [PATCH v2 " Pali Rohár
2022-07-14 18:33   ` [PATCH v2 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x Pali Rohár
2022-07-18 21:18     ` Rob Herring
2022-07-14 18:33   ` [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios Pali Rohár
2022-07-16 14:40     ` Uwe Kleine-König
2022-07-16 14:50       ` Pali Rohár
2022-07-16 15:07         ` Uwe Kleine-König
2022-07-16 16:09           ` Pali Rohár
2022-07-25 20:04             ` Uwe Kleine-König
2022-08-31 14:30               ` Pali Rohár
2022-09-30 23:34     ` Pali Rohár
2022-10-09 12:05       ` Pali Rohár
2022-11-01 22:44         ` Pali Rohár
2022-11-28  0:05     ` Gregory CLEMENT
2022-12-31  7:18       ` Klaus Kudielka
2022-11-28 20:24     ` Chris Packham
2022-07-14 18:33   ` [PATCH v2 4/4] ARM: dts: armada-39x: " Pali Rohár
2022-11-28  0:05     ` Gregory CLEMENT
2022-09-24 10:34   ` [PATCH v2 1/4] gpio: mvebu: Fix check for pwm support on non-A8K platforms Pali Rohár
2022-09-26  7:20   ` Bartosz Golaszewski

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