gpio: mvebu: Add PWM fan support
Subsystems (5)
v5 cover gpio: mvebu: Add PWM fan support
Hi everyone,
With the bike shedding fixes as Thierry called them out of the way and the ACK by Rob for the bindings this version could be merged.
The only thing still sort of open is whether to use npwm=1 and giving up the sysfs use case. Though an ACK was given for this implementation already I think we should give Thierry a chance to speak up once more if he so wishes.
Thanks
Ralph
---
Notes:
About npwm = 1:
The only way I can think of to achieve that requires reading the GPIO line from the device tree. This would prevent a user to dynamically choose a line. Which is fine for the fan found on Mamba but let's take some development board with freely accessible GPIOs and suddenly we limit the use of this driver (sysfs). Given the above, npwm = ngpio with only one usable at a time is a closer / more appropriate description of the situation. The downside is some "wasted" space and not meeting the expectation that all PWMs are usable concurrently, only one per chip at any given time.
About the new compatible string:
Orion was chosen for the SoC variant for the same reason as in commit 5f79c651e81e ("arm: mvebu: use global interrupts for GPIOs on Armada XP").
The "pwm" property remains optional for the new compatible string so the compatiple string "marvell,armada-370-xp-gpio" can be used by all and not just the first two GPIO chips.
About extending the driver for use with a third GPIO chip:
It's possible to add an extra node "mvebugpiopwmctrl" to configure a different assignment without requiring changes to the current bindings. The current implementation doesn't prevent a fan to be used as gpio-fan connect to the 3rd chip.
---
Changes v5->v6:
Patch 1/4 gpio: mvebu: Add limited PWM support:
* more uppercase for GPIO / PWM in prose (suggested by Thierry Reding)
* use a variable for register set A/B selection value (suggested by Thierry Reding)
* Don't set pwm_chip base to gpio_chip base, use hwpwm instead. (suggested by Thierry Reding)
* use pointer to gpio_desc instead of boolen used (suggested by Thierry Reding)
* check a bit earlier for working clock (suggested by Thierry Reding)
* Add Acked-by: Thierry Reding <[email protected]>
* Acked-by: Rob Herring <[email protected]>
Changes v4->v5:
All
* add Tested-by: Andrew Lunn <[email protected]>, thanks
Patch 2/4 mvebu: xp: Add PWM properties to .dtsi files
* keep the old compatible stings, we don't have to drop them (suggested by Gregory CLEMENT)
* subject starts with ARM: dts: mvebu: (suggested by Gregory CLEMENT)
Patch 4/4 mvebu: wrt1900ac: Use pwm-fan rather than gpio-fan
* subject starts with ARM: dts: armada-xp: (suggested by Gregory CLEMENT)
Changes v3->v4:
Patch 1/4 gpio: mvebu: Add limited PWM support:
* braces for both branches in if statement if one needs it. (suggested by Andrew Lunn)
* introduce compatible string marvell,armada-370-xp-gpio (suggest by Rob Herring)
* fix mvebu_pwmreg_blink_on_duration -> mvebu_pwmreg_blink_off_duration for period callculation in mvebu_pwm_get_state()
Patch 4/4 mvebu: wrt1900ac: Use pwm-fan rather than gpio-fan
* Drop flags from pwms for Mamba, as no longer used (suggested by Andrew Lunn)
* Use again #pwm-cell = 2, the second cell is actually the period.
Changes v2->v3:
Patch 1/4 gpio: mvebu: Add limited PWM support:
* drop pin from mvebu_pwn, can be infered (suggested by Thierry Reding)
* rename pwm to mvpwm so pwm can be used for pwm_device as in the API, avoids some mental gymnastic.
* drop id from struct mvebu_gpio_chip, select blink counter in mvebu_pwm_probe for all lines instead. We do not care about the unused ones. I think a clear improvement in readability. Makes coming up with a good comment simple as well.
* Switch to new atomic PWM API (suggested by Thierry Reding)
* rename use mvebu_gpioreg_blink_select to mvebu_gpioreg_blink_counter_select.
* mark *_suspend() / *_resume() as __maybe_unused (suggested by Linus Walleij)
* document #pwm-cells = 1 (suggested by Thierry Reding)
Patch 2/4 mvebu: xp: Add PWM properties to .dtsi files
* add missing reg-names / #pwm-cell properties to armada-xp-mv78260.dtsi gpio1 node
* set pwm-cells = 1 (suggested by Thierry Reding)
All:
* always uppercase GPIO/PWM in prose (suggested by Thierry Reding)
Changes v1 -> v2:
Patch 1/4 gpio: mvebu: Add limited PWM support:
* use BIT macro (suggested by Linus Walleij)
* move id from struct mvebu_pwm to struct mvebu_gpio_chip, implement blink select as if else and comment on the chip id for code clarity (to accommodate Linus Walleijs request for a code clarification / comment. If you can word it better I'm all ears.)
* Move function comment mvebu_pwm_probe into the function itself.
---
Andrew Lunn (4):
gpio: mvebu: Add limited PWM support
ARM: dts: mvebu: Add PWM properties to .dtsi files
ARM: mvebu: Enable SENSORS_PWM_FAN in defconfig
ARM: dts: armada-xp: Use pwm-fan rather than gpio-fan
.../devicetree/bindings/gpio/gpio-mvebu.txt | 32 ++ MAINTAINERS | 2 + arch/arm/boot/dts/armada-370.dtsi | 19 +- arch/arm/boot/dts/armada-xp-linksys-mamba.dts | 8 +- arch/arm/boot/dts/armada-xp-mv78230.dtsi | 16 +- arch/arm/boot/dts/armada-xp-mv78260.dtsi | 19 +- arch/arm/boot/dts/armada-xp-mv78460.dtsi | 19 +- arch/arm/configs/mvebu_v7_defconfig | 2 + drivers/gpio/gpio-mvebu.c | 327 ++++++++++++++++++++- 9 files changed, 408 insertions(+), 36 deletions(-)
Signature · 1 line
2.10.2
PATCH v6 1/4 gpio: mvebu: Add limited PWM support
From: Andrew Lunn <[email protected]>
Armada 370/XP devices can 'blink' GPIO lines with a configurable on and off period. This can be modelled as a PWM.
However, there are only two sets of PWM configuration registers for all the GPIO lines. This driver simply allows a single GPIO line per GPIO chip of 32 lines to be used as a PWM. Attempts to use more return EBUSY.
Due to the interleaving of registers it is not simple to separate the PWM driver from the GPIO driver. Thus the GPIO driver has been extended with a PWM driver.
URL: https://patchwork.ozlabs.org/patch/427287/
URL: https://patchwork.ozlabs.org/patch/427295/
[Ralph Sennhauser:
* Port forward
* Merge PWM portion into gpio-mvebu.c
* Switch to atomic PWM API
* Add new compatible string marvell,armada-370-xp-gpio
* Update and merge documentation patch
* Update MAINTAINERS]
--- .../devicetree/bindings/gpio/gpio-mvebu.txt | 32 ++ MAINTAINERS | 2 + drivers/gpio/gpio-mvebu.c | 327 ++++++++++++++++++++- 3 files changed, 349 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/gpio/gpio-mvebu.txt +32 -0
@@ -38,6 +38,24 @@ Required properties: - #gpio-cells: Should be two. The first cell is the pin number. The second cell is reserved for flags, unused at the moment. +Optional properties: + +In order to use the GPIO lines in PWM mode, some additional optional +properties are required. Only Armada 370 and XP support these properties. + +- compatible: Must contain "marvell,armada-370-xp-gpio" + +- reg: an additional register set is needed, for the GPIO Blink + Counter on/off registers. + +- reg-names: Must contain an entry "pwm" corresponding to the + additional register range needed for PWM operation. + +- #pwm-cells: Should be two. The first cell is the GPIO line number. The + second cell is the period in nanoseconds. + +- clocks: Must be a phandle to the clock for the GPIO controller. + Example: gpio0: gpio at d0018100 {
@@ -51,3 +69,17 @@ Example: #interrupt-cells = <2>; interrupts = <16>, <17>, <18>, <19>; }; + + gpio1: gpio at 18140 { + compatible = "marvell,armada-370-xp-gpio"; + reg = <0x18140 0x40>, <0x181c8 0x08>; + reg-names = "gpio", "pwm"; + ngpios = <17>; + gpio-controller; + #gpio-cells = <2>; + #pwm-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <87>, <88>, <89>; + clocks = <&coreclk 0>; + };
MAINTAINERS +2 -0
@@ -10295,6 +10295,8 @@ F: include/linux/pwm.h F: drivers/pwm/ F: drivers/video/backlight/pwm_bl.c F: include/linux/pwm_backlight.h +F: drivers/gpio/gpio-mvebu.c +F: Documentation/devicetree/bindings/gpio/gpio-mvebu.txt PXA2xx/PXA3xx SUPPORT M: Daniel Mack <[email protected]>
drivers/gpio/gpio-mvebu.c +315 -12
408 lines not on this page · raw message
Signature · 1 line
2.10.2
Re: [PATCH v6 1/4] gpio: mvebu: Add limited PWM support
Quoted 24 lines · Ralph Sennhauser
From: Andrew Lunn <[email protected]>
Armada 370/XP devices can 'blink' GPIO lines with a configurable on and off period. This can be modelled as a PWM.
However, there are only two sets of PWM configuration registers for all the GPIO lines. This driver simply allows a single GPIO line per GPIO chip of 32 lines to be used as a PWM. Attempts to use more return EBUSY.
Due to the interleaving of registers it is not simple to separate the PWM driver from the GPIO driver. Thus the GPIO driver has been extended with a PWM driver.
Signed-off-by Andrew Lunn <[email protected]>URL: https://patchwork.ozlabs.org/patch/427287/
URL: https://patchwork.ozlabs.org/patch/427295/
[Ralph Sennhauser:
* Port forward
* Merge PWM portion intogpio-mvebu.c
* Switch to atomic PWM API
* Add new compatible string marvell,armada-370-xp-gpio
* Update and merge documentation patch
* UpdateMAINTAINERS]
Quoted 4 lines
Signed-off-by Ralph Sennhauser <[email protected]>Tested-by Andrew Lunn <[email protected]>Acked-by Thierry Reding <[email protected]>Acked-by Rob Herring <[email protected]>
Patch applied.
Yours,
Linus Walleij
Re: [PATCH v6 1/4] gpio: mvebu: Add limited PWM support
Hi Ralph and Linus,
I resurrect this thread following the series post by Richard Genoud:
http://lists.infradead.org/pipermail/linux-arm-kernel/2017-May/509461.html
Quoted 17 lines · Linus Walleij
Quoted 14 lines · Ralph Sennhauser
From: Andrew Lunn <[email protected]>
Armada 370/XP devices can 'blink' GPIO lines with a configurable on and off period. This can be modelled as a PWM.
However, there are only two sets of PWM configuration registers for all the GPIO lines. This driver simply allows a single GPIO line per GPIO chip of 32 lines to be used as a PWM. Attempts to use more return EBUSY.
Due to the interleaving of registers it is not simple to separate the PWM driver from the GPIO driver. Thus the GPIO driver has been extended with a PWM driver.
Quoted 8 lines
Quoted 8 lines
Signed-off-by Andrew Lunn <[email protected]>URL: https://patchwork.ozlabs.org/patch/427287/
URL: https://patchwork.ozlabs.org/patch/427295/
[Ralph Sennhauser:
* Port forward
* Merge PWM portion intogpio-mvebu.c
* Switch to atomic PWM API
* Add new compatible string marvell,armada-370-xp-gpio
The fact that Richard managed to run the code on Armada 38x draw my attention on the documentation that need to be amend.
And it makes me realized that I missed the bad naming of the compatible string. We don't use family name for the compatible string, but the name of the first SoC compatible with. So in this case we should use "marvell,armada-370", as it is still in rc and not yet deployed. What about fixing the name now?
I can send a patch for it if you want and fix the dts that are still in my mvebu branch.
Thanks,
Gregory
Quoted 11 lines
Quoted 6 lines
* Update and merge documentation patch
* UpdateMAINTAINERS]Signed-off-by Ralph Sennhauser <[email protected]>Tested-by Andrew Lunn <[email protected]>Acked-by Thierry Reding <[email protected]>Acked-by Rob Herring <[email protected]>Patch applied.
Yours,
Linus Walleij
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Re: [PATCH v6 1/4] gpio: mvebu: Add limited PWM support
Quoted 34 lines · On Tue, 30 May 2017 15:40:00 +0200 Gregory CLEMENT…
Hi Ralph and Linus,
I resurrect this thread following the series post by Richard Genoud:
http://lists.infradead.org/pipermail/linux-arm-kernel/2017-May/509461.htmlQuoted 17 lines · Linus Walleij
Quoted 14 lines · Ralph Sennhauser
From: Andrew Lunn <[email protected]>
Armada 370/XP devices can 'blink' GPIO lines with a configurable on and off period. This can be modelled as a PWM.
However, there are only two sets of PWM configuration registers for all the GPIO lines. This driver simply allows a single GPIO line per GPIO chip of 32 lines to be used as a PWM. Attempts to use more return EBUSY.
Due to the interleaving of registers it is not simple to separate the PWM driver from the GPIO driver. Thus the GPIO driver has been extended with a PWM driver.
Quoted 8 lines
Quoted 8 lines
Signed-off-by Andrew Lunn <[email protected]>URL: https://patchwork.ozlabs.org/patch/427287/
URL: https://patchwork.ozlabs.org/patch/427295/
[Ralph Sennhauser:
* Port forward
* Merge PWM portion intogpio-mvebu.c
* Switch to atomic PWM API
* Add new compatible string marvell,armada-370-xp-gpio
Quoted 2 lines
The fact that Richard managed to run the code on Armada 38x draw my attention on the documentation that need to be amend.
Hi Gregory
But does it behave as a pwm-fan? I don't have access to the 38x functional spec (no NDA with Marvell), the one for XP is public. According to Andrew the 38x doesn't have the blinking hardware and so I expect the pwm-fan is just an overblown gpio-fan there, additionally writing some random values to random registers where luck has it nothing goes wrong.
Kirkwood apparently has blinking support but only at fixed frequency of 10Hz, so not usable for this purpose either.
So to my knowledge it really is just 370 and XP.
Quoted 6 lines
And it makes me realized that I missed the bad naming of the compatible string. We don't use family name for the compatible string, but the name of the first SoC compatible with. So in this case we should use "marvell,armada-370", as it is still in rc and not yet deployed. What about fixing the name now?
I don't mind but certainly not for me to decide at this point.
Quoted 3 lines
I can send a patch for it if you want and fix the dts that are still in my mvebu branch.
Sure, or if you prefer I can do it as well if we decide for the change. No preference.
Ralph
Re: [PATCH v6 1/4] gpio: mvebu: Add limited PWM support
2017-05-30 16:51 GMT+02:00 Ralph Sennhauser <[email protected]>:
Quoted 49 lines
Quoted 34 lines · On Tue, 30 May 2017 15:40:00 +0200 Gregory CLEMENT…
Hi Ralph and Linus,
I resurrect this thread following the series post by Richard Genoud:
http://lists.infradead.org/pipermail/linux-arm-kernel/2017-May/509461.htmlQuoted 17 lines · Linus Walleij
Quoted 14 lines · Ralph Sennhauser
From: Andrew Lunn <[email protected]>
Armada 370/XP devices can 'blink' GPIO lines with a configurable on and off period. This can be modelled as a PWM.
However, there are only two sets of PWM configuration registers for all the GPIO lines. This driver simply allows a single GPIO line per GPIO chip of 32 lines to be used as a PWM. Attempts to use more return EBUSY.
Due to the interleaving of registers it is not simple to separate the PWM driver from the GPIO driver. Thus the GPIO driver has been extended with a PWM driver.
Quoted 8 lines
Quoted 8 lines
Signed-off-by Andrew Lunn <[email protected]>URL: https://patchwork.ozlabs.org/patch/427287/
URL: https://patchwork.ozlabs.org/patch/427295/
[Ralph Sennhauser:
* Port forward
* Merge PWM portion intogpio-mvebu.c
* Switch to atomic PWM API
* Add new compatible string marvell,armada-370-xp-gpioQuoted 2 lines
The fact that Richard managed to run the code on Armada 38x draw my attention on the documentation that need to be amend.
Hi Gregory
But does it behave as a pwm-fan? I don't have access to the 38x functional spec (no NDA with Marvell), the one for XP is public. According to Andrew the 38x doesn't have the blinking hardware and so I expect the pwm-fan is just an overblown gpio-fan there, additionally writing some random values to random registers where luck has it nothing goes wrong.
Quoted 4 lines
Kirkwood apparently has blinking support but only at fixed frequency of 10Hz, so not usable for this purpose either.
So to my knowledge it really is just 370 and XP.
Hi Ralph,
I have the functional spec (no NDA needed, but it's not the full one) :
A38x-Functional-Spec-PU0A.pdf
https://marvellcorp.wufoo.com/forms/marvell-armada-38x-functional-specifications/
(just an email needed, no blood signing nor chicken slaughtering) There are the GPIO Blink Counter A/B is ON/OFF Duration Registers as well as the Blink Enable Registers.
I've done a pwm with different periods (8ms, 4ms, 100ns). Looking at the scope, it seems to work pretty well :)
Quoted 17 lines
Quoted 6 lines
And it makes me realized that I missed the bad naming of the compatible string. We don't use family name for the compatible string, but the name of the first SoC compatible with. So in this case we should use "marvell,armada-370", as it is still in rc and not yet deployed. What about fixing the name now?
I don't mind but certainly not for me to decide at this point.
Quoted 3 lines
I can send a patch for it if you want and fix the dts that are still in my mvebu branch.
Sure, or if you prefer I can do it as well if we decide for the change. No preference.
Ralph
Re: [PATCH v6 1/4] gpio: mvebu: Add limited PWM support
Quoted 9 lines · On Tue, 30 May 2017 17:35:33 +0200 Richard Genoud <[email protected]>…
Hi Ralph,
I have the functional spec (no NDA needed, but it's not the full one) : A38x-Functional-Spec-PU0A.pdf
https://marvellcorp.wufoo.com/forms/marvell-armada-38x-functional-specifications/
(just an email needed, no blood signing nor chicken slaughtering) There are the GPIO Blink Counter A/B is ON/OFF Duration Registers as well as the Blink Enable Registers.
Hi Richard,
Thanks for the link, as the terms only talk about materials obtained from www.marvell.com this one from wufoo.com should be exempt ;) Also at a glance looks like the complete one. Also says "Functional Specifications ? Unrestricted". Maybe you want to re-download it.
Regardless, as you said the blinking registers are all described. So it's probably safe to assume 39x will have them as well.
Quoted 9 lines
I've done a pwm with different periods (8ms, 4ms, 100ns). Looking at the scope, it seems to work pretty well :)
Quoted 6 lines
Quoted 6 lines
And it makes me realized that I missed the bad naming of the compatible string. We don't use family name for the compatible string, but the name of the first SoC compatible with. So in this case we should use "marvell,armada-370", as it is still in rc and not yet deployed. What about fixing the name now?
Gregory,
Knowing it's not limited to 370/XP makes "marvell,armada-370-gpio" an obviously better choice for the compatible string. Guess you didn't mean to drop the "-gpio" suffix.
Will work on a patch changing the compatible string / documentation for 4.12 and an updated patch for armada 370/XP dtsi as well as a patch adding the properties to 38x for 4.13+. Expect them tomorrow, probably won't get around to it today anymore.
Ralph
Re: [PATCH v6 1/4] gpio: mvebu: Add limited PWM support
Hi Ralph,
Quoted 15 lines · Ralph Sennhauser
Quoted 9 lines · On Tue, 30 May 2017 17:35:33 +0200 Richard Genoud <[email protected]>…
Hi Ralph,
I have the functional spec (no NDA needed, but it's not the full one) : A38x-Functional-Spec-PU0A.pdf
https://marvellcorp.wufoo.com/forms/marvell-armada-38x-functional-specifications/
(just an email needed, no blood signing nor chicken slaughtering) There are the GPIO Blink Counter A/B is ON/OFF Duration Registers as well as the Blink Enable Registers.Hi Richard,
Quoted 7 lines
Thanks for the link, as the terms only talk about materials obtained from www.marvell.com this one from wufoo.com should be exempt ;) Also at a glance looks like the complete one. Also says "Functional Specifications ? Unrestricted". Maybe you want to re-download it.
Regardless, as you said the blinking registers are all described. So it's probably safe to assume 39x will have them as well.
I guess you meant 38x. (But I suppose it is also true for 39x)
Quoted 11 lines
Quoted 10 lines
I've done a pwm with different periods (8ms, 4ms, 100ns). Looking at the scope, it seems to work pretty well :)
Quoted 6 lines
Quoted 6 lines
And it makes me realized that I missed the bad naming of the compatible string. We don't use family name for the compatible string, but the name of the first SoC compatible with. So in this case we should use "marvell,armada-370", as it is still in rc and not yet deployed. What about fixing the name now?
Quoted 5 lines
Gregory,
Knowing it's not limited to 370/XP makes "marvell,armada-370-gpio" an obviously better choice for the compatible string. Guess you didn't mean to drop the "-gpio" suffix.
You're right I meant "marvell,armada-370-gpio".
Quoted 5 lines
Will work on a patch changing the compatible string / documentation for 4.12 and an updated patch for armada 370/XP dtsi as well as a patch adding the properties to 38x for 4.13+. Expect them tomorrow, probably won't get around to it today anymore.
Great!
Thanks,
Gregory
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH v6 2/4 ARM: dts: mvebu: Add PWM properties to .dtsi files
In reply to Ralph SennhauserFrom: Andrew Lunn <[email protected]>
Add properties to the GPIO nodes to allow them to be also used as PWM lines.
URL: https://patchwork.ozlabs.org/patch/427294/
--- arch/arm/boot/dts/armada-370.dtsi | 19 ++++++++++++++----- arch/arm/boot/dts/armada-xp-mv78230.dtsi | 16 ++++++++++++---- arch/arm/boot/dts/armada-xp-mv78260.dtsi | 19 ++++++++++++++----- arch/arm/boot/dts/armada-xp-mv78460.dtsi | 19 ++++++++++++++----- 4 files changed, 54 insertions(+), 19 deletions(-)
arch/arm/boot/dts/armada-370.dtsi +14 -5
@@ -137,29 +137,38 @@ }; gpio0: gpio at 18100 { - compatible = "marvell,orion-gpio"; - reg = <0x18100 0x40>; + compatible = "marvell,armada-370-xp-gpio", + "marvell,orion-gpio"; + reg = <0x18100 0x40>, <0x181c0 0x08>; + reg-names = "gpio", "pwm"; ngpios = <32>; gpio-controller; #gpio-cells = <2>; + #pwm-cells = <2>; interrupt-controller; #interrupt-cells = <2>; interrupts = <82>, <83>, <84>, <85>; + clocks = <&coreclk 0>; }; gpio1: gpio at 18140 { - compatible = "marvell,orion-gpio"; - reg = <0x18140 0x40>; + compatible = "marvell,armada-370-xp-gpio", + "marvell,orion-gpio"; + reg = <0x18140 0x40>, <0x181c8 0x08>; + reg-names = "gpio", "pwm"; ngpios = <32>; gpio-controller; #gpio-cells = <2>; + #pwm-cells = <2>; interrupt-controller; #interrupt-cells = <2>; interrupts = <87>, <88>, <89>, <90>; + clocks = <&coreclk 0>; }; gpio2: gpio at 18180 { - compatible = "marvell,orion-gpio"; + compatible = "marvell,armada-370-xp-gpio", + "marvell,orion-gpio"; reg = <0x18180 0x40>; ngpios = <2>; gpio-controller;
arch/arm/boot/dts/armada-xp-mv78230.dtsi +12 -4
@@ -202,25 +202,33 @@ internal-regs { gpio0: gpio at 18100 { - compatible = "marvell,orion-gpio"; - reg = <0x18100 0x40>; + compatible = "marvell,armada-370-xp-gpio", + "marvell,orion-gpio"; + reg = <0x18100 0x40>, <0x181c0 0x08>; + reg-names = "gpio", "pwm"; ngpios = <32>; gpio-controller; #gpio-cells = <2>; + #pwm-cells = <2>; interrupt-controller; #interrupt-cells = <2>; interrupts = <82>, <83>, <84>, <85>; + clocks = <&coreclk 0>; }; gpio1: gpio at 18140 { - compatible = "marvell,orion-gpio"; - reg = <0x18140 0x40>; + compatible = "marvell,armada-370-xp-gpio", + "marvell,orion-gpio"; + reg = <0x18140 0x40>, <0x181c8 0x08>; + reg-names = "gpio", "pwm"; ngpios = <17>; gpio-controller; #gpio-cells = <2>; + #pwm-cells = <2>; interrupt-controller; #interrupt-cells = <2>; interrupts = <87>, <88>, <89>; + clocks = <&coreclk 0>; }; }; };
arch/arm/boot/dts/armada-xp-mv78260.dtsi +14 -5
@@ -285,29 +285,38 @@ internal-regs { gpio0: gpio at 18100 { - compatible = "marvell,orion-gpio"; - reg = <0x18100 0x40>; + compatible = "marvell,armada-370-xp-gpio", + "marvell,orion-gpio"; + reg = <0x18100 0x40>, <0x181c0 0x08>; + reg-names = "gpio", "pwm"; ngpios = <32>; gpio-controller; #gpio-cells = <2>; + #pwm-cells = <2>; interrupt-controller; #interrupt-cells = <2>; interrupts = <82>, <83>, <84>, <85>; + clocks = <&coreclk 0>; }; gpio1: gpio at 18140 { - compatible = "marvell,orion-gpio"; - reg = <0x18140 0x40>; + compatible = "marvell,armada-370-xp-gpio", + "marvell,orion-gpio"; + reg = <0x18140 0x40>, <0x181c8 0x08>; + reg-names = "gpio", "pwm"; ngpios = <32>; gpio-controller; #gpio-cells = <2>; + #pwm-cells = <2>; interrupt-controller; #interrupt-cells = <2>; interrupts = <87>, <88>, <89>, <90>; + clocks = <&coreclk 0>; }; gpio2: gpio at 18180 { - compatible = "marvell,orion-gpio"; + compatible = "marvell,armada-370-xp-gpio", + "marvell,orion-gpio"; reg = <0x18180 0x40>; ngpios = <3>; gpio-controller;
arch/arm/boot/dts/armada-xp-mv78460.dtsi +14 -5
@@ -323,29 +323,38 @@ internal-regs { gpio0: gpio at 18100 { - compatible = "marvell,orion-gpio"; - reg = <0x18100 0x40>; + compatible = "marvell,armada-370-xp-gpio", + "marvell,orion-gpio"; + reg = <0x18100 0x40>, <0x181c0 0x08>; + reg-names = "gpio", "pwm"; ngpios = <32>; gpio-controller; #gpio-cells = <2>; + #pwm-cells = <2>; interrupt-controller; #interrupt-cells = <2>; interrupts = <82>, <83>, <84>, <85>; + clocks = <&coreclk 0>; }; gpio1: gpio at 18140 { - compatible = "marvell,orion-gpio"; - reg = <0x18140 0x40>; + compatible = "marvell,armada-370-xp-gpio", + "marvell,orion-gpio"; + reg = <0x18140 0x40>, <0x181c8 0x08>; + reg-names = "gpio", "pwm"; ngpios = <32>; gpio-controller; #gpio-cells = <2>; + #pwm-cells = <2>; interrupt-controller; #interrupt-cells = <2>; interrupts = <87>, <88>, <89>, <90>; + clocks = <&coreclk 0>; }; gpio2: gpio at 18180 { - compatible = "marvell,orion-gpio"; + compatible = "marvell,armada-370-xp-gpio", + "marvell,orion-gpio"; reg = <0x18180 0x40>; ngpios = <3>; gpio-controller;
Signature · 1 line
2.10.2
Re: [PATCH v6 2/4] ARM: dts: mvebu: Add PWM properties to .dtsi files
Quoted 10 lines · Ralph Sennhauser
From: Andrew Lunn <[email protected]>
Add properties to the GPIO nodes to allow them to be also used as PWM lines.
Signed-off-by Andrew Lunn <[email protected]>URL: https://patchwork.ozlabs.org/patch/427294/
[Ralph Sennhauser: Add new compatible string marvell,armada-370-xp-gpio]Signed-off-by Ralph Sennhauser <[email protected]>Tested-by Andrew Lunn <[email protected]>
Please funnel this through ARM SoC.
Yours,
Linus Walleij
Re: [PATCH v6 2/4] ARM: dts: mvebu: Add PWM properties to .dtsi files
Quoted 15 lines · On Mon, 24 Apr 2017 11:19:32 +0200 Linus Walleij <[email protected]>…
Quoted 11 lines · Ralph Sennhauser
From: Andrew Lunn <[email protected]>
Add properties to the GPIO nodes to allow them to be also used as PWM lines.
Signed-off-by Andrew Lunn <[email protected]>URL: https://patchwork.ozlabs.org/patch/427294/
[Ralph Sennhauser: Add new compatible string marvell,armada-370-xp-gpio] Signed-off-by: Ralph Sennhauser <[email protected]> Tested-by: Andrew Lunn <[email protected]>
Quoted 3 lines
Acked-by Linus Walleij <[email protected]>Please funnel this through ARM SoC.
Hi Gregory,
A reminder on the off chance you have missed this and it's not to late already, Linus Walleij took the driver and submitted it for inclusion in 4.12 [1]. So for completeness it be nice to have the dts(i) and defconfig changes in as well.
Thanks
Ralph
[1] https://lkml.org/lkml/2017/5/4/82
Quoted 3 lines
Yours,
Linus Walleij
Re: [PATCH v6 2/4] ARM: dts: mvebu: Add PWM properties to .dtsi files
Hi Ralph,
Quoted 20 lines · Ralph Sennhauser
Quoted 17 lines · On Mon, 24 Apr 2017 11:19:32 +0200 Linus Walleij <[email protected]>…
Quoted 11 lines · Ralph Sennhauser
From: Andrew Lunn <[email protected]>
Add properties to the GPIO nodes to allow them to be also used as PWM lines.
Signed-off-by Andrew Lunn <[email protected]>URL: https://patchwork.ozlabs.org/patch/427294/
[Ralph Sennhauser: Add new compatible string marvell,armada-370-xp-gpio] Signed-off-by: Ralph Sennhauser <[email protected]> Tested-by: Andrew Lunn <[email protected]>Acked-by Linus Walleij <[email protected]>
Quoted 8 lines
Quoted 1 line
Please funnel this through ARM SoC.
Hi Gregory,
A reminder on the off chance you have missed this and it's not to late already, Linus Walleij took the driver and submitted it for inclusion in 4.12 [1]. So for completeness it be nice to have the dts(i) and defconfig changes in as well.
Unfortunately it was too late to applied and to push it to arm-soc when the gpio part was applied.
So I will apply when 4.12-rc1 will be released and it will be included in the 4.13 release.
Gregory
Quoted 10 lines
Thanks
Ralph[1] https://lkml.org/lkml/2017/5/4/82
Quoted 3 lines
Yours,
Linus Walleij
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Re: [PATCH v6 2/4] ARM: dts: mvebu: Add PWM properties to .dtsi files
Quoted 34 lines · On Fri, 05 May 2017 10:09:09 +0200 Gregory CLEMENT…
Hi Ralph,
Quoted 20 lines · Ralph Sennhauser
Quoted 17 lines · On Mon, 24 Apr 2017 11:19:32 +0200 Linus Walleij <[email protected]>…
Quoted 11 lines · Ralph Sennhauser
From: Andrew Lunn <[email protected]>
Add properties to the GPIO nodes to allow them to be also used as PWM lines.
Signed-off-by Andrew Lunn <[email protected]>URL: https://patchwork.ozlabs.org/patch/427294/
[Ralph Sennhauser: Add new compatible string marvell,armada-370-xp-gpio] Signed-off-by: Ralph Sennhauser <[email protected]> Tested-by: Andrew Lunn <[email protected]>Acked-by Linus Walleij <[email protected]>Quoted 8 lines
Quoted 1 line
Please funnel this through ARM SoC.
Hi Gregory,
A reminder on the off chance you have missed this and it's not to late already, Linus Walleij took the driver and submitted it for inclusion in 4.12 [1]. So for completeness it be nice to have the dts(i) and defconfig changes in as well.
Quoted 5 lines
Unfortunately it was too late to applied and to push it to arm-soc when the gpio part was applied.
So I will apply when 4.12-rc1 will be released and it will be included in the 4.13 release.
Such is life, thanks for the heads up.
Ralph
Quoted 13 lines
Gregory
Quoted 10 lines
Thanks
Ralph[1] https://lkml.org/lkml/2017/5/4/82
Quoted 3 lines
Yours,
Linus Walleij
Re: [PATCH v6 2/4] ARM: dts: mvebu: Add PWM properties to .dtsi files
In reply to Linus WalleijHi,
Quoted 14 lines · Linus Walleij
Quoted 10 lines · Ralph Sennhauser
From: Andrew Lunn <[email protected]>
Add properties to the GPIO nodes to allow them to be also used as PWM lines.
Signed-off-by Andrew Lunn <[email protected]>URL: https://patchwork.ozlabs.org/patch/427294/
[Ralph Sennhauser: Add new compatible string marvell,armada-370-xp-gpio]Signed-off-by Ralph Sennhauser <[email protected]>Tested-by Andrew Lunn <[email protected]>
Quoted 3 lines
Acked-by Linus Walleij <[email protected]>Please funnel this through ARM SoC.
Applied on mvebu/dt
Thanks,
Gregory
Quoted 3 lines
Yours,
Linus Walleij
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH v6 3/4 ARM: mvebu: Enable SENSORS_PWM_FAN in defconfig
In reply to Ralph SennhauserFrom: Andrew Lunn <[email protected]>
Now that the GPIO driver also supports PWM operation, enable the PWM framework and fan driver in mvebu_v7_defconfig.
URL: https://patchwork.ozlabs.org/patch/427297/
--- arch/arm/configs/mvebu_v7_defconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/configs/mvebu_v7_defconfig +2 -0
@@ -135,6 +135,8 @@ CONFIG_DMADEVICES=y CONFIG_MV_XOR=y # CONFIG_IOMMU_SUPPORT is not set CONFIG_MEMORY=y +CONFIG_PWM=y +CONFIG_SENSORS_PWM_FAN=y CONFIG_EXT4_FS=y CONFIG_ISO9660_FS=y CONFIG_JOLIET=y
Signature · 1 line
2.10.2
Re: [PATCH v6 3/4] ARM: mvebu: Enable SENSORS_PWM_FAN in defconfig
Quoted 10 lines · Ralph Sennhauser
From: Andrew Lunn <[email protected]>
Now that the GPIO driver also supports PWM operation, enable the PWM framework and fan driver in
mvebu_v7_defconfig.Signed-off-by Andrew Lunn <[email protected]>URL: https://patchwork.ozlabs.org/patch/427297/
[Ralph Sennhauser: add fan driver to defconfig]Signed-off-by Ralph Sennhauser <[email protected]>Tested-by Andrew Lunn <[email protected]>
Please funnel this through ARM SoC.
Yours,
Linus Walleij
Re: [PATCH v6 3/4] ARM: mvebu: Enable SENSORS_PWM_FAN in defconfig
Hi,
Quoted 14 lines · Linus Walleij
Quoted 10 lines · Ralph Sennhauser
From: Andrew Lunn <[email protected]>
Now that the GPIO driver also supports PWM operation, enable the PWM framework and fan driver in
mvebu_v7_defconfig.Signed-off-by Andrew Lunn <[email protected]>URL: https://patchwork.ozlabs.org/patch/427297/
[Ralph Sennhauser: add fan driver to defconfig]Signed-off-by Ralph Sennhauser <[email protected]>Tested-by Andrew Lunn <[email protected]>
Quoted 3 lines
Acked-by Linus Walleij <[email protected]>Please funnel this through ARM SoC.
Applied on mvebu/defconfig
Thanks,
Gregory
Quoted 3 lines
Yours,
Linus Walleij
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH v6 4/4 ARM: dts: armada-xp: Use pwm-fan rather than gpio-fan
In reply to Ralph SennhauserFrom: Andrew Lunn <[email protected]>
The mvebu GPIO driver can also perform PWM on some pins. Use the pwm-fan driver to control the fan of the WRT1900AC, giving us finer grained control over its speed and hence noise.
URL: https://patchwork.ozlabs.org/patch/427291/
--- arch/arm/boot/dts/armada-xp-linksys-mamba.dts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
arch/arm/boot/dts/armada-xp-linksys-mamba.dts +3 -5
@@ -308,13 +308,11 @@ }; }; - gpio_fan { + pwm_fan { /* SUNON HA4010V4-0000-C99 */ - compatible = "gpio-fan"; - gpios = <&gpio0 24 0>; - gpio-fan,speed-map = <0 0 - 4500 1>; + compatible = "pwm-fan"; + pwms = <&gpio0 24 4000>; }; dsa {
Signature · 1 line
2.10.2
Re: [PATCH v6 4/4] ARM: dts: armada-xp: Use pwm-fan rather than gpio-fan
Quoted 11 lines · Ralph Sennhauser
From: Andrew Lunn <[email protected]>
The mvebu GPIO driver can also perform PWM on some pins. Use the pwm-fan driver to control the fan of the WRT1900AC, giving us finer grained control over its speed and hence noise.
Signed-off-by Andrew Lunn <[email protected]>URL: https://patchwork.ozlabs.org/patch/427291/
[Ralph Sennhauser: drop flags paramter from pwms, no longer used]Signed-off-by Ralph Sennhauser <[email protected]>Tested-by Andrew Lunn <[email protected]>
Please funnel this through ARM SoC.
Yours,
Linus Walleij
Re: [PATCH v6 4/4] ARM: dts: armada-xp: Use pwm-fan rather than gpio-fan
Hi
Quoted 15 lines · Linus Walleij
Quoted 11 lines · Ralph Sennhauser
From: Andrew Lunn <[email protected]>
The mvebu GPIO driver can also perform PWM on some pins. Use the pwm-fan driver to control the fan of the WRT1900AC, giving us finer grained control over its speed and hence noise.
Signed-off-by Andrew Lunn <[email protected]>URL: https://patchwork.ozlabs.org/patch/427291/
[Ralph Sennhauser: drop flags paramter from pwms, no longer used]Signed-off-by Ralph Sennhauser <[email protected]>Tested-by Andrew Lunn <[email protected]>
Quoted 3 lines
Acked-by Linus Walleij <[email protected]>Please funnel this through ARM SoC.
Applied on mvebu/dt
Thanks,
Gregory
Quoted 3 lines
Yours,
Linus Walleij
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com