2020-05-28 20:51:46

by Diego Rondini

[permalink] [raw]
Subject: [PATCH 1/2] ARM: dts: orange-pi-zero-plus2: enable USB OTG port

Enable support for USB OTG port on Orange Pi Zero Plus 2 (both H3 and H5
variants). As, according to the board schematics, the USB OTG port cannot
provide power to external devices, we set dr_mode to peripheral.

Signed-off-by: Diego Rondini <[email protected]>
---
.../boot/dts/sun8i-h3-orangepi-zero-plus2.dts | 23 +++++++++++++++++++
.../sun50i-h5-orangepi-zero-plus2.dts | 23 +++++++++++++++++++
2 files changed, 46 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
index b8f46e2802fd3..4376767699a47 100644
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
@@ -137,3 +137,26 @@ &uart0 {
pinctrl-0 = <&uart0_pa_pins>;
status = "okay";
};
+
+&usbphy {
+ status = "okay";
+};
+
+&usb_otg {
+ /*
+ * According to schematics CN1 MicroUSB port can be used to take
+ * external 5V to power up the board VBUS. On the contrary CN1 MicroUSB
+ * port cannot provide power externally even if the board is powered
+ * via GPIO pins. It thus makes sense to force peripheral mode.
+ */
+ dr_mode = "peripheral";
+ status = "okay";
+};
+
+&ehci0 {
+ status = "okay";
+};
+
+&ohci0 {
+ status = "okay";
+};
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
index c95a68541309c..d8192a7483e9e 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
@@ -103,3 +103,26 @@ &uart1 {
pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
status = "okay";
};
+
+&usbphy {
+ status = "okay";
+};
+
+&usb_otg {
+ /*
+ * According to schematics CN1 MicroUSB port can be used to take
+ * external 5V to power up the board VBUS. On the contrary CN1 MicroUSB
+ * port cannot provide power externally even if the board is powered
+ * via GPIO pins. It thus makes sense to force peripheral mode.
+ */
+ dr_mode = "peripheral";
+ status = "okay";
+};
+
+&ehci0 {
+ status = "okay";
+};
+
+&ohci0 {
+ status = "okay";
+};
--
2.25.4


2020-05-28 20:52:18

by Diego Rondini

[permalink] [raw]
Subject: [PATCH 2/2] ARM: dts: orange-pi-zero-plus2: add leds configuration

Add pwr and status leds configuration and turn on pwr led by default for Orange
Pi Zero Plus 2 (both H3 and H5 variants).

Signed-off-by: Diego Rondini <[email protected]>
---
.../boot/dts/sun8i-h3-orangepi-zero-plus2.dts | 16 ++++++++++++++++
.../allwinner/sun50i-h5-orangepi-zero-plus2.dts | 16 ++++++++++++++++
2 files changed, 32 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
index 4376767699a47..4cd0ac706bd2c 100644
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
@@ -82,6 +82,22 @@ wifi_pwrseq: wifi_pwrseq {
reset-gpios = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */
post-power-on-delay-ms = <200>;
};
+
+ leds {
+ compatible = "gpio-leds";
+
+ pwr_led {
+ label = "orangepi:green:pwr";
+ gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
+ default-state = "on";
+ };
+
+ status_led {
+ label = "orangepi:red:status";
+ gpios = <&pio 0 17 GPIO_ACTIVE_HIGH>;
+ };
+
+ };
};

&de {
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
index d8192a7483e9e..517d53e1b0ff1 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
@@ -42,6 +42,22 @@ wifi_pwrseq: wifi_pwrseq {
reset-gpios = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */
post-power-on-delay-ms = <200>;
};
+
+ leds {
+ compatible = "gpio-leds";
+
+ pwr_led {
+ label = "orangepi:green:pwr";
+ gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
+ default-state = "on";
+ };
+
+ status_led {
+ label = "orangepi:red:status";
+ gpios = <&pio 0 17 GPIO_ACTIVE_HIGH>;
+ };
+
+ };
};

&de {
--
2.25.4

2020-06-15 08:15:11

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH 1/2] ARM: dts: orange-pi-zero-plus2: enable USB OTG port

