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	pinctrl-0 = <&i2s0_2ch_bus>;
436	rockchip,capture-channels = <2>;
437	rockchip,playback-channels = <2>;
438	status = "okay";
439};
440
441&i2s1 {
442	rockchip,playback-channels = <2>;
443	rockchip,capture-channels = <2>;
444	status = "okay";
445};
446
447&i2s2 {
448	status = "okay";
449};
450
451&io_domains {
452	status = "okay";
453
454	bt656-supply = <&vcc_3v0>;
455	audio-supply = <&vcc_3v0>;
456	sdmmc-supply = <&vcc_sdio>;
457	gpio1830-supply = <&vcc_3v0>;
458};
459
460&pmu_io_domains {
461	status = "okay";
462
463	pmu1830-supply = <&vcc_3v0>;
464};
465
466&pcie_phy {
467	status = "okay";
468};
469
470&pcie0 {
471	ep-gpios = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>;
472	max-link-speed = <2>;
473	num-lanes = <4>;
474	pinctrl-0 = <&pcie_clkreqnb_cpm>;
475	pinctrl-names = "default";
476	vpcie0v9-supply = <&vcc_0v9>;
477	vpcie1v8-supply = <&vcc_1v8>;
478	vpcie3v3-supply = <&vcc3v3_pcie>;
479	status = "okay";
480};
481
482&pinctrl {
483	bt {
484		bt_enable_h: bt-enable-h {
485			rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
486		};
487
488		bt_host_wake_l: bt-host-wake-l {
489			rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
490		};
491
492		bt_wake_l: bt-wake-l {
493			rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
494		};
495	};
496
497	pcie {
498		pcie_pwr_en: pcie-pwr-en {
499			rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
500		};
501	};
502
503	sdio0 {
504		sdio0_bus4: sdio0-bus4 {
505			rockchip,pins = <2 RK_PC4 1 &pcfg_pull_up_20ma>,
506					<2 RK_PC5 1 &pcfg_pull_up_20ma>,
507					<2 RK_PC6 1 &pcfg_pull_up_20ma>,
508					<2 RK_PC7 1 &pcfg_pull_up_20ma>;
509		};
510
511		sdio0_cmd: sdio0-cmd {
512			rockchip,pins = <2 RK_PD0 1 &pcfg_pull_up_20ma>;
513		};
514
515		sdio0_clk: sdio0-clk {
516			rockchip,pins = <2 RK_PD1 1 &pcfg_pull_none_20ma>;
517		};
518	};
519
520	pmic {
521		pmic_int_l: pmic-int-l {
522			rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
523		};
524
525		vsel1_pin: vsel1-pin {
526			rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
527		};
528
529		vsel2_pin: vsel2-pin {
530			rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
531		};
532	};
533
534	usb-typec {
535		vcc5v0_typec_en: vcc5v0-typec-en {
536			rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
537		};
538	};
539
540	usb2 {
541		vcc5v0_host_en: vcc5v0-host-en {
542			rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
543		};
544	};
545
546	wifi {
547		wifi_enable_h: wifi-enable-h {
548			rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
549		};
550
551		wifi_host_wake_l: wifi-host-wake-l {
552			rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
553		};
554	};
555};
556
557&pwm2 {
558	status = "okay";
559};
560
561&saradc {
562	status = "okay";
563
564	vref-supply = <&vcc_1v8>;
565};
566
567&sdio0 {
568	#address-cells = <1>;
569	#size-cells = <0>;
570	bus-width = <4>;
571	clock-frequency = <50000000>;
572	cap-sdio-irq;
573	cap-sd-highspeed;
574	keep-power-in-suspend;
575	mmc-pwrseq = <&sdio_pwrseq>;
576	non-removable;
577	pinctrl-names = "default";
578	pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
579	sd-uhs-sdr104;
580};
581
582&sdmmc {
583	bus-width = <4>;
584	cap-mmc-highspeed;
585	cap-sd-highspeed;
586	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
587	disable-wp;
588	max-frequency = <150000000>;
589	pinctrl-names = "default";
590	pinctrl-0 = <&sdmmc_clk &sdmmc_cd &sdmmc_cmd &sdmmc_bus4>;
591	status = "okay";
592};
593
594&sdhci {
595	bus-width = <8>;
596	mmc-hs400-1_8v;
597	mmc-hs400-enhanced-strobe;
598	non-removable;
599	status = "okay";
600};
601
602&tcphy0 {
603	status = "okay";
604};
605
606&tcphy1 {
607	status = "okay";
608};
609
610&tsadc {
611	status = "okay";
612
613	/* tshut mode 0:CRU 1:GPIO */
614	rockchip,hw-tshut-mode = <1>;
615	/* tshut polarity 0:LOW 1:HIGH */
616	rockchip,hw-tshut-polarity = <1>;
617};
618
619&u2phy0 {
620	status = "okay";
621
622	u2phy0_otg: otg-port {
623		status = "okay";
624	};
625
626	u2phy0_host: host-port {
627		phy-supply = <&vcc5v0_host>;
628		status = "okay";
629	};
630};
631
632&u2phy1 {
633	status = "okay";
634
635	u2phy1_otg: otg-port {
636		status = "okay";
637	};
638
639	u2phy1_host: host-port {
640		phy-supply = <&vcc5v0_host>;
641		status = "okay";
642	};
643};
644
645&uart0 {
646	pinctrl-names = "default";
647	pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
648};
649
650&uart2 {
651	status = "okay";
652};
653
654&usb_host0_ehci {
655	status = "okay";
656};
657
658&usb_host0_ohci {
659	status = "okay";
660};
661
662&usb_host1_ehci {
663	status = "okay";
664};
665
666&usb_host1_ohci {
667	status = "okay";
668};
669
670&usbdrd3_0 {
671	status = "okay";
672};
673
674&usbdrd_dwc3_0 {
675	status = "okay";
676	dr_mode = "host";
677};
678
679&usbdrd3_1 {
680	status = "okay";
681};
682
683&usbdrd_dwc3_1 {
684	status = "okay";
685	dr_mode = "host";
686};
687
688&vopb {
689	status = "okay";
690};
691
692&vopb_mmu {
693	status = "okay";
694};
695
696&vopl {
697	status = "okay";
698};
699
700&vopl_mmu {
701	status = "okay";
702};
703