004-v6.2-arm64-dts-allwinner-h616-OrangePi-Zero-2-Add-USB-nodes.patch 2.3 KB

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