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		ethernet0 = &gmac1;
16		mmc0 = &sdhci;
17		mmc1 = &sdmmc;
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&combphy2_psu {
118	status = "okay";
119};
120
121&cpu_b0 {
122	cpu-supply = <&vdd_cpu_big0_s0>;
123};
124
125&cpu_b1 {
126	cpu-supply = <&vdd_cpu_big0_s0>;
127};
128
129&cpu_b2 {
130	cpu-supply = <&vdd_cpu_big1_s0>;
131};
132
133&cpu_b3 {
134	cpu-supply = <&vdd_cpu_big1_s0>;
135};
136
137&cpu_l0 {
138	cpu-supply = <&vdd_cpu_lit_s0>;
139};
140
141&cpu_l1 {
142	cpu-supply = <&vdd_cpu_lit_s0>;
143};
144
145&cpu_l2 {
146	cpu-supply = <&vdd_cpu_lit_s0>;
147};
148
149&cpu_l3 {
150	cpu-supply = <&vdd_cpu_lit_s0>;
151};
152
153&i2c0 {
154	pinctrl-names = "default";
155	pinctrl-0 = <&i2c0m2_xfer>;
156	status = "okay";
157
158	vdd_cpu_big0_s0: regulator@42 {
159		compatible = "rockchip,rk8602";
160		reg = <0x42>;
161		fcs,suspend-voltage-selector = <1>;
162		regulator-name = "vdd_cpu_big0_s0";
163		regulator-always-on;
164		regulator-boot-on;
165		regulator-min-microvolt = <550000>;
166		regulator-max-microvolt = <1050000>;
167		regulator-ramp-delay = <2300>;
168		vin-supply = <&vcc5v0_sys>;
169
170		regulator-state-mem {
171			regulator-off-in-suspend;
172		};
173	};
174
175	vdd_cpu_big1_s0: regulator@43 {
176		compatible = "rockchip,rk8603", "rockchip,rk8602";
177		reg = <0x43>;
178		fcs,suspend-voltage-selector = <1>;
179		regulator-name = "vdd_cpu_big1_s0";
180		regulator-always-on;
181		regulator-boot-on;
182		regulator-min-microvolt = <550000>;
183		regulator-max-microvolt = <1050000>;
184		regulator-ramp-delay = <2300>;
185		vin-supply = <&vcc5v0_sys>;
186
187		regulator-state-mem {
188			regulator-off-in-suspend;
189		};
190	};
191};
192
193&i2c2 {
194	status = "okay";
195
196	vdd_npu_s0: regulator@42 {
197		compatible = "rockchip,rk8602";
198		reg = <0x42>;
199		fcs,suspend-voltage-selector = <1>;
200		regulator-name = "vdd_npu_s0";
201		regulator-always-on;
202		regulator-boot-on;
203		regulator-min-microvolt = <550000>;
204		regulator-max-microvolt = <950000>;
205		regulator-ramp-delay = <2300>;
206		vin-supply = <&vcc5v0_sys>;
207
208		regulator-state-mem {
209			regulator-off-in-suspend;
210		};
211	};
212
213	eeprom: eeprom@50 {
214		compatible = "belling,bl24c16a", "atmel,24c16";
215		reg = <0x50>;
216		pagesize = <16>;
217	};
218};
219
220&i2c3 {
221	status = "okay";
222};
223
224&i2c5 {
225	status = "okay";
226	pinctrl-names = "default";
227	pinctrl-0 = <&i2c5m2_xfer>;
228};
229
230&i2c7 {
231	status = "okay";
232
233	es8316: audio-codec@11 {
234		compatible = "everest,es8316";
235		reg = <0x11>;
236		clocks = <&cru I2S0_8CH_MCLKOUT>;
237		clock-names = "mclk";
238		assigned-clocks = <&cru I2S0_8CH_MCLKOUT>;
239		assigned-clock-rates = <12288000>;
240		#sound-dai-cells = <0>;
241
242		port {
243			es8316_p0_0: endpoint {
244				remote-endpoint = <&i2s0_8ch_p0_0>;
245			};
246		};
247	};
248};
249
250&i2s0_8ch {
251	pinctrl-names = "default";
252	pinctrl-0 = <&i2s0_lrck
253		     &i2s0_mclk
254		     &i2s0_sclk
255		     &i2s0_sdi0
256		     &i2s0_sdo0>;
257	status = "okay";
258
259	i2s0_8ch_p0: port {
260		i2s0_8ch_p0_0: endpoint {
261			dai-format = "i2s";
262			mclk-fs = <256>;
263			remote-endpoint = <&es8316_p0_0>;
264		};
265	};
266};
267
268&gmac1 {
269	clock_in_out = "output";
270	phy-handle = <&rgmii_phy1>;
271	phy-mode = "rgmii";
272	pinctrl-0 = <&gmac1_miim
273		     &gmac1_tx_bus2
274		     &gmac1_rx_bus2
275		     &gmac1_rgmii_clk
276		     &gmac1_rgmii_bus>;
277	pinctrl-names = "default";
278	tx_delay = <0x3a>;
279	rx_delay = <0x3e>;
280	status = "okay";
281};
282
283&mdio1 {
284	rgmii_phy1: ethernet-phy@1 {
285		/* RTL8211F */
286		compatible = "ethernet-phy-id001c.c916";
287		reg = <0x1>;
288		pinctrl-names = "default";
289		pinctrl-0 = <&rtl8211f_rst>;
290		reset-assert-us = <20000>;
291		reset-deassert-us = <100000>;
292		reset-gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
293	};
294};
295
296&pinctrl {
297	leds {
298		io_led: io-led {
299			rockchip,pins = <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
300		};
301	};
302
303	power {
304		vcc_5v0_en: vcc-5v0-en {
305			rockchip,pins = <4 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
306		};
307	};
308
309	rtl8211f {
310		rtl8211f_rst: rtl8211f-rst {
311			rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
312		};
313	};
314
315	usb {
316		vcc5v0_host_en: vcc5v0-host-en {
317			rockchip,pins = <4 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
318		};
319	};
320
321	wifibt {
322		wl_reset: wl-reset {
323			rockchip,pins = <0 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>;
324		};
325
326		wl_dis: wl-dis {
327			rockchip,pins = <0 RK_PD5 RK_FUNC_GPIO &pcfg_output_high>;
328		};
329
330		wl_wake_host: wl-wake-host {
331			rockchip,pins = <0 RK_PC7 RK_FUNC_GPIO &pcfg_pull_up>;
332		};
333
334		bt_dis: bt-dis {
335			rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_output_high>;
336		};
337
338		bt_wake_host: bt-wake-host {
339			rockchip,pins = <0 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
340		};
341	};
342};
343
344&pwm3 {
345	pinctrl-names = "default";
346	pinctrl-0 = <&pwm3m1_pins>;
347	status = "okay";
348};
349
350&saradc {
351	vref-supply = <&avcc_1v8_s0>;
352	status = "okay";
353};
354
355&sdhci {
356	bus-width = <8>;
357	no-sdio;
358	no-sd;
359	non-removable;
360	mmc-hs400-1_8v;
361	mmc-hs400-enhanced-strobe;
362	status = "okay";
363};
364
365&sdmmc {
366	bus-width = <4>;
367	cap-mmc-highspeed;
368	cap-sd-highspeed;
369	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
370	disable-wp;
371	max-frequency = <150000000>;
372	no-sdio;
373	no-mmc;
374	sd-uhs-sdr104;
375	vmmc-supply = <&vcc_3v3_s0>;
376	vqmmc-supply = <&vccio_sd_s0>;
377	status = "okay";
378};
379
380&spi2 {
381	status = "okay";
382	assigned-clocks = <&cru CLK_SPI2>;
383	assigned-clock-rates = <200000000>;
384	num-cs = <1>;
385	pinctrl-names = "default";
386	pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>;
387
388	pmic@0 {
389		compatible = "rockchip,rk806";
390		reg = <0x0>;
391		interrupt-parent = <&gpio0>;
392		interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
393		pinctrl-names = "default";
394		pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>,
395			    <&rk806_dvs2_null>, <&rk806_dvs3_null>;
396		spi-max-frequency = <1000000>;
397
398		vcc1-supply = <&vcc5v0_sys>;
399		vcc2-supply = <&vcc5v0_sys>;
400		vcc3-supply = <&vcc5v0_sys>;
401		vcc4-supply = <&vcc5v0_sys>;
402		vcc5-supply = <&vcc5v0_sys>;
403		vcc6-supply = <&vcc5v0_sys>;
404		vcc7-supply = <&vcc5v0_sys>;
405		vcc8-supply = <&vcc5v0_sys>;
406		vcc9-supply = <&vcc5v0_sys>;
407		vcc10-supply = <&vcc5v0_sys>;
408		vcc11-supply = <&vcc_2v0_pldo_s3>;
409		vcc12-supply = <&vcc5v0_sys>;
410		vcc13-supply = <&vcc_1v1_nldo_s3>;
411		vcc14-supply = <&vcc_1v1_nldo_s3>;
412		vcca-supply = <&vcc5v0_sys>;
413
414		gpio-controller;
415		#gpio-cells = <2>;
416
417		rk806_dvs1_null: dvs1-null-pins {
418			pins = "gpio_pwrctrl2";
419			function = "pin_fun0";
420		};
421
422		rk806_dvs2_null: dvs2-null-pins {
423			pins = "gpio_pwrctrl2";
424			function = "pin_fun0";
425		};
426
427		rk806_dvs3_null: dvs3-null-pins {
428			pins = "gpio_pwrctrl3";
429			function = "pin_fun0";
430		};
431
432		regulators {
433			vdd_gpu_s0: vdd_gpu_mem_s0: dcdc-reg1 {
434				regulator-name = "vdd_gpu_s0";
435				regulator-boot-on;
436				regulator-min-microvolt = <550000>;
437				regulator-max-microvolt = <950000>;
438				regulator-ramp-delay = <12500>;
439				regulator-enable-ramp-delay = <400>;
440
441				regulator-state-mem {
442					regulator-off-in-suspend;
443				};
444			};
445
446			vdd_cpu_lit_s0: vdd_cpu_lit_mem_s0: dcdc-reg2 {
447				regulator-name = "vdd_cpu_lit_s0";
448				regulator-always-on;
449				regulator-boot-on;
450				regulator-min-microvolt = <550000>;
451				regulator-max-microvolt = <950000>;
452				regulator-ramp-delay = <12500>;
453
454				regulator-state-mem {
455					regulator-off-in-suspend;
456				};
457			};
458
459			vdd_log_s0: dcdc-reg3 {
460				regulator-name = "vdd_log_s0";
461				regulator-always-on;
462				regulator-boot-on;
463				regulator-min-microvolt = <675000>;
464				regulator-max-microvolt = <750000>;
465				regulator-ramp-delay = <12500>;
466
467				regulator-state-mem {
468					regulator-off-in-suspend;
469					regulator-suspend-microvolt = <750000>;
470				};
471			};
472
473			vdd_vdenc_s0: vdd_vdenc_mem_s0: dcdc-reg4 {
474				regulator-name = "vdd_vdenc_s0";
475				regulator-always-on;
476				regulator-boot-on;
477				regulator-min-microvolt = <550000>;
478				regulator-max-microvolt = <950000>;
479				regulator-ramp-delay = <12500>;
480
481				regulator-state-mem {
482					regulator-off-in-suspend;
483				};
484			};
485
486			vdd_ddr_s0: dcdc-reg5 {
487				regulator-name = "vdd_ddr_s0";
488				regulator-always-on;
489				regulator-boot-on;
490				regulator-min-microvolt = <675000>;
491				regulator-max-microvolt = <900000>;
492				regulator-ramp-delay = <12500>;
493
494				regulator-state-mem {
495					regulator-off-in-suspend;
496					regulator-suspend-microvolt = <850000>;
497				};
498			};
499
500			vdd2_ddr_s3: dcdc-reg6 {
501				regulator-name = "vdd2_ddr_s3";
502				regulator-always-on;
503				regulator-boot-on;
504
505				regulator-state-mem {
506					regulator-on-in-suspend;
507				};
508			};
509
510			vcc_2v0_pldo_s3: dcdc-reg7 {
511				regulator-name = "vdd_2v0_pldo_s3";
512				regulator-always-on;
513				regulator-boot-on;
514				regulator-min-microvolt = <2000000>;
515				regulator-max-microvolt = <2000000>;
516				regulator-ramp-delay = <12500>;
517
518				regulator-state-mem {
519					regulator-on-in-suspend;
520					regulator-suspend-microvolt = <2000000>;
521				};
522			};
523
524			vcc_3v3_s3: dcdc-reg8 {
525				regulator-name = "vcc_3v3_s3";
526				regulator-always-on;
527				regulator-boot-on;
528				regulator-min-microvolt = <3300000>;
529				regulator-max-microvolt = <3300000>;
530
531				regulator-state-mem {
532					regulator-on-in-suspend;
533					regulator-suspend-microvolt = <3300000>;
534				};
535			};
536
537			vddq_ddr_s0: dcdc-reg9 {
538				regulator-name = "vddq_ddr_s0";
539				regulator-always-on;
540				regulator-boot-on;
541
542				regulator-state-mem {
543					regulator-off-in-suspend;
544				};
545			};
546
547			vcc_1v8_s3: dcdc-reg10 {
548				regulator-name = "vcc_1v8_s3";
549				regulator-always-on;
550				regulator-boot-on;
551				regulator-min-microvolt = <1800000>;
552				regulator-max-microvolt = <1800000>;
553
554				regulator-state-mem {
555					regulator-on-in-suspend;
556					regulator-suspend-microvolt = <1800000>;
557				};
558			};
559
560			avcc_1v8_s0: pldo-reg1 {
561				regulator-name = "avcc_1v8_s0";
562				regulator-always-on;
563				regulator-boot-on;
564				regulator-min-microvolt = <1800000>;
565				regulator-max-microvolt = <1800000>;
566
567				regulator-state-mem {
568					regulator-off-in-suspend;
569				};
570			};
571
572			vcc_1v8_s0: pldo-reg2 {
573				regulator-name = "vcc_1v8_s0";
574				regulator-always-on;
575				regulator-boot-on;
576				regulator-min-microvolt = <1800000>;
577				regulator-max-microvolt = <1800000>;
578
579				regulator-state-mem {
580					regulator-off-in-suspend;
581					regulator-suspend-microvolt = <1800000>;
582				};
583			};
584
585			avdd_1v2_s0: pldo-reg3 {
586				regulator-name = "avdd_1v2_s0";
587				regulator-always-on;
588				regulator-boot-on;
589				regulator-min-microvolt = <1200000>;
590				regulator-max-microvolt = <1200000>;
591
592				regulator-state-mem {
593					regulator-off-in-suspend;
594				};
595			};
596
597			vcc_3v3_s0: pldo-reg4 {
598				regulator-name = "vcc_3v3_s0";
599				regulator-always-on;
600				regulator-boot-on;
601				regulator-min-microvolt = <3300000>;
602				regulator-max-microvolt = <3300000>;
603				regulator-ramp-delay = <12500>;
604
605				regulator-state-mem {
606					regulator-off-in-suspend;
607				};
608			};
609
610			vccio_sd_s0: pldo-reg5 {
611				regulator-name = "vccio_sd_s0";
612				regulator-always-on;
613				regulator-boot-on;
614				regulator-min-microvolt = <1800000>;
615				regulator-max-microvolt = <3300000>;
616				regulator-ramp-delay = <12500>;
617
618				regulator-state-mem {
619					regulator-off-in-suspend;
620				};
621			};
622
623			pldo6_s3: pldo-reg6 {
624				regulator-name = "pldo6_s3";
625				regulator-always-on;
626				regulator-boot-on;
627				regulator-min-microvolt = <1800000>;
628				regulator-max-microvolt = <1800000>;
629
630				regulator-state-mem {
631					regulator-on-in-suspend;
632					regulator-suspend-microvolt = <1800000>;
633				};
634			};
635
636			vdd_0v75_s3: nldo-reg1 {
637				regulator-name = "vdd_0v75_s3";
638				regulator-always-on;
639				regulator-boot-on;
640				regulator-min-microvolt = <750000>;
641				regulator-max-microvolt = <750000>;
642
643				regulator-state-mem {
644					regulator-on-in-suspend;
645					regulator-suspend-microvolt = <750000>;
646				};
647			};
648
649			vdd_ddr_pll_s0: nldo-reg2 {
650				regulator-name = "vdd_ddr_pll_s0";
651				regulator-always-on;
652				regulator-boot-on;
653				regulator-min-microvolt = <850000>;
654				regulator-max-microvolt = <850000>;
655
656				regulator-state-mem {
657					regulator-off-in-suspend;
658					regulator-suspend-microvolt = <850000>;
659				};
660			};
661
662			avdd_0v75_s0: nldo-reg3 {
663				regulator-name = "avdd_0v75_s0";
664				regulator-always-on;
665				regulator-boot-on;
666				regulator-min-microvolt = <750000>;
667				regulator-max-microvolt = <750000>;
668
669				regulator-state-mem {
670					regulator-off-in-suspend;
671				};
672			};
673
674			vdd_0v85_s0: nldo-reg4 {
675				regulator-name = "vdd_0v85_s0";
676				regulator-always-on;
677				regulator-boot-on;
678				regulator-min-microvolt = <850000>;
679				regulator-max-microvolt = <850000>;
680
681				regulator-state-mem {
682					regulator-off-in-suspend;
683				};
684			};
685
686			vdd_0v75_s0: nldo-reg5 {
687				regulator-name = "vdd_0v75_s0";
688				regulator-always-on;
689				regulator-boot-on;
690				regulator-min-microvolt = <750000>;
691				regulator-max-microvolt = <750000>;
692
693				regulator-state-mem {
694					regulator-off-in-suspend;
695				};
696			};
697		};
698	};
699};
700
701&u2phy2 {
702	status = "okay";
703};
704
705&u2phy2_host {
706	status = "okay";
707	phy-supply = <&vcc5v0_host>;
708};
709
710&u2phy3 {
711	status = "okay";
712};
713
714&u2phy3_host {
715	phy-supply = <&vcc5v0_host>;
716	status = "okay";
717};
718
719&uart2 {
720	pinctrl-0 = <&uart2m0_xfer>;
721	status = "okay";
722};
723
724&usb_host0_ehci {
725	status = "okay";
726	pinctrl-names = "default";
727	pinctrl-0 = <&wl_reset &wl_dis &wl_wake_host &bt_dis &bt_wake_host>;
728};
729
730&usb_host0_ohci {
731	status = "okay";
732};
733
734&usb_host1_ehci {
735	status = "okay";
736};
737
738&usb_host1_ohci {
739	status = "okay";
740};
741
742&usb_host2_xhci {
743	status = "okay";
744};
745