gpio: mvebu: Fix check for pwm support on non-A8K platforms
Subsystems (3)
PATCH 1/4 gpio: mvebu: Fix check for pwm support on non-A8K platforms
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.
--- drivers/gpio/gpio-mvebu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpio/gpio-mvebu.c +1 -2
@@ -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
Signature · 1 line
2.20.1
PATCH 2/4 doc: gpio-mvebu: Add information about Armada 38x and Armada 39x
Armada 38x and Armada 39x should use compatible string "marvel,armadaxp-gpio".
--- Documentation/devicetree/bindings/gpio/gpio-mvebu.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/gpio/gpio-mvebu.txt +1 -1
@@ -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
Signature · 1 line
2.20.1
PATCH 3/4 ARM: dts: armada-38x: Fix compatible string for gpios
In reply to Pali RohárArmada 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.
--- arch/arm/boot/dts/armada-38x.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/armada-38x.dtsi +2 -2
@@ -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";
Signature · 1 line
2.20.1
PATCH 4/4 ARM: dts: armada-39x: Fix compatible string for gpios
In reply to Pali RohárArmada 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.
--- arch/arm/boot/dts/armada-39x.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/armada-39x.dtsi +2 -2
@@ -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;
Signature · 1 line
2.20.1
Quoted 15 lines · Pali Rohár
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 <[email protected]>--- drivers/gpio/gpio-mvebu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpio/gpio-mvebu.c +0
-0
drivers/gpio/gpio-mvebu.c static int mvebu_pwm_probe(struct platform_device *pdev, · line 799
Quoted 9 lines
drivers/gpio/gpio-mvebu.c +1
-2@@ -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
Hi Pali,
Quoted 15 lines · Pali Rohár
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 <[email protected]>--- drivers/gpio/gpio-mvebu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpio/gpio-mvebu.c +0
-0
drivers/gpio/gpio-mvebu.c static int mvebu_pwm_probe(struct platform_device *pdev, · line 796
Quoted 6 lines
drivers/gpio/gpio-mvebu.c +1
-2@@ -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
Quoted 3 lines
drivers/gpio/gpio-mvebu.c +0
-0/* * There are only two sets of PWM configuration registers for * all the GPIO lines on those SoCs which this driver reserves
Signature · 3 lines
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- [email protected] - tel: +972.52.368.4656, http://www.tkos.co.il -PATCH v2 1/4 gpio: mvebu: Fix check for pwm support on non-A8K platforms
In reply to Pali Rohárpwm 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.
---
Changes in v2:
* reverse the if/else order per Baruch request
--- drivers/gpio/gpio-mvebu.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/gpio/gpio-mvebu.c +6 -9
@@ -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))
Signature · 1 line
2.20.1
PATCH v2 2/4 doc: gpio-mvebu: Add information about Armada 38x and Armada 39x
Armada 38x and Armada 39x should use compatible string "marvel,armadaxp-gpio".
--- Documentation/devicetree/bindings/gpio/gpio-mvebu.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/gpio/gpio-mvebu.txt +1 -1
@@ -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
Signature · 1 line
2.20.1
Re: [PATCH v2 2/4] doc: gpio-mvebu: Add information about Armada 38x and Armada 39x
Quoted 7 lines · Pali Rohár
Armada 38x and Armada 39x should use compatible string "marvel,armadaxp-gpio".
Signed-off-by Pali Rohár <[email protected]>--- Documentation/devicetree/bindings/gpio/gpio-mvebu.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH v2 3/4 ARM: dts: armada-38x: Fix compatible string for gpios
In reply to Pali RohárArmada 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.
--- arch/arm/boot/dts/armada-38x.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/armada-38x.dtsi +2 -2
@@ -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";
Signature · 1 line
2.20.1
Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
Quoted 21 lines · Pali Rohár
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.cwhich 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 <[email protected]>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(-)arch/arm/boot/dts/armada-38x.dtsi +0
-0
arch/arm/boot/dts/armada-38x.dtsi line 296
Quoted 6 lines
arch/arm/boot/dts/armada-38x.dtsi +1
-1@@ -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
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
Quoted 32 lines · On Saturday 16 July 2022 16:40:28 Uwe Kleine-König wrote:
Quoted 21 lines · Pali Rohár
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.cwhich 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 <[email protected]>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(-)arch/arm/boot/dts/armada-38x.dtsi +0
-0arch/arm/boot/dts/armada-38x.dtsi line 296
Quoted 6 lines
arch/arm/boot/dts/armada-38x.dtsi +1
-1@@ -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:
Quoted 3 lines
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.
Quoted 6 lines
Best regards
UweSignature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
Quoted 35 lines · Pali Rohár
Quoted 34 lines · On Saturday 16 July 2022 16:40:28 Uwe Kleine-König wrote:
Quoted 21 lines · Pali Rohár
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.cwhich 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 <[email protected]>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(-)arch/arm/boot/dts/armada-38x.dtsi +0
-0arch/arm/boot/dts/armada-38x.dtsi line 296
Quoted 6 lines
arch/arm/boot/dts/armada-38x.dtsi +1
-1@@ -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";
Quoted 8 lines
Quoted 1 line
?
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
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
Quoted 42 lines · On Saturday 16 July 2022 17:07:51 Uwe Kleine-König wrote:
Quoted 41 lines · Pali Rohár
Quoted 32 lines · On Saturday 16 July 2022 16:40:28 Uwe Kleine-König wrote:
Quoted 21 lines · Pali Rohár
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.cwhich 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 <[email protected]>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(-)arch/arm/boot/dts/armada-38x.dtsi +0
-0arch/arm/boot/dts/armada-38x.dtsi line 296
Quoted 6 lines
arch/arm/boot/dts/armada-38x.dtsi +1
-1@@ -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:
Quoted 3 lines
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).
Quoted 5 lines
Quoted 2 lines
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?
Quoted 2 lines
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.
Quoted 2 lines
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
Acked-byRe: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
Hello Pali,
Quoted 43 lines · Pali Rohár
Quoted 42 lines · On Saturday 16 July 2022 17:07:51 Uwe Kleine-König wrote:
Quoted 41 lines · Pali Rohár
Quoted 32 lines · On Saturday 16 July 2022 16:40:28 Uwe Kleine-König wrote:
Quoted 21 lines · Pali Rohár
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.cwhich 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 <[email protected]>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(-)arch/arm/boot/dts/armada-38x.dtsi +0
-0arch/arm/boot/dts/armada-38x.dtsi line 296
Quoted 6 lines
arch/arm/boot/dts/armada-38x.dtsi +1
-1@@ -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:
Quoted 3 lines
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).
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
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.
Quoted 7 lines
Quoted 2 lines
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.
Quoted 5 lines
Quoted 2 lines
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:
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
Quoted 69 lines · On Monday 25 July 2022 22:04:17 Uwe Kleine-König wrote:
Hello Pali,
Quoted 43 lines · Pali Rohár
Quoted 42 lines · On Saturday 16 July 2022 17:07:51 Uwe Kleine-König wrote:
Quoted 41 lines · Pali Rohár
Quoted 32 lines · On Saturday 16 July 2022 16:40:28 Uwe Kleine-König wrote:
Quoted 21 lines · Pali Rohár
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.cwhich 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 <[email protected]>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(-)arch/arm/boot/dts/armada-38x.dtsi +0
-0arch/arm/boot/dts/armada-38x.dtsi line 296
Quoted 6 lines
arch/arm/boot/dts/armada-38x.dtsi +1
-1@@ -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:
Quoted 3 lines
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).
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
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.
Quoted 7 lines
Quoted 2 lines
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.
Quoted 5 lines
Quoted 2 lines
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.
Quoted 7 lines
OK, you're right, my assumptions were wrong. I'm convinced your change is fine now:
Acked-by Uwe Kleine-König <[email protected]>Best regards
Uwe
Ok, are there any other objections with this patch series?
Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
In reply to Pali RohárGregory: ping
Quoted 41 lines · 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.cwhich 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 <[email protected]>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(-)arch/arm/boot/dts/armada-38x.dtsi +2
-2@@ -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";Signature · 1 line
2.20.1
Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
PING
Quoted 44 lines · On Saturday 01 October 2022 01:34:53 Pali Rohár wrote:
Gregory: ping
Quoted 41 lines · 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.cwhich 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 <[email protected]>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(-)arch/arm/boot/dts/armada-38x.dtsi +2
-2@@ -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";Signature · 1 line
2.20.1
Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
PING?
Quoted 47 lines · On Sunday 09 October 2022 14:05:58 Pali Rohár wrote:
PING
Quoted 44 lines · On Saturday 01 October 2022 01:34:53 Pali Rohár wrote:
Gregory: ping
Quoted 41 lines · 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.cwhich 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 <[email protected]>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(-)arch/arm/boot/dts/armada-38x.dtsi +2
-2@@ -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";Signature · 1 line
2.20.1
Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
In reply to Pali RohárQuoted 7 lines · Pali Rohár
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.
Quoted 5 lines
Driver
gpio-mvebu.cwhich 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 <[email protected]>Fixes 7cb2acb3fbae ("ARM: dts: mvebu: Add PWM properties for armada-38x")
Applied on mvebu/dt
Thanks,
Gregory
Quoted 29 lines
--- arch/arm/boot/dts/armada-38x.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/arm/boot/dts/armada-38x.dtsi +2
-2@@ -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";Signature · 1 line
2.20.1
Signature · 3 lines
Gregory Clement, Bootlin Embedded Linux and Kernel engineering http://bootlin.com
Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
Quoted 12 lines · Gregory CLEMENT
Quoted 10 lines · Pali Rohár
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.cwhich handles both pre-XP and XP variants already provides support for per CPU interrupts on XP and newer variants.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Pali Rohár <[email protected]>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.
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
Quoted 30 lines
Quoted 29 lines
---
arch/arm/boot/dts/armada-38x.dtsi | 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)arch/arm/boot/dts/armada-38x.dtsi +0
-0@@ -292,7 +292,7 @@ };
gpio0: gpio@18100 {
- compatible = "marvell,armada-370-gpio", + compatible = "marvell,armadaxp-gpio", "marvell,orion-gpio"; reg = <0x181000x40>, <0x181c00x08>; reg-names = "gpio", "pwm";arch/arm/boot/dts/armada-38x.dtsi +0
-0@@ -310,7 +310,7 @@ };
gpio1: gpio@18140 {
- compatible = "marvell,armada-370-gpio", + compatible = "marvell,armadaxp-gpio", "marvell,orion-gpio"; reg = <0x181400x40>, <0x181c80x08>; reg-names = "gpio", "pwm";Signature · 1 line
2.20.1
Re: [PATCH v2 3/4] ARM: dts: armada-38x: Fix compatible string for gpios
In reply to Pali RohárHi Pali,
Quoted 21 lines · Pali Rohár
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.cwhich 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 <[email protected]>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(-)arch/arm/boot/dts/armada-38x.dtsi +0
-0
arch/arm/boot/dts/armada-38x.dtsi line 298
Quoted 8 lines
arch/arm/boot/dts/armada-38x.dtsi +1
-1@@ -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).
Quoted 9 lines
arch/arm/boot/dts/armada-38x.dtsi +1
-1@@ -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";
PATCH v2 4/4 ARM: dts: armada-39x: Fix compatible string for gpios
In reply to Pali RohárArmada 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.
--- arch/arm/boot/dts/armada-39x.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/armada-39x.dtsi +2 -2
@@ -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;
Signature · 1 line
2.20.1
Re: [PATCH v2 4/4] ARM: dts: armada-39x: Fix compatible string for gpios
Quoted 9 lines · Pali Rohár
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.cwhich 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 <[email protected]>Fixes d81a914fc630 ("ARM: dts: mvebu: armada-39x: add missing nodes describing GPIO's")
Applied on mvebu/dt
Thanks,
Gregory
Quoted 29 lines
--- arch/arm/boot/dts/armada-39x.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/arm/boot/dts/armada-39x.dtsi +2
-2@@ -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;Signature · 1 line
2.20.1
Signature · 3 lines
Gregory Clement, Bootlin Embedded Linux and Kernel engineering http://bootlin.com
PING?
Quoted 50 lines · 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 <[email protected]>---
Changes in v2:
* reverse the if/else order per Baruch request--- drivers/gpio/gpio-mvebu.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)drivers/gpio/gpio-mvebu.c +6
-9@@ -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))Signature · 1 line
2.20.1
Bartosz Golaszewski
AppliedQuoted 11 lines · Pali Rohár
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 <[email protected]>---
Changes in v2:
* reverse the if/else order per Baruch request
Applied, thanks!
Bart