xref: /linux/arch/arm64/boot/dts/allwinner/sun55i-t527-orangepi-4a.dts (revision db4a3f0fbedb0398f77b9047e8b8bb2b49f355bb)
1// SPDX-License-Identifier: (GPL-2.0-only OR MIT)
2/*
3 * Copyright (C) 2025 Chen-Yu Tsai <wens@csie.org>
4 */
5
6/dts-v1/;
7
8#include "sun55i-a523.dtsi"
9
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/leds/common.h>
12
13/ {
14	model = "OrangePi 4A";
15	compatible = "xunlong,orangepi-4a", "allwinner,sun55i-t527";
16
17	aliases {
18		serial0 = &uart0;
19	};
20
21	chosen {
22		stdout-path = "serial0:115200n8";
23	};
24
25	ext_osc32k: ext-osc32k-clk {
26		#clock-cells = <0>;
27		compatible = "fixed-clock";
28		clock-frequency = <32768>;
29		clock-output-names = "ext_osc32k";
30	};
31
32	leds {
33		compatible = "gpio-leds";
34
35		/* PWM capable pin, but PWM isn't supported yet. */
36		led {
37			function = LED_FUNCTION_STATUS;
38			color = <LED_COLOR_ID_GREEN>;
39			gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */
40		};
41	};
42
43	iio-hwmon {
44		compatible = "iio-hwmon";
45		io-channels = <&axp717_adc 3>, /* vsys_v */
46			      <&axp717_adc 4>, /* pmic_temp */
47			      <&axp717_adc 7>; /* bkup_batt_v */
48	};
49
50	wifi_pwrseq: pwrseq {
51		compatible = "mmc-pwrseq-simple";
52		reset-gpios = <&r_pio 1 1 GPIO_ACTIVE_LOW>; /* PM1 */
53		clocks = <&rtc CLK_OSC32K_FANOUT>;
54		clock-names = "ext_clock";
55	};
56
57	reg_otg_vbus: regulator-otg-vbus {
58		compatible = "regulator-fixed";
59		regulator-name = "otg-vbus";
60		regulator-min-microvolt = <5000000>;
61		regulator-max-microvolt = <5000000>;
62		vin-supply = <&reg_vcc5v>;
63		gpio = <&r_pio 0 4 GPIO_ACTIVE_HIGH>;	/* PL4 */
64		enable-active-high;
65	};
66
67	reg_pcie_vcc3v3: regulator-pcie-vcc3v3 {
68		compatible = "regulator-fixed";
69		regulator-name = "vcc-pcie-3v3";
70		regulator-min-microvolt = <3300000>;
71		regulator-max-microvolt = <3300000>;
72		vin-supply = <&reg_vcc5v>;
73		gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>;	/* PL8 */
74		enable-active-high;
75	};
76
77	reg_usb_vbus: regulator-usb-vbus {
78		compatible = "regulator-fixed";
79		regulator-name = "usb-vbus";
80		regulator-min-microvolt = <5000000>;
81		regulator-max-microvolt = <5000000>;
82		vin-supply = <&reg_vcc5v>;
83		gpio = <&r_pio 0 12 GPIO_ACTIVE_HIGH>;	/* PL12 */
84		enable-active-high;
85	};
86
87	reg_vcc5v: regulator-vcc5v {
88		/* board wide 5V supply from USB type-C port */
89		compatible = "regulator-fixed";
90		regulator-name = "vcc-5v";
91		regulator-min-microvolt = <5000000>;
92		regulator-max-microvolt = <5000000>;
93		regulator-always-on;
94	};
95};
96
97&ehci0 {
98	status = "okay";
99};
100
101&ehci1 {
102	status = "okay";
103};
104
105&gpu {
106	mali-supply = <&reg_dcdc2>;
107	status = "okay";
108};
109
110&mmc0 {
111	vmmc-supply = <&reg_cldo3>;
112	cd-gpios = <&pio 5 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PF6 */
113	bus-width = <4>;
114	status = "okay";
115};
116
117&mmc1 {
118	bus-width = <4>;
119	mmc-pwrseq = <&wifi_pwrseq>;
120	non-removable;
121	vmmc-supply = <&reg_dldo1_323>;
122	vqmmc-supply = <&reg_bldo1>;
123	status = "okay";
124
125	brcmf: wifi@1 {
126		compatible = "brcm,bcm4329-fmac";
127		reg = <1>;
128		interrupt-parent = <&r_pio>;
129		interrupts = <1 0 IRQ_TYPE_LEVEL_LOW>; /* PM0 */
130		interrupt-names = "host-wake";
131	};
132};
133
134&mmc2 {
135	bus-width = <8>;
136	cap-mmc-hw-reset;
137	mmc-ddr-1_8v;
138	mmc-hs200-1_8v;
139	non-removable;
140	vmmc-supply = <&reg_cldo3>;
141	vqmmc-supply = <&reg_cldo1>;
142	status = "okay";
143};
144
145&ohci0 {
146	status = "okay";
147};
148
149&ohci1 {
150	status = "okay";
151};
152
153&pio {
154	vcc-pb-supply = <&reg_cldo3>;	/* via VCC-IO */
155	vcc-pc-supply = <&reg_cldo1>;
156	vcc-pd-supply = <&reg_cldo3>;
157	vcc-pe-supply = <&reg_aldo2>;
158	vcc-pf-supply = <&reg_cldo3>;	/* VCC-IO for 3.3v; VCC-MCSI for 1.8v */
159	vcc-pg-supply = <&reg_bldo1>;
160	vcc-ph-supply = <&reg_cldo3>;	/* via VCC-IO */
161	vcc-pi-supply = <&reg_cldo3>;
162	vcc-pj-supply = <&reg_cldo1>;
163	vcc-pk-supply = <&reg_cldo1>;
164};
165
166&r_i2c0 {
167	status = "okay";
168
169	axp717: pmic@35 {
170		compatible = "x-powers,axp717";
171		reg = <0x35>;
172		interrupt-controller;
173		#interrupt-cells = <1>;
174		interrupts-extended = <&nmi_intc 0 IRQ_TYPE_LEVEL_LOW>;
175
176		vin1-supply = <&reg_vcc5v>;
177		vin2-supply = <&reg_vcc5v>;
178		vin3-supply = <&reg_vcc5v>;
179		vin4-supply = <&reg_vcc5v>;
180		aldoin-supply = <&reg_vcc5v>;
181		bldoin-supply = <&reg_vcc5v>;
182		cldoin-supply = <&reg_vcc5v>;
183
184		axp717_adc: adc {
185			compatible = "x-powers,axp717-adc";
186			#io-channel-cells = <1>;
187		};
188
189		battery-power {
190			compatible = "x-powers,axp717-battery-power-supply";
191			/* no battery; output used for dcdc4 instead */
192			status = "disabled";
193		};
194
195		regulators {
196			/* Supplies the "little" cluster (1.4 GHz cores) */
197			reg_dcdc1: dcdc1 {
198				regulator-always-on;
199				regulator-min-microvolt = <900000>;
200				regulator-max-microvolt = <1160000>;
201				regulator-name = "vdd-cpul";
202			};
203
204			reg_dcdc2: dcdc2 {
205				regulator-always-on;
206				regulator-min-microvolt = <920000>;
207				regulator-max-microvolt = <920000>;
208				regulator-name = "vdd-gpu-sys";
209			};
210
211			reg_dcdc3: dcdc3 {
212				regulator-always-on;
213				regulator-min-microvolt = <1160000>;
214				regulator-max-microvolt = <1160000>;
215				regulator-name = "vcc-dram";
216			};
217
218			reg_dcdc4: dcdc4 {
219				/* feeds 3.3V pin on GPIO header */
220				regulator-always-on;
221				regulator-min-microvolt = <3300000>;
222				regulator-max-microvolt = <3300000>;
223				regulator-name = "vdd-io";
224			};
225
226			aldo1 {
227				/* not actually connected */
228				regulator-name = "avdd-csi";
229			};
230
231			reg_aldo2: aldo2 {
232				regulator-min-microvolt = <1800000>;
233				regulator-max-microvolt = <1800000>;
234				regulator-name = "vcc-pe";
235			};
236
237			reg_aldo3: aldo3 {
238				/* supplies the I2C pins for this PMIC */
239				regulator-always-on;
240				regulator-min-microvolt = <3300000>;
241				regulator-max-microvolt = <3300000>;
242				regulator-name = "vcc-pl-usb";
243			};
244
245			reg_aldo4: aldo4 {
246				regulator-always-on;
247				regulator-min-microvolt = <1800000>;
248				regulator-max-microvolt = <1800000>;
249				regulator-name = "vcc-pll-dxco-avcc";
250			};
251
252			reg_bldo1: bldo1 {
253				regulator-min-microvolt = <1800000>;
254				regulator-max-microvolt = <1800000>;
255				regulator-name = "vcc-pg-wifi";
256			};
257
258			reg_bldo2: bldo2 {
259				regulator-always-on;
260				regulator-min-microvolt = <1800000>;
261				regulator-max-microvolt = <1800000>;
262				regulator-name = "vcc-pm-lpddr";
263			};
264
265			bldo3 {
266				/* not actually connected */
267				regulator-name = "afvcc-csi";
268			};
269
270			bldo4 {
271				/* not actually connected */
272				regulator-name = "dvdd-csi";
273			};
274
275			reg_cldo1: cldo1 {
276				regulator-always-on;
277				regulator-min-microvolt = <1800000>;
278				regulator-max-microvolt = <1800000>;
279				regulator-name = "vcc-cvp-pc-lvds-mcsi-pk-efuse-pcie-edp-1v8";
280			};
281
282			reg_cldo2: cldo2 {
283				regulator-min-microvolt = <3300000>;
284				regulator-max-microvolt = <3300000>;
285				regulator-name = "vcc3v3-csi";
286			};
287
288			reg_cldo3: cldo3 {
289				regulator-always-on;
290				regulator-min-microvolt = <3300000>;
291				regulator-max-microvolt = <3300000>;
292				regulator-name = "vcc-io-mmc-nand-pd-pi-usb";
293			};
294
295			reg_cldo4: cldo4 {
296				regulator-min-microvolt = <3300000>;
297				regulator-max-microvolt = <3300000>;
298				regulator-name = "vcc-3v3-phy1-lcd";
299			};
300
301			reg_cpusldo: cpusldo {
302				/* supplies the management core */
303				regulator-always-on;
304				regulator-min-microvolt = <900000>;
305				regulator-max-microvolt = <900000>;
306				regulator-name = "vdd-cpus-usb-0v9";
307			};
308		};
309
310		usb-power {
311			compatible = "x-powers,axp717-usb-power-supply";
312			input-current-limit-microamp = <3000000>;
313		};
314	};
315
316	axp323: pmic@36 {
317		compatible = "x-powers,axp323";
318		reg = <0x36>;
319		#interrupt-cells = <1>;
320		interrupt-controller;
321		status = "okay";
322
323		vin1-supply = <&reg_vcc5v>;
324		vin2-supply = <&reg_vcc5v>;
325		vin3-supply = <&reg_vcc5v>;
326
327		regulators {
328			reg_aldo1_323: aldo1 {
329				/* less capable and shares load with dldo1 */
330				regulator-min-microvolt = <3300000>;
331				regulator-max-microvolt = <3300000>;
332				regulator-name = "vcc-wifi";
333			};
334
335			reg_dldo1_323: dldo1 {
336				/* more capable and shares load with aldo1 */
337				regulator-min-microvolt = <3300000>;
338				regulator-max-microvolt = <3300000>;
339				regulator-name = "vcc-wifi2";
340			};
341
342			/* Supplies the "big" cluster (1.8 GHz cores) */
343			reg_dcdc1_323: dcdc1 {
344				regulator-always-on;
345				regulator-min-microvolt = <900000>;
346				regulator-max-microvolt = <1150000>;
347				regulator-name = "vdd-cpub";
348			};
349
350			/* DCDC2 is polyphased with DCDC1 */
351
352			/* Some RISC-V management core related voltage */
353			reg_dcdc3_323: dcdc3 {
354				regulator-always-on;
355				regulator-min-microvolt = <900000>;
356				regulator-max-microvolt = <900000>;
357				regulator-name = "vdd-dnr";
358			};
359		};
360	};
361};
362
363&r_pio {
364/*
365 * Specifying the supply would create a circular dependency.
366 *
367 *	vcc-pl-supply = <&reg_aldo3>;
368 */
369	vcc-pm-supply = <&reg_bldo2>;
370};
371
372&rtc {
373	clocks = <&r_ccu CLK_BUS_R_RTC>, <&osc24M>,
374		 <&r_ccu CLK_R_AHB>, <&ext_osc32k>;
375	clock-names = "bus", "hosc", "ahb", "ext-osc32k";
376	assigned-clocks = <&rtc CLK_OSC32K>;
377	assigned-clock-rates = <32768>;
378};
379
380&uart0 {
381	pinctrl-names = "default";
382	pinctrl-0 = <&uart0_pb_pins>;
383	status = "okay";
384};
385
386&uart1 {
387	pinctrl-names = "default";
388	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
389	uart-has-rtscts;
390	status = "okay";
391
392	bluetooth {
393		compatible = "brcm,bcm4345c5";
394		clocks = <&rtc CLK_OSC32K_FANOUT>;
395		clock-names = "lpo";
396		vbat-supply = <&reg_aldo1_323>;
397		vddio-supply = <&reg_bldo1>;
398		device-wakeup-gpios = <&r_pio 1 3 GPIO_ACTIVE_HIGH>; /* PM3 */
399		host-wakeup-gpios = <&r_pio 1 4 GPIO_ACTIVE_HIGH>; /* PM4 */
400		shutdown-gpios = <&r_pio 1 2 GPIO_ACTIVE_HIGH>; /* PM2 */
401	};
402};
403
404&usb_otg {
405	/*
406	 * The OTG controller is connected to one of the type-A ports.
407	 * There is a regulator, controlled by a GPIO, to provide VBUS power
408	 * to the port, and a VBUSDET GPIO, to detect externally provided
409	 * power. But without ID or CC pins there is no real way to do a
410	 * runtime role detection.
411	 */
412	dr_mode = "host";
413	status = "okay";
414};
415
416&usbphy {
417	usb0_vbus-supply = <&reg_otg_vbus>;
418	usb0_vbus_det-gpios = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
419	usb1_vbus-supply = <&reg_usb_vbus>;
420	status = "okay";
421};
422