devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/5] dts: sun8i-h3: complete UART I2C for H3
@ 2016-09-12 18:12 jorik
  2016-09-12 18:12 ` [PATCH v5 1/5] dts: sun8i-h3: add pinmux definitions for UART2-3 jorik
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: jorik @ 2016-09-12 18:12 UTC (permalink / raw)
  To: wens, maxime.ripard
  Cc: mark.rutland, robh+dt, linux, devicetree, linux-arm-kernel,
	linux-kernel, Jorik Jonker

From: Jorik Jonker <jorik@kippendief.biz>

This is my fifth attempt to complete the UART/I2C definitions on H3.

Many thanks to Maxime and Chen-Yu for helping me understand the 
philosophy behind the DTS/DTSI structure. I hope I get it and five
times is a charm :-)

Changes since v4:
 * RTS/CTS for UART1 is split off in seperate pinmux to make uart1-3
   consistent.
 * UART0 is left untouched
 * UARTs 1-3 are associated and re-disabled in DTS instead of DTSI

Best,
Jorik

Jorik Jonker (5):
  dts: sun8i-h3: add pinmux definitions for UART2-3
  dts: sun8i-h3: split off RTS/CTS for UART1 in seperate pinmux
  dts: sun8i-h3: associate exposed UARTs on Orange Pi Boards
  dts: sun8i-h3: add pinmux definitions for I2C0-2
  dts: sun8i-h3: add I2C0-2 peripherals to H3 SOC

 arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts |  2 +-
 arch/arm/boot/dts/sun8i-h3-orangepi-2.dts       | 18 ++++++
 arch/arm/boot/dts/sun8i-h3-orangepi-one.dts     | 18 ++++++
 arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts      | 18 ++++++
 arch/arm/boot/dts/sun8i-h3.dtsi                 | 85 ++++++++++++++++++++++++-
 5 files changed, 138 insertions(+), 3 deletions(-)

-- 
2.7.4

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

* [PATCH v5 1/5] dts: sun8i-h3: add pinmux definitions for UART2-3
  2016-09-12 18:12 [PATCH v5 0/5] dts: sun8i-h3: complete UART I2C for H3 jorik
@ 2016-09-12 18:12 ` jorik
  2016-09-12 18:12 ` [PATCH v5 2/5] dts: sun8i-h3: split off RTS/CTS for UART1 in seperate pinmux jorik
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: jorik @ 2016-09-12 18:12 UTC (permalink / raw)
  To: wens, maxime.ripard
  Cc: mark.rutland, robh+dt, linux, devicetree, linux-arm-kernel,
	linux-kernel, Jorik Jonker

From: Jorik Jonker <jorik@kippendief.biz>

These are the pinmux definitions for UART2-3 on H3. These UARTs can only
be muxed to these pins, so _a and @0 do not really make sense. I have
left out RTS/CTS, since these are rarely used. These can easily be
enabled using an additional pinmux set.

Signed-off-by: Jorik Jonker <jorik@kippendief.biz>
---
 arch/arm/boot/dts/sun8i-h3.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
index fdf9fdb..665fa32 100644
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
@@ -373,6 +373,20 @@
 				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 			};
+
+			uart2_pins: uart2 {
+				allwinner,pins = "PA0", "PA1";
+				allwinner,function = "uart2";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			uart3_pins: uart3 {
+				allwinner,pins = "PG13", "PG14";
+				allwinner,function = "uart3";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
 		};
 
 		timer@01c20c00 {
-- 
2.7.4

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

* [PATCH v5 2/5] dts: sun8i-h3: split off RTS/CTS for UART1 in seperate pinmux
  2016-09-12 18:12 [PATCH v5 0/5] dts: sun8i-h3: complete UART I2C for H3 jorik
  2016-09-12 18:12 ` [PATCH v5 1/5] dts: sun8i-h3: add pinmux definitions for UART2-3 jorik
