Skip to contentSkip to conversation

ARM: dts: add pwm node for r40.

PATCH Superseded hao_zhang 2 participants 5 messages Jan 11, 2018 – Jan 15, 2018

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

hao_zhang

author
#0 lore raw

PATCH 4/4 ARM: dts: add pwm node for r40.

This patch add pwm node for r40.

---
 arch/arm/boot/dts/sun8i-r40.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/sun8i-r40.dtsi +13 -0
index 173dcc1..84c963c 100644
@@ -295,6 +295,11 @@
 				bias-pull-up;
 			};
 
+			pwm_pins: pwm-pins {
+				pins = "PB2", "PB3";
+				function = "pwm";
+			};
+
 			uart0_pb_pins: uart0-pb-pins {
 				pins = "PB22", "PB23";
 				function = "uart0";
@@ -306,6 +311,14 @@
 			reg = <0x01c20c90 0x10>;
 		};
 
+		pwm: pwm at 1c23400 {
+			     compatible = "allwinner,sun8i-r40-pwm";
+			     reg = <0x01c23400 0x154>;
+			     clocks = <&osc24M>;
+			     #pwm-cells = <3>;
+			     status = "disabled";
+		};
+
 		uart0: serial at 1c28000 {
 			compatible = "snps,dw-apb-uart";
 			reg = <0x01c28000 0x400>;
Signature · 1 line
2.7.4
#1 lore raw

Hi,

Quoted 12 lines · hao_zhang

This patch add pwm node for r40.

---
 arch/arm/boot/dts/sun8i-r40.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/sun8i-r40.dtsi +0 -0
index 173dcc1..84c963c 100644

arch/arm/boot/dts/sun8i-r40.dtsi line 302

Quoted 8 lines
arch/arm/boot/dts/sun8i-r40.dtsi +5 -0
@@ -295,6 +295,11 @@
 				bias-pull-up;
 			};
 
+			pwm_pins: pwm-pins {
+				pins = "PB2", "PB3";
+				function = "pwm";
+			};
+

Is it the only combination of pins that is usable?

If so, you can add the pinctrl-0 property directly in the pwm nodes.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180111/42ba49ea/attachment.sig>
author
#2 lore raw

2018-01-11 20:47 GMT+08:00 Maxime Ripard <[email protected]>:

Quoted 26 lines

Hi,

Quoted 12 lines · hao_zhang

This patch add pwm node for r40.

---
 arch/arm/boot/dts/sun8i-r40.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/sun8i-r40.dtsi +0 -0
index 173dcc1..84c963c 100644

arch/arm/boot/dts/sun8i-r40.dtsi line 302

Quoted 8 lines
arch/arm/boot/dts/sun8i-r40.dtsi +5 -0
@@ -295,6 +295,11 @@
                              bias-pull-up;
                      };
 
+                     pwm_pins: pwm-pins {
+                             pins = "PB2", "PB3";
+                             function = "pwm";
+                     };
+

Is it the only combination of pins that is usable?

Quoted 2 lines

If so, you can add the pinctrl-0 property directly in the pwm nodes.

There are 8 channel pwm of R40/V40/T3, the pins that can be configed to pwm are:
PB2, PB3, PI20, PI21, PB20, PB21, PB9, PB10

PB2, PB3 can be configed on bananapi-m2-ultra and on my T3 board, but the other pins
is not exist on the board or some pin is confilct with other functions, so i just add
PB2, PB3. but i think split it is better, just like this :

pwm0_pin: pwm0-pin {
    pins = "PB2";
    function = "pwm";
};
pwm1_pin: pwm1-pin {
    pins = "PB3";
    function = "pwm";
};

the node of pwm2~7 should also be added here?

On sun8i-r40-bananapi-m2-ultra.dts:
because of the special customize board, i think just add pinctrl-0 = <&pwm0_pin> (PB3 I just use to test pwm channel 1)for bananapi-m2-ultra board is enough.

&pwm {
    pinctrl-names = "default";
    pinctrl-0 = <&pwm0_pin>;
    status = "okay";
};

Thanks ;-)
Hao Zhang

Quoted 7 lines

Thanks!
Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

#3 lore raw

Hi,

Quoted 25 lines · Hao Zhang

2018-01-11 20:47 GMT+08:00 Maxime Ripard <[email protected]>:

Quoted 24 lines · hao_zhang
Quoted 12 lines

This patch add pwm node for r40.

---
 arch/arm/boot/dts/sun8i-r40.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/sun8i-r40.dtsi +0 -0
index 173dcc1..84c963c 100644

arch/arm/boot/dts/sun8i-r40.dtsi line 302

