linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Add PWM feature in Allwinner H3
@ 2016-08-31  8:25 Milo Kim
  2016-08-31  8:25 ` [PATCH v2 1/4] ARM: dts: sun8i: Add PWM pin in H3 Milo Kim
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Milo Kim @ 2016-08-31  8:25 UTC (permalink / raw)
  To: linux-arm-kernel

According to the latest datasheet, H3 has single PWM channel.
H3 PWM controller has same register layout as sun4i driver, so it works 
by adding H3 specific data.
And the second PWM channel is not supported, so the pinctrl function is removed.

Datasheet:
  http://linux-sunxi.org/File:Allwinner_H3_Datasheet_V1.2.pdf

Test environment:
  Tested on Nano Pi M1 board, but PA5 pin is assigned for UART0.
  So the debug console should be changed to other port like UART1.

  Ex)
	aliases {
		serial0 = &uart1;
	};

	&uart1 {
        	pinctrl-names = "default";
	        pinctrl-0 = <&uart1_pins_a>;
        	status = "okay";
	};

v2:
  Split v1 patch-set into several patches

Milo Kim (4):
  ARM: dts: sun8i: Add PWM pin in H3
  ARM: dts: sun8i: Add PWM controller node in H3
  pinctrl: sunxi: Remove unsupported PWM channel pinmux in H3
  pwm: sunxi: Add H3 support

 Documentation/devicetree/bindings/pwm/pwm-sun4i.txt |  1 +
 arch/arm/boot/dts/sun8i-h3.dtsi                     | 15 +++++++++++++++
 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c            |  1 -
 drivers/pwm/pwm-sun4i.c                             |  9 +++++++++
 4 files changed, 25 insertions(+), 1 deletion(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 1/4] ARM: dts: sun8i: Add PWM pin in H3
  2016-08-31  8:25 [PATCH v2 0/4] Add PWM feature in Allwinner H3 Milo Kim
@ 2016-08-31  8:25 ` Milo Kim
  2016-08-31  8:33   ` Chen-Yu Tsai
  2016-08-31 16:20   ` Maxime Ripard
  2016-08-31  8:25 ` [PATCH v2 2/4] ARM: dts: sun8i: Add PWM controller node " Milo Kim
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 20+ messages in thread
From: Milo Kim @ 2016-08-31  8:25 UTC (permalink / raw)
  To: linux-arm-kernel

H3 PA5 pin is assigned for single PWM channel.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: devicetree at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
---
 arch/arm/boot/dts/sun8i-h3.dtsi | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
index fdf9fdb..05d0c4b 100644
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
@@ -360,6 +360,13 @@
 				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 			};
 
+			pwm0_pin_a: pwm0 at 0 {
+				allwinner,pins = "PA5";
+				allwinner,function = "pwm0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
 			uart0_pins_a: uart0 at 0 {
 				allwinner,pins = "PA4", "PA5";
 				allwinner,function = "uart0";
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 2/4] ARM: dts: sun8i: Add PWM controller node in H3
  2016-08-31  8:25 [PATCH v2 0/4] Add PWM feature in Allwinner H3 Milo Kim
  2016-08-31  8:25 ` [PATCH v2 1/4] ARM: dts: sun8i: Add PWM pin in H3 Milo Kim
