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