Skip to contentSkip to conversation

arm: sun8i: nanopi-neo: Enable USB OTG

PATCH Superseded David Disseldorp 2 participants 3 messages Aug 28, 2017 2 messages not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: sun8i: nanopi-neo: Enable USB OTG

From: David Disseldorp <[email protected]>

The NanoPi NEO features a MicroUSB port that can work in both host mode and peripheral mode. Switching is handled via GPIO PG12.

---
 arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts +27 -0
index 78f6c24952dd..5abf430ac5a6 100644
@@ -47,9 +47,36 @@
 	compatible = "friendlyarm,nanopi-neo", "allwinner,sun8i-h3";
 };
 
+&ehci0 {
+	status = "okay";
+};
+
+&ehci3 {
+	status = "okay";
+};
+
 &emac {
 	phy-handle = <&int_mii_phy>;
 	phy-mode = "mii";
 	allwinner,leds-active-low;
 	status = "okay";
 };
+
+&ohci0 {
+	status = "okay";
+};
+
+&ohci3 {
+	status = "okay";
+};
+
+&usb_otg {
+	dr_mode = "otg";
+	status = "okay";
+};
+
+&usbphy {
+	/* USB Type-A port's VBUS is always on */
+	usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
+	status = "okay";
+};
Signature · 6 lines
2.13.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 4 lines · 在 2017-08-28 08:12,David Disseldorp 写道:

From: David Disseldorp <[email protected]>

The NanoPi NEO features a MicroUSB port that can work in both host mode and peripheral mode. Switching is handled via GPIO PG12.

How's the Vbus of the OTG handled?

Quoted 13 lines
---
 arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts | 27 
+++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts +0 -0
index 78f6c24952dd..5abf430ac5a6 100644

arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts line 56

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts +7 -0
@@ -47,9 +47,36 @@
 	compatible = "friendlyarm,nanopi-neo", "allwinner,sun8i-h3";
 };
 
+&ehci0 {
+	status = "okay";
+};
+
+&ehci3 {
+	status = "okay";
+};

Why do you also enable ehci/ohci3 here?
I think they're already enabled in sun8i-h3-nanopi.dtsi .

Quoted 16 lines
arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts +10 -0
+
 &emac {
 	phy-handle = <&int_mii_phy>;
 	phy-mode = "mii";
 	allwinner,leds-active-low;
 	status = "okay";
 };
+
+&ohci0 {
+	status = "okay";
+};
+
+&ohci3 {
+	status = "okay";
+};
+

arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts line 82

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts +10 -0
+&usb_otg {
+	dr_mode = "otg";
+	status = "okay";
+};
+
+&usbphy {
+	/* USB Type-A port's VBUS is always on */
+	usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
+	status = "okay";
+};

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 7 lines · On Mon, 28 Aug 2017 10:37:56 +0800, [email protected] wrote:
Quoted 4 lines · 在 2017-08-28 08:12,David Disseldorp 写道:

From: David Disseldorp <[email protected]>

The NanoPi NEO features a MicroUSB port that can work in both host mode and peripheral mode. Switching is handled via GPIO PG12.

How's the Vbus of the OTG handled?

I don't know. Unlike the NanoPi NEO2[2], the NanoPi NEO schematics[1] don't show a regulator connected to the Vbus pin. I've tested this change with USB device mode only.

Quoted 15 lines
Quoted 15 lines
---
 arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts | 27 
+++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts +0 -0
index 78f6c24952dd..5abf430ac5a6 100644
@@ -47,9 +47,36 @@
 	compatible = "friendlyarm,nanopi-neo", "allwinner,sun8i-h3";
 };
 
Quoted 10 lines

arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts line 56

Quoted 7 lines
arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts +7 -0
+&ehci0 {
+	status = "okay";
+};
+
+&ehci3 {
+	status = "okay";
+};  

Why do you also enable ehci/ohci3 here?
I think they're already enabled in sun8i-h3-nanopi.dtsi .

You're right. I'll drop the duplication here.

Cheers, David

1. NanoPi NEO schematics
http://wiki.friendlyarm.com/wiki/images/1/1c/NanoPi-NEO-V1.2-1608-Schematic.pdf

2. NanoPi NEO2 schematics
http://wiki.friendlyarm.com/wiki/images/a/a1/Schematic_NanoPi_NEO2-v1.0_1701.pdf
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html