xref: /OK3568_Linux_fs/kernel/arch/arm64/boot/dts/rockchip/rk3399-sapphire.dtsi (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
4 */
5
6#include "dt-bindings/usb/pd.h"
7#include "dt-bindings/pwm/pwm.h"
8#include "dt-bindings/input/input.h"
9#include "rk3399.dtsi"
10#include "rk3399-opp.dtsi"
11
12/ {
13	compatible = "rockchip,rk3399-sapphire", "rockchip,rk3399";
14
15	chosen {
16		stdout-path = "serial2:1500000n8";
17	};
18
19	adc_keys: adc-keys {
20		compatible = "adc-keys";
21		io-channels = <&saradc 1>;
22		io-channel-names = "buttons";
23		keyup-threshold-microvolt = <1800000>;
24		poll-interval = <100>;
25
26		vol-up-key {
27			label = "volume up";
28			linux,code = <KEY_VOLUMEUP>;
29			press-threshold-microvolt = <1750>;
30		};
31
32		vol-down-key {
33			label = "volume down";
34			linux,code = <KEY_VOLUMEDOWN>;
35			press-threshold-microvolt = <297500>;
36		};
37
38		menu-key {
39			label = "menu";
40			linux,code = <KEY_MENU>;
41			press-threshold-microvolt = <1305500>;
42		};
43
44		home-key {
45			label = "home";
46			linux,code = <KEY_HOME>;
47			press-threshold-microvolt = <621250>;
48		};
49
50		back-key {
51			label = "back";
52			linux,code = <KEY_BACK>;
53			press-threshold-microvolt = <980000>;
54		};
55
56		camera-key {
57			label = "camera";
58			linux,code = <KEY_CAMERA>;
59			press-threshold-microvolt = <787500>;
60		};
61	};
62
63	clkin_gmac: external-gmac-clock {
64		compatible = "fixed-clock";
65		clock-frequency = <125000000>;
66		clock-output-names = "clkin_gmac";
67		#clock-cells = <0>;
68	};
69
70	dc_12v: dc-12v {
71		compatible = "regulator-fixed";
72		regulator-name = "dc_12v";
73		regulator-always-on;
74		regulator-boot-on;
75		regulator-min-microvolt = <12000000>;
76		regulator-max-microvolt = <12000000>;
77	};
78
79	/*
80	 * The fan power supply comes from the baseboard.
81	 * For the standalone Sapphire one option is to connect a wire
82	 * from  R90030 DNP R0805 pin2  to  C90002 10uF C0805 pin1 (vcc_sys).
83	 */
84	fan0: gpio-fan {
85		#cooling-cells = <2>;
86		compatible = "gpio-fan";
87		gpio-fan,speed-map = <0 0 3000 1>;
88		gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>;
89		status = "okay";
90	};
91
92	keys: gpio-keys {
93		compatible = "gpio-keys";
94		autorepeat;
95
96		power {
97			debounce-interval = <100>;
98			gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
99			label = "GPIO Power";
100			linux,code = <KEY_POWER>;
101			linux,input-type = <1>;
102			pinctrl-names = "default";
103			pinctrl-0 = <&pwr_btn>;
104			wakeup-source;
105		};
106	};
107
108	/* switched by pmic_sleep */
109	vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 {
110		compatible = "regulator-fixed";
111		regulator-name = "vcc1v8_s3";
112		regulator-always-on;
113		regulator-boot-on;
114		regulator-min-microvolt = <1800000>;
115		regulator-max-microvolt = <1800000>;
116		vin-supply = <&vcc_1v8>;
117	};
118
119	vcc3v0_sd: vcc3v0-sd {
120		compatible = "regulator-fixed";
121		enable-active-high;
122		gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
123		pinctrl-names = "default";
124		pinctrl-0 = <&sdmmc0_pwr_h>;
125		regulator-always-on;
126		regulator-max-microvolt = <3000000>;
127		regulator-min-microvolt = <3000000>;
128		regulator-name = "vcc3v0_sd";
129		vin-supply = <&vcc3v3_sys>;
130	};
131
132	vcc3v3_sys: vcc3v3-sys {
133		compatible = "regulator-fixed";
134		regulator-name = "vcc3v3_sys";
135		regulator-always-on;
136		regulator-boot-on;
137		regulator-min-microvolt = <3300000>;
138		regulator-max-microvolt = <3300000>;
139		vin-supply = <&vcc_sys>;
140	};
141
142	vcc5v0_host: vcc5v0-host-regulator {
143		compatible = "regulator-fixed";
144		enable-active-high;
145		gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>;
146		pinctrl-names = "default";
147		pinctrl-0 = <&vcc5v0_host_en>;
148		regulator-name = "vcc5v0_host";
149		regulator-always-on;
150		vin-supply = <&vcc_sys>;
151	};
152
153	vcc5v0_typec0: vcc5v0-typec0-regulator {
154		compatible = "regulator-fixed";
155		enable-active-high;
156		gpio = <&gpio2 RK_PA0 GPIO_ACTIVE_HIGH>;
157		pinctrl-names = "default";
158		pinctrl-0 = <&vcc5v0_typec0_en>;
159		regulator-name = "vcc5v0_typec0";
160		vin-supply = <&vcc_sys>;
161	};
162
163	vcc_sys: vcc-sys {
164		compatible = "regulator-fixed";
165		regulator-name = "vcc_sys";
166		regulator-always-on;
167		regulator-boot-on;
168		regulator-min-microvolt = <5000000>;
169		regulator-max-microvolt = <5000000>;
170		vin-supply = <&dc_12v>;
171	};
172
173	vdd_log: vdd-log {
174		compatible = "pwm-regulator";
175		pwms = <&pwm2 0 25000 1>;
176		regulator-name = "vdd_log";
177		regulator-always-on;
178		regulator-boot-on;
179		regulator-min-microvolt = <800000>;
180		regulator-max-microvolt = <1400000>;
181		vin-supply = <&vcc_sys>;
182	};
183};
184
185&cdn_dp {
186	status = "okay";
187	phys = <&tcphy0_dp>;
188};
189
190&cpu_l0 {
191	cpu-supply = <&vdd_cpu_l>;
192};
193
194&cpu_l1 {
195	cpu-supply = <&vdd_cpu_l>;
196};
197
198&cpu_l2 {
199	cpu-supply = <&vdd_cpu_l>;
200};
201
202&cpu_l3 {
203	cpu-supply = <&vdd_cpu_l>;
204};
205
206&cpu_b0 {
207	cpu-supply = <&vdd_cpu_b>;
208};
209
210&cpu_b1 {
211	cpu-supply = <&vdd_cpu_b>;
212};
213
214&cpu_thermal {
215	trips {
216		cpu_hot: cpu_hot {
217			hysteresis = <10000>;
218			temperature = <55000>;
219			type = "active";
220		};
221	};
222
223	cooling-maps {
224		map2 {
225			cooling-device =
226				<&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
227			trip = <&cpu_hot>;
228		};
229	};
230};
231
232&emmc_phy {
233	status = "okay";
234};
235
236&gmac {
237	assigned-clocks = <&cru SCLK_RMII_SRC>;
238	assigned-clock-parents = <&clkin_gmac>;
239	clock_in_out = "input";
240	phy-supply = <&vcc_lan>;
241	phy-mode = "rgmii";
242	pinctrl-names = "default";
243	pinctrl-0 = <&rgmii_pins>;
244	snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
245	snps,reset-active-low;
246	snps,reset-delays-us = <0 10000 50000>;
247	tx_delay = <0x28>;
248	rx_delay = <0x11>;
249	status = "okay";
250};
251
252&gpu {
253	mali-supply = <&vdd_gpu>;
254	status = "okay";
255};
256
257&hdmi {
258	status = "okay";
259};
260
261&hdmi_sound {
262	status = "okay";
263};
264
265&i2c0 {
266	clock-frequency = <400000>;
267	i2c-scl-rising-time-ns = <168>;
268	i2c-scl-falling-time-ns = <4>;
269	status = "okay";
270
271	rk808: pmic@1b {
272		compatible = "rockchip,rk808";
273		reg = <0x1b>;
274		interrupt-parent = <&gpio1>;
275		interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
276		#clock-cells = <1>;
277		clock-output-names = "xin32k", "rk808-clkout2";
278		pinctrl-names = "default";
279		pinctrl-0 = <&pmic_int_l>;
280		rockchip,system-power-controller;
281		wakeup-source;
282
283		vcc1-supply = <&vcc_sys>;
284		vcc2-supply = <&vcc_sys>;
285		vcc3-supply = <&vcc_sys>;
286		vcc4-supply = <&vcc_sys>;
287		vcc6-supply = <&vcc_sys>;
288		vcc7-supply = <&vcc_sys>;
289		vcc8-supply = <&vcc3v3_sys>;
290		vcc9-supply = <&vcc_sys>;
291		vcc10-supply = <&vcc_sys>;
292		vcc11-supply = <&vcc_sys>;
293		vcc12-supply = <&vcc3v3_sys>;
294		vddio-supply = <&vcc1v8_pmu>;
295
296		regulators {
297			vdd_center: DCDC_REG1 {
298				regulator-name = "vdd_center";
299				regulator-always-on;
300				regulator-boot-on;
301				regulator-min-microvolt = <750000>;
302				regulator-max-microvolt = <1350000>;
303				regulator-ramp-delay = <6001>;
304				regulator-state-mem {
305					regulator-off-in-suspend;
306				};
307			};
308
309			vdd_cpu_l: DCDC_REG2 {
310				regulator-name = "vdd_cpu_l";
311				regulator-always-on;
312				regulator-boot-on;
313				regulator-min-microvolt = <750000>;
314				regulator-max-microvolt = <1350000>;
315				regulator-ramp-delay = <6001>;
316				regulator-state-mem {
317					regulator-off-in-suspend;
318				};
319			};
320
321			vcc_ddr: DCDC_REG3 {
322				regulator-name = "vcc_ddr";
323				regulator-always-on;
324				regulator-boot-on;
325				regulator-state-mem {
326					regulator-on-in-suspend;
327				};
328			};
329
330			vcc_1v8: DCDC_REG4 {
331				regulator-name = "vcc_1v8";
332				regulator-always-on;
333				regulator-boot-on;
334				regulator-min-microvolt = <1800000>;
335				regulator-max-microvolt = <1800000>;
336				regulator-state-mem {
337					regulator-on-in-suspend;
338					regulator-suspend-microvolt = <1800000>;
339				};
340			};
341
342			vcc1v8_dvp: LDO_REG1 {
343				regulator-name = "vcc1v8_dvp";
344				regulator-always-on;
345				regulator-boot-on;
346				regulator-min-microvolt = <1800000>;
347				regulator-max-microvolt = <1800000>;
348				regulator-state-mem {
349					regulator-off-in-suspend;
350				};
351			};
352
353			vcc3v0_tp: LDO_REG2 {
354				regulator-name = "vcc3v0_tp";
355				regulator-always-on;
356				regulator-boot-on;
357				regulator-min-microvolt = <3000000>;
358				regulator-max-microvolt = <3000000>;
359				regulator-state-mem {
360					regulator-off-in-suspend;
361				};
362			};
363
364			vcc1v8_pmu: LDO_REG3 {
365				regulator-name = "vcc1v8_pmu";
366				regulator-always-on;
367				regulator-boot-on;
368				regulator-min-microvolt = <1800000>;
369				regulator-max-microvolt = <1800000>;
370				regulator-state-mem {
371					regulator-on-in-suspend;
372					regulator-suspend-microvolt = <1800000>;
373				};
374			};
375
376			vcc_sdio: LDO_REG4 {
377				regulator-name = "vcc_sdio";
378				regulator-always-on;
379				regulator-boot-on;
380				regulator-min-microvolt = <1800000>;
381				regulator-max-microvolt = <3300000>;
382				regulator-state-mem {
383					regulator-on-in-suspend;
384					regulator-suspend-microvolt = <3000000>;
385				};
386			};
387
388			vcca3v0_codec: LDO_REG5 {
389				regulator-name = "vcca3v0_codec";
390				regulator-always-on;
391				regulator-boot-on;
392				regulator-min-microvolt = <3000000>;
393				regulator-max-microvolt = <3000000>;
394				regulator-state-mem {
395					regulator-off-in-suspend;
396				};
397			};
398
399			vcc_1v5: LDO_REG6 {
400				regulator-name = "vcc_1v5";
401				regulator-always-on;
402				regulator-boot-on;
403				regulator-min-microvolt = <1500000>;
404				regulator-max-microvolt = <1500000>;
405				regulator-state-mem {
406					regulator-on-in-suspend;
407					regulator-suspend-microvolt = <1500000>;
408				};
409			};
410
411			vcca1v8_codec: LDO_REG7 {
412				regulator-name = "vcca1v8_codec";
413				regulator-always-on;
414				regulator-boot-on;
415				regulator-min-microvolt = <1800000>;
416				regulator-max-microvolt = <1800000>;
417				regulator-state-mem {
418					regulator-off-in-suspend;
419				};
420			};
421
422			vcc_3v0: LDO_REG8 {
423				regulator-name = "vcc_3v0";
424				regulator-always-on;
425				regulator-boot-on;
426				regulator-min-microvolt = <3000000>;
427				regulator-max-microvolt = <3000000>;
428				regulator-state-mem {
429					regulator-on-in-suspend;
430					regulator-suspend-microvolt = <3000000>;
431				};
432			};
433
434			vcc3v3_s3: vcc_lan: SWITCH_REG1 {
435				regulator-name = "vcc3v3_s3";
436				regulator-always-on;
437				regulator-boot-on;
438				regulator-state-mem {
439					regulator-off-in-suspend;
440				};
441			};
442
443			vcc3v3_s0: SWITCH_REG2 {
444				regulator-name = "vcc3v3_s0";
445				regulator-always-on;
446				regulator-boot-on;
447				regulator-state-mem {
448					regulator-off-in-suspend;
449				};
450			};
451		};
452	};
453
454	vdd_cpu_b: regulator@40 {
455		compatible = "silergy,syr827";
456		reg = <0x40>;
457		fcs,suspend-voltage-selector = <1>;
458		regulator-name = "vdd_cpu_b";
459		regulator-min-microvolt = <712500>;
460		regulator-max-microvolt = <1500000>;
461		regulator-ramp-delay = <1000>;
462		regulator-always-on;
463		regulator-boot-on;
464		vin-supply = <&vcc_sys>;
465
466		regulator-state-mem {
467			regulator-off-in-suspend;
468		};
469	};
470
471	vdd_gpu: regulator@41 {
472		compatible = "silergy,syr828";
473		reg = <0x41>;
474		fcs,suspend-voltage-selector = <1>;
475		regulator-name = "vdd_gpu";
476		regulator-min-microvolt = <712500>;
477		regulator-max-microvolt = <1500000>;
478		regulator-ramp-delay = <1000>;
479		regulator-always-on;
480		regulator-boot-on;
481		vin-supply = <&vcc_sys>;
482
483		regulator-state-mem {
484			regulator-off-in-suspend;
485		};
486	};
487};
488
489&i2c4 {
490	status = "okay";
491	i2c-scl-rising-time-ns = <475>;
492	i2c-scl-falling-time-ns = <26>;
493
494	usbc0: fusb302@22 {
495		compatible = "fcs,fusb302";
496		reg = <0x22>;
497		interrupt-parent = <&gpio1>;
498		interrupts = <RK_PA2 IRQ_TYPE_LEVEL_LOW>;
499		pinctrl-names = "default";
500		pinctrl-0 = <&usbc0_int>;
501		vbus-supply = <&vcc5v0_typec0>;
502		status = "okay";
503
504		ports {
505			#address-cells = <1>;
506			#size-cells = <0>;
507
508			port@0 {
509				reg = <0>;
510				usbc0_role_sw: endpoint@0 {
511					remote-endpoint = <&dwc3_0_role_switch>;
512				};
513			};
514		};
515
516		usb_con: connector {
517			compatible = "usb-c-connector";
518			label = "USB-C";
519			data-role = "dual";
520			power-role = "dual";
521			try-power-role = "sink";
522			op-sink-microwatt = <1000000>;
523			sink-pdos =
524				<PDO_FIXED(5000, 1000, PDO_FIXED_USB_COMM)>;
525			source-pdos =
526				<PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
527
528			displayport = <&cdn_dp>;
529
530			altmodes {
531				#address-cells = <1>;
532				#size-cells = <0>;
533
534				altmode@0 {
535					reg = <0>;
536					svid = <0xff01>;
537					vdo = <0xffffffff>;
538				};
539			};
540
541			ports {
542				#address-cells = <1>;
543				#size-cells = <0>;
544
545				port@0 {
546					reg = <0>;
547					usbc0_orien_sw: endpoint {
548						remote-endpoint = <&tcphy0_orientation_switch>;
549					};
550				};
551				port@1 {
552					reg = <1>;
553					dp_mode_sw: endpoint {
554						remote-endpoint = <&tcphy_dp_altmode_switch>;
555					};
556				};
557			};
558		};
559	};
560};
561
562&i2s2 {
563	status = "okay";
564};
565
566&io_domains {
567	status = "okay";
568
569	bt656-supply = <&vcc_3v0>;
570	audio-supply = <&vcca1v8_codec>;
571	sdmmc-supply = <&vcc_sdio>;
572	gpio1830-supply = <&vcc_3v0>;
573};
574
575&pmu_io_domains {
576	pmu1830-supply = <&vcc_3v0>;
577	status = "okay";
578};
579
580&pinctrl {
581	buttons {
582		pwr_btn: pwr-btn {
583			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
584		};
585	};
586
587	fan {
588		motor_pwr: motor-pwr {
589			rockchip,pins =
590				<1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
591		};
592	};
593
594	pmic {
595		pmic_int_l: pmic-int-l {
596			rockchip,pins =
597				<1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
598		};
599
600		vsel1_pin: vsel1-pin {
601			rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
602		};
603
604		vsel2_pin: vsel2-pin {
605			rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
606		};
607	};
608
609	sd {
610		sdmmc0_pwr_h: sdmmc0-pwr-h {
611			rockchip,pins =
612				<0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
613		};
614	};
615
616	usb2 {
617		vcc5v0_host_en: vcc5v0-host-en {
618			rockchip,pins =
619				<4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
620		};
621	};
622
623	usb-typec {
624		usbc0_int: usbc0-int {
625			rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>;
626		};
627
628		vcc5v0_typec0_en: vcc5v0-typec0-en {
629			rockchip,pins =
630				<2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
631		};
632	};
633};
634
635&pwm0 {
636	status = "okay";
637};
638
639&pwm2 {
640	status = "okay";
641	pinctrl-names = "active";
642	pinctrl-0 = <&pwm2_pin_pull_down>;
643};
644
645&saradc {
646	vref-supply = <&vcca1v8_s3>;
647	status = "okay";
648};
649
650&sdhci {
651	bus-width = <8>;
652	mmc-hs400-1_8v;
653	mmc-hs400-enhanced-strobe;
654	non-removable;
655	status = "okay";
656};
657
658&sdmmc {
659	broken-cd;
660	bus-width = <4>;
661	cap-mmc-highspeed;
662	cap-sd-highspeed;
663	clock-frequency = <150000000>;
664	disable-wp;
665	max-frequency = <150000000>;
666	pinctrl-names = "default";
667	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
668	vmmc-supply = <&vcc3v0_sd>;
669	vqmmc-supply = <&vcc_sdio>;
670	status = "okay";
671};
672
673&tcphy0 {
674	status = "okay";
675	svid = <0xff01>;
676	orientation-switch;
677
678	port {
679		#address-cells = <1>;
680		#size-cells = <0>;
681		tcphy0_orientation_switch: endpoint@0 {
682			reg = <0>;
683			remote-endpoint = <&usbc0_orien_sw>;
684		};
685		tcphy_dp_altmode_switch: endpoint@1 {
686			reg = <1>;
687			remote-endpoint = <&dp_mode_sw>;
688		};
689	};
690};
691
692&tcphy1 {
693	status = "okay";
694};
695
696&tsadc {
697	/* tshut mode 0:CRU 1:GPIO */
698	rockchip,hw-tshut-mode = <1>;
699	/* tshut polarity 0:LOW 1:HIGH */
700	rockchip,hw-tshut-polarity = <1>;
701	status = "okay";
702};
703
704&u2phy0 {
705	status = "okay";
706
707	u2phy0_otg: otg-port {
708		status = "okay";
709	};
710
711	u2phy0_host: host-port {
712		phy-supply = <&vcc5v0_host>;
713		status = "okay";
714	};
715};
716
717&u2phy1 {
718	status = "okay";
719
720	u2phy1_otg: otg-port {
721		status = "okay";
722	};
723
724	u2phy1_host: host-port {
725		phy-supply = <&vcc5v0_host>;
726		status = "okay";
727	};
728};
729
730&uart0 {
731	pinctrl-names = "default";
732	pinctrl-0 = <&uart0_xfer &uart0_cts>;
733	status = "okay";
734};
735
736&uart2 {
737	status = "okay";
738};
739
740&usb_host0_ehci {
741	status = "okay";
742};
743
744&usb_host0_ohci {
745	status = "okay";
746};
747
748&usb_host1_ehci {
749	status = "okay";
750};
751
752&usb_host1_ohci {
753	status = "okay";
754};
755
756&usbdrd3_0 {
757	status = "okay";
758};
759
760&usbdrd_dwc3_0 {
761	status = "okay";
762	dr_mode = "otg";
763	usb-role-switch;
764	port {
765		#address-cells = <1>;
766		#size-cells = <0>;
767		dwc3_0_role_switch: endpoint@0 {
768			reg = <0>;
769			remote-endpoint = <&usbc0_role_sw>;
770		};
771	};
772};
773
774&usbdrd3_1 {
775	status = "okay";
776};
777
778&usbdrd_dwc3_1 {
779	status = "okay";
780	dr_mode = "host";
781};
782
783&vopb {
784	status = "okay";
785};
786
787&vopb_mmu {
788	status = "okay";
789};
790
791&vopl {
792	status = "okay";
793};
794
795&vopl_mmu {
796	status = "okay";
797};