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