Skip to contentSkip to conversation

arm64: allwinner: a64: orangepi-zero-plus2: add usb otg

PATCH In review Jagan Teki 3 participants 4 messages Jan 12, 2018 – Jan 15, 2018

Subsystems (2)
lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

PATCH v2 1/1 arm64: allwinner: a64: orangepi-zero-plus2: add usb otg

Add usb otg support for orangepi-zero-plus2 board:
- Add usb_otg node with dr_mode as 'otg'
- USB0-IDDET connected to PA21
- VBUS connected through DCIN which always on

Tested mass storage function.

---
Changes for v2:
- Change dr_mode to peripheral

 .../dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts    | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts +18 -0
index af43533..6511190 100644
@@ -73,6 +73,10 @@
 	};
 };
 
+&ehci0 {
+	status = "okay";
+};
+
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>;
@@ -111,6 +115,10 @@
 	status = "okay";
 };
 
+&ohci0 {
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
@@ -122,3 +130,13 @@
 	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
 	status = "okay";
 };
+
+&usb_otg {
+	dr_mode = "peripheral";
+	status = "okay";
+};
+
+&usbphy {
+	usb0_id_det-gpios = <&pio 0 21 GPIO_ACTIVE_HIGH>; /* PA21 */
+	status = "okay";
+};
Signature · 1 line
2.7.4
#1 lore raw

Hi,

Quoted 42 lines · Jagan Teki

Add usb otg support for orangepi-zero-plus2 board:
- Add usb_otg node with dr_mode as 'otg'
- USB0-IDDET connected to PA21
- VBUS connected through DCIN which always on

Tested mass storage function.

---
Changes for v2:
- Change dr_mode to peripheral

 .../dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts    | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts +8 -0
index af43533..6511190 100644
@@ -73,6 +73,10 @@
 	};
 };
 
+&ehci0 {
+	status = "okay";
+};
+
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>;
@@ -111,6 +115,10 @@
 	status = "okay";
 };
 
+&ohci0 {
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;

arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts line 135

Quoted 6 lines
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts +3 -0
@@ -122,3 +130,13 @@
 	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
 	status = "okay";
 };
+
+&usb_otg {
+	dr_mode = "peripheral";

If VBUS is always on, this can only operate safely in host mode, not peripheral.

Maxime

Signature · 10 lines
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: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180115/b1e2668a/attachment-0001.sig>
#2 lore raw

? 2018?1?15???? CST ??4:01:39?Maxime Ripard ???

Quoted 61 lines

Hi,

Quoted 58 lines · Jagan Teki

Add usb otg support for orangepi-zero-plus2 board:
- Add usb_otg node with dr_mode as 'otg'
- USB0-IDDET connected to PA21
- VBUS connected through DCIN which always on

Tested mass storage function.

---
Changes for v2:
- Change dr_mode to peripheral

 .../dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts    | 18

++++++++++++++++++ 1 file changed, 18 insertions(+)

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 af43533..6511190 100644

arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts +4 -0
@@ -73,6 +73,10 @@
 
 	};
 
 };
 
+&ehci0 {
+	status = "okay";
+};
+
 

&mmc0 {

arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts +4 -0
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>;
@@ -111,6 +115,10 @@
 
 	status = "okay";
 
 };
 
+&ohci0 {
+	status = "okay";
+};
+
 

&uart0 {

arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts +0 -0
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
@@ -122,3 +130,13 @@
 
 	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
 	status = "okay";
Quoted 8 lines

arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts line 135

Quoted 5 lines
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts +3 -0
 };
 
+
+&usb_otg {
+	dr_mode = "peripheral";

If VBUS is always on, this can only operate safely in host mode, not peripheral.

I think this kind of device is designed to directly drain power from the host in peripheral mode.

Quoted 2 lines

Maxime

#3 lore raw
Quoted 71 lines · Icenowy Zheng

? 2018?1?15???? CST ??4:01:39?Maxime Ripard ???

Quoted 61 lines

Hi,

Quoted 58 lines · Jagan Teki

Add usb otg support for orangepi-zero-plus2 board:
- Add usb_otg node with dr_mode as 'otg'
- USB0-IDDET connected to PA21
- VBUS connected through DCIN which always on

Tested mass storage function.

---
Changes for v2:
- Change dr_mode to peripheral

 .../dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts    | 18

++++++++++++++++++ 1 file changed, 18 insertions(+)

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 af43533..6511190 100644

arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts +4 -0
@@ -73,6 +73,10 @@
 
 	};
 
 };
 
+&ehci0 {
+	status = "okay";
+};
+
 

&mmc0 {

arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts +4 -0
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>;
@@ -111,6 +115,10 @@
 
 	status = "okay";
 
 };
 
+&ohci0 {
+	status = "okay";
+};
+
 

&uart0 {

arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts +0 -0
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
@@ -122,3 +130,13 @@
 
 	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
 	status = "okay";
Quoted 8 lines

arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts line 135

Quoted 5 lines
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts +3 -0
 };
 
+
+&usb_otg {
+	dr_mode = "peripheral";

If VBUS is always on, this can only operate safely in host mode, not peripheral.

Quoted 2 lines

I think this kind of device is designed to directly drain power from the host in peripheral mode.

Then the commit log has it backwards, VBUS is not connected through DCIN, DCIN is VBUS.

Maxime

Signature · 10 lines
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: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180115/4783897a/attachment.sig>