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-ramp-delay = <12500>;
341				regulator-name = "vdd_vdenc_s0";
342
343				regulator-state-mem {
344					regulator-off-in-suspend;
345				};
346			};
347
348			vdd_ddr_s0: dcdc-reg5 {
349				regulator-always-on;
350				regulator-boot-on;
351				regulator-min-microvolt = <675000>;
352				regulator-max-microvolt = <900000>;
353				regulator-ramp-delay = <12500>;
354				regulator-name = "vdd_ddr_s0";
355
356				regulator-state-mem {
357					regulator-off-in-suspend;
358					regulator-suspend-microvolt = <850000>;
359				};
360			};
361
362			vdd2_ddr_s3: dcdc-reg6 {
363				regulator-always-on;
364				regulator-boot-on;
365				regulator-name = "vdd2_ddr_s3";
366
367				regulator-state-mem {
368					regulator-on-in-suspend;
369				};
370			};
371
372			vcc_2v0_pldo_s3: dcdc-reg7 {
373				regulator-always-on;
374				regulator-boot-on;
375				regulator-min-microvolt = <2000000>;
376				regulator-max-microvolt = <2000000>;
377				regulator-ramp-delay = <12500>;
378				regulator-name = "vdd_2v0_pldo_s3";
379
380				regulator-state-mem {
381					regulator-on-in-suspend;
382					regulator-suspend-microvolt = <2000000>;
383				};
384			};
385
386			vcc_3v3_s3: dcdc-reg8 {
387				regulator-always-on;
388				regulator-boot-on;
389				regulator-min-microvolt = <3300000>;
390				regulator-max-microvolt = <3300000>;
391				regulator-name = "vcc_3v3_s3";
392
393				regulator-state-mem {
394					regulator-on-in-suspend;
395					regulator-suspend-microvolt = <3300000>;
396				};
397			};
398
399			vddq_ddr_s0: dcdc-reg9 {
400				regulator-always-on;
401				regulator-boot-on;
402				regulator-name = "vddq_ddr_s0";
403
404				regulator-state-mem {
405					regulator-off-in-suspend;
406				};
407			};
408
409			vcc_1v8_s3: dcdc-reg10 {
410				regulator-always-on;
411				regulator-boot-on;
412				regulator-min-microvolt = <1800000>;
413				regulator-max-microvolt = <1800000>;
414				regulator-name = "vcc_1v8_s3";
415
416				regulator-state-mem {
417					regulator-on-in-suspend;
418					regulator-suspend-microvolt = <1800000>;
419				};
420			};
421
422			avcc_1v8_s0: pldo-reg1 {
423				regulator-always-on;
424				regulator-boot-on;
425				regulator-min-microvolt = <1800000>;
426				regulator-max-microvolt = <1800000>;
427				regulator-name = "avcc_1v8_s0";
428
429				regulator-state-mem {
430					regulator-off-in-suspend;
431				};
432			};
433
434			vcc_1v8_s0: pldo-reg2 {
435				regulator-always-on;
436				regulator-boot-on;
437				regulator-min-microvolt = <1800000>;
438				regulator-max-microvolt = <1800000>;
439				regulator-name = "vcc_1v8_s0";
440
441				regulator-state-mem {
442					regulator-off-in-suspend;
443					regulator-suspend-microvolt = <1800000>;
444				};
445			};
446
447			avdd_1v2_s0: pldo-reg3 {
448				regulator-always-on;
449				regulator-boot-on;
450				regulator-min-microvolt = <1200000>;
451				regulator-max-microvolt = <1200000>;
452				regulator-name = "avdd_1v2_s0";
453
454				regulator-state-mem {
455					regulator-off-in-suspend;
456				};
457			};
458
459			vcc_3v3_s0: pldo-reg4 {
460				regulator-always-on;
461				regulator-boot-on;
462				regulator-min-microvolt = <3300000>;
463				regulator-max-microvolt = <3300000>;
464				regulator-ramp-delay = <12500>;
465				regulator-name = "vcc_3v3_s0";
466
467				regulator-state-mem {
468					regulator-off-in-suspend;
469				};
470			};
471
472			vccio_sd_s0: pldo-reg5 {
473				regulator-always-on;
474				regulator-boot-on;
475				regulator-min-microvolt = <1800000>;
476				regulator-max-microvolt = <3300000>;
477				regulator-ramp-delay = <12500>;
478				regulator-name = "vccio_sd_s0";
479
480				regulator-state-mem {
481					regulator-off-in-suspend;
482				};
483			};
484
485			pldo6_s3: pldo-reg6 {
486				regulator-always-on;
487				regulator-boot-on;
488				regulator-min-microvolt = <1800000>;
489				regulator-max-microvolt = <1800000>;
490				regulator-name = "pldo6_s3";
491
492				regulator-state-mem {
493					regulator-on-in-suspend;
494					regulator-suspend-microvolt = <1800000>;
495				};
496			};
497
498			vdd_0v75_s3: nldo-reg1 {
499				regulator-always-on;
500				regulator-boot-on;
501				regulator-min-microvolt = <750000>;
502				regulator-max-microvolt = <750000>;
503				regulator-name = "vdd_0v75_s3";
504
505				regulator-state-mem {
506					regulator-on-in-suspend;
507					regulator-suspend-microvolt = <750000>;
508				};
509			};
510
511			vdd_ddr_pll_s0: nldo-reg2 {
512				regulator-always-on;
513				regulator-boot-on;
514				regulator-min-microvolt = <850000>;
515				regulator-max-microvolt = <850000>;
516				regulator-name = "vdd_ddr_pll_s0";
517
518				regulator-state-mem {
519					regulator-off-in-suspend;
520					regulator-suspend-microvolt = <850000>;
521				};
522			};
523
524			avdd_0v75_s0: nldo-reg3 {
525				regulator-always-on;
526				regulator-boot-on;
527				regulator-min-microvolt = <750000>;
528				regulator-max-microvolt = <750000>;
529				regulator-name = "avdd_0v75_s0";
530
531				regulator-state-mem {
532					regulator-off-in-suspend;
533				};
534			};
535
536			vdd_0v85_s0: nldo-reg4 {
537				regulator-always-on;
538				regulator-boot-on;
539				regulator-min-microvolt = <850000>;
540				regulator-max-microvolt = <850000>;
541				regulator-name = "vdd_0v85_s0";
542
543				regulator-state-mem {
544					regulator-off-in-suspend;
545				};
546			};
547
548			vdd_0v75_s0: nldo-reg5 {
549				regulator-always-on;
550				regulator-boot-on;
551				regulator-min-microvolt = <750000>;
552				regulator-max-microvolt = <750000>;
553				regulator-name = "vdd_0v75_s0";
554
555				regulator-state-mem {
556					regulator-off-in-suspend;
557				};
558			};
559		};
560	};
561};
562
563&uart2 {
564	pinctrl-0 = <&uart2m0_xfer>;
565	status = "okay";
566};
567