@ 2016-08-31  8:25 ` Milo Kim
  2016-08-31  8:42   ` Chen-Yu Tsai
  2016-08-31 16:16   ` Maxime Ripard
  2016-08-31  8:25 ` [PATCH v2 3/4] pinctrl: sunxi: Remove unsupported PWM channel pinmux " Milo Kim
  2016-08-31  8:25 ` [PATCH v2 4/4] pwm: sunxi: Add H3 support Milo Kim
  3 siblings, 2 replies; 20+ messages in thread
From: Milo Kim @ 2016-08-31  8:25 UTC (permalink / raw)
  To: linux-arm-kernel

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: devicetree at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
---
 arch/arm/boot/dts/sun8i-h3.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
index 05d0c4b..860e355 100644
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
@@ -396,6 +396,14 @@
 			interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		pwm: pwm at 01c21400 {
+			compatible = "allwinner,sun8i-h3-pwm";
+			reg = <0x01c21400 0x8>;
+			clocks = <&osc24M>;
+			#pwm-cells = <3>;
+			status = "disabled";
+		};
+
 		uart0: serial at 01c28000 {
 			compatible = "snps,dw-apb-uart";
 			reg = <0x01c28000 0x400>;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 3/4] pinctrl: sunxi: Remove unsupported PWM channel pinmux in H3
  2016-08-31  8:25 [PATCH v2 0/4] Add PWM feature in Allwinner H3 Milo Kim
  2016-08-31  8:25 ` [PATCH v2 1/4] ARM: dts: sun8i: Add PWM pin in H3 Milo Kim
  2016-08-31  8:25 ` [PATCH v2 2/4] ARM: dts: sun8i: Add PWM controller node " Milo Kim
@ 2016-08-31  8:25 ` Milo Kim
  2016-08-31  8:35   ` Chen-Yu Tsai
                     ` (2 more replies)
  2016-08-31  8:25 ` [PATCH v2 4/4] pwm: sunxi: Add H3 support Milo Kim
  3 siblings, 3 replies; 20+ messages in thread
From: Milo Kim @ 2016-08-31  8:25 UTC (permalink / raw)
  To: linux-arm-kernel

H3 has single PWM channel. The second PWM channel is not supported,
so the pinctrl function should be removed.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Icenowy Zheng <icenowy@aosc.xyz>
Cc: Jens Kuske <jenskuske@gmail.com>
Cc: Krzysztof Adamski <k@japko.eu>
Cc: linux-gpio at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
---
 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
index 26a2ad3..518a92d 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
@@ -60,7 +60,6 @@ static const struct sunxi_desc_pin sun8i_h3_pins[] = {
 		  SUNXI_FUNCTION(0x0, "gpio_in"),
 		  SUNXI_FUNCTION(0x1, "gpio_out"),
 		  SUNXI_FUNCTION(0x2, "sim"),		/* PWREN */
-		  SUNXI_FUNCTION(0x3, "pwm1"),
 		  SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 6)),	/* PA_EINT6 */
 	SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 7),
 		  SUNXI_FUNCTION(0x0, "gpio_in"),
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 4/4] pwm: sunxi: Add H3 support
  2016-08-31  8:25 [PATCH v2 0/4] Add PWM feature in Allwinner H3 Milo Kim
                   ` (2 preceding siblings ...)
  2016-08-31  8:25 ` [PATCH v2 3/4] pinctrl: sunxi: Remove unsupported PWM channel pinmux " Milo Kim
@ 2016-08-31  8:25 ` Milo Kim
  2016-08-31  8:41   ` Chen-Yu Tsai
                     ` (3 more replies)
  3 siblings, 4 replies; 20+ messages in thread
From: Milo Kim @ 2016-08-31  8:25 UTC (permalink / raw)
  To: linux-arm-kernel

H3 PWM controller has same register layout as sun4i driver, so it works
by adding H3 specific data.

Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: linux-pwm at vger.kernel.org
Cc: devicetree at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
---
 Documentation/devicetree/bindings/pwm/pwm-sun4i.txt | 1 +
 drivers/pwm/pwm-sun4i.c                             | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/pwm/pwm-sun4i.txt b/Documentation/devicetree/bindings/pwm/pwm-sun4i.txt
index cf6068b..f1cbeef 100644
--- a/Documentation/devicetree/bindings/pwm/pwm-sun4i.txt
+++ b/Documentation/devicetree/bindings/pwm/pwm-sun4i.txt
@@ -6,6 +6,7 @@ Required properties:
     - "allwinner,sun5i-a10s-pwm"
     - "allwinner,sun5i-a13-pwm"
     - "allwinner,sun7i-a20-pwm"
