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