005-v6.6-arm64-dts-allwinner-h616-Split-Orange-Pi-Zero-2-DT.patch 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. From 322bf103204b8f786547acbeed85569254e7088f Mon Sep 17 00:00:00 2001
  2. From: Andre Przywara <[email protected]>
  3. Date: Fri, 4 Aug 2023 18:08:54 +0100
  4. Subject: [PATCH] arm64: dts: allwinner: h616: Split Orange Pi Zero 2 DT
  5. The Orange Pi Zero 2 got a successor (Zero 3), which shares quite some
  6. DT nodes with the Zero 2, but comes with a different PMIC.
  7. Move the common parts (except the PMIC) into a new shared file, and
  8. include that from the existing board .dts file.
  9. No functional change, the generated DTB is the same, except for some
  10. phandle numbering differences.
  11. Signed-off-by: Andre Przywara <[email protected]>
  12. Acked-by: Jernej Skrabec <[email protected]>
  13. Link: https://lore.kernel.org/r/[email protected]
  14. Signed-off-by: Jernej Skrabec <[email protected]>
  15. ---
  16. .../allwinner/sun50i-h616-orangepi-zero.dtsi | 134 ++++++++++++++++++
  17. .../allwinner/sun50i-h616-orangepi-zero2.dts | 119 +---------------
  18. 2 files changed, 135 insertions(+), 118 deletions(-)
  19. create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero.dtsi
  20. --- /dev/null
  21. +++ b/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero.dtsi
  22. @@ -0,0 +1,134 @@
  23. +// SPDX-License-Identifier: (GPL-2.0+ or MIT)
  24. +/*
  25. + * Copyright (C) 2020 Arm Ltd.
  26. + *
  27. + * DT nodes common between Orange Pi Zero 2 and Orange Pi Zero 3.
  28. + * Excludes PMIC nodes and properties, since they are different between the two.
  29. + */
  30. +
  31. +#include "sun50i-h616.dtsi"
  32. +
  33. +#include <dt-bindings/gpio/gpio.h>
  34. +#include <dt-bindings/interrupt-controller/arm-gic.h>
  35. +#include <dt-bindings/leds/common.h>
  36. +
  37. +/ {
  38. + aliases {
  39. + ethernet0 = &emac0;
  40. + serial0 = &uart0;
  41. + };
  42. +
  43. + chosen {
  44. + stdout-path = "serial0:115200n8";
  45. + };
  46. +
  47. + leds {
  48. + compatible = "gpio-leds";
  49. +
  50. + led-0 {
  51. + function = LED_FUNCTION_POWER;
  52. + color = <LED_COLOR_ID_RED>;
  53. + gpios = <&pio 2 12 GPIO_ACTIVE_HIGH>; /* PC12 */
  54. + default-state = "on";
  55. + };
  56. +
  57. + led-1 {
  58. + function = LED_FUNCTION_STATUS;
  59. + color = <LED_COLOR_ID_GREEN>;
  60. + gpios = <&pio 2 13 GPIO_ACTIVE_HIGH>; /* PC13 */
  61. + };
  62. + };
  63. +
  64. + reg_vcc5v: vcc5v {
  65. + /* board wide 5V supply directly from the USB-C socket */
  66. + compatible = "regulator-fixed";
  67. + regulator-name = "vcc-5v";
  68. + regulator-min-microvolt = <5000000>;
  69. + regulator-max-microvolt = <5000000>;
  70. + regulator-always-on;
  71. + };
  72. +
  73. + reg_usb1_vbus: regulator-usb1-vbus {
  74. + compatible = "regulator-fixed";
  75. + regulator-name = "usb1-vbus";
  76. + regulator-min-microvolt = <5000000>;
  77. + regulator-max-microvolt = <5000000>;
  78. + vin-supply = <&reg_vcc5v>;
  79. + enable-active-high;
  80. + gpio = <&pio 2 16 GPIO_ACTIVE_HIGH>; /* PC16 */
  81. + };
  82. +};
  83. +
  84. +&ehci1 {
  85. + status = "okay";
  86. +};
  87. +
  88. +/* USB 2 & 3 are on headers only. */
  89. +
  90. +&emac0 {
  91. + pinctrl-names = "default";
  92. + pinctrl-0 = <&ext_rgmii_pins>;
  93. + phy-mode = "rgmii";
  94. + phy-handle = <&ext_rgmii_phy>;
  95. + allwinner,rx-delay-ps = <3100>;
  96. + allwinner,tx-delay-ps = <700>;
  97. + status = "okay";
  98. +};
  99. +
  100. +&mdio0 {
  101. + ext_rgmii_phy: ethernet-phy@1 {
  102. + compatible = "ethernet-phy-ieee802.3-c22";
  103. + reg = <1>;
  104. + };
  105. +};
  106. +
  107. +&mmc0 {
  108. + cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
  109. + bus-width = <4>;
  110. + status = "okay";
  111. +};
  112. +
  113. +&ohci1 {
  114. + status = "okay";
  115. +};
  116. +
  117. +&spi0 {
  118. + status = "okay";
  119. + pinctrl-names = "default";
  120. + pinctrl-0 = <&spi0_pins>, <&spi0_cs0_pin>;
  121. +
  122. + flash@0 {
  123. + #address-cells = <1>;
  124. + #size-cells = <1>;
  125. + compatible = "jedec,spi-nor";
  126. + reg = <0>;
  127. + spi-max-frequency = <40000000>;
  128. + };
  129. +};
  130. +
  131. +&uart0 {
  132. + pinctrl-names = "default";
  133. + pinctrl-0 = <&uart0_ph_pins>;
  134. + status = "okay";
  135. +};
  136. +
  137. +&usbotg {
  138. + /*
  139. + * PHY0 pins are connected to a USB-C socket, but a role switch
  140. + * is not implemented: both CC pins are pulled to GND.
  141. + * The VBUS pins power the device, so a fixed peripheral mode
  142. + * is the best choice.
  143. + * The board can be powered via GPIOs, in this case port0 *can*
  144. + * act as a host (with a cable/adapter ignoring CC), as VBUS is
  145. + * then provided by the GPIOs. Any user of this setup would
  146. + * need to adjust the DT accordingly: dr_mode set to "host",
  147. + * enabling OHCI0 and EHCI0.
  148. + */
  149. + dr_mode = "peripheral";
  150. + status = "okay";
  151. +};
  152. +
  153. +&usbphy {
  154. + usb1_vbus-supply = <&reg_usb1_vbus>;
  155. + status = "okay";
  156. +};
  157. --- a/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts
  158. +++ b/arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zero2.dts
  159. @@ -5,95 +5,19 @@
  160. /dts-v1/;
  161. -#include "sun50i-h616.dtsi"
  162. -
  163. -#include <dt-bindings/gpio/gpio.h>
  164. -#include <dt-bindings/interrupt-controller/arm-gic.h>
  165. -#include <dt-bindings/leds/common.h>
  166. +#include "sun50i-h616-orangepi-zero.dtsi"
  167. / {
  168. model = "OrangePi Zero2";
  169. compatible = "xunlong,orangepi-zero2", "allwinner,sun50i-h616";
  170. -
  171. - aliases {
  172. - ethernet0 = &emac0;
  173. - serial0 = &uart0;
  174. - };
  175. -
  176. - chosen {
  177. - stdout-path = "serial0:115200n8";
  178. - };
  179. -
  180. - leds {
  181. - compatible = "gpio-leds";
  182. -
  183. - led-0 {
  184. - function = LED_FUNCTION_POWER;
  185. - color = <LED_COLOR_ID_RED>;
  186. - gpios = <&pio 2 12 GPIO_ACTIVE_HIGH>; /* PC12 */
  187. - default-state = "on";
  188. - };
  189. -
  190. - led-1 {
  191. - function = LED_FUNCTION_STATUS;
  192. - color = <LED_COLOR_ID_GREEN>;
  193. - gpios = <&pio 2 13 GPIO_ACTIVE_HIGH>; /* PC13 */
  194. - };
  195. - };
  196. -
  197. - reg_vcc5v: vcc5v {
  198. - /* board wide 5V supply directly from the USB-C socket */
  199. - compatible = "regulator-fixed";
  200. - regulator-name = "vcc-5v";
  201. - regulator-min-microvolt = <5000000>;
  202. - regulator-max-microvolt = <5000000>;
  203. - regulator-always-on;
  204. - };
  205. -
  206. - reg_usb1_vbus: regulator-usb1-vbus {
  207. - compatible = "regulator-fixed";
  208. - regulator-name = "usb1-vbus";
  209. - regulator-min-microvolt = <5000000>;
  210. - regulator-max-microvolt = <5000000>;
  211. - vin-supply = <&reg_vcc5v>;
  212. - enable-active-high;
  213. - gpio = <&pio 2 16 GPIO_ACTIVE_HIGH>; /* PC16 */
  214. - };
  215. -};
  216. -
  217. -&ehci1 {
  218. - status = "okay";
  219. };
  220. -/* USB 2 & 3 are on headers only. */
  221. -
  222. &emac0 {
  223. - pinctrl-names = "default";
  224. - pinctrl-0 = <&ext_rgmii_pins>;
  225. - phy-mode = "rgmii";
  226. - phy-handle = <&ext_rgmii_phy>;
  227. phy-supply = <&reg_dcdce>;
  228. - allwinner,rx-delay-ps = <3100>;
  229. - allwinner,tx-delay-ps = <700>;
  230. - status = "okay";
  231. -};
  232. -
  233. -&mdio0 {
  234. - ext_rgmii_phy: ethernet-phy@1 {
  235. - compatible = "ethernet-phy-ieee802.3-c22";
  236. - reg = <1>;
  237. - };
  238. };
  239. &mmc0 {
  240. vmmc-supply = <&reg_dcdce>;
  241. - cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
  242. - bus-width = <4>;
  243. - status = "okay";
  244. -};
  245. -
  246. -&ohci1 {
  247. - status = "okay";
  248. };
  249. &r_rsb {
  250. @@ -211,44 +135,3 @@
  251. vcc-ph-supply = <&reg_aldo1>;
  252. vcc-pi-supply = <&reg_aldo1>;
  253. };
  254. -
  255. -&spi0 {
  256. - status = "okay";
  257. - pinctrl-names = "default";
  258. - pinctrl-0 = <&spi0_pins>, <&spi0_cs0_pin>;
  259. -
  260. - flash@0 {
  261. - #address-cells = <1>;
  262. - #size-cells = <1>;
  263. - compatible = "jedec,spi-nor";
  264. - reg = <0>;
  265. - spi-max-frequency = <40000000>;
  266. - };
  267. -};
  268. -
  269. -&uart0 {
  270. - pinctrl-names = "default";
  271. - pinctrl-0 = <&uart0_ph_pins>;
  272. - status = "okay";
  273. -};
  274. -
  275. -&usbotg {
  276. - /*
  277. - * PHY0 pins are connected to a USB-C socket, but a role switch
  278. - * is not implemented: both CC pins are pulled to GND.
  279. - * The VBUS pins power the device, so a fixed peripheral mode
  280. - * is the best choice.
  281. - * The board can be powered via GPIOs, in this case port0 *can*
  282. - * act as a host (with a cable/adapter ignoring CC), as VBUS is
  283. - * then provided by the GPIOs. Any user of this setup would
  284. - * need to adjust the DT accordingly: dr_mode set to "host",
  285. - * enabling OHCI0 and EHCI0.
  286. - */
  287. - dr_mode = "peripheral";
  288. - status = "okay";
  289. -};
  290. -
  291. -&usbphy {
  292. - usb1_vbus-supply = <&reg_usb1_vbus>;
  293. - status = "okay";
  294. -};