+    - "allwinner,sun8i-h3-pwm"
   - reg: physical base address and length of the controller's registers
   - #pwm-cells: should be 3. See pwm.txt in this directory for a description of
     the cells format.
diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
index 03a99a5..b0803f6 100644
--- a/drivers/pwm/pwm-sun4i.c
+++ b/drivers/pwm/pwm-sun4i.c
@@ -284,6 +284,12 @@ static const struct sun4i_pwm_data sun4i_pwm_data_a20 = {
 	.npwm = 2,
 };
 
+static const struct sun4i_pwm_data sun4i_pwm_data_h3 = {
+	.has_prescaler_bypass = true,
+	.has_rdy = true,
+	.npwm = 1,
+};
+
 static const struct of_device_id sun4i_pwm_dt_ids[] = {
 	{
 		.compatible = "allwinner,sun4i-a10-pwm",
@@ -298,6 +304,9 @@ static const struct of_device_id sun4i_pwm_dt_ids[] = {
 		.compatible = "allwinner,sun7i-a20-pwm",
 		.data = &sun4i_pwm_data_a20,
 	}, {
+		.compatible = "allwinner,sun8i-h3-pwm",
+		.data = &sun4i_pwm_data_h3,
+	}, {
 		/* sentinel */
 	},
 };
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v2 1/4] ARM: dts: sun8i: Add PWM pin in H3
  2016-08-31  8:25 ` [PATCH v2 1/4] ARM: dts: sun8i: Add PWM pin in H3 Milo Kim
@ 2016-08-31  8:33   ` Chen-Yu Tsai
  2016-09-01 12:51     ` Milo Kim
  2016-08-31 16:20   ` Maxime Ripard
  1 sibling, 1 reply; 20+ messages in thread
From: Chen-Yu Tsai @ 2016-08-31  8:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 31, 2016 at 4:25 PM, Milo Kim <woogyom.kim@gmail.com> wrote:
> H3 PA5 pin is assigned for single PWM channel.
>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: devicetree at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
> ---
>  arch/arm/boot/dts/sun8i-h3.dtsi | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
> index fdf9fdb..05d0c4b 100644
> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
> @@ -360,6 +360,13 @@
>                                 allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
>                         };
>
> +                       pwm0_pin_a: pwm0 at 0 {

This is the only possible configuration. You can drop the _a suffix
from the label, and @0 from the node name.

ChenYu

> +                               allwinner,pins = "PA5";
> +                               allwinner,function = "pwm0";
> +                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> +                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> +                       };
> +
>                         uart0_pins_a: uart0 at 0 {
>                                 allwinner,pins = "PA4", "PA5";
>                                 allwinner,function = "uart0";
> --
> 2.9.3
>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 3/4] pinctrl: sunxi: Remove unsupported PWM channel pinmux in H3
  2016-08-31  8:25 ` [PATCH v2 3/4] pinctrl: sunxi: Remove unsupported PWM channel pinmux " Milo Kim
@ 2016-08-31  8:35   ` Chen-Yu Tsai
  2016-09-07 19:41   ` Linus Walleij
  2016-09-07 23:09   ` Linus Walleij
  2 siblings, 0 replies; 20+ messages in thread
From: Chen-Yu Tsai @ 2016-08-31  8:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 31, 2016 at 4:25 PM, Milo Kim <woogyom.kim@gmail.com> wrote:
> H3 has single PWM channel. The second PWM channel is not supported,
> so the pinctrl function should be removed.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Icenowy Zheng <icenowy@aosc.xyz>
> Cc: Jens Kuske <jenskuske@gmail.com>
> Cc: Krzysztof Adamski <k@japko.eu>
> Cc: linux-gpio at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>

