linux-arm-kernel.lists.infradead.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 at kippendief.biz
  2016-09-12 18:12 ` [PATCH v5 1/5] dts: sun8i-h3: add pinmux definitions for UART2-3 jorik at kippendief.biz
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jorik at kippendief.biz @ 2016-09-12 18:12 UTC (permalink / raw)
  To: linux-arm-kernel

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 at kippendief.biz
@ 2016-09-12 18:12 ` jorik at kippendief.biz
  2016-09-12 18:12 ` [PATCH v5 2/5] dts: sun8i-h3: split off RTS/CTS for UART1 in seperate pinmux jorik at kippendief.biz
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jorik at kippendief.biz @ 2016-09-12 18:12 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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 at kippendief.biz
  2016-09-12 18:12 ` [PATCH v5 1/5] dts: sun8i-h3: add pinmux definitions for UART2-3 jorik at kippendief.biz
@ 2016-09-12 18:12 ` jorik at kippendief.biz
  2016-09-12 18:12 ` [PATCH v5 3/5] dts: sun8i-h3: associate exposed UARTs on Orange Pi Boards jorik at kippendief.biz
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jorik at kippendief.biz @ 2016-09-12 18:12 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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 at kippendief.biz
  2016-09-12 18:12 ` [PATCH v5 1/5] dts: sun8i-h3: add pinmux definitions for UART2-3 jorik at kippendief.biz
  2016-09-12 18:12 ` [PATCH v5 2/5] dts: sun8i-h3: split off RTS/CTS for UART1 in seperate pinmux jorik at kippendief.biz
@ 2016-09-12 18:12 ` jorik at kippendief.biz
  2016-09-12 18:12 ` [PATCH v5 4/5] dts: sun8i-h3: add pinmux definitions for I2C0-2 jorik at kippendief.biz
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jorik at kippendief.biz @ 2016-09-12 18:12 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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 at kippendief.biz
                   ` (2 preceding siblings ...)
  2016-09-12 18:12 ` [PATCH v5 3/5] dts: sun8i-h3: associate exposed UARTs on Orange Pi Boards jorik at kippendief.biz
@ 2016-09-12 18:12 ` jorik at kippendief.biz
  2016-09-12 18:12 ` [PATCH v5 5/5] dts: sun8i-h3: add I2C0-2 peripherals to H3 SOC jorik at kippendief.biz
  2016-09-15 14:58 ` [PATCH v5 0/5] dts: sun8i-h3: complete UART I2C for H3 Maxime Ripard
  5 siblings, 0 replies; 7+ messages in thread
From: jorik at kippendief.biz @ 2016-09-12 18:12 UTC (permalink / raw)
  To: linux-arm-kernel

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 at 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
  2016-09-12 18:12 [PATCH v5 0/5] dts: sun8i-h3: complete UART I2C for H3 jorik at kippendief.biz
                   ` (3 preceding siblings ...)
  2016-09-12 18:12 ` [PATCH v5 4/5] dts: sun8i-h3: add pinmux definitions for I2C0-2 jorik at kippendief.biz
@ 2016-09-12 18:12 ` jorik at kippendief.biz
  2016-09-15 14:58 ` [PATCH v5 0/5] dts: sun8i-h3: complete UART I2C for H3 Maxime Ripard
  5 siblings, 0 replies; 7+ messages in thread
From: jorik at kippendief.biz @ 2016-09-12 18:12 UTC (permalink / raw)
  To: linux-arm-kernel

From: Jorik Jonker <jorik@kippendief.biz>

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 at 01c2ac00 status okay

Signed-off-by: Jorik Jonker <jorik@kippendief.biz>
---
 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 at 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 at 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 at 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 at 01c81000 {
 			compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
 			reg = <0x01c81000 0x1000>,
-- 
2.7.4

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

* [PATCH v5 0/5] dts: sun8i-h3: complete UART I2C for H3
  2016-09-12 18:12 [PATCH v5 0/5] dts: sun8i-h3: complete UART I2C for H3 jorik at kippendief.biz
                   ` (4 preceding siblings ...)
  2016-09-12 18:12 ` [PATCH v5 5/5] dts: sun8i-h3: add I2C0-2 peripherals to H3 SOC jorik at kippendief.biz
@ 2016-09-15 14:58 ` Maxime Ripard
  5 siblings, 0 replies; 7+ messages in thread
From: Maxime Ripard @ 2016-09-15 14:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Sep 12, 2016 at 08:12:42PM +0200, jorik at kippendief.biz wrote:
> 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 :-)

I queued it, 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/20160915/87dc4dd1/attachment.sig>

^ 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 at kippendief.biz
2016-09-12 18:12 ` [PATCH v5 1/5] dts: sun8i-h3: add pinmux definitions for UART2-3 jorik at kippendief.biz
2016-09-12 18:12 ` [PATCH v5 2/5] dts: sun8i-h3: split off RTS/CTS for UART1 in seperate pinmux jorik at kippendief.biz
2016-09-12 18:12 ` [PATCH v5 3/5] dts: sun8i-h3: associate exposed UARTs on Orange Pi Boards jorik at kippendief.biz
2016-09-12 18:12 ` [PATCH v5 4/5] dts: sun8i-h3: add pinmux definitions for I2C0-2 jorik at kippendief.biz
2016-09-12 18:12 ` [PATCH v5 5/5] dts: sun8i-h3: add I2C0-2 peripherals to H3 SOC jorik at kippendief.biz
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).