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/pinctrl/rockchip.h>
8#include "rk3588s.dtsi"
9
10/ {
11	model = "Radxa ROCK 5 Model A";
12	compatible = "radxa,rock-5a", "rockchip,rk3588s";
13
14	aliases {
15		mmc0 = &sdhci;
16		mmc1 = &sdmmc;
17		serial2 = &uart2;
18	};
19
20	analog-sound {
21		compatible = "audio-graph-card";
22		label = "rk3588-es8316";
23
24		widgets = "Microphone", "Mic Jack",
25			  "Headphone", "Headphones";
26
27		routing = "MIC2", "Mic Jack",
28			  "Headphones", "HPOL",
29			  "Headphones", "HPOR";
30
31		dais = <&i2s0_8ch_p0>;
32	};
33
34	chosen {
35		stdout-path = "serial2:1500000n8";
36	};
37
38	leds {
39		compatible = "gpio-leds";
40		pinctrl-names = "default";
41		pinctrl-0 = <&io_led>;
42
43		io-led {
44			color = <LED_COLOR_ID_BLUE>;
45			function = LED_FUNCTION_STATUS;
46			gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
47			linux,default-trigger = "heartbeat";
48		};
49	};
50
51	fan: pwm-fan {
52		compatible = "pwm-fan";
53		cooling-levels = <0 95 145 195 255>;
54		fan-supply = <&vcc_5v0>;
55		pwms = <&pwm3 0 50000 0>;
56		#cooling-cells = <2>;
57	};
58
59	vcc12v_dcin: vcc12v-dcin-regulator {
60		compatible = "regulator-fixed";
61		regulator-name = "vcc12v_dcin";
62		regulator-always-on;
63		regulator-boot-on;
64		regulator-min-microvolt = <12000000>;
65		regulator-max-microvolt = <12000000>;
66	};
67
68	vcc5v0_host: vcc5v0-host-regulator {
69		compatible = "regulator-fixed";
70		regulator-name = "vcc5v0_host";
71		regulator-boot-on;
72		regulator-always-on;
73		regulator-min-microvolt = <5000000>;
74		regulator-max-microvolt = <5000000>;
75		enable-active-high;
76		gpio = <&gpio4 RK_PB5 GPIO_ACTIVE_HIGH>;
77		pinctrl-names = "default";
78		pinctrl-0 = <&vcc5v0_host_en>;
79		vin-supply = <&vcc5v0_sys>;
80	};
81
82	vcc5v0_sys: vcc5v0-sys-regulator {
83		compatible = "regulator-fixed";
84		regulator-name = "vcc5v0_sys";
85		regulator-always-on;
86		regulator-boot-on;
87		regulator-min-microvolt = <5000000>;
88		regulator-max-microvolt = <5000000>;
89		vin-supply = <&vcc12v_dcin>;
90	};
91
92	vcc_5v0: vcc-5v0-regulator {
93		compatible = "regulator-fixed";
94		regulator-name = "vcc_5v0";
95		regulator-min-microvolt = <5000000>;
96		regulator-max-microvolt = <5000000>;
97		regulator-boot-on;
98		regulator-always-on;
99		enable-active-high;
100		gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_HIGH>;
101		pinctrl-names = "default";
102		pinctrl-0 = <&vcc_5v0_en>;
103		vin-supply = <&vcc5v0_sys>;
104	};
105
106	vcc_1v1_nldo_s3: vcc-1v1-nldo-s3-regulator {
107		compatible = "regulator-fixed";
108		regulator-name = "vcc_1v1_nldo_s3";
109		regulator-always-on;
110		regulator-boot-on;
111		regulator-min-microvolt = <1100000>;
112		regulator-max-microvolt = <1100000>;
113		vin-supply = <&vcc5v0_sys>;
114	};
115};
116
117&cpu_b0 {
118	cpu-supply = <&vdd_cpu_big0_s0>;
119};
120
121&cpu_b1 {
122	cpu-supply = <&vdd_cpu_big0_s0>;
123};
124
125&cpu_b2 {
126	cpu-supply = <&vdd_cpu_big1_s0>;
127};
128
129&cpu_b3 {
130	cpu-supply = <&vdd_cpu_big1_s0>;
131};
132
133&cpu_l0 {
134	cpu-supply = <&vdd_cpu_lit_s0>;
135};
136
137&cpu_l1 {
138	cpu-supply = <&vdd_cpu_lit_s0>;
139};
140
141&cpu_l2 {
142	cpu-supply = <&vdd_cpu_lit_s0>;
143};
144
145&cpu_l3 {
146	cpu-supply = <&vdd_cpu_lit_s0>;
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	eeprom: eeprom@50 {
210		compatible = "belling,bl24c16a", "atmel,24c16";
211		reg = <0x50>;
212		pagesize = <16>;
213	};
214};
215
216&i2c3 {
217	status = "okay";
218};
219
220&i2c5 {
221	status = "okay";
222	pinctrl-names = "default";
223	pinctrl-0 = <&i2c5m2_xfer>;
224};
225
226&i2c7 {
227	status = "okay";
228
229	es8316: audio-codec@11 {
230		compatible = "everest,es8316";
231		reg = <0x11>;
232		clocks = <&cru I2S0_8CH_MCLKOUT>;
233		clock-names = "mclk";
234		assigned-clocks = <&cru I2S0_8CH_MCLKOUT>;
235		assigned-clock-rates = <12288000>;
236		#sound-dai-cells = <0>;
237
238		port {
239			es8316_p0_0: endpoint {
240				remote-endpoint = <&i2s0_8ch_p0_0>;
241			};
242		};
243	};
244};
245
246&i2s0_8ch {
247	pinctrl-names = "default";
248	pinctrl-0 = <&i2s0_lrck
249		     &i2s0_mclk
250		     &i2s0_sclk
251		     &i2s0_sdi0
252		     &i2s0_sdo0>;
253	status = "okay";
254
255	i2s0_8ch_p0: port {
256		i2s0_8ch_p0_0: endpoint {
257			dai-format = "i2s";
258			mclk-fs = <256>;
259			remote-endpoint = <&es8316_p0_0>;
260		};
261	};
262};
263
264&gmac1 {
265	clock_in_out = "output";
266	phy-handle = <&rgmii_phy1>;
267	phy-mode = "rgmii";
268	pinctrl-0 = <&gmac1_miim
269		     &gmac1_tx_bus2
270		     &gmac1_rx_bus2
271		     &gmac1_rgmii_clk
272		     &gmac1_rgmii_bus>;
273	pinctrl-names = "default";
274	tx_delay = <0x3a>;
275	rx_delay = <0x3e>;
276	status = "okay";
277};
278
279&mdio1 {
280	rgmii_phy1: 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 = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
289	};
290};
291
292&pinctrl {
293	leds {
294		io_led: io-led {
295			rockchip,pins = <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
296		};
297	};
298
299	power {
300		vcc_5v0_en: vcc-5v0-en {
301			rockchip,pins = <4 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
302		};
303	};
304
305	rtl8211f {
306		rtl8211f_rst: rtl8211f-rst {
307			rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
308		};
309	};
310
311	usb {
312		vcc5v0_host_en: vcc5v0-host-en {
313			rockchip,pins = <4 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
314		};
315	};
316
317	wifibt {
318		wl_reset: wl-reset {
319			rockchip,pins = <0 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>;
320		};
321
322		wl_dis: wl-dis {
323			rockchip,pins = <0 RK_PD5 RK_FUNC_GPIO &pcfg_output_high>;
324		};
325
326		wl_wake_host: wl-wake-host {
327			rockchip,pins = <0 RK_PC7 RK_FUNC_GPIO &pcfg_pull_up>;
328		};
329
330		bt_dis: bt-dis {
331			rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_output_high>;
332		};
333
334		bt_wake_host: bt-wake-host {
335			rockchip,pins = <0 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
336		};
337	};
338};
339
340&pwm3 {
341	pinctrl-names = "default";
342	pinctrl-0 = <&pwm3m1_pins>;
343	status = "okay";
344};
345
346&saradc {
347	vref-supply = <&avcc_1v8_s0>;
348	status = "okay";
349};
350
351&sdhci {
352	bus-width = <8>;
353	no-sdio;
354	no-sd;
355	non-removable;
356	mmc-hs400-1_8v;
357	mmc-hs400-enhanced-strobe;
358	status = "okay";
359};
360
361&sdmmc {
362	bus-width = <4>;
363	cap-mmc-highspeed;
364	cap-sd-highspeed;
365	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
366	disable-wp;
367	max-frequency = <150000000>;
368	no-sdio;
369	no-mmc;
370	sd-uhs-sdr104;
371	vmmc-supply = <&vcc_3v3_s0>;
372	vqmmc-supply = <&vccio_sd_s0>;
373	status = "okay";
374};
375
376&spi2 {
377	status = "okay";
378	assigned-clocks = <&cru CLK_SPI2>;
379	assigned-clock-rates = <200000000>;
380	num-cs = <1>;
381	pinctrl-names = "default";
382	pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>;
383
384	pmic@0 {
385		compatible = "rockchip,rk806";
386		reg = <0x0>;
387		interrupt-parent = <&gpio0>;
388		interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
389		pinctrl-names = "default";
390		pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>,
391			    <&rk806_dvs2_null>, <&rk806_dvs3_null>;
392		spi-max-frequency = <1000000>;
393		system-power-controller;
394
395		vcc1-supply = <&vcc5v0_sys>;
396		vcc2-supply = <&vcc5v0_sys>;
397		vcc3-supply = <&vcc5v0_sys>;
398		vcc4-supply = <&vcc5v0_sys>;
399		vcc5-supply = <&vcc5v0_sys>;
400		vcc6-supply = <&vcc5v0_sys>;
401		vcc7-supply = <&vcc5v0_sys>;
402		vcc8-supply = <&vcc5v0_sys>;
403		vcc9-supply = <&vcc5v0_sys>;
404		vcc10-supply = <&vcc5v0_sys>;
405		vcc11-supply = <&vcc_2v0_pldo_s3>;
406		vcc12-supply = <&vcc5v0_sys>;
407		vcc13-supply = <&vcc_1v1_nldo_s3>;
408		vcc14-supply = <&vcc_1v1_nldo_s3>;
409		vcca-supply = <&vcc5v0_sys>;
410
411		gpio-controller;
412		#gpio-cells = <2>;
413
414		rk806_dvs1_null: dvs1-null-pins {
415			pins = "gpio_pwrctrl2";
416			function = "pin_fun0";
417		};
418
419		rk806_dvs2_null: dvs2-null-pins {
420			pins = "gpio_pwrctrl2";
421			function = "pin_fun0";
422		};
423
424		rk806_dvs3_null: dvs3-null-pins {
425			pins = "gpio_pwrctrl3";
426			function = "pin_fun0";
427		};
428
429		regulators {
430			vdd_gpu_s0: vdd_gpu_mem_s0: dcdc-reg1 {
431				regulator-name = "vdd_gpu_s0";
432				regulator-boot-on;
433				regulator-min-microvolt = <550000>;
434				regulator-max-microvolt = <950000>;
435				regulator-ramp-delay = <12500>;
436				regulator-enable-ramp-delay = <400>;
437
438				regulator-state-mem {
439					regulator-off-in-suspend;
440				};
441			};
442
443			vdd_cpu_lit_s0: vdd_cpu_lit_mem_s0: dcdc-reg2 {
444				regulator-name = "vdd_cpu_lit_s0";
445				regulator-always-on;
446				regulator-boot-on;
447				regulator-min-microvolt = <550000>;
448				regulator-max-microvolt = <950000>;
449				regulator-ramp-delay = <12500>;
450
451				regulator-state-mem {
452					regulator-off-in-suspend;
453				};
454			};
455
456			vdd_log_s0: dcdc-reg3 {
457				regulator-name = "vdd_log_s0";
458				regulator-always-on;
459				regulator-boot-on;
460				regulator-min-microvolt = <675000>;
461				regulator-max-microvolt = <750000>;
462				regulator-ramp-delay = <12500>;
463
464				regulator-state-mem {
465					regulator-off-in-suspend;
466					regulator-suspend-microvolt = <750000>;
467				};
468			};
469
470			vdd_vdenc_s0: vdd_vdenc_mem_s0: dcdc-reg4 {
471				regulator-name = "vdd_vdenc_s0";
472				regulator-always-on;
473				regulator-boot-on;
474				regulator-min-microvolt = <550000>;
475				regulator-max-microvolt = <950000>;
476				regulator-ramp-delay = <12500>;
477
478				regulator-state-mem {
479					regulator-off-in-suspend;
480				};
481			};
482
483			vdd_ddr_s0: dcdc-reg5 {
484				regulator-name = "vdd_ddr_s0";
485				regulator-always-on;
486				regulator-boot-on;
487				regulator-min-microvolt = <675000>;
488				regulator-max-microvolt = <900000>;
489				regulator-ramp-delay = <12500>;
490
491				regulator-state-mem {
492					regulator-off-in-suspend;
493					regulator-suspend-microvolt = <850000>;
494				};
495			};
496
497			vdd2_ddr_s3: dcdc-reg6 {
498				regulator-name = "vdd2_ddr_s3";
499				regulator-always-on;
500				regulator-boot-on;
501
502				regulator-state-mem {
503					regulator-on-in-suspend;
504				};
505			};
506
507			vcc_2v0_pldo_s3: dcdc-reg7 {
508				regulator-name = "vdd_2v0_pldo_s3";
509				regulator-always-on;
510				regulator-boot-on;
511				regulator-min-microvolt = <2000000>;
512				regulator-max-microvolt = <2000000>;
513				regulator-ramp-delay = <12500>;
514
515				regulator-state-mem {
516					regulator-on-in-suspend;
517					regulator-suspend-microvolt = <2000000>;
518				};
519			};
520
521			vcc_3v3_s3: dcdc-reg8 {
522				regulator-name = "vcc_3v3_s3";
523				regulator-always-on;
524				regulator-boot-on;
525				regulator-min-microvolt = <3300000>;
526				regulator-max-microvolt = <3300000>;
527
528				regulator-state-mem {
529					regulator-on-in-suspend;
530					regulator-suspend-microvolt = <3300000>;
531				};
532			};
533
534			vddq_ddr_s0: dcdc-reg9 {
535				regulator-name = "vddq_ddr_s0";
536				regulator-always-on;
537				regulator-boot-on;
538
539				regulator-state-mem {
540					regulator-off-in-suspend;
541				};
542			};
543
544			vcc_1v8_s3: dcdc-reg10 {
545				regulator-name = "vcc_1v8_s3";
546				regulator-always-on;
547				regulator-boot-on;
548				regulator-min-microvolt = <1800000>;
549				regulator-max-microvolt = <1800000>;
550
551				regulator-state-mem {
552					regulator-on-in-suspend;
553					regulator-suspend-microvolt = <1800000>;
554				};
555			};
556
557			avcc_1v8_s0: pldo-reg1 {
558				regulator-name = "avcc_1v8_s0";
559				regulator-always-on;
560				regulator-boot-on;
561				regulator-min-microvolt = <1800000>;
562				regulator-max-microvolt = <1800000>;
563
564				regulator-state-mem {
565					regulator-off-in-suspend;
566				};
567			};
568
569			vcc_1v8_s0: pldo-reg2 {
570				regulator-name = "vcc_1v8_s0";
571				regulator-always-on;
572				regulator-boot-on;
573				regulator-min-microvolt = <1800000>;
574				regulator-max-microvolt = <1800000>;
575
576				regulator-state-mem {
577					regulator-off-in-suspend;
578					regulator-suspend-microvolt = <1800000>;
579				};
580			};
581
582			avdd_1v2_s0: pldo-reg3 {
583				regulator-name = "avdd_1v2_s0";
584				regulator-always-on;
585				regulator-boot-on;
586				regulator-min-microvolt = <1200000>;
587				regulator-max-microvolt = <1200000>;
588
589				regulator-state-mem {
590					regulator-off-in-suspend;
591				};
592			};
593
594			vcc_3v3_s0: pldo-reg4 {
595				regulator-name = "vcc_3v3_s0";
596				regulator-always-on;
597				regulator-boot-on;
598				regulator-min-microvolt = <3300000>;
599				regulator-max-microvolt = <3300000>;
600				regulator-ramp-delay = <12500>;
601
602				regulator-state-mem {
603					regulator-off-in-suspend;
604				};
605			};
606
607			vccio_sd_s0: pldo-reg5 {
608				regulator-name = "vccio_sd_s0";
609				regulator-always-on;
610				regulator-boot-on;
611				regulator-min-microvolt = <1800000>;
612				regulator-max-microvolt = <3300000>;
613				regulator-ramp-delay = <12500>;
614
615				regulator-state-mem {
616					regulator-off-in-suspend;
617				};
618			};
619
620			pldo6_s3: pldo-reg6 {
621				regulator-name = "pldo6_s3";
622				regulator-always-on;
623				regulator-boot-on;
624				regulator-min-microvolt = <1800000>;
625				regulator-max-microvolt = <1800000>;
626
627				regulator-state-mem {
628					regulator-on-in-suspend;
629					regulator-suspend-microvolt = <1800000>;
630				};
631			};
632
633			vdd_0v75_s3: nldo-reg1 {
634				regulator-name = "vdd_0v75_s3";
635				regulator-always-on;
636				regulator-boot-on;
637				regulator-min-microvolt = <750000>;
638				regulator-max-microvolt = <750000>;
639
640				regulator-state-mem {
641					regulator-on-in-suspend;
642					regulator-suspend-microvolt = <750000>;
643				};
644			};
645
646			vdd_ddr_pll_s0: nldo-reg2 {
647				regulator-name = "vdd_ddr_pll_s0";
648				regulator-always-on;
649				regulator-boot-on;
650				regulator-min-microvolt = <850000>;
651				regulator-max-microvolt = <850000>;
652
653				regulator-state-mem {
654					regulator-off-in-suspend;
655					regulator-suspend-microvolt = <850000>;
656				};
657			};
658
659			avdd_0v75_s0: nldo-reg3 {
660				regulator-name = "avdd_0v75_s0";
661				regulator-always-on;
662				regulator-boot-on;
663				regulator-min-microvolt = <750000>;
664				regulator-max-microvolt = <750000>;
665
666				regulator-state-mem {
667					regulator-off-in-suspend;
668				};
669			};
670
671			vdd_0v85_s0: nldo-reg4 {
672				regulator-name = "vdd_0v85_s0";
673				regulator-always-on;
674				regulator-boot-on;
675				regulator-min-microvolt = <850000>;
676				regulator-max-microvolt = <850000>;
677
678				regulator-state-mem {
679					regulator-off-in-suspend;
680				};
681			};
682
683			vdd_0v75_s0: nldo-reg5 {
684				regulator-name = "vdd_0v75_s0";
685				regulator-always-on;
686				regulator-boot-on;
687				regulator-min-microvolt = <750000>;
688				regulator-max-microvolt = <750000>;
689
690				regulator-state-mem {
691					regulator-off-in-suspend;
692				};
693			};
694		};
695	};
696};
697
698&u2phy2 {
699	status = "okay";
700};
701
702&u2phy2_host {
703	status = "okay";
704	phy-supply = <&vcc5v0_host>;
705};
706
707&u2phy3 {
708	status = "okay";
709};
710
711&u2phy3_host {
712	phy-supply = <&vcc5v0_host>;
713	status = "okay";
714};
715
716&uart2 {
717	pinctrl-0 = <&uart2m0_xfer>;
718	status = "okay";
719};
720
721&usb_host0_ehci {
722	status = "okay";
723	pinctrl-names = "default";
724	pinctrl-0 = <&wl_reset &wl_dis &wl_wake_host &bt_dis &bt_wake_host>;
725};
726
727&usb_host0_ohci {
728	status = "okay";
729};
730
731&usb_host1_ehci {
732	status = "okay";
733};
734
735&usb_host1_ohci {
736	status = "okay";
737};
738