Skip to contentSkip to conversation

Add PWM support for Meson8

PATCH New Martin Blumenstingl 2 participants 4 messages Jul 11, 2017 – Jul 28, 2017

Subsystems (2)
lore
Share & tools
lore

Martin Blumenstingl

author reviewer
#0 lore raw

cover Add PWM support for Meson8

This series moves the pwm_ab and pwm_cd nodes to the common meson.dtsi. According to Amlogic's GPL kernel sources Meson6 contains the same PWM IP blocks for pwm_ab and pwm_cd (at the same register offsets) as Meson8 and Meson8b.

pwm_ef on the other hand does not exist on Meson6, so it stays in meson8b.dtsi (and is added to meson8b.dtsi).

Known usages of the PWM controllers:
- controlling the brightness of the system LED
- generating the 32.768kHz wifi LPO clock
- controlling the VDDEE (CPU) voltage

Martin Blumenstingl (2):
ARM: dts: move the pwm_ab and pwm_cd nodes to meson.dtsi
ARM: dts: meson8: add the PWM controller nodes

 arch/arm/boot/dts/meson.dtsi   | 14 ++++++++++++++
 arch/arm/boot/dts/meson8.dtsi  | 15 +++++++++++++++
 arch/arm/boot/dts/meson8b.dtsi | 22 ++++++++--------------
 3 files changed, 37 insertions(+), 14 deletions(-)
Signature · 1 line
2.13.2
author reviewer
#1 lore raw

PATCH 1/2 ARM: dts: move the pwm_ab and pwm_cd nodes to meson.dtsi

According to the vendor kernel sources these also exist (at the same address) on Meson6 and Meson8. This can be found by running

$ grep -R "define PWM_PWM_[A-D]" arch/arm/
in the Amlogic GPL kernel tree (arm-src-kernel-2015-01-15-321cfb5a46).
pwm_ef does not seem to exist on older SoCs, so we keep it in
meson8b.dtsi for now.
---
 arch/arm/boot/dts/meson.dtsi   | 14 ++++++++++++++
 arch/arm/boot/dts/meson8b.dtsi | 22 ++++++++--------------
 2 files changed, 22 insertions(+), 14 deletions(-)
arch/arm/boot/dts/meson.dtsi +14 -0
index 15204e44161d..4c27ca083afb 100644
@@ -108,6 +108,20 @@
 				status = "disabled";
 			};
 
+			pwm_ab: pwm at 8550 {
+				compatible = "amlogic,meson-pwm";
+				reg = <0x8550 0x10>;
+				#pwm-cells = <3>;
+				status = "disabled";
+			};
+
+			pwm_cd: pwm at 8650 {
+				compatible = "amlogic,meson-pwm";
+				reg = <0x8650 0x10>;
+				#pwm-cells = <3>;
+				status = "disabled";
+			};
+
 			saradc: adc at 8680 {
 				compatible = "amlogic,meson-saradc";
 				reg = <0x8680 0x34>;
arch/arm/boot/dts/meson8b.dtsi +8 -14
index 72e4f425f190..65b36c944b45 100644
@@ -129,20 +129,6 @@
 		#reset-cells = <1>;
 	};
 
-	pwm_ab: pwm at 8550 {
-		compatible = "amlogic,meson8b-pwm";
-		reg = <0x8550 0x10>;
-		#pwm-cells = <3>;
-		status = "disabled";
-	};
-
-	pwm_cd: pwm at 8650 {
-		compatible = "amlogic,meson8b-pwm";
-		reg = <0x8650 0x10>;
-		#pwm-cells = <3>;
-		status = "disabled";
-	};
-
 	pwm_ef: pwm at 86c0 {
 		compatible = "amlogic,meson8b-pwm";
 		reg = <0x86c0 0x10>;
@@ -193,6 +179,14 @@
 	arm,filter-ranges = <0x100000 0xc0000000>;
 };
 
+&pwm_ab {
+	compatible = "amlogic,meson8b-pwm";
+};
+
+&pwm_cd {
+	compatible = "amlogic,meson8b-pwm";
+};
+
 &saradc {
 	compatible = "amlogic,meson8b-saradc", "amlogic,meson-saradc";
 	clocks = <&clkc CLKID_XTAL>,
Signature · 1 line
2.13.2
author reviewer
#2 lore raw

PATCH 2/2 ARM: dts: meson8: add the PWM controller nodes

In reply to Martin Blumenstingl

pwm_ab and pwm_cd are already inherited from meson.dtsi, we only need to define the correct "compatible" string so the pwm-meson driver can choose the parent clocks correctly.
pwm_ef is added to meson8.dtsi directly (similar to how it's done in meson8b.dtsi) as this controller only exists on Meson8 and Meson8b.

---
 arch/arm/boot/dts/meson8.dtsi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/boot/dts/meson8.dtsi +15 -0
index cada35828931..6fe6a159e960 100644
@@ -172,6 +172,13 @@
 		reg = <0x8000 0x4>, <0x4000 0x460>;
 	};
 
+	pwm_ef: pwm at 86c0 {
+		compatible = "amlogic,meson8-pwm", "amlogic,meson8b-pwm";
+		reg = <0x86c0 0x10>;
+		#pwm-cells = <3>;
+		status = "disabled";
+	};
+
 	pinctrl_cbus: pinctrl at 9880 {
 		compatible = "amlogic,meson8-cbus-pinctrl";
 		reg = <0x9880 0x10>;
@@ -270,6 +277,14 @@
 	arm,filter-ranges = <0x100000 0xc0000000>;
 };
 
+&pwm_ab {
+	compatible = "amlogic,meson8-pwm", "amlogic,meson8b-pwm";
+};
+
+&pwm_cd {
+	compatible = "amlogic,meson8-pwm", "amlogic,meson8b-pwm";
+};
+
 &saradc {
 	compatible = "amlogic,meson8-saradc", "amlogic,meson-saradc";
 	clocks = <&clkc CLKID_XTAL>,
Signature · 1 line
2.13.2
maintainer Applied
#3 lore raw

cover Add PWM support for Meson8

In reply to Martin Blumenstingl
Quoted 5 lines · Martin Blumenstingl

This series moves the pwm_ab and pwm_cd nodes to the common meson.dtsi. According to Amlogic's GPL kernel sources Meson6 contains the same PWM IP blocks for pwm_ab and pwm_cd (at the same register offsets) as Meson8 and Meson8b.

Quoted 7 lines

pwm_ef on the other hand does not exist on Meson6, so it stays in meson8b.dtsi (and is added to meson8b.dtsi).

Known usages of the PWM controllers:
- controlling the brightness of the system LED
- generating the 32.768kHz wifi LPO clock
- controlling the VDDEE (CPU) voltage

Applied to v4.14/dt,

Thanks,

Kevin