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