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