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