1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2
3/dts-v1/;
4
5#include <dt-bindings/gpio/gpio.h>
6#include "rk3588.dtsi"
7
8/ {
9	model = "Radxa ROCK 5 Model B";
10	compatible = "radxa,rock-5b", "rockchip,rk3588";
11
12	aliases {
13		mmc0 = &sdhci;
14		serial2 = &uart2;
15	};
16
17	chosen {
18		stdout-path = "serial2:1500000n8";
19	};
20
21	analog-sound {
22		compatible = "audio-graph-card";
23		label = "rk3588-es8316";
24
25		widgets = "Microphone", "Mic Jack",
26			  "Headphone", "Headphones";
27
28		routing = "MIC2", "Mic Jack",
29			  "Headphones", "HPOL",
30			  "Headphones", "HPOR";
31
32		dais = <&i2s0_8ch_p0>;
33		hp-det-gpio = <&gpio1 RK_PD5 GPIO_ACTIVE_HIGH>;
34		pinctrl-names = "default";
35		pinctrl-0 = <&hp_detect>;
36	};
37
38	fan: pwm-fan {
39		compatible = "pwm-fan";
40		cooling-levels = <0 95 145 195 255>;
41		fan-supply = <&vcc5v0_sys>;
42		pwms = <&pwm1 0 50000 0>;
43		#cooling-cells = <2>;
44	};
45
46	vcc5v0_host: vcc5v0-host-regulator {
47		compatible = "regulator-fixed";
48		regulator-name = "vcc5v0_host";
49		regulator-boot-on;
50		regulator-always-on;
51		regulator-min-microvolt = <5000000>;
52		regulator-max-microvolt = <5000000>;
53		enable-active-high;
54		gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>;
55		pinctrl-names = "default";
56		pinctrl-0 = <&vcc5v0_host_en>;
57		vin-supply = <&vcc5v0_sys>;
58	};
59
60	vcc5v0_sys: vcc5v0-sys-regulator {
61		compatible = "regulator-fixed";
62		regulator-name = "vcc5v0_sys";
63		regulator-always-on;
64		regulator-boot-on;
65		regulator-min-microvolt = <5000000>;
66		regulator-max-microvolt = <5000000>;
67	};
68
69	vcc_1v1_nldo_s3: vcc-1v1-nldo-s3-regulator {
70		compatible = "regulator-fixed";
71		regulator-name = "vcc_1v1_nldo_s3";
72		regulator-always-on;
73		regulator-boot-on;
74		regulator-min-microvolt = <1100000>;
75		regulator-max-microvolt = <1100000>;
76		vin-supply = <&vcc5v0_sys>;
77	};
78};
79
80&cpu_b0 {
81	cpu-supply = <&vdd_cpu_big0_s0>;
82};
83
84&cpu_b1 {
85	cpu-supply = <&vdd_cpu_big0_s0>;
86};
87
88&cpu_b2 {
89	cpu-supply = <&vdd_cpu_big1_s0>;
90};
91
92&cpu_b3 {
93	cpu-supply = <&vdd_cpu_big1_s0>;
94};
95
96&cpu_l0 {
97	cpu-supply = <&vdd_cpu_lit_s0>;
98};
99
100&cpu_l1 {
101	cpu-supply = <&vdd_cpu_lit_s0>;
102};
103
104&cpu_l2 {
105	cpu-supply = <&vdd_cpu_lit_s0>;
106};
107
108&cpu_l3 {
109	cpu-supply = <&vdd_cpu_lit_s0>;
110};
111
112&i2c0 {
113	pinctrl-names = "default";
114	pinctrl-0 = <&i2c0m2_xfer>;
115	status = "okay";
116
117	vdd_cpu_big0_s0: regulator@42 {
118		compatible = "rockchip,rk8602";
119		reg = <0x42>;
120		fcs,suspend-voltage-selector = <1>;
121		regulator-name = "vdd_cpu_big0_s0";
122		regulator-always-on;
123		regulator-boot-on;
124		regulator-min-microvolt = <550000>;
125		regulator-max-microvolt = <1050000>;
126		regulator-ramp-delay = <2300>;
127		vin-supply = <&vcc5v0_sys>;
128
129		regulator-state-mem {
130			regulator-off-in-suspend;
131		};
132	};
133
134	vdd_cpu_big1_s0: regulator@43 {
135		compatible = "rockchip,rk8603", "rockchip,rk8602";
136		reg = <0x43>;
137		fcs,suspend-voltage-selector = <1>;
138		regulator-name = "vdd_cpu_big1_s0";
139		regulator-always-on;
140		regulator-boot-on;
141		regulator-min-microvolt = <550000>;
142		regulator-max-microvolt = <1050000>;
143		regulator-ramp-delay = <2300>;
144		vin-supply = <&vcc5v0_sys>;
145
146		regulator-state-mem {
147			regulator-off-in-suspend;
148		};
149	};
150};
151
152&i2c6 {
153	status = "okay";
154
155	hym8563: rtc@51 {
156		compatible = "haoyu,hym8563";
157		reg = <0x51>;
158		#clock-cells = <0>;
159		clock-output-names = "hym8563";
160		pinctrl-names = "default";
161		pinctrl-0 = <&hym8563_int>;
162		interrupt-parent = <&gpio0>;
163		interrupts = <RK_PB0 IRQ_TYPE_LEVEL_LOW>;
164		wakeup-source;
165	};
166};
167
168&i2c7 {
169	status = "okay";
170
171	es8316: audio-codec@11 {
172		compatible = "everest,es8316";
173		reg = <0x11>;
174		clocks = <&cru I2S0_8CH_MCLKOUT>;
175		clock-names = "mclk";
176		assigned-clocks = <&cru I2S0_8CH_MCLKOUT>;
177		assigned-clock-rates = <12288000>;
178		#sound-dai-cells = <0>;
179
180		port {
181			es8316_p0_0: endpoint {
182				remote-endpoint = <&i2s0_8ch_p0_0>;
183			};
184		};
185	};
186};
187
188&i2s0_8ch {
189	pinctrl-names = "default";
190	pinctrl-0 = <&i2s0_lrck
191		     &i2s0_mclk
192		     &i2s0_sclk
193		     &i2s0_sdi0
194		     &i2s0_sdo0>;
195	status = "okay";
196
197	i2s0_8ch_p0: port {
198		i2s0_8ch_p0_0: endpoint {
199			dai-format = "i2s";
200			mclk-fs = <256>;
201			remote-endpoint = <&es8316_p0_0>;
202		};
203	};
204};
205
206&pinctrl {
207	hym8563 {
208		hym8563_int: hym8563-int {
209			rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
210		};
211	};
212
213	sound {
214		hp_detect: hp-detect {
215			rockchip,pins = <1 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
216		};
217	};
218
219	usb {
220		vcc5v0_host_en: vcc5v0-host-en {
221			rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
222		};
223	};
224};
225
226&pwm1 {
227	status = "okay";
228};
229
230&saradc {
231	vref-supply = <&avcc_1v8_s0>;
232	status = "okay";
233};
234
235&sdhci {
236	bus-width = <8>;
237	no-sdio;
238	no-sd;
239	non-removable;
240	mmc-hs400-1_8v;
241	mmc-hs400-enhanced-strobe;
242	status = "okay";
243};
244
245&sdmmc {
246	max-frequency = <200000000>;
247	no-sdio;
248	no-mmc;
249	bus-width = <4>;
250	cap-mmc-highspeed;
251	cap-sd-highspeed;
252	disable-wp;
253	sd-uhs-sdr104;
254	vmmc-supply = <&vcc_3v3_s3>;
255	vqmmc-supply = <&vccio_sd_s0>;
256	status = "okay";
257};
258
259&spi2 {
260	status = "okay";
261	assigned-clocks = <&cru CLK_SPI2>;
262	assigned-clock-rates = <200000000>;
263	pinctrl-names = "default";
264	pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>;
265	num-cs = <1>;
266
267	pmic@0 {
268		compatible = "rockchip,rk806";
269		spi-max-frequency = <1000000>;
270		reg = <0x0>;
271
272		interrupt-parent = <&gpio0>;
273		interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
274
275		pinctrl-names = "default";
276		pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>,
277			    <&rk806_dvs2_null>, <&rk806_dvs3_null>;
278
279		vcc1-supply = <&vcc5v0_sys>;
280		vcc2-supply = <&vcc5v0_sys>;
281		vcc3-supply = <&vcc5v0_sys>;
282		vcc4-supply = <&vcc5v0_sys>;
283		vcc5-supply = <&vcc5v0_sys>;
284		vcc6-supply = <&vcc5v0_sys>;
285		vcc7-supply = <&vcc5v0_sys>;
286		vcc8-supply = <&vcc5v0_sys>;
287		vcc9-supply = <&vcc5v0_sys>;
288		vcc10-supply = <&vcc5v0_sys>;
289		vcc11-supply = <&vcc_2v0_pldo_s3>;
290		vcc12-supply = <&vcc5v0_sys>;
291		vcc13-supply = <&vcc_1v1_nldo_s3>;
292		vcc14-supply = <&vcc_1v1_nldo_s3>;
293		vcca-supply = <&vcc5v0_sys>;
294
295		gpio-controller;
296		#gpio-cells = <2>;
297
298		rk806_dvs1_null: dvs1-null-pins {
299			pins = "gpio_pwrctrl2";
300			function = "pin_fun0";
301		};
302
303		rk806_dvs2_null: dvs2-null-pins {
304			pins = "gpio_pwrctrl2";
305			function = "pin_fun0";
306		};
307
308		rk806_dvs3_null: dvs3-null-pins {
309			pins = "gpio_pwrctrl3";
310			function = "pin_fun0";
311		};
312
313		regulators {
314			vdd_gpu_s0: vdd_gpu_mem_s0: dcdc-reg1 {
315				regulator-boot-on;
316				regulator-min-microvolt = <550000>;
317				regulator-max-microvolt = <950000>;
318				regulator-ramp-delay = <12500>;
319				regulator-name = "vdd_gpu_s0";
320				regulator-enable-ramp-delay = <400>;
321
322				regulator-state-mem {
323					regulator-off-in-suspend;
324				};
325			};
326
327			vdd_cpu_lit_s0: vdd_cpu_lit_mem_s0: dcdc-reg2 {
328				regulator-always-on;
329				regulator-boot-on;
330				regulator-min-microvolt = <550000>;
331				regulator-max-microvolt = <950000>;
332				regulator-ramp-delay = <12500>;
333				regulator-name = "vdd_cpu_lit_s0";
334
335				regulator-state-mem {
336					regulator-off-in-suspend;
337				};
338			};
339
340			vdd_log_s0: dcdc-reg3 {
341				regulator-always-on;
342				regulator-boot-on;
343				regulator-min-microvolt = <675000>;
344				regulator-max-microvolt = <750000>;
345				regulator-ramp-delay = <12500>;
346				regulator-name = "vdd_log_s0";
347
348				regulator-state-mem {
349					regulator-off-in-suspend;
350					regulator-suspend-microvolt = <750000>;
351				};
352			};
353
354			vdd_vdenc_s0: vdd_vdenc_mem_s0: dcdc-reg4 {
355				regulator-always-on;
356				regulator-boot-on;
357				regulator-min-microvolt = <550000>;
358				regulator-max-microvolt = <950000>;
359				regulator-init-microvolt = <750000>;
360				regulator-ramp-delay = <12500>;
361				regulator-name = "vdd_vdenc_s0";
362
363				regulator-state-mem {
364					regulator-off-in-suspend;
365				};
366			};
367
368			vdd_ddr_s0: dcdc-reg5 {
369				regulator-always-on;
370				regulator-boot-on;
371				regulator-min-microvolt = <675000>;
372				regulator-max-microvolt = <900000>;
373				regulator-ramp-delay = <12500>;
374				regulator-name = "vdd_ddr_s0";
375
376				regulator-state-mem {
377					regulator-off-in-suspend;
378					regulator-suspend-microvolt = <850000>;
379				};
380			};
381
382			vdd2_ddr_s3: dcdc-reg6 {
383				regulator-always-on;
384				regulator-boot-on;
385				regulator-name = "vdd2_ddr_s3";
386
387				regulator-state-mem {
388					regulator-on-in-suspend;
389				};
390			};
391
392			vcc_2v0_pldo_s3: dcdc-reg7 {
393				regulator-always-on;
394				regulator-boot-on;
395				regulator-min-microvolt = <2000000>;
396				regulator-max-microvolt = <2000000>;
397				regulator-ramp-delay = <12500>;
398				regulator-name = "vdd_2v0_pldo_s3";
399
400				regulator-state-mem {
401					regulator-on-in-suspend;
402					regulator-suspend-microvolt = <2000000>;
403				};
404			};
405
406			vcc_3v3_s3: dcdc-reg8 {
407				regulator-always-on;
408				regulator-boot-on;
409				regulator-min-microvolt = <3300000>;
410				regulator-max-microvolt = <3300000>;
411				regulator-name = "vcc_3v3_s3";
412
413				regulator-state-mem {
414					regulator-on-in-suspend;
415					regulator-suspend-microvolt = <3300000>;
416				};
417			};
418
419			vddq_ddr_s0: dcdc-reg9 {
420				regulator-always-on;
421				regulator-boot-on;
422				regulator-name = "vddq_ddr_s0";
423
424				regulator-state-mem {
425					regulator-off-in-suspend;
426				};
427			};
428
429			vcc_1v8_s3: dcdc-reg10 {
430				regulator-always-on;
431				regulator-boot-on;
432				regulator-min-microvolt = <1800000>;
433				regulator-max-microvolt = <1800000>;
434				regulator-name = "vcc_1v8_s3";
435
436				regulator-state-mem {
437					regulator-on-in-suspend;
438					regulator-suspend-microvolt = <1800000>;
439				};
440			};
441
442			avcc_1v8_s0: pldo-reg1 {
443				regulator-always-on;
444				regulator-boot-on;
445				regulator-min-microvolt = <1800000>;
446				regulator-max-microvolt = <1800000>;
447				regulator-name = "avcc_1v8_s0";
448
449				regulator-state-mem {
450					regulator-off-in-suspend;
451				};
452			};
453
454			vcc_1v8_s0: pldo-reg2 {
455				regulator-always-on;
456				regulator-boot-on;
457				regulator-min-microvolt = <1800000>;
458				regulator-max-microvolt = <1800000>;
459				regulator-name = "vcc_1v8_s0";
460
461				regulator-state-mem {
462					regulator-off-in-suspend;
463					regulator-suspend-microvolt = <1800000>;
464				};
465			};
466
467			avdd_1v2_s0: pldo-reg3 {
468				regulator-always-on;
469				regulator-boot-on;
470				regulator-min-microvolt = <1200000>;
471				regulator-max-microvolt = <1200000>;
472				regulator-name = "avdd_1v2_s0";
473
474				regulator-state-mem {
475					regulator-off-in-suspend;
476				};
477			};
478
479			vcc_3v3_s0: pldo-reg4 {
480				regulator-always-on;
481				regulator-boot-on;
482				regulator-min-microvolt = <3300000>;
483				regulator-max-microvolt = <3300000>;
484				regulator-ramp-delay = <12500>;
485				regulator-name = "vcc_3v3_s0";
486
487				regulator-state-mem {
488					regulator-off-in-suspend;
489				};
490			};
491
492			vccio_sd_s0: pldo-reg5 {
493				regulator-always-on;
494				regulator-boot-on;
495				regulator-min-microvolt = <1800000>;
496				regulator-max-microvolt = <3300000>;
497				regulator-ramp-delay = <12500>;
498				regulator-name = "vccio_sd_s0";
499
500				regulator-state-mem {
501					regulator-off-in-suspend;
502				};
503			};
504
505			pldo6_s3: pldo-reg6 {
506				regulator-always-on;
507				regulator-boot-on;
508				regulator-min-microvolt = <1800000>;
509				regulator-max-microvolt = <1800000>;
510				regulator-name = "pldo6_s3";
511
512				regulator-state-mem {
513					regulator-on-in-suspend;
514					regulator-suspend-microvolt = <1800000>;
515				};
516			};
517
518			vdd_0v75_s3: nldo-reg1 {
519				regulator-always-on;
520				regulator-boot-on;
521				regulator-min-microvolt = <750000>;
522				regulator-max-microvolt = <750000>;
523				regulator-name = "vdd_0v75_s3";
524
525				regulator-state-mem {
526					regulator-on-in-suspend;
527					regulator-suspend-microvolt = <750000>;
528				};
529			};
530
531			vdd_ddr_pll_s0: nldo-reg2 {
532				regulator-always-on;
533				regulator-boot-on;
534				regulator-min-microvolt = <850000>;
535				regulator-max-microvolt = <850000>;
536				regulator-name = "vdd_ddr_pll_s0";
537
538				regulator-state-mem {
539					regulator-off-in-suspend;
540					regulator-suspend-microvolt = <850000>;
541				};
542			};
543
544			avdd_0v75_s0: nldo-reg3 {
545				regulator-always-on;
546				regulator-boot-on;
547				regulator-min-microvolt = <750000>;
548				regulator-max-microvolt = <750000>;
549				regulator-name = "avdd_0v75_s0";
550
551				regulator-state-mem {
552					regulator-off-in-suspend;
553				};
554			};
555
556			vdd_0v85_s0: nldo-reg4 {
557				regulator-always-on;
558				regulator-boot-on;
559				regulator-min-microvolt = <850000>;
560				regulator-max-microvolt = <850000>;
561				regulator-name = "vdd_0v85_s0";
562
563				regulator-state-mem {
564					regulator-off-in-suspend;
565				};
566			};
567
568			vdd_0v75_s0: nldo-reg5 {
569				regulator-always-on;
570				regulator-boot-on;
571				regulator-min-microvolt = <750000>;
572				regulator-max-microvolt = <750000>;
573				regulator-name = "vdd_0v75_s0";
574
575				regulator-state-mem {
576					regulator-off-in-suspend;
577				};
578			};
579		};
580	};
581};
582
583&uart2 {
584	pinctrl-0 = <&uart2m0_xfer>;
585	status = "okay";
586};
587
588&u2phy2 {
589	status = "okay";
590};
591
592&u2phy2_host {
593	/* connected to USB hub, which is powered by vcc5v0_sys */
594	phy-supply = <&vcc5v0_sys>;
595	status = "okay";
596};
597
598&u2phy3 {
599	status = "okay";
600};
601
602&u2phy3_host {
603	phy-supply = <&vcc5v0_host>;
604	status = "okay";
605};
606
607&usb_host0_ehci {
608	status = "okay";
609};
610
611&usb_host0_ohci {
612	status = "okay";
613};
614
615&usb_host1_ehci {
616	status = "okay";
617};
618
619&usb_host1_ohci {
620	status = "okay";
621};
622