1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2024 Radxa Computer (Shenzhen) Co., Ltd.
4 */
5
6/dts-v1/;
7
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/input/input.h>
10#include <dt-bindings/leds/common.h>
11#include <dt-bindings/pinctrl/rockchip.h>
12#include <dt-bindings/pwm/pwm.h>
13#include "rk3588s.dtsi"
14
15/ {
16	model = "Radxa E52C";
17	compatible = "radxa,e52c", "rockchip,rk3582", "rockchip,rk3588s";
18
19	aliases {
20		mmc0 = &sdhci;
21		mmc1 = &sdmmc;
22	};
23
24	chosen {
25		stdout-path = "serial2:1500000n8";
26	};
27
28	keys-0 {
29		compatible = "adc-keys";
30		io-channels = <&saradc 0>;
31		io-channel-names = "buttons";
32		keyup-threshold-microvolt = <18000>;
33		poll-interval = <100>;
34
35		button-0 {
36			label = "Maskrom";
37			linux,code = <KEY_VENDOR>;
38			press-threshold-microvolt = <0>;
39		};
40	};
41
42	keys-1 {
43		compatible = "gpio-keys";
44		pinctrl-names = "default";
45		pinctrl-0 = <&btn_0>;
46
47		button-1 {
48			label = "User";
49			gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_LOW>;
50			linux,code = <BTN_0>;
51			wakeup-source;
52		};
53	};
54
55	leds-0 {
56		compatible = "gpio-leds";
57		pinctrl-names = "default";
58		pinctrl-0 = <&led_0>;
59
60		led-0 {
61			color = <LED_COLOR_ID_GREEN>;
62			default-state = "on";
63			function = LED_FUNCTION_STATUS;
64			gpios = <&gpio3 RK_PC4 GPIO_ACTIVE_HIGH>;
65			linux,default-trigger = "heartbeat";
66		};
67	};
68
69	leds-1 {
70		compatible = "pwm-leds";
71
72		led-1 {
73			color = <LED_COLOR_ID_GREEN>;
74			default-state = "on";
75			function = LED_FUNCTION_LAN;
76			linux,default-trigger = "netdev";
77			pwms = <&pwm14 0 1000000 PWM_POLARITY_INVERTED>;
78			max-brightness = <255>;
79		};
80
81		led-2 {
82			color = <LED_COLOR_ID_GREEN>;
83			default-state = "on";
84			function = LED_FUNCTION_WAN;
85			linux,default-trigger = "netdev";
86			pwms = <&pwm11 0 1000000 PWM_POLARITY_INVERTED>;
87			max-brightness = <255>;
88		};
89	};
90
91	vcc_1v1_nldo_s3: regulator-1v1 {
92		compatible = "regulator-fixed";
93		regulator-name = "vcc_1v1_nldo_s3";
94		regulator-always-on;
95		regulator-boot-on;
96		regulator-min-microvolt = <1100000>;
97		regulator-max-microvolt = <1100000>;
98		vin-supply = <&vcc_sysin>;
99	};
100
101	vcc_3v3_pmu: regulator-3v3-0 {
102		compatible = "regulator-fixed";
103		regulator-name = "vcc_3v3_pmu";
104		regulator-always-on;
105		regulator-boot-on;
106		regulator-min-microvolt = <3300000>;
107		regulator-max-microvolt = <3300000>;
108		vin-supply = <&vcc_3v3_s3>;
109	};
110
111	vcc_3v3_s0: regulator-3v3-1 {
112		compatible = "regulator-fixed";
113		regulator-name = "vcc_3v3_s0";
114		regulator-always-on;
115		regulator-boot-on;
116		regulator-min-microvolt = <3300000>;
117		regulator-max-microvolt = <3300000>;
118		vin-supply = <&vcc_3v3_s3>;
119	};
120
121	vcca: regulator-4v0 {
122		compatible = "regulator-fixed";
123		regulator-name = "vcca";
124		regulator-always-on;
125		regulator-boot-on;
126		regulator-min-microvolt = <4000000>;
127		regulator-max-microvolt = <4000000>;
128		vin-supply = <&vcc_sysin>;
129	};
130
131	vcc5v0_usb_otg0: regulator-5v0-0 {
132		compatible = "regulator-fixed";
133		enable-active-high;
134		gpio = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>;
135		pinctrl-names = "default";
136		pinctrl-0 = <&usb_otg_pwren_h>;
137		regulator-name = "vcc5v0_usb_otg0";
138		regulator-min-microvolt = <5000000>;
139		regulator-max-microvolt = <5000000>;
140		vin-supply = <&vcc_sysin>;
141	};
142
143	vcc_5v0: regulator-5v0-1 {
144		compatible = "regulator-fixed";
145		enable-active-high;
146		gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_HIGH>;
147		pinctrl-names = "default";
148		pinctrl-0 = <&vcc_5v0_pwren_h>;
149		regulator-name = "vcc_5v0";
150		regulator-min-microvolt = <5000000>;
151		regulator-max-microvolt = <5000000>;
152		vin-supply = <&vcc_sysin>;
153	};
154
155	vcc_sysin: regulator-5v0-2 {
156		compatible = "regulator-fixed";
157		regulator-name = "vcc_sysin";
158		regulator-always-on;
159		regulator-boot-on;
160		regulator-min-microvolt = <5000000>;
161		regulator-max-microvolt = <5000000>;
162	};
163};
164
165&combphy0_ps {
166	status = "okay";
167};
168
169&combphy2_psu {
170	status = "okay";
171};
172
173/*
174 * In the Rockchip RK3582 SoC, some CPU cores end up disabled
175 * and unused because they're marked in the efuses as defective.
176 * The disabling in the DT is performed by the boot loader.
177 */
178&cpu_b0 {
179	cpu-supply = <&vdd_cpu_big0_s0>;
180};
181
182&cpu_b1 {
183	cpu-supply = <&vdd_cpu_big0_s0>;
184};
185
186&cpu_b2 {
187	cpu-supply = <&vdd_cpu_big1_s0>;
188};
189
190&cpu_b3 {
191	cpu-supply = <&vdd_cpu_big1_s0>;
192};
193
194&cpu_l0 {
195	cpu-supply = <&vdd_cpu_lit_s0>;
196};
197
198&cpu_l1 {
199	cpu-supply = <&vdd_cpu_lit_s0>;
200};
201
202&cpu_l2 {
203	cpu-supply = <&vdd_cpu_lit_s0>;
204};
205
206&cpu_l3 {
207	cpu-supply = <&vdd_cpu_lit_s0>;
208};
209
210&i2c0 {
211	pinctrl-names = "default";
212	pinctrl-0 = <&i2c0m2_xfer>;
213	status = "okay";
214
215	vdd_cpu_big0_s0: regulator@42 {
216		compatible = "rockchip,rk8602";
217		reg = <0x42>;
218		fcs,suspend-voltage-selector = <1>;
219		regulator-name = "vdd_cpu_big0_s0";
220		regulator-always-on;
221		regulator-boot-on;
222		regulator-min-microvolt = <550000>;
223		regulator-max-microvolt = <1050000>;
224		regulator-ramp-delay = <2300>;
225		vin-supply = <&vcc_sysin>;
226
227		regulator-state-mem {
228			regulator-off-in-suspend;
229		};
230	};
231
232	vdd_cpu_big1_s0: regulator@43 {
233		compatible = "rockchip,rk8603", "rockchip,rk8602";
234		reg = <0x43>;
235		fcs,suspend-voltage-selector = <1>;
236		regulator-name = "vdd_cpu_big1_s0";
237		regulator-always-on;
238		regulator-boot-on;
239		regulator-min-microvolt = <550000>;
240		regulator-max-microvolt = <1050000>;
241		regulator-ramp-delay = <2300>;
242		vin-supply = <&vcc_sysin>;
243
244		regulator-state-mem {
245			regulator-off-in-suspend;
246		};
247	};
248
249	eeprom@50 {
250		compatible = "belling,bl24c16a", "atmel,24c16";
251		reg = <0x50>;
252		pagesize = <16>;
253		vcc-supply = <&vcc_3v3_pmu>;
254	};
255};
256
257&i2c2 {
258	status = "okay";
259
260	vdd_npu_s0: regulator@42 {
261		compatible = "rockchip,rk8602";
262		reg = <0x42>;
263		fcs,suspend-voltage-selector = <1>;
264		regulator-name = "vdd_npu_s0";
265		regulator-always-on;
266		regulator-boot-on;
267		regulator-min-microvolt = <550000>;
268		regulator-max-microvolt = <950000>;
269		regulator-ramp-delay = <2300>;
270		vin-supply = <&vcc_sysin>;
271
272		regulator-state-mem {
273			regulator-off-in-suspend;
274		};
275	};
276};
277
278&i2c5 {
279	pinctrl-names = "default";
280	pinctrl-0 = <&i2c5m2_xfer>;
281	status = "okay";
282
283	rtc@51 {
284		compatible = "haoyu,hym8563";
285		reg = <0x51>;
286		#clock-cells = <0>;
287		clock-output-names = "rtcic_32kout";
288		interrupt-parent = <&gpio0>;
289		interrupts = <RK_PB0 IRQ_TYPE_LEVEL_LOW>;
290		pinctrl-names = "default";
291		pinctrl-0 = <&rtc_int_l>;
292		wakeup-source;
293	};
294};
295
296&pcie2x1l1 {
297	pinctrl-names = "default";
298	pinctrl-0 = <&pcie20x1_1_perstn_m1>;
299	reset-gpios = <&gpio4 RK_PA2 GPIO_ACTIVE_HIGH>;
300	vpcie3v3-supply = <&vcc_3v3_s3>;
301	status = "okay";
302};
303
304&pcie2x1l2 {
305	pinctrl-names = "default";
306	pinctrl-0 = <&pcie20x1_2_perstn_m0>;
307	reset-gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_HIGH>;
308	vpcie3v3-supply = <&vcc_3v3_s3>;
309	status = "okay";
310};
311
312&pinctrl {
313	keys {
314		btn_0: button-0 {
315			rockchip,pins = <4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
316		};
317	};
318
319	leds {
320		led_0: led-0 {
321			rockchip,pins = <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>;
322		};
323	};
324
325	pcie {
326		pcie20x1_1_perstn_m1: pcie-1 {
327			rockchip,pins = <4 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
328		};
329
330		pcie20x1_2_perstn_m0: pcie-2 {
331			rockchip,pins = <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
332		};
333	};
334
335	regulators {
336		vcc_5v0_pwren_h: regulator-5v0-1 {
337			rockchip,pins = <4 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
338		};
339	};
340
341	rtc {
342		rtc_int_l: rtc-0 {
343			rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
344		};
345	};
346
347	usb {
348		usb_otg_pwren_h: regulator-5v0-0 {
349			rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
350		};
351	};
352};
353
354&pwm11 {
355	pinctrl-names = "default";
356	pinctrl-0 = <&pwm11m1_pins>;
357	status = "okay";
358};
359
360&pwm14 {
361	pinctrl-names = "default";
362	pinctrl-0 = <&pwm14m1_pins>;
363	status = "okay";
364};
365
366&saradc {
367	vref-supply = <&vcca_1v8_s0>;
368	status = "okay";
369};
370
371&sdhci {
372	bus-width = <8>;
373	cap-mmc-highspeed;
374	mmc-hs400-1_8v;
375	mmc-hs400-enhanced-strobe;
376	no-sd;
377	no-sdio;
378	non-removable;
379	vmmc-supply = <&vcc_3v3_s0>;
380	vqmmc-supply = <&vcc_1v8_s3>;
381	status = "okay";
382};
383
384&sdmmc {
385	bus-width = <4>;
386	cap-mmc-highspeed;
387	cap-sd-highspeed;
388	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
389	disable-wp;
390	no-sdio;
391	sd-uhs-sdr104;
392	vmmc-supply = <&vcc_3v3_s3>;
393	vqmmc-supply = <&vccio_sd_s0>;
394	status = "okay";
395};
396
397&spi2 {
398	status = "okay";
399	assigned-clocks = <&cru CLK_SPI2>;
400	assigned-clock-rates = <200000000>;
401	num-cs = <1>;
402	pinctrl-names = "default";
403	pinctrl-0 = <&spi2m2_cs0 &spi2m2_pins>;
404
405	pmic@0 {
406		compatible = "rockchip,rk806";
407		reg = <0>;
408		gpio-controller;
409		#gpio-cells = <2>;
410		interrupt-parent = <&gpio0>;
411		interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
412		pinctrl-names = "default";
413		pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>,
414			    <&rk806_dvs2_null>, <&rk806_dvs3_null>;
415		spi-max-frequency = <1000000>;
416		system-power-controller;
417
418		vcc1-supply = <&vcc_sysin>;
419		vcc2-supply = <&vcc_sysin>;
420		vcc3-supply = <&vcc_sysin>;
421		vcc4-supply = <&vcc_sysin>;
422		vcc5-supply = <&vcc_sysin>;
423		vcc6-supply = <&vcc_sysin>;
424		vcc7-supply = <&vcc_sysin>;
425		vcc8-supply = <&vcc_sysin>;
426		vcc9-supply = <&vcc_sysin>;
427		vcc10-supply = <&vcc_sysin>;
428		vcc11-supply = <&vcc_2v0_pldo_s3>;
429		vcc12-supply = <&vcc_sysin>;
430		vcc13-supply = <&vcc_1v1_nldo_s3>;
431		vcc14-supply = <&vcc_1v1_nldo_s3>;
432		vcca-supply = <&vcca>;
433
434		rk806_dvs1_null: dvs1-null-pins {
435			pins = "gpio_pwrctrl1";
436			function = "pin_fun0";
437		};
438
439		rk806_dvs2_null: dvs2-null-pins {
440			pins = "gpio_pwrctrl2";
441			function = "pin_fun0";
442		};
443
444		rk806_dvs3_null: dvs3-null-pins {
445			pins = "gpio_pwrctrl3";
446			function = "pin_fun0";
447		};
448
449		regulators {
450			vdd_gpu_s0: dcdc-reg1 {
451				regulator-name = "vdd_gpu_s0";
452				regulator-boot-on;
453				regulator-min-microvolt = <550000>;
454				regulator-max-microvolt = <950000>;
455				regulator-ramp-delay = <12500>;
456				regulator-enable-ramp-delay = <400>;
457
458				regulator-state-mem {
459					regulator-off-in-suspend;
460				};
461			};
462
463			vdd_cpu_lit_s0: dcdc-reg2 {
464				regulator-name = "vdd_cpu_lit_s0";
465				regulator-always-on;
466				regulator-boot-on;
467				regulator-min-microvolt = <550000>;
468				regulator-max-microvolt = <950000>;
469				regulator-ramp-delay = <12500>;
470
471				regulator-state-mem {
472					regulator-off-in-suspend;
473				};
474			};
475
476			vdd_logic_s0: dcdc-reg3 {
477				regulator-name = "vdd_logic_s0";
478				regulator-always-on;
479				regulator-boot-on;
480				regulator-min-microvolt = <675000>;
481				regulator-max-microvolt = <750000>;
482				regulator-ramp-delay = <12500>;
483
484				regulator-state-mem {
485					regulator-on-in-suspend;
486					regulator-suspend-microvolt = <750000>;
487				};
488			};
489
490			vdd_vdenc_s0: dcdc-reg4 {
491				regulator-name = "vdd_vdenc_s0";
492				regulator-always-on;
493				regulator-boot-on;
494				regulator-min-microvolt = <550000>;
495				regulator-max-microvolt = <950000>;
496				regulator-ramp-delay = <12500>;
497
498				regulator-state-mem {
499					regulator-off-in-suspend;
500				};
501			};
502
503			vdd_ddr_s0: dcdc-reg5 {
504				regulator-name = "vdd_ddr_s0";
505				regulator-always-on;
506				regulator-boot-on;
507				regulator-min-microvolt = <675000>;
508				regulator-max-microvolt = <900000>;
509				regulator-ramp-delay = <12500>;
510
511				regulator-state-mem {
512					regulator-off-in-suspend;
513					regulator-suspend-microvolt = <850000>;
514				};
515			};
516
517			vdd2_ddr_s3: dcdc-reg6 {
518				regulator-name = "vdd2_ddr_s3";
519				regulator-always-on;
520				regulator-boot-on;
521
522				regulator-state-mem {
523					regulator-on-in-suspend;
524				};
525			};
526
527			vcc_2v0_pldo_s3: dcdc-reg7 {
528				regulator-name = "vcc_2v0_pldo_s3";
529				regulator-always-on;
530				regulator-boot-on;
531				regulator-min-microvolt = <2000000>;
532				regulator-max-microvolt = <2000000>;
533
534				regulator-state-mem {
535					regulator-on-in-suspend;
536					regulator-suspend-microvolt = <2000000>;
537				};
538			};
539
540			vcc_3v3_s3: dcdc-reg8 {
541				regulator-name = "vcc_3v3_s3";
542				regulator-always-on;
543				regulator-boot-on;
544				regulator-min-microvolt = <3300000>;
545				regulator-max-microvolt = <3300000>;
546
547				regulator-state-mem {
548					regulator-on-in-suspend;
549					regulator-suspend-microvolt = <3300000>;
550				};
551			};
552
553			vddq_ddr_s0: dcdc-reg9 {
554				regulator-name = "vddq_ddr_s0";
555				regulator-always-on;
556				regulator-boot-on;
557
558				regulator-state-mem {
559					regulator-off-in-suspend;
560				};
561			};
562
563			vcc_1v8_s3: dcdc-reg10 {
564				regulator-name = "vcc_1v8_s3";
565				regulator-always-on;
566				regulator-boot-on;
567				regulator-min-microvolt = <1800000>;
568				regulator-max-microvolt = <1800000>;
569
570				regulator-state-mem {
571					regulator-on-in-suspend;
572					regulator-suspend-microvolt = <1800000>;
573				};
574			};
575
576			vcc_1v8_s0: pldo-reg1 {
577				regulator-name = "vcc_1v8_s0";
578				regulator-always-on;
579				regulator-boot-on;
580				regulator-min-microvolt = <1800000>;
581				regulator-max-microvolt = <1800000>;
582
583				regulator-state-mem {
584					regulator-on-in-suspend;
585					regulator-suspend-microvolt = <1800000>;
586				};
587			};
588
589			vcca_1v8_s0: pldo-reg2 {
590				regulator-name = "vcca_1v8_s0";
591				regulator-always-on;
592				regulator-boot-on;
593				regulator-min-microvolt = <1800000>;
594				regulator-max-microvolt = <1800000>;
595
596				regulator-state-mem {
597					regulator-on-in-suspend;
598					regulator-suspend-microvolt = <1800000>;
599				};
600			};
601
602			vdda_1v2_s0: pldo-reg3 {
603				regulator-name = "vdda_1v2_s0";
604				regulator-always-on;
605				regulator-boot-on;
606				regulator-min-microvolt = <1200000>;
607				regulator-max-microvolt = <1200000>;
608
609				regulator-state-mem {
610					regulator-off-in-suspend;
611				};
612			};
613
614			vcca_3v3_s0: pldo-reg4 {
615				regulator-name = "vcca_3v3_s0";
616				regulator-always-on;
617				regulator-boot-on;
618				regulator-min-microvolt = <3300000>;
619				regulator-max-microvolt = <3300000>;
620
621				regulator-state-mem {
622					regulator-on-in-suspend;
623					regulator-suspend-microvolt = <3300000>;
624				};
625			};
626
627			vccio_sd_s0: pldo-reg5 {
628				regulator-name = "vccio_sd_s0";
629				regulator-always-on;
630				regulator-boot-on;
631				regulator-min-microvolt = <1800000>;
632				regulator-max-microvolt = <3300000>;
633
634				regulator-state-mem {
635					regulator-off-in-suspend;
636				};
637			};
638
639			pldo6_s3: pldo-reg6 {
640				regulator-name = "pldo6_s3";
641				regulator-always-on;
642				regulator-boot-on;
643				regulator-min-microvolt = <1800000>;
644				regulator-max-microvolt = <1800000>;
645
646				regulator-state-mem {
647					regulator-on-in-suspend;
648					regulator-suspend-microvolt = <1800000>;
649				};
650			};
651
652			vdd_0v75_s3: nldo-reg1 {
653				regulator-name = "vdd_0v75_s3";
654				regulator-always-on;
655				regulator-boot-on;
656				regulator-min-microvolt = <750000>;
657				regulator-max-microvolt = <750000>;
658
659				regulator-state-mem {
660					regulator-on-in-suspend;
661					regulator-suspend-microvolt = <750000>;
662				};
663			};
664
665			vdda_ddr_pll_s0: nldo-reg2 {
666				regulator-name = "vdda_ddr_pll_s0";
667				regulator-always-on;
668				regulator-boot-on;
669				regulator-min-microvolt = <850000>;
670				regulator-max-microvolt = <850000>;
671
672				regulator-state-mem {
673					regulator-on-in-suspend;
674					regulator-suspend-microvolt = <850000>;
675				};
676			};
677
678			vdda_0v75_s0: nldo-reg3 {
679				regulator-name = "vdda_0v75_s0";
680				regulator-always-on;
681				regulator-boot-on;
682				regulator-min-microvolt = <750000>;
683				regulator-max-microvolt = <750000>;
684
685				regulator-state-mem {
686					regulator-on-in-suspend;
687					regulator-suspend-microvolt = <750000>;
688				};
689			};
690
691			vdda_0v85_s0: nldo-reg4 {
692				regulator-name = "vdda_0v85_s0";
693				regulator-always-on;
694				regulator-boot-on;
695				regulator-min-microvolt = <850000>;
696				regulator-max-microvolt = <850000>;
697
698				regulator-state-mem {
699					regulator-off-in-suspend;
700				};
701			};
702
703			vdd_0v75_s0: nldo-reg5 {
704				regulator-name = "vdd_0v75_s0";
705				regulator-always-on;
706				regulator-boot-on;
707				regulator-min-microvolt = <750000>;
708				regulator-max-microvolt = <750000>;
709
710				regulator-state-mem {
711					regulator-off-in-suspend;
712				};
713			};
714		};
715	};
716};
717
718&tsadc {
719	status = "okay";
720};
721
722&u2phy0 {
723	status = "okay";
724};
725
726&u2phy0_otg {
727	phy-supply = <&vcc5v0_usb_otg0>;
728	status = "okay";
729};
730
731&uart2 {
732	pinctrl-0 = <&uart2m0_xfer>;
733	status = "okay";
734};
735
736&usb_host0_xhci {
737	dr_mode = "host";
738	status = "okay";
739};
740
741&usbdp_phy0 {
742	status = "okay";
743};
744