Skip to contentSkip to conversation

ARM: berlin: PWM support

PATCH Applied Antoine Tenart 4 participants 10 messages Oct 2, 2015 – Oct 6, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

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
new file mode 100644
index 000000000000..82cbe16fcbbc
@@ -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
#2 lore raw

Re: [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.

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

#3 lore raw

PATCH v7 2/5 pwm: add the Berlin pwm controller driver

In reply to Antoine Tenart

Add 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
index 062630ab7424..f3e8b7566ce5 100644
@@ -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
index a0e00c09ead3..601833d82da5 100644
@@ -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
#4 lore raw

Re: [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.

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

#5 lore raw

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.

---
 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
index a390de6a760f..97933d3b2cc4 100644
@@ -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);
 }
#6 lore raw

PATCH v7 3/5 ARM: berlin: add a PWM node on the BG2Q

In reply to Antoine Tenart

This 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
index 63a48490e2f9..5bfa71a87617 100644
@@ -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
#7 lore raw

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.

---
  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
index 63a48490e2f9..5bfa71a87617 100644
@@ -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>;
#8 lore raw

PATCH v7 4/5 ARM: berlin: add a PWM node on the BG2

In reply to Antoine Tenart

This 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
index ef811de09908..f094b06d16aa 100644
@@ -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
#9 lore raw

PATCH v7 5/5 ARM: berlin: add a PWM node on the BG2CD

In reply to Antoine Tenart

This 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
index 900213d78a32..5d984f58dde7 100644
@@ -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