linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] arm64: dts: allwinner: h6: orangepi: Enable USB 2.0 and LEDs
@ 2018-11-20  6:53 Chen-Yu Tsai
  2018-11-20  6:53 ` [PATCH 1/3] arm64: dts: allwinner: h6: orangepi: Add board-wide 5V regulator Chen-Yu Tsai
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chen-Yu Tsai @ 2018-11-20  6:53 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, linux-arm-kernel, devicetree, linux-kernel, linux-sunxi

Hi,

This small series enables USB 2.0 and LEDs on the Orange Pi Lite 2 and
Orange Pi One Plus. The two features are unrelated, but included in the
same series as the patch contexts overlap.

Patch one adds a fixed regulator to represent the board-wide 5V rail.
While not strictly necessary, this helps define the relationship between
regulators.

Patch two enables USB 2.0 host and OTG. Note that VBUS on both ports are
directly tied to the 5V rail, without any power switches or current
limiters.

Patch three add device nodes for the two LEDs. These LEDs are driven
directly by the GPIO pins, without a current limiting resistor. At the
default drive strength, the LEDs are quite bright.

Please have a look.
ChenYu

Chen-Yu Tsai (3):
  arm64: dts: allwinner: h6: orangepi: Add board-wide 5V regulator
  arm64: dts: allwinner: h6: orangepi: Enable USB 2.0 host and OTG ports
  arm64: dts: allwinner: h6: orangepi: Add device nodes for LEDs

 .../dts/allwinner/sun50i-h6-orangepi.dtsi     | 60 +++++++++++++++++++
 1 file changed, 60 insertions(+)

-- 
2.19.1


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

* [PATCH 1/3] arm64: dts: allwinner: h6: orangepi: Add board-wide 5V regulator
  2018-11-20  6:53 [PATCH 0/3] arm64: dts: allwinner: h6: orangepi: Enable USB 2.0 and LEDs Chen-Yu Tsai
@ 2018-11-20  6:53 ` Chen-Yu Tsai
  2018-11-20  6:53 ` [PATCH 2/3] arm64: dts: allwinner: h6: orangepi: Enable USB 2.0 host and OTG ports Chen-Yu Tsai
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Chen-Yu Tsai @ 2018-11-20  6:53 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, linux-arm-kernel, devicetree, linux-kernel, linux-sunxi

The Orange Pi Lite 2 and Orange Pi One Plus share the same design for
their USB 2.0 ports. VBUS is directly tied to the board wide 5V rail,
which is also directly tied to the DC jack. There is no current limiting
in this design. This 5V rail also supplies the various inputs to the
PMIC.

This patch adds a board wide 5V regulator and sets it as the input to
the PMIC inputs.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 .../boot/dts/allwinner/sun50i-h6-orangepi.dtsi  | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
index 0612c19cd994..f910d5eb9267 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
@@ -21,6 +21,15 @@
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
+
+	reg_vcc5v: vcc5v {
+		/* board wide 5V supply directly from the DC jack */
+		compatible = "regulator-fixed";
+		regulator-name = "vcc-5v";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-always-on;
+	};
 };
 
 &mmc0 {
@@ -43,6 +52,14 @@
 		interrupt-controller;
 		#interrupt-cells = <1>;
 		x-powers,self-working-mode;
+		vina-supply = <&reg_vcc5v>;
+		vinb-supply = <&reg_vcc5v>;
+		vinc-supply = <&reg_vcc5v>;
+		vind-supply = <&reg_vcc5v>;
+		vine-supply = <&reg_vcc5v>;
+		aldoin-supply = <&reg_vcc5v>;
+		bldoin-supply = <&reg_vcc5v>;
+		cldoin-supply = <&reg_vcc5v>;
 
 		regulators {
 			reg_aldo1: aldo1 {
-- 
2.19.1


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

* [PATCH 2/3] arm64: dts: allwinner: h6: orangepi: Enable USB 2.0 host and OTG ports
  2018-11-20  6:53 [PATCH 0/3] arm64: dts: allwinner: h6: orangepi: Enable USB 2.0 and LEDs Chen-Yu Tsai
  2018-11-20  6:53 ` [PATCH 1/3] arm64: dts: allwinner: h6: orangepi: Add board-wide 5V regulator Chen-Yu Tsai
