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