ARM: berlin: PWM support
Subsystems (2)
v7 cover ARM: berlin: PWM support
Hi all,
This series adds a driver for the Marvell Berlin PWM controller, which has 4 channels.
This has been tested on a BG2Q DMP.
Thanks,
Antoine
Changes since v6:
- Used a prescaler_table again
- Removed the spinlock
- Used inline function for read/write
- Always disable the clock in _remvove()
- Cosmtic updates
- Reordered the Documentation patch
Changes since v5:
- Rebased on top of 4.3-rc1
- Added a call to clk_disable_unprepare() in case of failure
Changes since v4:
- Reworked _remove()
- Reworked _enable()
Changes since v3:
- Use readl_relaxed
- Reworked the clk enable / clk disable calls
- Removed BERLIN_PWM_DISABLE
Changes since v2:
- Reworked the prescaler/tcnt calculation
- Added an input clock
- Updated the documentation
- Reordered the pwm node
- Added some definition for BIT()
Changes since v1:
- Added a sentinel in berlin_pwm_match[]
Antoine Tenart (5):
Documentation: bindings: document the Berlin PWM driver
pwm: add the Berlin pwm controller driver
ARM: berlin: add a PWM node on the BG2Q
ARM: berlin: add a PWM node on the BG2
ARM: berlin: add a PWM node on the BG2CD
.../devicetree/bindings/pwm/pwm-berlin.txt | 17 ++ arch/arm/boot/dts/berlin2.dtsi | 7 + arch/arm/boot/dts/berlin2cd.dtsi | 7 + arch/arm/boot/dts/berlin2q.dtsi | 7 + drivers/pwm/Kconfig | 9 + drivers/pwm/Makefile | 1 + drivers/pwm/pwm-berlin.c | 221 +++++++++++++++++++++ 7 files changed, 269 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/pwm-berlin.txt create mode 100644 drivers/pwm/pwm-berlin.c
Signature · 1 line
2.6.0
PATCH v7 1/5 Documentation: bindings: document the Berlin PWM driver
Following the addition of a Berlin PWM driver, this patch adds the corresponding documentation.
--- Documentation/devicetree/bindings/pwm/pwm-berlin.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/pwm-berlin.txt
Documentation/devicetree/bindings/pwm/pwm-berlin.txt new file +17 -0
@@ -0,0 +1,17 @@ +Berlin PWM controller + +Required properties: +- compatible: should be "marvell,berlin-pwm" +- reg: physical base address and length of the controller's registers +- clocks: phandle to the input clock +- #pwm-cells: should be 3. See pwm.txt in this directory for a description of + the cells format. + +Example: + +pwm: pwm at f7f20000 { + compatible = "marvell,berlin-pwm"; + reg = <0xf7f20000 0x40>; + clocks = <&chip_clk CLKID_CFG>; + #pwm-cells = <3>; +}
Signature · 1 line
2.6.0
Thierry Reding
AppliedRe: [PATCH v7 1/5] Documentation: bindings: document the Berlin PWM driver
Quoted 9 lines · Antoine Tenart
Following the addition of a Berlin PWM driver, this patch adds the corresponding documentation.
Signed-off-by Antoine Tenart <[email protected]>--- Documentation/devicetree/bindings/pwm/pwm-berlin.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/pwm-berlin.txt
Applied, thanks.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151005/d5676ae0/attachment.sig>
PATCH v7 2/5 pwm: add the Berlin pwm controller driver
In reply to Antoine TenartAdd a PWM controller driver for the Marvell Berlin SoCs. This PWM controller has 4 channels.
--- drivers/pwm/Kconfig | 9 ++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-berlin.c | 221 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 231 insertions(+) create mode 100644 drivers/pwm/pwm-berlin.c
drivers/pwm/Kconfig +9 -0
@@ -92,6 +92,15 @@ config PWM_BCM2835 To compile this driver as a module, choose M here: the module will be called pwm-bcm2835. +config PWM_BERLIN + tristate "Berlin PWM support" + depends on ARCH_BERLIN + help + PWM framework driver for Berlin. + + To compile this driver as a module, choose M here: the module + will be called pwm-berlin. + config PWM_BFIN tristate "Blackfin PWM support" depends on BFIN_GPTIMERS
drivers/pwm/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_PWM_ATMEL_HLCDC_PWM) += pwm-atmel-hlcdc.o obj-$(CONFIG_PWM_ATMEL_TCB) += pwm-atmel-tcb.o obj-$(CONFIG_PWM_BCM_KONA) += pwm-bcm-kona.o obj-$(CONFIG_PWM_BCM2835) += pwm-bcm2835.o +obj-$(CONFIG_PWM_BERLIN) += pwm-berlin.o obj-$(CONFIG_PWM_BFIN) += pwm-bfin.o obj-$(CONFIG_PWM_CLPS711X) += pwm-clps711x.o obj-$(CONFIG_PWM_CRC) += pwm-crc.o
drivers/pwm/pwm-berlin.c new file +221 -0
221 lines not on this page · raw message
Signature · 1 line
2.6.0
Thierry Reding
AppliedRe: [PATCH v7 2/5] pwm: add the Berlin pwm controller driver
Quoted 11 lines · Antoine Tenart
Add a PWM controller driver for the Marvell Berlin SoCs. This PWM controller has 4 channels.
Signed-off-by Antoine Tenart <[email protected]>--- drivers/pwm/Kconfig | 9 ++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-berlin.c | 221 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 231 insertions(+) create mode 100644 drivers/pwm/pwm-berlin.c
Applied, with minor tweaks, thanks.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151005/2457e4a4/attachment.sig>
PATCH 1/1 pwm: berlin: fix build warning
The newly added berlin pwm driver causes a build warning:
drivers/pwm/pwm-berlin.c: In function 'berlin_pwm_config':drivers/pwm/pwm-berlin.c:61:32: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
struct berlin_pwm_chip *pwm = to_berlin_pwm_chip(chip);
This changes the prototype of the to_berlin_pwm_chip() the way it was meant to be.
---
Quoted 13 lines · On Monday 05 October 2015 16:30:15 Thierry Reding wrote:
Quoted 11 lines · Antoine Tenart
Add a PWM controller driver for the Marvell Berlin SoCs. This PWM controller has 4 channels.
Signed-off-by Antoine Tenart <[email protected]>--- drivers/pwm/Kconfig | 9 ++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-berlin.c | 221 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 231 insertions(+) create mode 100644 drivers/pwm/pwm-berlin.c
Quoted 1 line
Applied, with minor tweaks, thanks.
Apparently the tweak has failed
drivers/pwm/pwm-berlin.c +1 -1
@@ -33,7 +33,7 @@ struct berlin_pwm_chip {void __iomem *base; }; -static inline to_berlin_pwm_chip(struct pwm_chip *chip) +static inline struct berlin_pwm_chip *to_berlin_pwm_chip (struct pwm_chip *chip) { return container_of((chip), struct berlin_pwm_chip, chip); }
PATCH v7 3/5 ARM: berlin: add a PWM node on the BG2Q
In reply to Antoine TenartThis patch adds a PWM node in the Berlin BG2Q device tree, using the newly added Berlin PWM driver.
--- arch/arm/boot/dts/berlin2q.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/berlin2q.dtsi +7 -0
@@ -477,6 +477,13 @@ status = "disabled"; }; + pwm: pwm at f20000 { + compatible = "marvell,berlin-pwm"; + reg = <0xf20000 0x40>; + clocks = <&chip_clk CLKID_CFG>; + #pwm-cells = <3>; + }; + apb at fc0000 { compatible = "simple-bus"; #address-cells = <1>;
Signature · 1 line
2.6.0
Re: [PATCH v7 3/5] ARM: berlin: add a PWM node on the BG2Q
Quoted 7 lines · Antoine Tenart
This patch adds a PWM node in the Berlin BG2Q device tree, using the newly added Berlin PWM driver.
Signed-off-by Antoine Tenart <[email protected]>--- arch/arm/boot/dts/berlin2q.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
Applied this and the next two for BG2 and BG2CD
to berlin/dt.
Thanks,
Sebastian
Quoted 19 lines
arch/arm/boot/dts/berlin2q.dtsi +7
-0@@ -477,6 +477,13 @@ status = "disabled"; }; + pwm: pwm at f20000 { + compatible = "marvell,berlin-pwm"; + reg = <0xf20000 0x40>; + clocks = <&chip_clk CLKID_CFG>; + #pwm-cells = <3>; + }; + apb at fc0000 { compatible = "simple-bus"; #address-cells = <1>;
PATCH v7 4/5 ARM: berlin: add a PWM node on the BG2
In reply to Antoine TenartThis patch adds a PWM node in the Berlin BG2 device tree, using the newly added Berlin PWM driver.
--- arch/arm/boot/dts/berlin2.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/berlin2.dtsi +7 -0
@@ -404,6 +404,13 @@ }; }; + pwm: pwm at f20000 { + compatible = "marvell,berlin-pwm"; + reg = <0xf20000 0x40>; + clocks = <&chip_clk CLKID_CFG>; + #pwm-cells = <3>; + }; + apb at fc0000 { compatible = "simple-bus"; #address-cells = <1>;
Signature · 1 line
2.6.0
PATCH v7 5/5 ARM: berlin: add a PWM node on the BG2CD
In reply to Antoine TenartThis patch adds a PWM node in the Berlin BG2CD device tree, using the newly added Berlin PWM driver.
--- arch/arm/boot/dts/berlin2cd.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/berlin2cd.dtsi +7 -0
@@ -368,6 +368,13 @@ status = "disabled"; }; + pwm: pwm at f20000 { + compatible = "marvell,berlin-pwm"; + reg = <0xf20000 0x40>; + clocks = <&chip_clk CLKID_CFG>; + #pwm-cells = <3>; + }; + apb at fc0000 { compatible = "simple-bus"; #address-cells = <1>;
Signature · 1 line
2.6.0