1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2
3/dts-v1/;
4
5#include <dt-bindings/gpio/gpio.h>
6#include <dt-bindings/leds/common.h>
7#include <dt-bindings/input/input.h>
8#include <dt-bindings/pinctrl/rockchip.h>
9#include "rk3588s.dtsi"
10
11/ {
12	model = "Xunlong Orange Pi 5";
13	compatible = "xunlong,orangepi-5", "rockchip,rk3588s";
14
15	aliases {
16		ethernet0 = &gmac1;
17		mmc0 = &sdmmc;
18	};
19
20	chosen {
21		stdout-path = "serial2:1500000n8";
22	};
23
24	adc-keys {
25		compatible = "adc-keys";
26		io-channels = <&saradc 1>;
27		io-channel-names = "buttons";
28		keyup-threshold-microvolt = <1800000>;
29		poll-interval = <100>;
30
31		button-recovery {
32			label = "Recovery";
33			linux,code = <KEY_VENDOR>;
34			press-threshold-microvolt = <1800>;
35		};
36	};
37
38	leds {
39		compatible = "gpio-leds";
40		pinctrl-names = "default";
41		pinctrl-0 = <&leds_gpio>;
42
43		led-1 {
44			gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_HIGH>;
45			label = "status_led";
46			linux,default-trigger = "heartbeat";
47		};
48	};
49
50	vbus_typec: vbus-typec-regulator {
51		compatible = "regulator-fixed";
52		enable-active-high;
53		gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_HIGH>;
54		pinctrl-names = "default";
55		pinctrl-0 = <&typec5v_pwren>;
56		regulator-name = "vbus_typec";
57		regulator-min-microvolt = <5000000>;
58		regulator-max-microvolt = <5000000>;
59		vin-supply = <&vcc5v0_sys>;
60	};
61
62	vcc5v0_sys: vcc5v0-sys-regulator {
63		compatible = "regulator-fixed";
64		regulator-name = "vcc5v0_sys";
65		regulator-always-on;
66		regulator-boot-on;
67		regulator-min-microvolt = <5000000>;
68		regulator-max-microvolt = <5000000>;
69	};
70
71	vcc_3v3_sd_s0: vcc-3v3-sd-s0-regulator {
72		compatible = "regulator-fixed";
73		enable-active-low;
74		gpios = <&gpio4 RK_PB5 GPIO_ACTIVE_LOW>;
75		regulator-name = "vcc_3v3_sd_s0";
76		regulator-boot-on;
77		regulator-min-microvolt = <3300000>;
78		regulator-max-microvolt = <3300000>;
79		vin-supply = <&vcc_3v3_s3>;
80	};
81
82	vcc3v3_pcie20: vcc3v3-pcie20-regulator {
83		compatible = "regulator-fixed";
84		enable-active-high;
85		gpios = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>;
86		regulator-name = "vcc3v3_pcie20";
87		regulator-boot-on;
88		regulator-min-microvolt = <1800000>;
89		regulator-max-microvolt = <1800000>;
90		startup-delay-us = <50000>;
91		vin-supply = <&vcc5v0_sys>;
92	};
93};
94
95&combphy0_ps {
96	status = "okay";
97};
98
99&combphy2_psu {
100	status = "okay";
101};
102
103&cpu_b0 {
104	cpu-supply = <&vdd_cpu_big0_s0>;
105};
106
107&cpu_b1 {
108	cpu-supply = <&vdd_cpu_big0_s0>;
109};
110
111&cpu_b2 {
112	cpu-supply = <&vdd_cpu_big1_s0>;
113};
114
115&cpu_b3 {
116	cpu-supply = <&vdd_cpu_big1_s0>;
117};
118
119&cpu_l0 {
120	cpu-supply = <&vdd_cpu_lit_s0>;
121};
122
123&cpu_l1 {
124	cpu-supply = <&vdd_cpu_lit_s0>;
125};
126
127&cpu_l2 {
128	cpu-supply = <&vdd_cpu_lit_s0>;
129};
130
131&cpu_l3 {
132	cpu-supply = <&vdd_cpu_lit_s0>;
133};
134
135&gmac1 {
136	clock_in_out = "output";
137	phy-handle = <&rgmii_phy1>;
138	phy-mode = "rgmii-rxid";
139	pinctrl-0 = <&gmac1_miim
140		     &gmac1_tx_bus2
141		     &gmac1_rx_bus2
142		     &gmac1_rgmii_clk
143		     &gmac1_rgmii_bus>;
144	pinctrl-names = "default";
145	tx_delay = <0x42>;
146	status = "okay";
147};
148
149&i2c0 {
150	pinctrl-names = "default";
151	pinctrl-0 = <&i2c0m2_xfer>;
152	status = "okay";
153
154	vdd_cpu_big0_s0: regulator@42 {
155		compatible = "rockchip,rk8602";
156		reg = <0x42>;
157		fcs,suspend-voltage-selector = <1>;
158		regulator-name = "vdd_cpu_big0_s0";
159		regulator-always-on;
160		regulator-boot-on;
161		regulator-min-microvolt = <550000>;
162		regulator-max-microvolt = <1050000>;
163		regulator-ramp-delay = <2300>;
164		vin-supply = <&vcc5v0_sys>;
165
166		regulator-state-mem {
167			regulator-off-in-suspend;
168		};
169	};
170
171	vdd_cpu_big1_s0: regulator@43 {
172		compatible = "rockchip,rk8603", "rockchip,rk8602";
173		reg = <0x43>;
174		fcs,suspend-voltage-selector = <1>;
175		regulator-name = "vdd_cpu_big1_s0";
176		regulator-always-on;
177		regulator-boot-on;
178		regulator-min-microvolt = <550000>;
179		regulator-max-microvolt = <1050000>;
180		regulator-ramp-delay = <2300>;
181		vin-supply = <&vcc5v0_sys>;
182
183		regulator-state-mem {
184			regulator-off-in-suspend;
185		};
186	};
187};
188
189&i2c2 {
190	status = "okay";
191
192	vdd_npu_s0: regulator@42 {
193		compatible = "rockchip,rk8602";
194		reg = <0x42>;
195		fcs,suspend-voltage-selector = <1>;
196		regulator-name = "vdd_npu_s0";
197		regulator-always-on;
198		regulator-boot-on;
199		regulator-min-microvolt = <550000>;
200		regulator-max-microvolt = <950000>;
201		regulator-ramp-delay = <2300>;
202		vin-supply = <&vcc5v0_sys>;
203
204		regulator-state-mem {
205			regulator-off-in-suspend;
206		};
207	};
208};
209
210&i2c6 {
211	pinctrl-names = "default";
212	pinctrl-0 = <&i2c6m3_xfer>;
213	status = "okay";
214
215	hym8563: rtc@51 {
216		compatible = "haoyu,hym8563";
217		reg = <0x51>;
218		#clock-cells = <0>;
219		clock-output-names = "hym8563";
220		pinctrl-names = "default";
221		pinctrl-0 = <&hym8563_int>;
222		interrupt-parent = <&gpio0>;
223		interrupts = <RK_PB0 IRQ_TYPE_LEVEL_LOW>;
224		wakeup-source;
225	};
226};
227
228&mdio1 {
229	rgmii_phy1: ethernet-phy@1 {
230		compatible = "ethernet-phy-ieee802.3-c22";
231		reg = <0x1>;
232		reset-assert-us = <20000>;
233		reset-deassert-us = <100000>;
234		reset-gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>;
235	};
236};
237
238&pcie2x1l2 {
239	reset-gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_HIGH>;
240	vpcie3v3-supply = <&vcc3v3_pcie20>;
241	status = "okay";
242};
243
244&pinctrl {
245	gpio-func {
246		leds_gpio: leds-gpio {
247			rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
248		};
249	};
250
251	hym8563 {
252		hym8563_int: hym8563-int {
253			rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
254		};
255	};
256
257	usb-typec {
258		usbc0_int: usbc0-int {
259			rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>;
260		};
261
262		typec5v_pwren: typec5v-pwren {
263			rockchip,pins = <3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>;
264		};
265	};
266};
267
268&saradc {
269	vref-supply = <&avcc_1v8_s0>;
270	status = "okay";
271};
272
273&sdmmc {
274	bus-width = <4>;
275	cap-sd-highspeed;
276	disable-wp;
277	max-frequency = <150000000>;
278	no-mmc;
279	no-sdio;
280	sd-uhs-sdr104;
281	vmmc-supply = <&vcc_3v3_sd_s0>;
282	vqmmc-supply = <&vccio_sd_s0>;
283	status = "okay";
284};
285
286&sfc {
287	pinctrl-names = "default";
288	pinctrl-0 = <&fspim0_pins>;
289	status = "okay";
290
291	flash@0 {
292		compatible = "jedec,spi-nor";
293		reg = <0x0>;
294		spi-max-frequency = <100000000>;
295		spi-rx-bus-width = <4>;
296		spi-tx-bus-width = <1>;
297	};
298};
299
300&spi2 {
301	status = "okay";
302	assigned-clocks = <&cru CLK_SPI2>;
303	assigned-clock-rates = <200000000>;
304	num-cs = <1>;
305	pinctrl-names = "default";
306	pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>;
307
308	pmic@0 {
309		compatible = "rockchip,rk806";
310		reg = <0x0>;
311		interrupt-parent = <&gpio0>;
312		interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
313		pinctrl-names = "default";
314		pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>,
315				<&rk806_dvs2_null>, <&rk806_dvs3_null>;
316		spi-max-frequency = <1000000>;
317		system-power-controller;
318
319		vcc1-supply = <&vcc5v0_sys>;
320		vcc2-supply = <&vcc5v0_sys>;
321		vcc3-supply = <&vcc5v0_sys>;
322		vcc4-supply = <&vcc5v0_sys>;
323		vcc5-supply = <&vcc5v0_sys>;
324		vcc6-supply = <&vcc5v0_sys>;
325		vcc7-supply = <&vcc5v0_sys>;
326		vcc8-supply = <&vcc5v0_sys>;
327		vcc9-supply = <&vcc5v0_sys>;
328		vcc10-supply = <&vcc5v0_sys>;
329		vcc11-supply = <&vcc_2v0_pldo_s3>;
330		vcc12-supply = <&vcc5v0_sys>;
331		vcc13-supply = <&vcc_1v1_nldo_s3>;
332		vcc14-supply = <&vcc_1v1_nldo_s3>;
333		vcca-supply = <&vcc5v0_sys>;
334
335		gpio-controller;
336		#gpio-cells = <2>;
337
338		rk806_dvs1_null: dvs1-null-pins {
339			pins = "gpio_pwrctrl2";
340			function = "pin_fun0";
341		};
342
343		rk806_dvs2_null: dvs2-null-pins {
344			pins = "gpio_pwrctrl2";
345			function = "pin_fun0";
346		};
347
348		rk806_dvs3_null: dvs3-null-pins {
349			pins = "gpio_pwrctrl3";
350			function = "pin_fun0";
351		};
352
353		regulators {
354			vdd_gpu_s0: dcdc-reg1 {
355				regulator-name = "vdd_gpu_s0";
356				regulator-boot-on;
357				regulator-min-microvolt = <550000>;
358				regulator-max-microvolt = <950000>;
359				regulator-ramp-delay = <12500>;
360				regulator-enable-ramp-delay = <400>;
361
362				regulator-state-mem {
363					regulator-off-in-suspend;
364				};
365			};
366
367			vdd_cpu_lit_s0: dcdc-reg2 {
368				regulator-name = "vdd_cpu_lit_s0";
369				regulator-always-on;
370				regulator-boot-on;
371				regulator-min-microvolt = <550000>;
372				regulator-max-microvolt = <950000>;
373				regulator-ramp-delay = <12500>;
374
375				regulator-state-mem {
376					regulator-off-in-suspend;
377				};
378			};
379
380			vdd_log_s0: dcdc-reg3 {
381				regulator-name = "vdd_log_s0";
382				regulator-always-on;
383				regulator-boot-on;
384				regulator-min-microvolt = <675000>;
385				regulator-max-microvolt = <750000>;
386				regulator-ramp-delay = <12500>;
387
388				regulator-state-mem {
389					regulator-off-in-suspend;
390					regulator-suspend-microvolt = <750000>;
391				};
392			};
393
394			vdd_vdenc_s0: dcdc-reg4 {
395				regulator-name = "vdd_vdenc_s0";
396				regulator-always-on;
397				regulator-boot-on;
398				regulator-min-microvolt = <550000>;
399				regulator-max-microvolt = <950000>;
400				regulator-ramp-delay = <12500>;
401
402				regulator-state-mem {
403					regulator-off-in-suspend;
404				};
405			};
406
407			vdd_ddr_s0: dcdc-reg5 {
408				regulator-name = "vdd_ddr_s0";
409				regulator-always-on;
410				regulator-boot-on;
411				regulator-min-microvolt = <675000>;
412				regulator-max-microvolt = <900000>;
413				regulator-ramp-delay = <12500>;
414
415				regulator-state-mem {
416					regulator-off-in-suspend;
417					regulator-suspend-microvolt = <850000>;
418				};
419			};
420
421			vcc_1v1_nldo_s3: vdd2_ddr_s3: dcdc-reg6 {
422				regulator-name = "vdd2_ddr_s3";
423				regulator-always-on;
424				regulator-boot-on;
425				regulator-max-microvolt = <1100000>;
426				regulator-min-microvolt = <1100000>;
427
428				regulator-state-mem {
429					regulator-on-in-suspend;
430				};
431			};
432
433			vcc_2v0_pldo_s3: dcdc-reg7 {
434				regulator-name = "vdd_2v0_pldo_s3";
435				regulator-always-on;
436				regulator-boot-on;
437				regulator-min-microvolt = <2000000>;
438				regulator-max-microvolt = <2000000>;
439				regulator-ramp-delay = <12500>;
440
441				regulator-state-mem {
442					regulator-on-in-suspend;
443					regulator-suspend-microvolt = <2000000>;
444				};
445			};
446
447			vcc_3v3_s3: dcdc-reg8 {
448				regulator-name = "vcc_3v3_s3";
449				regulator-always-on;
450				regulator-boot-on;
451				regulator-min-microvolt = <3300000>;
452				regulator-max-microvolt = <3300000>;
453
454				regulator-state-mem {
455					regulator-on-in-suspend;
456					regulator-suspend-microvolt = <3300000>;
457				};
458			};
459
460			vddq_ddr_s0: dcdc-reg9 {
461				regulator-name = "vddq_ddr_s0";
462				regulator-always-on;
463				regulator-boot-on;
464
465				regulator-state-mem {
466					regulator-off-in-suspend;
467				};
468			};
469
470			vcc_1v8_s3: dcdc-reg10 {
471				regulator-name = "vcc_1v8_s3";
472				regulator-always-on;
473				regulator-boot-on;
474				regulator-min-microvolt = <1800000>;
475				regulator-max-microvolt = <1800000>;
476
477				regulator-state-mem {
478					regulator-on-in-suspend;
479					regulator-suspend-microvolt = <1800000>;
480				};
481			};
482
483			avcc_1v8_s0: pldo-reg1 {
484				regulator-name = "avcc_1v8_s0";
485				regulator-always-on;
486				regulator-boot-on;
487				regulator-min-microvolt = <1800000>;
488				regulator-max-microvolt = <1800000>;
489
490				regulator-state-mem {
491					regulator-off-in-suspend;
492				};
493			};
494
495			vcc_1v8_s0: pldo-reg2 {
496				regulator-name = "vcc_1v8_s0";
497				regulator-always-on;
498				regulator-boot-on;
499				regulator-min-microvolt = <1800000>;
500				regulator-max-microvolt = <1800000>;
501
502				regulator-state-mem {
503					regulator-off-in-suspend;
504					regulator-suspend-microvolt = <1800000>;
505				};
506			};
507
508			avdd_1v2_s0: pldo-reg3 {
509				regulator-name = "avdd_1v2_s0";
510				regulator-always-on;
511				regulator-boot-on;
512				regulator-min-microvolt = <1200000>;
513				regulator-max-microvolt = <1200000>;
514
515				regulator-state-mem {
516					regulator-off-in-suspend;
517				};
518			};
519
520			vcc_3v3_s0: pldo-reg4 {
521				regulator-name = "vcc_3v3_s0";
522				regulator-always-on;
523				regulator-boot-on;
524				regulator-min-microvolt = <3300000>;
525				regulator-max-microvolt = <3300000>;
526				regulator-ramp-delay = <12500>;
527
528				regulator-state-mem {
529					regulator-off-in-suspend;
530				};
531			};
532
533			vccio_sd_s0: pldo-reg5 {
534				regulator-name = "vccio_sd_s0";
535				regulator-always-on;
536				regulator-boot-on;
537				regulator-min-microvolt = <1800000>;
538				regulator-max-microvolt = <3300000>;
539				regulator-ramp-delay = <12500>;
540
541				regulator-state-mem {
542					regulator-off-in-suspend;
543				};
544			};
545
546			pldo6_s3: pldo-reg6 {
547				regulator-name = "pldo6_s3";
548				regulator-always-on;
549				regulator-boot-on;
550				regulator-min-microvolt = <1800000>;
551				regulator-max-microvolt = <1800000>;
552
553				regulator-state-mem {
554					regulator-on-in-suspend;
555					regulator-suspend-microvolt = <1800000>;
556				};
557			};
558
559			vdd_0v75_s3: nldo-reg1 {
560				regulator-name = "vdd_0v75_s3";
561				regulator-always-on;
562				regulator-boot-on;
563				regulator-min-microvolt = <750000>;
564				regulator-max-microvolt = <750000>;
565
566				regulator-state-mem {
567					regulator-on-in-suspend;
568					regulator-suspend-microvolt = <750000>;
569				};
570			};
571
572			vdd_ddr_pll_s0: nldo-reg2 {
573				regulator-name = "vdd_ddr_pll_s0";
574				regulator-always-on;
575				regulator-boot-on;
576				regulator-min-microvolt = <850000>;
577				regulator-max-microvolt = <850000>;
578
579				regulator-state-mem {
580					regulator-off-in-suspend;
581					regulator-suspend-microvolt = <850000>;
582				};
583			};
584
585			avdd_0v75_s0: nldo-reg3 {
586				regulator-name = "avdd_0v75_s0";
587				regulator-always-on;
588				regulator-boot-on;
589				regulator-min-microvolt = <750000>;
590				regulator-max-microvolt = <750000>;
591
592				regulator-state-mem {
593					regulator-off-in-suspend;
594				};
595			};
596
597			vdd_0v85_s0: nldo-reg4 {
598				regulator-name = "vdd_0v85_s0";
599				regulator-always-on;
600				regulator-boot-on;
601				regulator-min-microvolt = <850000>;
602				regulator-max-microvolt = <850000>;
603
604				regulator-state-mem {
605					regulator-off-in-suspend;
606				};
607			};
608
609			vdd_0v75_s0: nldo-reg5 {
610				regulator-name = "vdd_0v75_s0";
611				regulator-always-on;
612				regulator-boot-on;
613				regulator-min-microvolt = <750000>;
614				regulator-max-microvolt = <750000>;
615
616				regulator-state-mem {
617					regulator-off-in-suspend;
618				};
619			};
620		};
621	};
622};
623
624&tsadc {
625	status = "okay";
626};
627
628&u2phy2 {
629	status = "okay";
630};
631
632&u2phy2_host {
633	status = "okay";
634};
635
636&u2phy3 {
637	status = "okay";
638};
639
640&u2phy3_host {
641	status = "okay";
642};
643
644&uart2 {
645	pinctrl-0 = <&uart2m0_xfer>;
646	status = "okay";
647};
648
649&usb_host0_ehci {
650	status = "okay";
651};
652
653&usb_host0_ohci {
654	status = "okay";
655};
656
657&usb_host1_ehci {
658	status = "okay";
659};
660
661&usb_host1_ohci {
662	status = "okay";
663};
664
665&usb_host2_xhci {
666	status = "okay";
667};
668