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