Acked-by: Chen-Yu Tsai <wens@csie.org>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 4/4] pwm: sunxi: Add H3 support
  2016-08-31  8:25 ` [PATCH v2 4/4] pwm: sunxi: Add H3 support Milo Kim
@ 2016-08-31  8:41   ` Chen-Yu Tsai
  2016-09-01 10:39   ` Alexandre Belloni
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 20+ messages in thread
From: Chen-Yu Tsai @ 2016-08-31  8:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 31, 2016 at 4:25 PM, Milo Kim <woogyom.kim@gmail.com> wrote:
> H3 PWM controller has same register layout as sun4i driver, so it works
> by adding H3 specific data.
>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: linux-pwm at vger.kernel.org
> Cc: devicetree at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>

Acked-by: Chen-Yu Tsai <wens@csie.org>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 2/4] ARM: dts: sun8i: Add PWM controller node in H3
  2016-08-31  8:25 ` [PATCH v2 2/4] ARM: dts: sun8i: Add PWM controller node " Milo Kim
@ 2016-08-31  8:42   ` Chen-Yu Tsai
  2016-08-31 16:16   ` Maxime Ripard
  1 sibling, 0 replies; 20+ messages in thread
From: Chen-Yu Tsai @ 2016-08-31  8:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 31, 2016 at 4:25 PM, Milo Kim <woogyom.kim@gmail.com> wrote:
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: devicetree at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>

Acked-by: Chen-Yu Tsai <wens@csie.org>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 2/4] ARM: dts: sun8i: Add PWM controller node in H3
  2016-08-31  8:25 ` [PATCH v2 2/4] ARM: dts: sun8i: Add PWM controller node " Milo Kim
  2016-08-31  8:42   ` Chen-Yu Tsai
@ 2016-08-31 16:16   ` Maxime Ripard
  1 sibling, 0 replies; 20+ messages in thread
From: Maxime Ripard @ 2016-08-31 16:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 31, 2016 at 05:25:18PM +0900, Milo Kim wrote:
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: devicetree at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>

Applied, thanks

Maxime

-- 
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: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160831/45a011ea/attachment.sig>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 1/4] ARM: dts: sun8i: Add PWM pin in H3
  2016-08-31  8:25 ` [PATCH v2 1/4] ARM: dts: sun8i: Add PWM pin in H3 Milo Kim
  2016-08-31  8:33   ` Chen-Yu Tsai
@ 2016-08-31 16:20   ` Maxime Ripard
  2016-09-01 13:06     ` Milo Kim
  1 sibling, 1 reply; 20+ messages in thread
From: Maxime Ripard @ 2016-08-31 16:20 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Milo,

On Wed, Aug 31, 2016 at 05:25:17PM +0900, Milo Kim wrote:
> H3 PA5 pin is assigned for single PWM channel.
> 
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: devicetree at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
> ---
>  arch/arm/boot/dts/sun8i-h3.dtsi | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
> index fdf9fdb..05d0c4b 100644
> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
> @@ -360,6 +360,13 @@
>  				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
>  			};
>  
> +			pwm0_pin_a: pwm0 at 0 {
> +				allwinner,pins = "PA5";
> +				allwinner,function = "pwm0";
> +				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> +				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> +			};
> +

Is it used on any boards?

If not, we have the policy of not merging the pinctrl nodes that are
not used by anyone to avoid bloating the DT for no particular reason.

Maxime

-- 
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: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160831/41aaa03c/attachment.sig>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 4/4] pwm: sunxi: Add H3 support
  2016-08-31  8:25 ` [PATCH v2 4/4] pwm: sunxi: Add H3 support Milo Kim
  2016-08-31  8:41   ` Chen-Yu Tsai
@ 2016-09-01 10:39   ` Alexandre Belloni
  2016-09-02 15:18   ` Rob Herring
  2016-09-05 10:09   ` Thierry Reding
  3 siblings, 0 replies; 20+ messages in thread
From: Alexandre Belloni @ 2016-09-01 10:39 UTC (permalink / raw)
  To: linux-arm-kernel

On 31/08/2016 at 17:25:20 +0900, Milo Kim wrote :
> H3 PWM controller has same register layout as sun4i driver, so it works
> by adding H3 specific data.
> 
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: linux-pwm at vger.kernel.org
> Cc: devicetree at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