@ 2016-09-12 18:12 ` jorik
  2016-09-12 18:12 ` [PATCH v5 3/5] dts: sun8i-h3: associate exposed UARTs on Orange Pi Boards jorik
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: jorik @ 2016-09-12 18:12 UTC (permalink / raw)
  To: wens, maxime.ripard
  Cc: mark.rutland, robh+dt, linux, devicetree, linux-arm-kernel,
	linux-kernel, Jorik Jonker

From: Jorik Jonker <jorik@kippendief.biz>

This was done to make UART1-3 on H3 consistent, and less complicated to
enable UART1-3 on the breakout header on the several H3 board (notably
Orange Pi's). This patch adds a bit of complexity for the existing Banana
Pi, which already had the RTS/CTS associated on UART1.

The RTS/CTS for UART2-3 could be defined in the same way, but since
there is no actual use case for them at the moment, they are left out.

Signed-off-by: Jorik Jonker <jorik@kippendief.biz>
---
 arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts |  2 +-
 arch/arm/boot/dts/sun8i-h3.dtsi                 | 11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts b/arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts
index f3b1d5f..06fddaa 100644
--- a/arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts
+++ b/arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts
@@ -185,7 +185,7 @@
 
 &uart1 {
 	pinctrl-names = "default";
-	pinctrl-0 = <&uart1_pins_a>;
+	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
 	status = "okay";
 };
 
diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
index 665fa32..742bced 100644
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
@@ -367,8 +367,15 @@
 				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 			};
 
