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