> ---
>  Documentation/devicetree/bindings/pwm/pwm-sun4i.txt | 1 +
>  drivers/pwm/pwm-sun4i.c                             | 9 +++++++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/pwm/pwm-sun4i.txt b/Documentation/devicetree/bindings/pwm/pwm-sun4i.txt
> index cf6068b..f1cbeef 100644
> --- a/Documentation/devicetree/bindings/pwm/pwm-sun4i.txt
> +++ b/Documentation/devicetree/bindings/pwm/pwm-sun4i.txt
> @@ -6,6 +6,7 @@ Required properties:
>      - "allwinner,sun5i-a10s-pwm"
>      - "allwinner,sun5i-a13-pwm"
>      - "allwinner,sun7i-a20-pwm"
> +    - "allwinner,sun8i-h3-pwm"
>    - reg: physical base address and length of the controller's registers
>    - #pwm-cells: should be 3. See pwm.txt in this directory for a description of
>      the cells format.
> diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
> index 03a99a5..b0803f6 100644
> --- a/drivers/pwm/pwm-sun4i.c
> +++ b/drivers/pwm/pwm-sun4i.c
> @@ -284,6 +284,12 @@ static const struct sun4i_pwm_data sun4i_pwm_data_a20 = {
>  	.npwm = 2,
>  };
>  
> +static const struct sun4i_pwm_data sun4i_pwm_data_h3 = {
> +	.has_prescaler_bypass = true,
> +	.has_rdy = true,
> +	.npwm = 1,
> +};
> +
>  static const struct of_device_id sun4i_pwm_dt_ids[] = {
>  	{
>  		.compatible = "allwinner,sun4i-a10-pwm",
> @@ -298,6 +304,9 @@ static const struct of_device_id sun4i_pwm_dt_ids[] = {
>  		.compatible = "allwinner,sun7i-a20-pwm",
>  		.data = &sun4i_pwm_data_a20,
>  	}, {
> +		.compatible = "allwinner,sun8i-h3-pwm",
> +		.data = &sun4i_pwm_data_h3,
> +	}, {
>  		/* sentinel */
>  	},
>  };
> -- 
> 2.9.3
> 

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 1/4] ARM: dts: sun8i: Add PWM pin in H3
  2016-08-31  8:33   ` Chen-Yu Tsai
@ 2016-09-01 12:51     ` Milo Kim
  0 siblings, 0 replies; 20+ messages in thread
From: Milo Kim @ 2016-09-01 12:51 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/31/2016 05:33 PM, Chen-Yu Tsai wrote:
>> +                       pwm0_pin_a: pwm0 at 0 {
> This is the only possible configuration. You can drop the _a suffix
> from the label, and @0 from the node name.

OK, thanks for your review.

Best regards,
Milo

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 1/4] ARM: dts: sun8i: Add PWM pin in H3
  2016-08-31 16:20   ` Maxime Ripard
@ 2016-09-01 13:06     ` Milo Kim
  2016-09-01 19:51       ` Maxime Ripard
  0 siblings, 1 reply; 20+ messages in thread
From: Milo Kim @ 2016-09-01 13:06 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/01/2016 01:20 AM, Maxime Ripard wrote:
> Hi Milo,
>
> On Wed, Aug 31, 2016 at 05:25:17PM +0900, Milo Kim wrote:
>> H3 PA5 pin is assigned for single PWM channel.
>>
>> Cc: Rob Herring <robh+dt@kernel.org>
>> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
>> Cc: Chen-Yu Tsai <wens@csie.org>
>> Cc: devicetree at vger.kernel.org
>> Cc: linux-arm-kernel at lists.infradead.org
>> Cc: linux-kernel at vger.kernel.org
>> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
>> ---
>>  arch/arm/boot/dts/sun8i-h3.dtsi | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
>> index fdf9fdb..05d0c4b 100644
>> --- a/arch/arm/boot/dts/sun8i-h3.dtsi
>> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi
>> @@ -360,6 +360,13 @@
>>  				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
>>  			};
>>
>> +			pwm0_pin_a: pwm0 at 0 {
>> +				allwinner,pins = "PA5";
>> +				allwinner,function = "pwm0";
>> +				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
>> +				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
>> +			};
>> +
>
> Is it used on any boards?
>
> If not, we have the policy of not merging the pinctrl nodes that are
> not used by anyone to avoid bloating the DT for no particular reason.

Yes, I have. It's Nano Pi M1 which was derived from Orange Pi PC.
The board DTS is ready to be sent out, but I'm not sure which is better.

	a) Send new board DTS file in other patch thread

	[PATCH v3 0/4] Add PWM feature in Allwinner H3
	[PATCH v3 1/4] ARM: dts: sun8i: Add PWM pin in H3
	..
	[PATCH v3 4/4] pwm: sunxi: Add H3 support

	[PATCH] ARM: dts: sun8i: Add Nano Pi M1 support

Or

	b) Include the DTS in next patch-set v3
	[PATCH v3 0/4] Add PWM feature in Allwinner H3
	[PATCH v3 1/4] ARM: dts: sun8i: Add PWM pin in H3
	[PATCH v3 2/4] ARM: dts: sun8i: Add PWM controller node in H3
	[PATCH v3 3/4] ARM: dts: sun8i: Add Nano Pi M1 support
	...

I'd like to have your opinion.

Best regards,
Milo

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 1/4] ARM: dts: sun8i: Add PWM pin in H3
  2016-09-01 13:06     ` Milo Kim