Hi Diego,

On Thu, May 28, 2020 at 10:47:11PM +0200, Diego Rondini wrote:
> Enable support for USB OTG port on Orange Pi Zero Plus 2 (both H3 and H5
> variants). As, according to the board schematics, the USB OTG port cannot
> provide power to external devices, we set dr_mode to peripheral.
>
> Signed-off-by: Diego Rondini <[email protected]>

Sorry for the time it took to review it. I initially thought it was ok
and wanted to wait until -rc1 was out to apply it, but...

> ---
> .../boot/dts/sun8i-h3-orangepi-zero-plus2.dts | 23 +++++++++++++++++++
> .../sun50i-h5-orangepi-zero-plus2.dts | 23 +++++++++++++++++++
> 2 files changed, 46 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
> index b8f46e2802fd3..4376767699a47 100644
> --- a/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
> +++ b/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
> @@ -137,3 +137,26 @@ &uart0 {
> pinctrl-0 = <&uart0_pa_pins>;
> status = "okay";
> };
> +
> +&usbphy {
> + status = "okay";
> +};
> +
> +&usb_otg {
> + /*
> + * According to schematics CN1 MicroUSB port can be used to take
> + * external 5V to power up the board VBUS. On the contrary CN1 MicroUSB
> + * port cannot provide power externally even if the board is powered
> + * via GPIO pins. It thus makes sense to force peripheral mode.
> + */
> + dr_mode = "peripheral";
> + status = "okay";
> +};
> +
> +&ehci0 {
> + status = "okay";
> +};
> +
> +&ohci0 {
> + status = "okay";
> +};

Nodes should be ordered alphabetically here.

> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
> index c95a68541309c..d8192a7483e9e 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
> @@ -103,3 +103,26 @@ &uart1 {
> pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
> status = "okay";
> };
> +
> +&usbphy {
> + status = "okay";
> +};
> +
> +&usb_otg {
> + /*
> + * According to schematics CN1 MicroUSB port can be used to take
> + * external 5V to power up the board VBUS. On the contrary CN1 MicroUSB
> + * port cannot provide power externally even if the board is powered
> + * via GPIO pins. It thus makes sense to force peripheral mode.
> + */
> + dr_mode = "peripheral";
> + status = "okay";
> +};
> +
> +&ehci0 {
> + status = "okay";
> +};
> +
> +&ohci0 {
> + status = "okay";
> +};

And here too.

Sorry for not spotting this earlier.

Maxime


Attachments:
(No filename) (2.64 kB)
signature.asc (235.00 B)
Download all attachments

2020-06-15 08:17:17

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH 2/2] ARM: dts: orange-pi-zero-plus2: add leds configuration

On Thu, May 28, 2020 at 10:47:12PM +0200, Diego Rondini wrote:
> Add pwr and status leds configuration and turn on pwr led by default for Orange
> Pi Zero Plus 2 (both H3 and H5 variants).
>
> Signed-off-by: Diego Rondini <[email protected]>
> ---
> .../boot/dts/sun8i-h3-orangepi-zero-plus2.dts | 16 ++++++++++++++++
> .../allwinner/sun50i-h5-orangepi-zero-plus2.dts | 16 ++++++++++++++++
> 2 files changed, 32 insertions(+)
>
> diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
> index 4376767699a47..4cd0ac706bd2c 100644
> --- a/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
> +++ b/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
> @@ -82,6 +82,22 @@ wifi_pwrseq: wifi_pwrseq {
> reset-gpios = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */
> post-power-on-delay-ms = <200>;
> };
> +
> + leds {
> + compatible = "gpio-leds";
> +
> + pwr_led {
> + label = "orangepi:green:pwr";
> + gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
> + default-state = "on";
> + };
> +
> + status_led {

Having an underscore in the node name will trigger a DTC warning. What
about using pwr and status as nodenames?

> + label = "orangepi:red:status";
> + gpios = <&pio 0 17 GPIO_ACTIVE_HIGH>;
> + };
> +

There's an extra line here that you should remove

Maxime


Attachments:
(No filename) (1.36 kB)
signature.asc (235.00 B)
Download all attachments