Skip to contentSkip to conversation

ARM: dts: sun8i: Orangepi Plus dts improvements

PATCH New Hans de Goede 3 participants 12 messages Mar 20, 2016 – Mar 21, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover ARM: dts: sun8i: Orangepi Plus dts improvements

Hi Maxime and Chen-Yu,

Here is a series with various improvements for the Orangepi Plus dts. Some (most) of these patches have been submitted before, esp. the USB ones have multiple revisions before. But I lost count of their version, so I'm posting this as a "new" set.

About the USB patches, these rely on the patches to add support for multiple-reset controllers to ohci-platform / ehci-platform. These patches are all acked up and will go upstream as soon as v4.6-rc1 is released (they depend on changes which will go into v4.6-rc1).

The old ohci-platform / ehci-platform will only look at the first reset specified in the dt and as such will fail to load with the new dt nodes (because they cannot talk to the controller).

I've also included a v6 of Krzysztof Adamski <[email protected]> leds / switches patch, fixing the comments you had in your review of v5. I've done this to avoid conflicts with my other patches.

Regards,

Hans

#1 lore raw

PATCH 1/8 ARM: dts: sun8i: Add mmc2_8bit_pins to sun8i-h3.dtsi

Add a pinctrl node for mmc2 in 8 bits mode on H3 SoCs.

---
 arch/arm/boot/dts/sun8i-h3.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/sun8i-h3.dtsi +10 -0
index dadb7f6..d1be2f5 100644
@@ -417,6 +417,16 @@
 				allwinner,drive = <SUN4I_PINCTRL_30_MA>;
 				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 			};
+
+			mmc2_8bit_pins: mmc2_8bit {
+				allwinner,pins = "PC5", "PC6", "PC8",
+						 "PC9", "PC10", "PC11",
+						 "PC12", "PC13", "PC14",
+						 "PC15", "PC16";
+				allwinner,function = "mmc2";
+				allwinner,drive = <SUN4I_PINCTRL_30_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
 		};
 
 		ahb_rst: reset at 01c202c0 {
Signature · 1 line
2.7.3
#2 lore raw

PATCH 2/8 ARM: dts: sun8i: Add support for H3 usb clocks

In reply to Hans de Goede

From: Reinder de Haan <[email protected]>

Add a node describing the usb-clks found on the H3.

---
 arch/arm/boot/dts/sun8i-h3.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/sun8i-h3.dtsi +12 -0
index d1be2f5..3a2e6e2 100644
@@ -269,6 +269,18 @@
 					     "mmc2_sample";
 		};
 
+		usb_clk: clk at 01c200cc {
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+			compatible = "allwinner,sun8i-h3-usb-clk";
+			reg = <0x01c200cc 0x4>;
+			clocks = <&osc24M>;
+			clock-output-names = "usb_phy0", "usb_phy1",
+					     "usb_phy2", "usb_phy3",
+					     "usb_ohci0", "usb_ohci1",
+					     "usb_ohci2", "usb_ohci3";
+		};
+
 		mbus_clk: clk at 01c2015c {
 			#clock-cells = <0>;
 			compatible = "allwinner,sun8i-a23-mbus-clk";
Signature · 1 line
2.7.3
#3 lore raw

PATCH 3/8 ARM: dts: sun8i: Add usbphy and usb host controller nodes

In reply to Hans de Goede

From: Reinder de Haan <[email protected]>

Add nodes describing the H3's usbphy and usb host controller nodes.

---
 arch/arm/boot/dts/sun8i-h3.dtsi | 101 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 101 insertions(+)
arch/arm/boot/dts/sun8i-h3.dtsi +101 -0
index 3a2e6e2..4a4926b 100644
@@ -389,6 +389,107 @@
 			#size-cells = <0>;
 		};
 