@ 2016-09-01 19:51       ` Maxime Ripard
  0 siblings, 0 replies; 20+ messages in thread
From: Maxime Ripard @ 2016-09-01 19:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 01, 2016 at 10:06:12PM +0900, Milo Kim wrote:
> On 09/01/2016 01:20 AM, Maxime Ripard wrote:
> >Hi Milo,
> >
> >On Wed, Aug 31, 2016 at 05:25:17PM +0900, Milo Kim wrote:
> >>H3 PA5 pin is assigned for single PWM channel.
> >>
> >>Cc: Rob Herring <robh+dt@kernel.org>
> >>Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> >>Cc: Chen-Yu Tsai <wens@csie.org>
> >>Cc: devicetree at vger.kernel.org
> >>Cc: linux-arm-kernel at lists.infradead.org
> >>Cc: linux-kernel at vger.kernel.org
> >>Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
> >>---
> >> arch/arm/boot/dts/sun8i-h3.dtsi | 7 +++++++
> >> 1 file changed, 7 insertions(+)
> >>
> >>diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
> >>index fdf9fdb..05d0c4b 100644
> >>--- a/arch/arm/boot/dts/sun8i-h3.dtsi
> >>+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
> >>@@ -360,6 +360,13 @@
> >> 				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> >> 			};
> >>
> >>+			pwm0_pin_a: pwm0 at 0 {
> >>+				allwinner,pins = "PA5";
> >>+				allwinner,function = "pwm0";
> >>+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> >>+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> >>+			};
> >>+
> >
> >Is it used on any boards?
> >
> >If not, we have the policy of not merging the pinctrl nodes that are
> >not used by anyone to avoid bloating the DT for no particular reason.
> 
> Yes, I have. It's Nano Pi M1 which was derived from Orange Pi PC.
> The board DTS is ready to be sent out, but I'm not sure which is better.
> 
> 	a) Send new board DTS file in other patch thread
> 
> 	[PATCH v3 0/4] Add PWM feature in Allwinner H3
> 	[PATCH v3 1/4] ARM: dts: sun8i: Add PWM pin in H3
> 	..
> 	[PATCH v3 4/4] pwm: sunxi: Add H3 support
> 
> 	[PATCH] ARM: dts: sun8i: Add Nano Pi M1 support
> 
> Or
> 
> 	b) Include the DTS in next patch-set v3
> 	[PATCH v3 0/4] Add PWM feature in Allwinner H3
> 	[PATCH v3 1/4] ARM: dts: sun8i: Add PWM pin in H3
> 	[PATCH v3 2/4] ARM: dts: sun8i: Add PWM controller node in H3
> 	[PATCH v3 3/4] ARM: dts: sun8i: Add Nano Pi M1 support
> 	...

Generally speaking, I'd prefer:

[PATCH v3 1/2] pwm: sunxi: Add H3 support
[PATCH v3 2/2] ARM: dts: sun8i: Add PWM controller node in H3

(It's usually better to add support for something and then add it)

And then

[PATCH v1 1/2] ARM: dts: sun8i: Add PWM pin in H3
[PATCH v1 2/2] ARM: dts: sun8i: Add Nano Pi M1 support

However, judging from the board documentation, that pin is labelled as
PWM1/GPIOA6, which means that they don't enforce any usage on that pin
(as opposed to the pin 3 and 5 for example, which are forced to i2c0).

In such a case, we also don't enforce anything, since any user should
be able to use it for whatever he or she wants.

Maxime

-- 
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: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160901/8453ddba/attachment.sig>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 4/4] pwm: sunxi: Add H3 support
  2016-08-31  8:25 ` [PATCH v2 4/4] pwm: sunxi: Add H3 support Milo Kim
  2016-08-31  8:41   ` Chen-Yu Tsai
  2016-09-01 10:39   ` Alexandre Belloni