@ 2018-11-20  6:53 ` Chen-Yu Tsai
  2018-11-20  6:53 ` [PATCH 3/3] arm64: dts: allwinner: h6: orangepi: Add device nodes for LEDs Chen-Yu Tsai
  2018-11-20  7:58 ` [PATCH 0/3] arm64: dts: allwinner: h6: orangepi: Enable USB 2.0 and LEDs Maxime Ripard
  3 siblings, 0 replies; 5+ messages in thread
From: Chen-Yu Tsai @ 2018-11-20  6:53 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, linux-arm-kernel, devicetree, linux-kernel, linux-sunxi

The Orange Pi Lite 2 and Orange Pi One Plus share the same design for
their USB 2.0 ports. VBUS is directly tied to the board wide 5V rail,
which is also directly tied to the DC jack. There is no current limiting
in this design.

This patch enables all the USB 2.0 related device nodes, and sets the
VBUS regulator supplies and OTG ID detection GPIO.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 .../dts/allwinner/sun50i-h6-orangepi.dtsi     | 28 +++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
index f910d5eb9267..f16b7ffbe797 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
@@ -32,6 +32,14 @@
 	};
 };
 
+&ehci0 {
+	status = "okay";
+};
+
+&ehci3 {
+	status = "okay";
+};
+
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins>;
@@ -41,6 +49,14 @@
 	status = "okay";
 };
 
+&ohci0 {
+	status = "okay";
+};
+
+&ohci3 {
+	status = "okay";
+};
+
 &r_i2c {
 	status = "okay";
 
@@ -165,3 +181,15 @@
 	pinctrl-0 = <&uart0_ph_pins>;
 	status = "okay";
 };
+
+&usb2otg {
+	dr_mode = "otg";
+	status = "okay";
+};
+
+&usb2phy {
+	usb0_id_det-gpios = <&pio 2 6 GPIO_ACTIVE_HIGH>; /* PC6 */
+	usb0_vbus-supply = <&reg_vcc5v>;
+	usb3_vbus-supply = <&reg_vcc5v>;
+	status = "okay";
+};
-- 
2.19.1


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

* [PATCH 3/3] arm64: dts: allwinner: h6: orangepi: Add device nodes for LEDs
  2018-11-20  6:53 [PATCH 0/3] arm64: dts: allwinner: h6: orangepi: Enable USB 2.0 and LEDs Chen-Yu Tsai
  2018-11-20  6:53 ` [PATCH 1/3] arm64: dts: allwinner: h6: orangepi: Add board-wide 5V regulator Chen-Yu Tsai
  2018-11-20  6:53 ` [PATCH 2/3] arm64: dts: allwinner: h6: orangepi: Enable USB 2.0 host and OTG ports Chen-Yu Tsai
@ 2018-11-20  6:53 ` Chen-Yu Tsai
  2018-11-20  7:58 ` [PATCH 0/3] arm64: dts: allwinner: h6: orangepi: Enable USB 2.0 and LEDs Maxime Ripard
  3 siblings, 0 replies; 5+ messages in thread
From: Chen-Yu Tsai @ 2018-11-20  6:53 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, linux-arm-kernel, devicetree, linux-kernel, linux-sunxi

The Orange Pi Lite 2 and Orange Pi One Plus both have two LEDs, one red
and one green. These are driven directly by GPIO lines in an active high
arrangement. The red LED is labeled "power", so it is set to be on by
default.

Note that the default drive current for the GPIO lines makes the LEDs
very bright.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 .../boot/dts/allwinner/sun50i-h6-orangepi.dtsi    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
index f16b7ffbe797..b2526dac2fcf 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
@@ -22,6 +22,21 @@
 		stdout-path = "serial0:115200n8";
 	};
 
+	leds {
+		compatible = "gpio-leds";
+
+		power {
+			label = "orangepi:red:power";
+			gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
+			default-state = "on";
+		};
+
+		status {
+			label = "orangepi:green:status";
+			gpios = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
+		};
+	};
+
 	reg_vcc5v: vcc5v {
 		/* board wide 5V supply directly from the DC jack */
 		compatible = "regulator-fixed";
-- 
2.19.1


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

* Re: [PATCH 0/3] arm64: dts: allwinner: h6: orangepi: Enable USB 2.0 and LEDs
  2018-11-20  6:53 [PATCH 0/3] arm64: dts: allwinner: h6: orangepi: Enable USB 2.0 and LEDs Chen-Yu Tsai
                   ` (2 preceding siblings ...)
  2018-11-20  6:53 ` [PATCH 3/3] arm64: dts: allwinner: h6: orangepi: Add device nodes for LEDs Chen-Yu Tsai
@ 2018-11-20  7:58 ` Maxime Ripard
  3 siblings, 0 replies; 5+ messages in thread
From: Maxime Ripard @ 2018-11-20  7:58 UTC (permalink / raw)
  To: Chen-Yu Tsai; +Cc: linux-arm-kernel, devicetree, linux-kernel, linux-sunxi

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

On Tue, Nov 20, 2018 at 02:53:08PM +0800, Chen-Yu Tsai wrote:
> Hi,
> 
> This small series enables USB 2.0 and LEDs on the Orange Pi Lite 2 and
> Orange Pi One Plus. The two features are unrelated, but included in the
> same series as the patch contexts overlap.
> 
> Patch one adds a fixed regulator to represent the board-wide 5V rail.
> While not strictly necessary, this helps define the relationship between
> regulators.
> 
> Patch two enables USB 2.0 host and OTG. Note that VBUS on both ports are
> directly tied to the 5V rail, without any power switches or current
> limiters.
> 
> Patch three add device nodes for the two LEDs. These LEDs are driven
> directly by the GPIO pins, without a current limiting resistor. At the
> default drive strength, the LEDs are quite bright.

Applied all three patches, thanks!

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

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

end of thread, other threads:[~2018-11-20  7:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-20  6:53 [PATCH 0/3] arm64: dts: allwinner: h6: orangepi: Enable USB 2.0 and LEDs Chen-Yu Tsai
2018-11-20  6:53 ` [PATCH 1/3] arm64: dts: allwinner: h6: orangepi: Add board-wide 5V regulator Chen-Yu Tsai
2018-11-20  6:53 ` [PATCH 2/3] arm64: dts: allwinner: h6: orangepi: Enable USB 2.0 host and OTG ports Chen-Yu Tsai
2018-11-20  6:53 ` [PATCH 3/3] arm64: dts: allwinner: h6: orangepi: Add device nodes for LEDs Chen-Yu Tsai
2018-11-20  7:58 ` [PATCH 0/3] arm64: dts: allwinner: h6: orangepi: Enable USB 2.0 and LEDs 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).