+		usbphy: phy at 01c19400 {
+			compatible = "allwinner,sun8i-h3-usb-phy";
+			reg = <0x01c19400 0x2c>,
+			      <0x01c1a800 0x4>,
+			      <0x01c1b800 0x4>,
+			      <0x01c1c800 0x4>,
+			      <0x01c1d800 0x4>;
+			reg-names = "phy_ctrl",
+				    "pmu0",
+				    "pmu1",
+				    "pmu2",
+				    "pmu3";
+			clocks = <&usb_clk 8>,
+				 <&usb_clk 9>,
+				 <&usb_clk 10>,
+				 <&usb_clk 11>;
+			clock-names = "usb0_phy",
+				      "usb1_phy",
+				      "usb2_phy",
+				      "usb3_phy";
+			resets = <&usb_clk 0>,
+				 <&usb_clk 1>,
+				 <&usb_clk 2>,
+				 <&usb_clk 3>;
+			reset-names = "usb0_reset",
+				      "usb1_reset",
+				      "usb2_reset",
+				      "usb3_reset";
+			status = "disabled";
+			#phy-cells = <1>;
+		};
+
+		ehci1: usb at 01c1b000 {
+			compatible = "allwinner,sun8i-h3-ehci", "generic-ehci";
+			reg = <0x01c1b000 0x100>;
+			interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&bus_gates 25>, <&bus_gates 29>;
+			resets = <&ahb_rst 25>, <&ahb_rst 29>;
+			phys = <&usbphy 1>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		ohci1: usb at 01c1b400 {
+			compatible = "allwinner,sun8i-h3-ohci", "generic-ohci";
+			reg = <0x01c1b400 0x100>;
+			interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&bus_gates 29>, <&bus_gates 25>,
+				 <&usb_clk 17>;
+			resets = <&ahb_rst 29>, <&ahb_rst 25>;
+			phys = <&usbphy 1>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		ehci2: usb at 01c1c000 {
+			compatible = "allwinner,sun8i-h3-ehci", "generic-ehci";
+			reg = <0x01c1c000 0x100>;
+			interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&bus_gates 26>, <&bus_gates 30>;
+			resets = <&ahb_rst 26>, <&ahb_rst 30>;
+			phys = <&usbphy 2>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		ohci2: usb at 01c1c400 {
+			compatible = "allwinner,sun8i-h3-ohci", "generic-ohci";
+			reg = <0x01c1c400 0x100>;
+			interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&bus_gates 30>, <&bus_gates 26>,
+				 <&usb_clk 18>;
+			resets = <&ahb_rst 30>, <&ahb_rst 26>;
+			phys = <&usbphy 2>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		ehci3: usb at 01c1d000 {
+			compatible = "allwinner,sun8i-h3-ehci", "generic-ehci";
+			reg = <0x01c1d000 0x100>;
+			interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&bus_gates 27>, <&bus_gates 31>;
+			resets = <&ahb_rst 27>, <&ahb_rst 31>;
+			phys = <&usbphy 3>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		ohci3: usb at 01c1d400 {
+			compatible = "allwinner,sun8i-h3-ohci", "generic-ohci";
+			reg = <0x01c1d400 0x100>;
+			interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&bus_gates 31>, <&bus_gates 27>,
+				 <&usb_clk 19>;
+			resets = <&ahb_rst 31>, <&ahb_rst 27>;
+			phys = <&usbphy 3>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
 		pio: pinctrl at 01c20800 {
 			compatible = "allwinner,sun8i-h3-pinctrl";
 			reg = <0x01c20800 0x400>;
Signature · 1 line
2.7.3
#4 lore raw

PATCH 4/8 ARM: dts: sun8i: Enable USB host controllers on Orangepi Plus boards

In reply to Hans de Goede

From: Jens Kuske <[email protected]>

Enable the 2 USB host controllers used on the Orange Pi Plus and add the necessary regulators.

---
 arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 44 ++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +44 -0
index e67df59..1cb6c66 100644
@@ -58,6 +58,35 @@
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
+
+	reg_usb3_vbus: usb3-vbus {
+		compatible = "regulator-fixed";
+		pinctrl-names = "default";
+		pinctrl-0 = <&usb3_vbus_pin_a>;
+		regulator-name = "usb3-vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-boot-on;
+		enable-active-high;
+		gpio = <&pio 6 11 GPIO_ACTIVE_HIGH>;
+	};
+};
+
+&ehci1 {
+	status = "okay";
+};
+
+&ehci3 {
+	status = "okay";
+};
+
+&pio {
+	usb3_vbus_pin_a: usb3_vbus_pin at 0 {
+		allwinner,pins = "PG11";
+		allwinner,function = "gpio_out";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+	};
 };
 
 &mmc0 {
@@ -70,8 +99,23 @@
 	status = "okay";
 };
 
+&reg_usb1_vbus {
+	gpio = <&pio 6 13 GPIO_ACTIVE_HIGH>;
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
 	status = "okay";
 };
+
+&usb1_vbus_pin_a {
+	allwinner,pins = "PG13";
+};
+
+&usbphy {
+	usb1_vbus-supply = <&reg_usb1_vbus>;
+	usb3_vbus-supply = <&reg_usb3_vbus>;
+	status = "okay";
+};
Signature · 1 line
2.7.3
#5 lore raw

PATCH 5/8 ARM: dts: sun8i: Enable IR receiver on Orangepi Plus boards

In reply to Hans de Goede

Enable the ir receiver found on the orangepi plus board.

---
 arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +6 -0
index 1cb6c66..a680b1f 100644
@@ -80,6 +80,12 @@
 	status = "okay";
 };
 
+&ir {
+	pinctrl-names = "default";
+	pinctrl-0 = <&ir_pins_a>;
+	status = "okay";
+};
+
 &pio {
 	usb3_vbus_pin_a: usb3_vbus_pin at 0 {
 		allwinner,pins = "PG11";
Signature · 1 line
2.7.3
#6 lore raw

PATCH 6/8 ARM: dts: sun8i: Add leds and switches on Orangepi Plus boards

In reply to Hans de Goede

From: Krzysztof Adamski <[email protected]>

OrangePi Plus board has two leds - green ("pwr") and red ("status") and two switches ("sw4" and "sw2"). This patch describes them in devicetree.

---
Changes in v6 (hdegoede):
-Merge leds and r_leds nodes into one
-Fix led labels to be in <board>:<colour>:<role> form -Alphabetically sort the added nodes
-Add support for sw2 (this is the small reset-like button)

---
 arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 63 ++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +63 -0
index a680b1f..a7cdfd0 100644
@@ -45,6 +45,7 @@
 #include "sunxi-common-regulators.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/pinctrl/sun4i-a10.h>
 
 / {
@@ -59,6 +60,43 @@
 		stdout-path = "serial0:115200n8";
 	};
 
+	gpio_keys {
+		compatible = "gpio-keys";
+		input-name = "sw4";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&sw_r_opc>;
+
+		sw2 at 0 {
+			label = "sw2";
+			linux,code = <BTN_1>;
+			gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>;
+		};
+
+		sw4 at 0 {
+			label = "sw4";
+			linux,code = <BTN_0>;
+			gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&leds_opc>, <&leds_r_opc>;
+
+		status_led {
+			label = "orangepi-plus:red:status";
+			gpios = <&pio 0 15 GPIO_ACTIVE_HIGH>;
+		};
+
+		pwr_led {
+			label = "orangepi-plus:green:pwr";
+			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
+			default-state = "on";
+		};
+	};
+
 	reg_usb3_vbus: usb3-vbus {
 		compatible = "regulator-fixed";
 		pinctrl-names = "default";
@@ -72,6 +110,31 @@
 	};
 };
 
+&pio {
+	leds_opc: led_pins at 0 {
+		allwinner,pins = "PA15";
+		allwinner,function = "gpio_out";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+	};
+};
+
+&r_pio {
+	leds_r_opc: led_pins at 0 {
+		allwinner,pins = "PL10";
+		allwinner,function = "gpio_out";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+	};
+
+	sw_r_opc: key_pins at 0 {
+		allwinner,pins = "PL03", "PL04";
+		allwinner,function = "gpio_in";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+	};
+};
+
 &ehci1 {
 	status = "okay";
 };
Signature · 1 line
2.7.3
#7 lore raw

PATCH 7/8 ARM: dts: sun8i: Add wifi dt node on Orangepi Plus boards

In reply to Hans de Goede

The Orangepi Plus and Orangepi Plus 2 have a realtek rtl8189etv sdio wifi chip. This commit adds a device-tree node to power it up, so that the mmc subsys can scan it, and enables the mmc controller which is connected to it.

Note that this just makes the wifi controller show up as a sdio device. In order for it to work a compatible sdio driver is necessary, an out of tree driver is available here:
https://github.com/jwrdegoede/rtl8189ES_linux/

Binding the driver is not done through device tree, but through sdio vendor- and device-id, so it can safely be enabled in devicetree without having a driver upstream yet.

---
 arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +24 -0
index a7cdfd0..f5aa694 100644
@@ -108,6 +108,13 @@
 		enable-active-high;
 		gpio = <&pio 6 11 GPIO_ACTIVE_HIGH>;
 	};
+
+	wifi_pwrseq: wifi_pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		pinctrl-names = "default";
+		pinctrl-0 = <&wifi_pwrseq_pin_orangepi>;
+		reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 WIFI_EN */
+	};
 };
 
 &pio {
@@ -156,6 +163,13 @@
 		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 	};
+
+	wifi_pwrseq_pin_orangepi: wifi_pwrseq_pin at 0 {
+		allwinner,pins = "PL7";
+		allwinner,function = "gpio_out";
+		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+	};
 };
 
 &mmc0 {
@@ -168,6 +182,16 @@
 	status = "okay";
 };
 
+&mmc1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc1_pins_a>;
+	vmmc-supply = <&reg_vcc3v3>;
+	mmc-pwrseq = <&wifi_pwrseq>;
+	bus-width = <4>;
+	non-removable;
+	status = "okay";
+};
+
 &reg_usb1_vbus {
 	gpio = <&pio 6 13 GPIO_ACTIVE_HIGH>;
 	status = "okay";
Signature · 1 line
2.7.3
#8 lore raw

PATCH 8/8 ARM: dts: sun8i: Add eMMC dt node on Orangepi Plus boards

In reply to Hans de Goede

The Orangepi Plus has a 16GB eMMC, the vcc, the lack of pull-ups and the use of the hw-reset pin have all been verified with the board schematic.

With this dts node for mmc2, the eMMC runs at the following ios settings:

clock:          52000000 Hz
vdd:            21 (3.3 ~ 3.4 V)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     2 (on)
bus width:      3 (8 bits)
timing spec:    8 (mmc DDR52)
signal voltage: 0 (3.30 V)
driver type:    0 (driver type B)

Note the mmcblk1boot0/boot1 partitions are unused as the BROM will load the SPL from 8k from the start of the main blockdev, just as with a regular sdcard in mmc0.

---
 arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts +17 -0
index f5aa694..7129aff 100644
@@ -192,6 +192,23 @@
 	status = "okay";
 };
 
+&mmc2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc2_8bit_pins>;
+	vmmc-supply = <&reg_vcc3v3>;
+	bus-width = <8>;
+	non-removable;
+	cap-mmc-hw-reset;
+	status = "okay";
+};
+
+&mmc2_8bit_pins {
+	/* Increase drive strength for DDR modes */
+	allwinner,drive = <SUN4I_PINCTRL_40_MA>;
+	/* eMMC is missing pull-ups */
+	allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+};
+
 &reg_usb1_vbus {
 	gpio = <&pio 6 13 GPIO_ACTIVE_HIGH>;
 	status = "okay";
Signature · 1 line
2.7.3
#9 lore raw

cover ARM: dts: sun8i: Orangepi Plus dts improvements

In reply to Hans de Goede

Hi,

Quoted 11 lines · Hans de Goede

Hi Maxime and Chen-Yu,

Here is a series with various improvements for the Orangepi Plus dts. Some (most) of these patches have been submitted before, esp. the USB ones have multiple revisions before. But I lost count of their version, so I'm posting this as a "new" set.

About the USB patches, these rely on the patches to add support for multiple-reset controllers to ohci-platform / ehci-platform. These patches are all acked up and will go upstream as soon as v4.6-rc1 is released (they depend on changes which will go into v4.6-rc1).

Does this mean you or I can send the Orange Pi PC DTS patch?

Thanks
ChenYu

Quoted 11 lines

The old ohci-platform / ehci-platform will only look at the first reset specified in the dt and as such will fail to load with the new dt nodes (because they cannot talk to the controller).

I've also included a v6 of Krzysztof Adamski <[email protected]> leds / switches patch, fixing the comments you had in your review of v5. I've done this to avoid conflicts with my other patches.

Regards,

Hans

#10 lore raw

Hi,

Quoted 10 lines · Chen-Yu Tsai

Hi,

Quoted 7 lines · Hans de Goede

Hi Maxime and Chen-Yu,

Here is a series with various improvements for the Orangepi Plus dts. Some (most) of these patches have been submitted before, esp. the USB ones have multiple revisions before. But I lost count of their version, so I'm posting this as a "new" set.

Quoted 6 lines
Quoted 4 lines

About the USB patches, these rely on the patches to add support for multiple-reset controllers to ohci-platform / ehci-platform. These patches are all acked up and will go upstream as soon as v4.6-rc1 is released (they depend on changes which will go into v4.6-rc1).

Does this mean you or I can send the Orange Pi PC DTS patch?

Yes, I was planning on submitting a v2 of it shortly, with support for IR and the LEDs / buttons added.

Regards,

Hans

p.s.

I just noticed a problem with the pinctrl node in
"Add leds and switches on Orangepi Plus boards"
patch, causing the following to show up in dmesg:

[    1.569702] sun8i-h3-r-pinctrl 1f02c00.pinctrl: unknown pin PL03
[    1.575741] sun8i-h3-r-pinctrl 1f02c00.pinctrl: unknown pin PL04

I'll submit a v7 soon, this replaces the one from this set, and should be applied in the same order as the v6

#11 lore raw

cover ARM: dts: sun8i: Orangepi Plus dts improvements

In reply to Hans de Goede
Quoted 12 lines · Hans de Goede

Hi Maxime and Chen-Yu,

Here is a series with various improvements for the Orangepi Plus dts. Some (most) of these patches have been submitted before, esp. the USB ones have multiple revisions before. But I lost count of their version, so I'm posting this as a "new" set.

About the USB patches, these rely on the patches to add support for multiple-reset controllers to ohci-platform / ehci-platform. These patches are all acked up and will go upstream as soon as v4.6-rc1 is released (they depend on changes which will go into v4.6-rc1).

Quoted 7 lines

The old ohci-platform / ehci-platform will only look at the first reset specified in the dt and as such will fail to load with the new dt nodes (because they cannot talk to the controller).

I've also included a v6 of Krzysztof Adamski <[email protected]> leds / switches patch, fixing the comments you had in your review of v5. I've done this to avoid conflicts with my other patches.

Applied all but patch 6, which was in already.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160321/3b151be5/attachment.sig>