@ 2016-09-02 15:18   ` Rob Herring
  2016-09-05 10:09   ` Thierry Reding
  3 siblings, 0 replies; 20+ messages in thread
From: Rob Herring @ 2016-09-02 15:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 31, 2016 at 05:25:20PM +0900, Milo Kim wrote:
> H3 PWM controller has same register layout as sun4i driver, so it works
> by adding H3 specific data.
> 
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: linux-pwm at vger.kernel.org
> Cc: devicetree at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
> ---
>  Documentation/devicetree/bindings/pwm/pwm-sun4i.txt | 1 +
>  drivers/pwm/pwm-sun4i.c                             | 9 +++++++++
>  2 files changed, 10 insertions(+)

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 4/4] pwm: sunxi: Add H3 support
  2016-08-31  8:25 ` [PATCH v2 4/4] pwm: sunxi: Add H3 support Milo Kim
                     ` (2 preceding siblings ...)
  2016-09-02 15:18   ` Rob Herring
@ 2016-09-05 10:09   ` Thierry Reding
  3 siblings, 0 replies; 20+ messages in thread
From: Thierry Reding @ 2016-09-05 10:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 31, 2016 at 05:25:20PM +0900, Milo Kim wrote:
> H3 PWM controller has same register layout as sun4i driver, so it works
> by adding H3 specific data.
> 
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: linux-pwm at vger.kernel.org
> Cc: devicetree at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
> ---
>  Documentation/devicetree/bindings/pwm/pwm-sun4i.txt | 1 +
>  drivers/pwm/pwm-sun4i.c                             | 9 +++++++++
>  2 files changed, 10 insertions(+)

Applied, thanks.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160905/043a11fc/attachment.sig>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 3/4] pinctrl: sunxi: Remove unsupported PWM channel pinmux in H3
  2016-08-31  8:25 ` [PATCH v2 3/4] pinctrl: sunxi: Remove unsupported PWM channel pinmux " Milo Kim
  2016-08-31  8:35   ` Chen-Yu Tsai
@ 2016-09-07 19:41   ` Linus Walleij
  2016-09-07 19:54     ` Maxime Ripard
  2016-09-07 23:09   ` Linus Walleij
  2 siblings, 1 reply; 20+ messages in thread
From: Linus Walleij @ 2016-09-07 19:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 31, 2016 at 10:25 AM, Milo Kim <woogyom.kim@gmail.com> wrote:

> H3 has single PWM channel. The second PWM channel is not supported,
> so the pinctrl function should be removed.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Icenowy Zheng <icenowy@aosc.xyz>
> Cc: Jens Kuske <jenskuske@gmail.com>
> Cc: Krzysztof Adamski <k@japko.eu>
> Cc: linux-gpio at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>

Maxime what is your opinion on this patch?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 3/4] pinctrl: sunxi: Remove unsupported PWM channel pinmux in H3
  2016-09-07 19:41   ` Linus Walleij
