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