Skip to content

Commit 757642f

Browse files
lunnlinusw
authored andcommitted
gpio: mvebu: Add limited PWM support
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 <andrew@lunn.ch> 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] Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com> Tested-by: Andrew Lunn <andrew@lunn.ch> Acked-by: Thierry Reding <thierry.reding@gmail.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 6f79309 commit 757642f

File tree

3 files changed

+349
-12
lines changed

3 files changed

+349
-12
lines changed

Documentation/devicetree/bindings/gpio/gpio-mvebu.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,24 @@ Required properties:
3838
- #gpio-cells: Should be two. The first cell is the pin number. The
3939
second cell is reserved for flags, unused at the moment.
4040

41+
Optional properties:
42+
43+
In order to use the GPIO lines in PWM mode, some additional optional
44+
properties are required. Only Armada 370 and XP support these properties.
45+
46+
- compatible: Must contain "marvell,armada-370-xp-gpio"
47+
48+
- reg: an additional register set is needed, for the GPIO Blink
49+
Counter on/off registers.
50+
51+
- reg-names: Must contain an entry "pwm" corresponding to the
52+
additional register range needed for PWM operation.
53+
54+
- #pwm-cells: Should be two. The first cell is the GPIO line number. The
55+
second cell is the period in nanoseconds.
56+
57+
- clocks: Must be a phandle to the clock for the GPIO controller.
58+
4159
Example:
4260

4361
gpio0: gpio@d0018100 {
@@ -51,3 +69,17 @@ Example:
5169
#interrupt-cells = <2>;
5270
interrupts = <16>, <17>, <18>, <19>;
5371
};
72+
73+
gpio1: gpio@18140 {
74+
compatible = "marvell,armada-370-xp-gpio";
75+
reg = <0x18140 0x40>, <0x181c8 0x08>;
76+
reg-names = "gpio", "pwm";
77+
ngpios = <17>;
78+
gpio-controller;
79+
#gpio-cells = <2>;
80+
#pwm-cells = <2>;
81+
interrupt-controller;
82+
#interrupt-cells = <2>;
83+
interrupts = <87>, <88>, <89>;
84+
clocks = <&coreclk 0>;
85+
};

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10212,6 +10212,8 @@ F: include/linux/pwm.h
1021210212
F: drivers/pwm/
1021310213
F: drivers/video/backlight/pwm_bl.c
1021410214
F: include/linux/pwm_backlight.h
10215+
F: drivers/gpio/gpio-mvebu.c
10216+
F: Documentation/devicetree/bindings/gpio/gpio-mvebu.txt
1021510217

1021610218
PXA2xx/PXA3xx SUPPORT
1021710219
M: Daniel Mack <daniel@zonque.org>

0 commit comments

Comments
 (0)