-			uart1_pins_a: uart1@0 {
-				allwinner,pins = "PG6", "PG7", "PG8", "PG9";
+			uart1_pins: uart1 {
+				allwinner,pins = "PG6", "PG7";
+				allwinner,function = "uart1";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			uart1_rts_cts_pins: uart1_rts_cts {
+				allwinner,pins = "PG8", "PG9";
 				allwinner,function = "uart1";
 				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
-- 
2.7.4

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

* [PATCH v5 3/5] dts: sun8i-h3: associate exposed UARTs on Orange Pi Boards
  2016-09-12 18:12 [PATCH v5 0/5] dts: sun8i-h3: complete UART I2C for H3 jorik
  2016-09-12 18:12 ` [PATCH v5 1/5] dts: sun8i-h3: add pinmux definitions for UART2-3 jorik
  2016-09-12 18:12 ` [PATCH v5 2/5] dts: sun8i-h3: split off RTS/CTS for UART1 in seperate pinmux jorik
@ 2016-09-12 18:12 ` jorik
  2016-09-12 18:12 ` [PATCH v5 4/5] dts: sun8i-h3: add pinmux definitions for I2C0-2 jorik
       [not found] ` <1473703967-21356-1-git-send-email-jorik-U9/BOH3cVv3CLqq/8VZgpA@public.gmane.org>
  4 siblings, 0 replies; 7+ messages in thread
From: jorik @ 2016-09-12 18:12 UTC (permalink / raw)
  To: wens, maxime.ripard
  Cc: mark.rutland, robh+dt, linux, devicetree, linux-arm-kernel,
	linux-kernel, Jorik Jonker

From: Jorik Jonker <jorik@kippendief.biz>

These H3 boards all expose UART1-3 on their expansion header. Since
other functions can be muxed to these pins, they are explicitly
disabled. To enable them, one could use DT overlays or U-boot commands:

 => fdt set /soc/serial@01c28c00 status okay

Signed-off-by: Jorik Jonker <jorik@kippendief.biz>
---
 arch/arm/boot/dts/sun8i-h3-orangepi-2.dts   | 18 ++++++++++++++++++
 arch/arm/boot/dts/sun8i-h3-orangepi-one.dts | 18 ++++++++++++++++++
 arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts  | 18 ++++++++++++++++++
 3 files changed, 54 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-2.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-2.dts
index f93f5d1..9aa2bb7 100644
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-2.dts
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-2.dts
@@ -176,6 +176,24 @@
 	status = "okay";
 };
 
+&uart1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart1_pins>;
+	status = "disabled";
+};
+
+&uart2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart2_pins>;
+	status = "disabled";
+};
+
+&uart3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart3_pins>;
+	status = "disabled";
+};
+
 &usb1_vbus_pin_a {
 	allwinner,pins = "PG13";
 };
diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-one.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-one.dts
index 0adf932..5c9b5bf 100644
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-one.dts
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-one.dts
@@ -139,6 +139,24 @@
 	status = "okay";
 };
 
+&uart1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart1_pins>;
+	status = "disabled";
+};
+
+&uart2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart2_pins>;
+	status = "disabled";
+};
+
+&uart3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart3_pins>;
+	status = "disabled";
+};
+
 &usbphy {
 	/* USB VBUS is always on */
 	status = "okay";
diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
index daf50b9..3ec9712 100644
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
@@ -161,6 +161,24 @@
 	status = "okay";
 };
 
+&uart1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart1_pins>;
+	status = "disabled";
+};
+
+&uart2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart2_pins>;
+	status = "disabled";
+};
+
+&uart3 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart3_pins>;
+	status = "disabled";
+};
+
 &usbphy {
 	/* USB VBUS is always on */
 	status = "okay";
-- 
2.7.4

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

* [PATCH v5 4/5] dts: sun8i-h3: add pinmux definitions for I2C0-2
  2016-09-12 18:12 [PATCH v5 0/5] dts: sun8i-h3: complete UART I2C for H3 jorik
                   ` (2 preceding siblings ...)
  2016-09-12 18:12 ` [PATCH v5 3/5] dts: sun8i-h3: associate exposed UARTs on Orange Pi Boards jorik
@ 2016-09-12 18:12 ` jorik
       [not found] ` <1473703967-21356-1-git-send-email-jorik-U9/BOH3cVv3CLqq/8VZgpA@public.gmane.org>
  4 siblings, 0 replies; 7+ messages in thread
From: jorik @ 2016-09-12 18:12 UTC (permalink / raw)
  To: wens, maxime.ripard
  Cc: mark.rutland, robh+dt, linux, devicetree, linux-arm-kernel,
	linux-kernel, Jorik Jonker

From: Jorik Jonker <jorik@kippendief.biz>

These are the only possible pins for these peripherals according to the
datasheet.

Signed-off-by: Jorik Jonker <jorik@kippendief.biz>
---
 arch/arm/boot/dts/sun8i-h3.dtsi | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
index 742bced..ed6628d 100644
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
@@ -327,6 +327,27 @@
 			interrupt-controller;
 			#interrupt-cells = <3>;
 
+			i2c0_pins: i2c0 {
+				allwinner,pins = "PA11", "PA12";
+				allwinner,function = "i2c0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			i2c1_pins: i2c1 {
+				allwinner,pins = "PA18", "PA19";
+				allwinner,function = "i2c1";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			i2c2_pins: i2c2 {
+				allwinner,pins = "PE12", "PE13";
+				allwinner,function = "i2c2";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
 			mmc0_pins_a: mmc0@0 {
 				allwinner,pins = "PF0", "PF1", "PF2", "PF3",
 						 "PF4", "PF5";
-- 
2.7.4

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

* [PATCH v5 5/5] dts: sun8i-h3: add I2C0-2 peripherals to H3 SOC
       [not found] ` <1473703967-21356-1-git-send-email-jorik-U9/BOH3cVv3CLqq/8VZgpA@public.gmane.org>
@ 2016-09-12 18:12   ` jorik-U9/BOH3cVv3CLqq/8VZgpA
  2016-09-15 14:58   ` [PATCH v5 0/5] dts: sun8i-h3: complete UART I2C for H3 Maxime Ripard
  1 sibling, 0 replies; 7+ messages in thread
From: jorik-U9/BOH3cVv3CLqq/8VZgpA @ 2016-09-12 18:12 UTC (permalink / raw)
  To: wens-jdAy2FN1RRM, maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
  Cc: mark.rutland-5wv7dgnIgG8, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	linux-I+IVW8TIWO2tmTQ+vhA3Yw, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Jorik Jonker

From: Jorik Jonker <jorik-U9/BOH3cVv3CLqq/8VZgpA@public.gmane.org>

These peripherals can only be muxed to these pins, so they are
associated in the DTSI instead of the board files. This makes it very
easy to enable them using overlays or u-boot commands:

 => fdt set /soc/i2c@01c2ac00 status okay

Signed-off-by: Jorik Jonker <jorik-U9/BOH3cVv3CLqq/8VZgpA@public.gmane.org>
---
 arch/arm/boot/dts/sun8i-h3.dtsi | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
index ed6628d..bfc9200 100644
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
@@ -483,6 +483,45 @@
 			status = "disabled";
 		};
 
+		i2c0: i2c@01c2ac00 {
+			compatible = "allwinner,sun6i-a31-i2c";
+			reg = <0x01c2ac00 0x400>;
+			interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_I2C0>;
+			resets = <&ccu RST_BUS_I2C0>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&i2c0_pins>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		i2c1: i2c@01c2b000 {
+			compatible = "allwinner,sun6i-a31-i2c";
+			reg = <0x01c2b000 0x400>;
+			interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_I2C1>;
+			resets = <&ccu RST_BUS_I2C1>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&i2c1_pins>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		i2c2: i2c@01c2b400 {
+			compatible = "allwinner,sun6i-a31-i2c";
+			reg = <0x01c2b000 0x400>;
+			interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_I2C2>;
+			resets = <&ccu RST_BUS_I2C2>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&i2c2_pins>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
 		gic: interrupt-controller@01c81000 {
 			compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
 			reg = <0x01c81000 0x1000>,
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v5 0/5] dts: sun8i-h3: complete UART I2C for H3
       [not found] ` <1473703967-21356-1-git-send-email-jorik-U9/BOH3cVv3CLqq/8VZgpA@public.gmane.org>
  2016-09-12 18:12   ` [PATCH v5 5/5] dts: sun8i-h3: add I2C0-2 peripherals to H3 SOC jorik-U9/BOH3cVv3CLqq/8VZgpA
@ 2016-09-15 14:58   ` Maxime Ripard
  1 sibling, 0 replies; 7+ messages in thread
From: Maxime Ripard @ 2016-09-15 14:58 UTC (permalink / raw)
  To: jorik-U9/BOH3cVv3CLqq/8VZgpA
  Cc: wens-jdAy2FN1RRM, mark.rutland-5wv7dgnIgG8,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, linux-I+IVW8TIWO2tmTQ+vhA3Yw,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 544 bytes --]

On Mon, Sep 12, 2016 at 08:12:42PM +0200, jorik-U9/BOH3cVv3CLqq/8VZgpA@public.gmane.org wrote:
> From: Jorik Jonker <jorik-U9/BOH3cVv3CLqq/8VZgpA@public.gmane.org>
> 
> This is my fifth attempt to complete the UART/I2C definitions on H3.
> 
> Many thanks to Maxime and Chen-Yu for helping me understand the 
> philosophy behind the DTS/DTSI structure. I hope I get it and five
> times is a charm :-)

I queued it, thanks!
Maxime

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2016-09-15 14:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-12 18:12 [PATCH v5 0/5] dts: sun8i-h3: complete UART I2C for H3 jorik
2016-09-12 18:12 ` [PATCH v5 1/5] dts: sun8i-h3: add pinmux definitions for UART2-3 jorik
2016-09-12 18:12 ` [PATCH v5 2/5] dts: sun8i-h3: split off RTS/CTS for UART1 in seperate pinmux jorik
2016-09-12 18:12 ` [PATCH v5 3/5] dts: sun8i-h3: associate exposed UARTs on Orange Pi Boards jorik
2016-09-12 18:12 ` [PATCH v5 4/5] dts: sun8i-h3: add pinmux definitions for I2C0-2 jorik
     [not found] ` <1473703967-21356-1-git-send-email-jorik-U9/BOH3cVv3CLqq/8VZgpA@public.gmane.org>
2016-09-12 18:12   ` [PATCH v5 5/5] dts: sun8i-h3: add I2C0-2 peripherals to H3 SOC jorik-U9/BOH3cVv3CLqq/8VZgpA
2016-09-15 14:58   ` [PATCH v5 0/5] dts: sun8i-h3: complete UART I2C for H3 Maxime Ripard

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