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