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