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