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