@ 2016-09-07 19:54     ` Maxime Ripard
  0 siblings, 0 replies; 20+ messages in thread
From: Maxime Ripard @ 2016-09-07 19:54 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, Sep 07, 2016 at 09:41:19PM +0200, Linus Walleij wrote:
> On Wed, Aug 31, 2016 at 10:25 AM, Milo Kim <woogyom.kim@gmail.com> wrote:
> 
> > H3 has single PWM channel. The second PWM channel is not supported,
> > so the pinctrl function should be removed.
> >
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> > Cc: Chen-Yu Tsai <wens@csie.org>
> > Cc: Icenowy Zheng <icenowy@aosc.xyz>
> > Cc: Jens Kuske <jenskuske@gmail.com>
> > Cc: Krzysztof Adamski <k@japko.eu>
> > Cc: linux-gpio at vger.kernel.org
> > Cc: linux-arm-kernel at lists.infradead.org
> > Cc: linux-kernel at vger.kernel.org
> > Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
> 
> Maxime what is your opinion on this patch?

Chen-Yu is the Allwinner co-maintainer, so you can trust his Acked-by,
but you have mine too.

Maxime

-- 
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: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160907/8cd97ef6/attachment.sig>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2 3/4] pinctrl: sunxi: Remove unsupported PWM channel pinmux in H3
  2016-08-31  8:25 ` [PATCH v2 3/4] pinctrl: sunxi: Remove unsupported PWM channel pinmux " Milo Kim
  2016-08-31  8:35   ` Chen-Yu Tsai
  2016-09-07 19:41   ` Linus Walleij
@ 2016-09-07 23:09   ` Linus Walleij
  2 siblings, 0 replies; 20+ messages in thread
From: Linus Walleij @ 2016-09-07 23:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 31, 2016 at 10:25 AM, Milo Kim <woogyom.kim@gmail.com> wrote:

> H3 has single PWM channel. The second PWM channel is not supported,
> so the pinctrl function should be removed.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Icenowy Zheng <icenowy@aosc.xyz>
> Cc: Jens Kuske <jenskuske@gmail.com>
> Cc: Krzysztof Adamski <k@japko.eu>
> Cc: linux-gpio at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>

Patch applied with Chen-Yu's ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2016-09-07 23:09 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-31  8:25 [PATCH v2 0/4] Add PWM feature in Allwinner H3 Milo Kim
2016-08-31  8:25 ` [PATCH v2 1/4] ARM: dts: sun8i: Add PWM pin in H3 Milo Kim
2016-08-31  8:33   ` Chen-Yu Tsai
2016-09-01 12:51     ` Milo Kim
2016-08-31 16:20   ` Maxime Ripard
2016-09-01 13:06     ` Milo Kim
2016-09-01 19:51       ` Maxime Ripard
2016-08-31  8:25 ` [PATCH v2 2/4] ARM: dts: sun8i: Add PWM controller node " Milo Kim
2016-08-31  8:42   ` Chen-Yu Tsai
2016-08-31 16:16   ` Maxime Ripard
2016-08-31  8:25 ` [PATCH v2 3/4] pinctrl: sunxi: Remove unsupported PWM channel pinmux " Milo Kim
2016-08-31  8:35   ` Chen-Yu Tsai
2016-09-07 19:41   ` Linus Walleij
2016-09-07 19:54     ` Maxime Ripard
2016-09-07 23:09   ` Linus Walleij
2016-08-31  8:25 ` [PATCH v2 4/4] pwm: sunxi: Add H3 support Milo Kim
2016-08-31  8:41   ` Chen-Yu Tsai
2016-09-01 10:39   ` Alexandre Belloni
2016-09-02 15:18   ` Rob Herring
2016-09-05 10:09   ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).