1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2019 Akash Gajjar <Akash_Gajjar@mentor.com>
4 * Copyright (c) 2019 Pragnesh Patel <Pragnesh_Patel@mentor.com>
5 */
6
7/dts-v1/;
8#include <dt-bindings/input/linux-event-codes.h>
9#include <dt-bindings/pwm/pwm.h>
10#include "rk3399.dtsi"
11#include "rk3399-opp.dtsi"
12
13/ {
14	chosen {
15		stdout-path = "serial2:1500000n8";
16	};
17
18	clkin_gmac: external-gmac-clock {
19		compatible = "fixed-clock";
20		clock-frequency = <125000000>;
21		clock-output-names = "clkin_gmac";
22		#clock-cells = <0>;
23	};
24
25	sdio_pwrseq: sdio-pwrseq {
26		compatible = "mmc-pwrseq-simple";
27		clocks = <&rk808 1>;
28		clock-names = "ext_clock";
29		pinctrl-names = "default";
30		pinctrl-0 = <&wifi_enable_h>;
31		reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
32	};
33
34	vcc12v_dcin: dc-12v {
35		compatible = "regulator-fixed";
36		regulator-name = "vcc12v_dcin";
37		regulator-always-on;
38		regulator-boot-on;
39		regulator-min-microvolt = <12000000>;
40		regulator-max-microvolt = <12000000>;
41	};
42
43	vcc5v0_sys: vcc-sys {
44		compatible = "regulator-fixed";
45		regulator-name = "vcc5v0_sys";
46		regulator-always-on;
47		regulator-boot-on;
48		regulator-min-microvolt = <5000000>;
49		regulator-max-microvolt = <5000000>;
50		vin-supply = <&vcc12v_dcin>;
51	};
52
53	vcc_0v9: vcc-0v9 {
54		compatible = "regulator-fixed";
55		regulator-name = "vcc_0v9";
56		regulator-always-on;
57		regulator-boot-on;
58		regulator-min-microvolt = <900000>;
59		regulator-max-microvolt = <900000>;
60		vin-supply = <&vcc3v3_sys>;
61	};
62
63	vcc3v3_pcie: vcc3v3-pcie-regulator {
64		compatible = "regulator-fixed";
65		enable-active-high;
66		gpio = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>;
67		pinctrl-names = "default";
68		pinctrl-0 = <&pcie_pwr_en>;
69		regulator-name = "vcc3v3_pcie";
70		regulator-always-on;
71		regulator-boot-on;
72		vin-supply = <&vcc5v0_sys>;
73	};
74
75	vcc3v3_sys: vcc3v3-sys {
76		compatible = "regulator-fixed";
77		regulator-name = "vcc3v3_sys";
78		regulator-always-on;
79		regulator-boot-on;
80		regulator-min-microvolt = <3300000>;
81		regulator-max-microvolt = <3300000>;
82		vin-supply = <&vcc5v0_sys>;
83	};
84
85	vcc5v0_host: vcc5v0-host-regulator {
86		compatible = "regulator-fixed";
87		enable-active-high;
88		gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>;
89		pinctrl-names = "default";
90		pinctrl-0 = <&vcc5v0_host_en>;
91		regulator-name = "vcc5v0_host";
92		regulator-always-on;
93		vin-supply = <&vcc5v0_sys>;
94	};
95
96	vcc5v0_typec: vcc5v0-typec-regulator {
97		compatible = "regulator-fixed";
98		enable-active-high;
99		gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
100		pinctrl-names = "default";
101		pinctrl-0 = <&vcc5v0_typec_en>;
102		regulator-name = "vcc5v0_typec";
103		regulator-always-on;
104		vin-supply = <&vcc5v0_sys>;
105	};
106
107	vcc_lan: vcc3v3-phy-regulator {
108		compatible = "regulator-fixed";
109		regulator-name = "vcc_lan";
110		regulator-always-on;
111		regulator-boot-on;
112		regulator-min-microvolt = <3300000>;
113		regulator-max-microvolt = <3300000>;
114	};
115
116	vdd_log: vdd-log {
117		compatible = "pwm-regulator";
118		pwms = <&pwm2 0 25000 1>;
119		regulator-name = "vdd_log";
120		regulator-always-on;
121		regulator-boot-on;
122		regulator-min-microvolt = <800000>;
123		regulator-max-microvolt = <1400000>;
124		vin-supply = <&vcc5v0_sys>;
125	};
126};
127
128&cpu_l0 {
129	cpu-supply = <&vdd_cpu_l>;
130};
131
132&cpu_l1 {
133	cpu-supply = <&vdd_cpu_l>;
134};
135
136&cpu_l2 {
137	cpu-supply = <&vdd_cpu_l>;
138};
139
140&cpu_l3 {
141	cpu-supply = <&vdd_cpu_l>;
142};
143
144&cpu_b0 {
145	cpu-supply = <&vdd_cpu_b>;
146};
147
148&cpu_b1 {
149	cpu-supply = <&vdd_cpu_b>;
150};
151
152&emmc_phy {
153	status = "okay";
154};
155
156&gmac {
157	assigned-clocks = <&cru SCLK_RMII_SRC>;
158	assigned-clock-parents = <&clkin_gmac>;
159	clock_in_out = "input";
160	phy-supply = <&vcc_lan>;
161	phy-mode = "rgmii";
162	pinctrl-names = "default";
163	pinctrl-0 = <&rgmii_pins>;
164	snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
165	snps,reset-active-low;
166	snps,reset-delays-us = <0 10000 50000>;
167	tx_delay = <0x28>;
168	rx_delay = <0x11>;
169	status = "okay";
170};
171
172&gpu {
173	mali-supply = <&vdd_gpu>;
174	status = "okay";
175};
176
177&hdmi {
178	ddc-i2c-bus = <&i2c3>;
179	pinctrl-names = "default";
180	pinctrl-0 = <&hdmi_cec>;
181	status = "okay";
182};
183
184&hdmi_sound {
185	status = "okay";
186};
187
188&i2c0 {
189	clock-frequency = <400000>;
190	i2c-scl-rising-time-ns = <168>;
191	i2c-scl-falling-time-ns = <4>;
192	status = "okay";
193
194	rk808: pmic@1b {
195		compatible = "rockchip,rk808";
196		reg = <0x1b>;
197		interrupt-parent = <&gpio1>;
198		interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
199		#clock-cells = <1>;
200		clock-output-names = "xin32k", "rk808-clkout2";
201		pinctrl-names = "default";
202		pinctrl-0 = <&pmic_int_l>;
203		rockchip,system-power-controller;
204		wakeup-source;
205
206		vcc1-supply = <&vcc5v0_sys>;
207		vcc2-supply = <&vcc5v0_sys>;
208		vcc3-supply = <&vcc5v0_sys>;
209		vcc4-supply = <&vcc5v0_sys>;
210		vcc6-supply = <&vcc5v0_sys>;
211		vcc7-supply = <&vcc5v0_sys>;
212		vcc8-supply = <&vcc3v3_sys>;
213		vcc9-supply = <&vcc5v0_sys>;
214		vcc10-supply = <&vcc5v0_sys>;
215		vcc11-supply = <&vcc5v0_sys>;
216		vcc12-supply = <&vcc3v3_sys>;
217		vddio-supply = <&vcc_1v8>;
218
219		regulators {
220			vdd_center: DCDC_REG1 {
221				regulator-name = "vdd_center";
222				regulator-always-on;
223				regulator-boot-on;
224				regulator-min-microvolt = <750000>;
225				regulator-max-microvolt = <1350000>;
226				regulator-ramp-delay = <6001>;
227				regulator-state-mem {
228					regulator-off-in-suspend;
229				};
230			};
231
232			vdd_cpu_l: DCDC_REG2 {
233				regulator-name = "vdd_cpu_l";
234				regulator-always-on;
235				regulator-boot-on;
236				regulator-min-microvolt = <750000>;
237				regulator-max-microvolt = <1350000>;
238				regulator-ramp-delay = <6001>;
239				regulator-state-mem {
240					regulator-off-in-suspend;
241				};
242			};
243
244			vcc_ddr: DCDC_REG3 {
245				regulator-name = "vcc_ddr";
246				regulator-always-on;
247				regulator-boot-on;
248				regulator-state-mem {
249					regulator-on-in-suspend;
250				};
251			};
252
253			vcc_1v8: DCDC_REG4 {
254				regulator-name = "vcc_1v8";
255				regulator-always-on;
256				regulator-boot-on;
257				regulator-min-microvolt = <1800000>;
258				regulator-max-microvolt = <1800000>;
259				regulator-state-mem {
260					regulator-on-in-suspend;
261					regulator-suspend-microvolt = <1800000>;
262				};
263			};
264
265			vcc1v8_codec: LDO_REG1 {
266				regulator-name = "vcc1v8_codec";
267				regulator-always-on;
268				regulator-boot-on;
269				regulator-min-microvolt = <1800000>;
270				regulator-max-microvolt = <1800000>;
271				regulator-state-mem {
272					regulator-off-in-suspend;
273				};
274			};
275
276			vcc1v8_hdmi: LDO_REG2 {
277				regulator-name = "vcc1v8_hdmi";
278				regulator-always-on;
279				regulator-boot-on;
280				regulator-min-microvolt = <1800000>;
281				regulator-max-microvolt = <1800000>;
282				regulator-state-mem {
283					regulator-off-in-suspend;
284				};
285			};
286
287			vcca_1v8: LDO_REG3 {
288				regulator-name = "vcca_1v8";
289				regulator-always-on;
290				regulator-boot-on;
291				regulator-min-microvolt = <1800000>;
292				regulator-max-microvolt = <1800000>;
293				regulator-state-mem {
294					regulator-on-in-suspend;
295					regulator-suspend-microvolt = <1800000>;
296				};
297			};
298
299			vcc_sdio: LDO_REG4 {
300				regulator-name = "vcc_sdio";
301				regulator-always-on;
302				regulator-boot-on;
303				regulator-min-microvolt = <3000000>;
304				regulator-max-microvolt = <3000000>;
305				regulator-state-mem {
306					regulator-on-in-suspend;
307					regulator-suspend-microvolt = <3000000>;
308				};
309			};
310
311			vcca3v0_codec: LDO_REG5 {
312				regulator-name = "vcca3v0_codec";
313				regulator-always-on;
314				regulator-boot-on;
315				regulator-min-microvolt = <3000000>;
316				regulator-max-microvolt = <3000000>;
317				regulator-state-mem {
318					regulator-off-in-suspend;
319				};
320			};
321
322			vcc_1v5: LDO_REG6 {
323				regulator-name = "vcc_1v5";
324				regulator-always-on;
325				regulator-boot-on;
326				regulator-min-microvolt = <1500000>;
327				regulator-max-microvolt = <1500000>;
328				regulator-state-mem {
329					regulator-on-in-suspend;
330					regulator-suspend-microvolt = <1500000>;
331				};
332			};
333
334			vcc0v9_hdmi: LDO_REG7 {
335				regulator-name = "vcc0v9_hdmi";
336				regulator-always-on;
337				regulator-boot-on;
338				regulator-min-microvolt = <900000>;
339				regulator-max-microvolt = <900000>;
340				regulator-state-mem {
341					regulator-off-in-suspend;
342				};
343			};
344
345			vcc_3v0: LDO_REG8 {
346				regulator-name = "vcc_3v0";
347				regulator-always-on;
348				regulator-boot-on;
349				regulator-min-microvolt = <3000000>;
350				regulator-max-microvolt = <3000000>;
351				regulator-state-mem {
352					regulator-on-in-suspend;
353					regulator-suspend-microvolt = <3000000>;
354				};
355			};
356
357			vcc_cam: SWITCH_REG1 {
358				regulator-name = "vcc_cam";
359				regulator-always-on;
360				regulator-boot-on;
361				regulator-state-mem {
362					regulator-off-in-suspend;
363				};
364			};
365
366			vcc_mipi: SWITCH_REG2 {
367				regulator-name = "vcc_mipi";
368				regulator-always-on;
369				regulator-boot-on;
370				regulator-state-mem {
371					regulator-off-in-suspend;
372				};
373			};
374		};
375	};
376
377	vdd_cpu_b: regulator@40 {
378		compatible = "silergy,syr827";
379		reg = <0x40>;
380		fcs,suspend-voltage-selector = <1>;
381		pinctrl-names = "default";
382		pinctrl-0 = <&vsel1_pin>;
383		regulator-name = "vdd_cpu_b";
384		regulator-min-microvolt = <712500>;
385		regulator-max-microvolt = <1500000>;
386		regulator-ramp-delay = <1000>;
387		regulator-always-on;
388		regulator-boot-on;
389		vin-supply = <&vcc5v0_sys>;
390
391		regulator-state-mem {
392			regulator-off-in-suspend;
393		};
394	};
395
396	vdd_gpu: regulator@41 {
397		compatible = "silergy,syr828";
398		reg = <0x41>;
399		fcs,suspend-voltage-selector = <1>;
400		pinctrl-names = "default";
401		pinctrl-0 = <&vsel2_pin>;
402		regulator-name = "vdd_gpu";
403		regulator-min-microvolt = <712500>;
404		regulator-max-microvolt = <1500000>;
405		regulator-ramp-delay = <1000>;
406		regulator-always-on;
407		regulator-boot-on;
408		vin-supply = <&vcc5v0_sys>;
409
410		regulator-state-mem {
411			regulator-off-in-suspend;
412		};
413	};
414};
415
416&i2c1 {
417	i2c-scl-rising-time-ns = <300>;
418	i2c-scl-falling-time-ns = <15>;
419	status = "okay";
420};
421
422&i2c3 {
423	i2c-scl-rising-time-ns = <450>;
424	i2c-scl-falling-time-ns = <15>;
425	status = "okay";
426};
427
428&i2c4 {
429	i2c-scl-rising-time-ns = <600>;
430	i2c-scl-falling-time-ns = <20>;
431	status = "okay";
432};
433
434&i2s0 {
435	rockchip,playback-channels = <8>;
436	rockchip,capture-channels = <8>;
437	status = "okay";
438};
439
440&i2s1 {
441	rockchip,playback-channels = <2>;
442	rockchip,capture-channels = <2>;
443	status = "okay";
444};
445
446&i2s2 {
447	status = "okay";
448};
449
450&io_domains {
451	status = "okay";
452
453	bt656-supply = <&vcc_3v0>;
454	audio-supply = <&vcc_3v0>;
455	sdmmc-supply = <&vcc_sdio>;
456	gpio1830-supply = <&vcc_3v0>;
457};
458
459&pmu_io_domains {
460	status = "okay";
461
462	pmu1830-supply = <&vcc_3v0>;
463};
464
465&pcie_phy {
466	status = "okay";
467};
468
469&pcie0 {
470	ep-gpios = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>;
471	max-link-speed = <2>;
472	num-lanes = <4>;
473	pinctrl-0 = <&pcie_clkreqnb_cpm>;
474	pinctrl-names = "default";
475	vpcie0v9-supply = <&vcc_0v9>;
476	vpcie1v8-supply = <&vcc_1v8>;
477	vpcie3v3-supply = <&vcc3v3_pcie>;
478	status = "okay";
479};
480
481&pinctrl {
482	bt {
483		bt_enable_h: bt-enable-h {
484			rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
485		};
486
487		bt_host_wake_l: bt-host-wake-l {
488			rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
489		};
490
491		bt_wake_l: bt-wake-l {
492			rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
493		};
494	};
495
496	pcie {
497		pcie_pwr_en: pcie-pwr-en {
498			rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
499		};
500	};
501
502	sdio0 {
503		sdio0_bus4: sdio0-bus4 {
504			rockchip,pins = <2 RK_PC4 1 &pcfg_pull_up_20ma>,
505					<2 RK_PC5 1 &pcfg_pull_up_20ma>,
506					<2 RK_PC6 1 &pcfg_pull_up_20ma>,
507					<2 RK_PC7 1 &pcfg_pull_up_20ma>;
508		};
509
510		sdio0_cmd: sdio0-cmd {
511			rockchip,pins = <2 RK_PD0 1 &pcfg_pull_up_20ma>;
512		};
513
514		sdio0_clk: sdio0-clk {
515			rockchip,pins = <2 RK_PD1 1 &pcfg_pull_none_20ma>;
516		};
517	};
518
519	pmic {
520		pmic_int_l: pmic-int-l {
521			rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
522		};
523
524		vsel1_pin: vsel1-pin {
525			rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
526		};
527
528		vsel2_pin: vsel2-pin {
529			rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
530		};
531	};
532
533	usb-typec {
534		vcc5v0_typec_en: vcc5v0-typec-en {
535			rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
536		};
537	};
538
539	usb2 {
540		vcc5v0_host_en: vcc5v0-host-en {
541			rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
542		};
543	};
544
545	wifi {
546		wifi_enable_h: wifi-enable-h {
547			rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
548		};
549
550		wifi_host_wake_l: wifi-host-wake-l {
551			rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
552		};
553	};
554};
555
556&pwm2 {
557	status = "okay";
558};
559
560&saradc {
561	status = "okay";
562
563	vref-supply = <&vcc_1v8>;
564};
565
566&sdio0 {
567	#address-cells = <1>;
568	#size-cells = <0>;
569	bus-width = <4>;
570	clock-frequency = <50000000>;
571	cap-sdio-irq;
572	cap-sd-highspeed;
573	keep-power-in-suspend;
574	mmc-pwrseq = <&sdio_pwrseq>;
575	non-removable;
576	pinctrl-names = "default";
577	pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
578	sd-uhs-sdr104;
579};
580
581&sdmmc {
582	bus-width = <4>;
583	cap-mmc-highspeed;
584	cap-sd-highspeed;
585	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
586	disable-wp;
587	max-frequency = <150000000>;
588	pinctrl-names = "default";
589	pinctrl-0 = <&sdmmc_clk &sdmmc_cd &sdmmc_cmd &sdmmc_bus4>;
590	status = "okay";
591};
592
593&sdhci {
594	bus-width = <8>;
595	mmc-hs400-1_8v;
596	mmc-hs400-enhanced-strobe;
597	non-removable;
598	status = "okay";
599};
600
601&tcphy0 {
602	status = "okay";
603};
604
605&tcphy1 {
606	status = "okay";
607};
608
609&tsadc {
610	status = "okay";
611
612	/* tshut mode 0:CRU 1:GPIO */
613	rockchip,hw-tshut-mode = <1>;
614	/* tshut polarity 0:LOW 1:HIGH */
615	rockchip,hw-tshut-polarity = <1>;
616};
617
618&u2phy0 {
619	status = "okay";
620
621	u2phy0_otg: otg-port {
622		status = "okay";
623	};
624
625	u2phy0_host: host-port {
626		phy-supply = <&vcc5v0_host>;
627		status = "okay";
628	};
629};
630
631&u2phy1 {
632	status = "okay";
633
634	u2phy1_otg: otg-port {
635		status = "okay";
636	};
637
638	u2phy1_host: host-port {
639		phy-supply = <&vcc5v0_host>;
640		status = "okay";
641	};
642};
643
644&uart0 {
645	pinctrl-names = "default";
646	pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
647};
648
649&uart2 {
650	status = "okay";
651};
652
653&usb_host0_ehci {
654	status = "okay";
655};
656
657&usb_host0_ohci {
658	status = "okay";
659};
660
661&usb_host1_ehci {
662	status = "okay";
663};
664
665&usb_host1_ohci {
666	status = "okay";
667};
668
669&usbdrd3_0 {
670	status = "okay";
671};
672
673&usbdrd_dwc3_0 {
674	status = "okay";
675	dr_mode = "otg";
676};
677
678&usbdrd3_1 {
679	status = "okay";
680};
681
682&usbdrd_dwc3_1 {
683	status = "okay";
684	dr_mode = "host";
685};
686
687&vopb {
688	status = "okay";
689};
690
691&vopb_mmu {
692	status = "okay";
693};
694
695&vopl {
696	status = "okay";
697};
698
699&vopl_mmu {
700	status = "okay";
701};
702