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