9ae5591cca02c5b0378651ca41274401defd09c5
[openwrt/staging/wigyori.git] / target / linux / sunxi / patches-6.1 / 463-arm64-dts-allwinner-h616-OrangePi-Zero-2-Add-USB-nod.patch
1 From 1bc12a9ae690a22a525f9b71778022bb4533fec1 Mon Sep 17 00:00:00 2001
2 From: Andre Przywara <andre.przywara@arm.com>
3 Date: Wed, 16 Jun 2021 18:32:36 +0100
4 Subject: [PATCH 5005/5006] arm64: dts: allwinner: h616: OrangePi Zero 2: Add
5 USB nodes
6
7 The OrangePi Zero 2 has one USB-A host port, VBUS is provided by
8 a GPIO controlled regulator.
9 The USB-C port is meant to power the board, but is also connected to
10 the USB 0 port, which we configure as an MUSB peripheral.
11
12 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
13 ---
14 .../allwinner/sun50i-h616-orangepi-zero2.dts | 41 +++++++++++++++++++
15 1 file changed, 41 insertions(+)
16
17 --- a/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts
18 +++ b/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts
19 @@ -49,8 +49,24 @@
20 regulator-max-microvolt = <5000000>;
21 regulator-always-on;
22 };
23 +
24 + reg_usb1_vbus: regulator-usb1-vbus {
25 + compatible = "regulator-fixed";
26 + regulator-name = "usb1-vbus";
27 + regulator-min-microvolt = <5000000>;
28 + regulator-max-microvolt = <5000000>;
29 + vin-supply = <&reg_vcc5v>;
30 + enable-active-high;
31 + gpio = <&pio 2 16 GPIO_ACTIVE_HIGH>; /* PC16 */
32 + };
33 +};
34 +
35 +&ehci1 {
36 + status = "okay";
37 };
38
39 +/* USB 2 & 3 are on headers only. */
40 +
41 &emac0 {
42 pinctrl-names = "default";
43 pinctrl-0 = <&ext_rgmii_pins>;
44 @@ -76,6 +92,10 @@
45 status = "okay";
46 };
47
48 +&ohci1 {
49 + status = "okay";
50 +};
51 +
52 &r_rsb {
53 status = "okay";
54
55 @@ -211,3 +231,24 @@
56 pinctrl-0 = <&uart0_ph_pins>;
57 status = "okay";
58 };
59 +
60 +&usbotg {
61 + /*
62 + * PHY0 pins are connected to a USB-C socket, but a role switch
63 + * is not implemented: both CC pins are pulled to GND.
64 + * The VBUS pins power the device, so a fixed peripheral mode
65 + * is the best choice.
66 + * The board can be powered via GPIOs, in this case port0 *can*
67 + * act as a host (with a cable/adapter ignoring CC), as VBUS is
68 + * then provided by the GPIOs. Any user of this setup would
69 + * need to adjust the DT accordingly: dr_mode set to "host",
70 + * enabling OHCI0 and EHCI0.
71 + */
72 + dr_mode = "peripheral";
73 + status = "okay";
74 +};
75 +
76 +&usbphy {
77 + usb1_vbus-supply = <&reg_usb1_vbus>;
78 + status = "okay";
79 +};