Quoted 8 lines
arch/arm/boot/dts/sun8i-r40.dtsi +5 -0
@@ -295,6 +295,11 @@
                              bias-pull-up;
                      };
 
+                     pwm_pins: pwm-pins {
+                             pins = "PB2", "PB3";
+                             function = "pwm";
+                     };
+

Is it the only combination of pins that is usable?

Quoted 5 lines
Quoted 2 lines

If so, you can add the pinctrl-0 property directly in the pwm nodes.

There are 8 channel pwm of R40/V40/T3, the pins that can be configed to pwm are: PB2, PB3, PI20, PI21, PB20, PB21, PB9, PB10

And a single controller, or several of them?

Quoted 10 lines

PB2, PB3 can be configed on bananapi-m2-ultra and on my T3 board, but the other pins is not exist on the board or some pin is confilct with other functions, so i just add PB2, PB3. but i think split it is better, just like this :

pwm0_pin: pwm0-pin {
    pins = "PB2";
    function = "pwm";
};
Quoted 4 lines
pwm1_pin: pwm1-pin {
    pins = "PB3";
    function = "pwm";
};

Yep, that would be better. If it's just a matter of channels, maybe we can even name them pwm-ch0-pin and pwm-ch1-pin? That would be more explicit.

Quoted 1 line

the node of pwm2~7 should also be added here?

If there's no users, no.

Quoted 9 lines

On sun8i-r40-bananapi-m2-ultra.dts:
because of the special customize board, i think just add pinctrl-0 = <&pwm0_pin> (PB3 I just use to test pwm channel 1)for bananapi-m2-ultra board is enough.

&pwm {
    pinctrl-names = "default";
    pinctrl-0 = <&pwm0_pin>;
    status = "okay";
};

It depends if that PWM is used as a PWM all the time (for example to drive a backlight for a panel tied to the board), or if it's exported through one of the generic pin headers, please leave it populated but disabled (with a comment that it is exported on one of the pin of the headers)

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180115/bee9321d/attachment.sig>
author
#4 lore raw

2018-01-15 16:38 GMT+08:00 Maxime Ripard <[email protected]>:

Quoted 28 lines

Hi,

Quoted 25 lines · Hao Zhang

2018-01-11 20:47 GMT+08:00 Maxime Ripard <[email protected]>:

Quoted 24 lines · hao_zhang
Quoted 12 lines

This patch add pwm node for r40.

---
 arch/arm/boot/dts/sun8i-r40.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/sun8i-r40.dtsi +0 -0
index 173dcc1..84c963c 100644

arch/arm/boot/dts/sun8i-r40.dtsi line 302

Quoted 8 lines
arch/arm/boot/dts/sun8i-r40.dtsi +5 -0
@@ -295,6 +295,11 @@
                              bias-pull-up;
                      };
 
+                     pwm_pins: pwm-pins {
+                             pins = "PB2", "PB3";
+                             function = "pwm";
+                     };
+

Is it the only combination of pins that is usable?

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

If so, you can add the pinctrl-0 property directly in the pwm nodes.

There are 8 channel pwm of R40/V40/T3, the pins that can be configed to pwm are: PB2, PB3, PI20, PI21, PB20, PB21, PB9, PB10

And a single controller, or several of them?

Single controller with 8 channels pwm output.

Quoted 11 lines
Quoted 11 lines

PB2, PB3 can be configed on bananapi-m2-ultra and on my T3 board, but the other pins is not exist on the board or some pin is confilct with other functions, so i just add PB2, PB3. but i think split it is better, just like this :

pwm0_pin: pwm0-pin {
    pins = "PB2";
    function = "pwm";
};
Quoted 9 lines
Quoted 4 lines
pwm1_pin: pwm1-pin {
    pins = "PB3";
    function = "pwm";
};

Yep, that would be better. If it's just a matter of channels, maybe we can even name them pwm-ch0-pin and pwm-ch1-pin? That would be more explicit.

Agree

Quoted 27 lines
Quoted 1 line

the node of pwm2~7 should also be added here?

If there's no users, no.

Quoted 9 lines

On sun8i-r40-bananapi-m2-ultra.dts:
because of the special customize board, i think just add pinctrl-0 = <&pwm0_pin> (PB3 I just use to test pwm channel 1)for bananapi-m2-ultra board is enough.

&pwm {
    pinctrl-names = "default";
    pinctrl-0 = <&pwm0_pin>;
    status = "okay";
};

It depends if that PWM is used as a PWM all the time (for example to drive a backlight for a panel tied to the board), or if it's exported through one of the generic pin headers, please leave it populated but disabled (with a comment that it is exported on one of the pin of the headers)

Thanks!
Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com