1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2018 Collabora Ltd.
4 * Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd.
5 * Copyright (c) 2018 Linaro Ltd.
6 */
7
8#include "rk3399.dtsi"
9#include "rk3399-opp.dtsi"
10#include <dt-bindings/interrupt-controller/irq.h>
11
12/ {
13	aliases {
14		mmc0 = &sdio0;
15		mmc1 = &sdmmc;
16		mmc2 = &sdhci;
17	};
18
19	sdio_pwrseq: sdio-pwrseq {
20		compatible = "mmc-pwrseq-simple";
21		clocks = <&rk808 1>;
22		clock-names = "ext_clock";
23		pinctrl-names = "default";
24		pinctrl-0 = <&wifi_enable_h>;
25		reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
26	};
27
28	vcc12v_dcin: vcc12v-dcin {
29		compatible = "regulator-fixed";
30		regulator-name = "vcc12v_dcin";
31		regulator-min-microvolt = <12000000>;
32		regulator-max-microvolt = <12000000>;
33		regulator-always-on;
34		regulator-boot-on;
35	};
36
37	vcc1v8_s0: vcc1v8-s0 {
38		compatible = "regulator-fixed";
39		regulator-name = "vcc1v8_s0";
40		regulator-min-microvolt = <1800000>;
41		regulator-max-microvolt = <1800000>;
42		regulator-always-on;
43	};
44
45	vcc5v0_sys: vcc5v0-sys {
46		compatible = "regulator-fixed";
47		regulator-name = "vcc5v0_sys";
48		regulator-min-microvolt = <5000000>;
49		regulator-max-microvolt = <5000000>;
50		regulator-always-on;
51		vin-supply = <&vcc12v_dcin>;
52	};
53
54	vcc3v3_sys: vcc3v3-sys {
55		compatible = "regulator-fixed";
56		regulator-name = "vcc3v3_sys";
57		regulator-min-microvolt = <3300000>;
58		regulator-max-microvolt = <3300000>;
59		regulator-always-on;
60		vin-supply = <&vcc5v0_sys>;
61	};
62
63	vcc3v3_pcie: vcc3v3-pcie-regulator {
64		compatible = "regulator-fixed";
65		enable-active-high;
66		pinctrl-names = "default";
67		pinctrl-0 = <&pcie_drv>;
68		regulator-boot-on;
69		regulator-name = "vcc3v3_pcie";
70		regulator-min-microvolt = <3300000>;
71		regulator-max-microvolt = <3300000>;
72		vin-supply = <&vcc3v3_sys>;
73	};
74
75	vcc5v0_host: vcc5v0-host-regulator {
76		compatible = "regulator-fixed";
77		enable-active-high;
78		pinctrl-names = "default";
79		pinctrl-0 = <&host_vbus_drv>;
80		regulator-name = "vcc5v0_host";
81		regulator-min-microvolt = <5000000>;
82		regulator-max-microvolt = <5000000>;
83		regulator-always-on;
84		vin-supply = <&vcc5v0_sys>;
85	};
86
87	vcc_0v9: vcc-0v9 {
88		compatible = "regulator-fixed";
89		regulator-name = "vcc_0v9";
90		regulator-always-on;
91		regulator-min-microvolt = <900000>;
92		regulator-max-microvolt = <900000>;
93		vin-supply = <&vcc3v3_sys>;
94	};
95};
96
97&cpu_l0 {
98	cpu-supply = <&vdd_cpu_l>;
99};
100
101&cpu_l1 {
102	cpu-supply = <&vdd_cpu_l>;
103};
104
105&cpu_l2 {
106	cpu-supply = <&vdd_cpu_l>;
107};
108
109&cpu_l3 {
110	cpu-supply = <&vdd_cpu_l>;
111};
112
113&cpu_b0 {
114	cpu-supply = <&vdd_cpu_b>;
115};
116
117&cpu_b1 {
118	cpu-supply = <&vdd_cpu_b>;
119};
120
121&emmc_phy {
122	status = "okay";
123};
124
125&gpu {
126	mali-supply = <&vdd_gpu>;
127	status = "okay";
128};
129
130&hdmi {
131	ddc-i2c-bus = <&i2c3>;
132	pinctrl-names = "default";
133	pinctrl-0 = <&hdmi_cec>;
134	status = "okay";
135};
136
137&hdmi_sound {
138	status = "okay";
139};
140
141&i2c0 {
142	clock-frequency = <400000>;
143	i2c-scl-rising-time-ns = <168>;
144	i2c-scl-falling-time-ns = <4>;
145	status = "okay";
146
147	vdd_cpu_b: regulator@40 {
148		compatible = "silergy,syr827";
149		reg = <0x40>;
150		fcs,suspend-voltage-selector = <1>;
151		regulator-name = "vdd_cpu_b";
152		regulator-min-microvolt = <712500>;
153		regulator-max-microvolt = <1500000>;
154		regulator-ramp-delay = <1000>;
155		regulator-always-on;
156		regulator-boot-on;
157		vin-supply = <&vcc5v0_sys>;
158		status = "okay";
159
160		regulator-state-mem {
161			regulator-off-in-suspend;
162		};
163	};
164
165	vdd_gpu: regulator@41 {
166		compatible = "silergy,syr828";
167		reg = <0x41>;
168		fcs,suspend-voltage-selector = <1>;
169		regulator-name = "vdd_gpu";
170		regulator-min-microvolt = <712500>;
171		regulator-max-microvolt = <1500000>;
172		regulator-ramp-delay = <1000>;
173		regulator-always-on;
174		regulator-boot-on;
175		vin-supply = <&vcc5v0_sys>;
176		regulator-state-mem {
177			regulator-off-in-suspend;
178		};
179	};
180
181	rk808: pmic@1b {
182		compatible = "rockchip,rk808";
183		reg = <0x1b>;
184		interrupt-parent = <&gpio1>;
185		interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
186		pinctrl-names = "default";
187		pinctrl-0 = <&pmic_int_l>;
188		rockchip,system-power-controller;
189		wakeup-source;
190		#clock-cells = <1>;
191		clock-output-names = "xin32k", "rk808-clkout2";
192
193		vcc1-supply = <&vcc5v0_sys>;
194		vcc2-supply = <&vcc5v0_sys>;
195		vcc3-supply = <&vcc5v0_sys>;
196		vcc4-supply = <&vcc5v0_sys>;
197		vcc6-supply = <&vcc5v0_sys>;
198		vcc7-supply = <&vcc5v0_sys>;
199		vcc8-supply = <&vcc3v3_sys>;
200		vcc9-supply = <&vcc5v0_sys>;
201		vcc10-supply = <&vcc5v0_sys>;
202		vcc11-supply = <&vcc5v0_sys>;
203		vcc12-supply = <&vcc3v3_sys>;
204		vddio-supply = <&vcc_1v8>;
205
206		regulators {
207			vdd_center: DCDC_REG1 {
208				regulator-name = "vdd_center";
209				regulator-min-microvolt = <750000>;
210				regulator-max-microvolt = <1350000>;
211				regulator-always-on;
212				regulator-boot-on;
213				regulator-state-mem {
214					regulator-off-in-suspend;
215				};
216			};
217
218			vdd_cpu_l: DCDC_REG2 {
219				regulator-name = "vdd_cpu_l";
220				regulator-min-microvolt = <750000>;
221				regulator-max-microvolt = <1350000>;
222				regulator-always-on;
223				regulator-boot-on;
224				regulator-state-mem {
225					regulator-off-in-suspend;
226				};
227			};
228
229			vcc_ddr: DCDC_REG3 {
230				regulator-name = "vcc_ddr";
231				regulator-always-on;
232				regulator-boot-on;
233				regulator-state-mem {
234					regulator-on-in-suspend;
235				};
236			};
237
238			vcc_1v8: DCDC_REG4 {
239				regulator-name = "vcc_1v8";
240				regulator-min-microvolt = <1800000>;
241				regulator-max-microvolt = <1800000>;
242				regulator-always-on;
243				regulator-boot-on;
244				regulator-state-mem {
245					regulator-on-in-suspend;
246					regulator-suspend-microvolt = <1800000>;
247				};
248			};
249
250			vcc1v8_dvp: LDO_REG1 {
251				regulator-name = "vcc1v8_dvp";
252				regulator-min-microvolt = <1800000>;
253				regulator-max-microvolt = <1800000>;
254				regulator-always-on;
255				regulator-boot-on;
256				regulator-state-mem {
257					regulator-on-in-suspend;
258					regulator-suspend-microvolt = <1800000>;
259				};
260			};
261
262			vcca1v8_hdmi: LDO_REG2 {
263				regulator-name = "vcca1v8_hdmi";
264				regulator-min-microvolt = <1800000>;
265				regulator-max-microvolt = <1800000>;
266				regulator-always-on;
267				regulator-boot-on;
268				regulator-state-mem {
269					regulator-on-in-suspend;
270					regulator-suspend-microvolt = <1800000>;
271				};
272			};
273
274			vcca_1v8: LDO_REG3 {
275				regulator-name = "vcca_1v8";
276				regulator-min-microvolt = <1800000>;
277				regulator-max-microvolt = <1800000>;
278				regulator-always-on;
279				regulator-boot-on;
280				regulator-state-mem {
281					regulator-on-in-suspend;
282					regulator-suspend-microvolt = <1800000>;
283				};
284			};
285
286			vcc_sd: LDO_REG4 {
287				regulator-name = "vcc_sd";
288				regulator-min-microvolt = <1800000>;
289				regulator-max-microvolt = <3300000>;
290				regulator-always-on;
291				regulator-boot-on;
292				regulator-state-mem {
293					regulator-on-in-suspend;
294					regulator-suspend-microvolt = <3300000>;
295				};
296			};
297
298			vcc3v0_sd: LDO_REG5 {
299				regulator-name = "vcc3v0_sd";
300				regulator-min-microvolt = <3000000>;
301				regulator-max-microvolt = <3000000>;
302				regulator-always-on;
303				regulator-boot-on;
304				regulator-state-mem {
305					regulator-on-in-suspend;
306					regulator-suspend-microvolt = <3000000>;
307				};
308			};
309
310			vcc_1v5: LDO_REG6 {
311				regulator-name = "vcc_1v5";
312				regulator-min-microvolt = <1500000>;
313				regulator-max-microvolt = <1500000>;
314				regulator-always-on;
315				regulator-boot-on;
316				regulator-state-mem {
317					regulator-on-in-suspend;
318					regulator-suspend-microvolt = <1500000>;
319				};
320			};
321
322			vcca0v9_hdmi: LDO_REG7 {
323				regulator-name = "vcca0v9_hdmi";
324				regulator-min-microvolt = <900000>;
325				regulator-max-microvolt = <900000>;
326				regulator-always-on;
327				regulator-boot-on;
328				regulator-state-mem {
329					regulator-on-in-suspend;
330					regulator-suspend-microvolt = <900000>;
331				};
332			};
333
334			vcc_3v0: LDO_REG8 {
335				regulator-name = "vcc_3v0";
336				regulator-min-microvolt = <3000000>;
337				regulator-max-microvolt = <3000000>;
338				regulator-always-on;
339				regulator-boot-on;
340				regulator-state-mem {
341					regulator-on-in-suspend;
342					regulator-suspend-microvolt = <3000000>;
343				};
344			};
345
346			vcc3v3_s3: SWITCH_REG1 {
347				regulator-name = "vcc3v3_s3";
348				regulator-always-on;
349				regulator-boot-on;
350				regulator-state-mem {
351					regulator-on-in-suspend;
352				};
353			};
354
355			vcc3v3_s0: SWITCH_REG2 {
356				regulator-name = "vcc3v3_s0";
357				regulator-always-on;
358				regulator-boot-on;
359				regulator-state-mem {
360					regulator-on-in-suspend;
361				};
362			};
363		};
364	};
365};
366
367&i2c1 {
368	status = "okay";
369};
370
371&i2c2 {
372	status = "okay";
373};
374
375&i2c3 {
376	status = "okay";
377};
378
379&i2c4 {
380	status = "okay";
381};
382
383&i2s2 {
384        status = "okay";
385};
386
387&io_domains {
388	bt656-supply = <&vcc1v8_s0>; /* bt656_gpio2ab_ms */
389	audio-supply = <&vcc1v8_s0>; /* audio_gpio3d4a_ms */
390	sdmmc-supply = <&vcc_sd>; /* sdmmc_gpio4b_ms */
391	gpio1830-supply = <&vcc_3v0>; /* gpio1833_gpio4cd_ms */
392	status = "okay";
393};
394
395&pcie_phy {
396	status = "okay";
397};
398
399&pcie0 {
400	num-lanes = <4>;
401	pinctrl-names = "default";
402	pinctrl-0 = <&pcie_clkreqn_cpm>;
403	vpcie0v9-supply = <&vcc_0v9>;
404	vpcie1v8-supply = <&vcca_1v8>;
405	vpcie3v3-supply = <&vcc3v3_pcie>;
406	status = "okay";
407};
408
409&pmu_io_domains {
410	pmu1830-supply = <&vcc_1v8>;
411	status = "okay";
412};
413
414&pinctrl {
415	bt {
416		bt_enable_h: bt-enable-h {
417			rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
418		};
419
420		bt_host_wake_l: bt-host-wake-l {
421			rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
422		};
423
424		bt_wake_l: bt-wake-l {
425			rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
426		};
427	};
428
429	sdmmc {
430		sdmmc_bus1: sdmmc-bus1 {
431			rockchip,pins =
432				<4 RK_PB0 1 &pcfg_pull_up_8ma>;
433		};
434
435		sdmmc_bus4: sdmmc-bus4 {
436			rockchip,pins =
437				<4 RK_PB0 1 &pcfg_pull_up_8ma>,
438				<4 RK_PB1 1 &pcfg_pull_up_8ma>,
439				<4 RK_PB2 1 &pcfg_pull_up_8ma>,
440				<4 RK_PB3 1 &pcfg_pull_up_8ma>;
441		};
442
443		sdmmc_clk: sdmmc-clk {
444			rockchip,pins =
445				<4 RK_PB4 1 &pcfg_pull_none_18ma>;
446		};
447
448		sdmmc_cmd: sdmmc-cmd {
449			rockchip,pins =
450				<4 RK_PB5 1 &pcfg_pull_up_8ma>;
451		};
452	};
453
454	sdio0 {
455		sdio0_bus4: sdio0-bus4 {
456			rockchip,pins =
457				<2 RK_PC4 1 &pcfg_pull_up_20ma>,
458				<2 RK_PC5 1 &pcfg_pull_up_20ma>,
459				<2 RK_PC6 1 &pcfg_pull_up_20ma>,
460				<2 RK_PC7 1 &pcfg_pull_up_20ma>;
461		};
462
463		sdio0_cmd: sdio0-cmd {
464			rockchip,pins =
465				<2 RK_PD0 1 &pcfg_pull_up_20ma>;
466		};
467
468		sdio0_clk: sdio0-clk {
469			rockchip,pins =
470				<2 RK_PD1 1 &pcfg_pull_none_20ma>;
471		};
472	};
473
474	pmic {
475		pmic_int_l: pmic-int-l {
476			rockchip,pins =
477				<1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
478		};
479
480		vsel1_pin: vsel1-pin {
481			rockchip,pins =
482				<1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
483		};
484
485		vsel2_pin: vsel2-pin {
486			rockchip,pins =
487				<1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
488		};
489	};
490
491	sdio-pwrseq {
492		wifi_enable_h: wifi-enable-h {
493			rockchip,pins =
494				<0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
495		};
496	};
497
498	wifi {
499		wifi_host_wake_l: wifi-host-wake-l {
500			rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
501		};
502	};
503};
504
505&pwm2 {
506	status = "okay";
507};
508
509&pwm3 {
510	status = "okay";
511};
512
513&sdio0 {
514	bus-width = <4>;
515	clock-frequency = <50000000>;
516	cap-sdio-irq;
517	cap-sd-highspeed;
518	keep-power-in-suspend;
519	mmc-pwrseq = <&sdio_pwrseq>;
520	non-removable;
521	pinctrl-names = "default";
522	pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
523	sd-uhs-sdr104;
524	#address-cells = <1>;
525	#size-cells = <0>;
526	status = "okay";
527
528	brcmf: wifi@1 {
529		compatible = "brcm,bcm4329-fmac";
530		reg = <1>;
531		interrupt-parent = <&gpio0>;
532		interrupts = <RK_PA3 IRQ_TYPE_LEVEL_HIGH>;
533		interrupt-names = "host-wake";
534		pinctrl-names = "default";
535		pinctrl-0 = <&wifi_host_wake_l>;
536	};
537};
538
539&sdhci {
540	bus-width = <8>;
541	mmc-hs400-1_8v;
542	mmc-hs400-enhanced-strobe;
543	non-removable;
544	status = "okay";
545};
546
547&sdmmc {
548	bus-width = <4>;
549	cap-mmc-highspeed;
550	cap-sd-highspeed;
551	clock-frequency = <100000000>;
552	max-frequency = <100000000>;
553	cd-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
554	disable-wp;
555	sd-uhs-sdr104;
556	vqmmc-supply = <&vcc_sd>;
557	card-detect-delay = <800>;
558	pinctrl-names = "default";
559	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
560	status = "okay";
561};
562
563&tsadc {
564	rockchip,hw-tshut-mode = <1>;
565	rockchip,hw-tshut-polarity = <1>;
566	rockchip,hw-tshut-temp = <110000>;
567	status = "okay";
568};
569
570&uart0 {
571	pinctrl-names = "default";
572	pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
573	status = "okay";
574
575	bluetooth {
576		compatible = "brcm,bcm43438-bt";
577		clocks = <&rk808 1>;
578		clock-names = "ext_clock";
579		device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>;
580		host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
581		shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
582		pinctrl-names = "default";
583		pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>;
584	};
585};
586
587&uart2 {
588	status = "okay";
589};
590
591&tcphy0 {
592	status = "okay";
593};
594
595&tcphy1 {
596	status = "okay";
597};
598
599&u2phy0 {
600	status = "okay";
601};
602
603&u2phy1 {
604	status = "okay";
605};
606
607&u2phy0_host {
608	phy-supply = <&vcc5v0_host>;
609	status = "okay";
610};
611
612&u2phy1_host {
613	phy-supply = <&vcc5v0_host>;
614	status = "okay";
615};
616
617&u2phy0_otg {
618	status = "okay";
619};
620
621&u2phy1_otg {
622	status = "okay";
623};
624
625&usb_host0_ehci {
626	status = "okay";
627};
628
629&usb_host0_ohci {
630	status = "okay";
631};
632
633&usb_host1_ehci {
634	status = "okay";
635};
636
637&usb_host1_ohci {
638	status = "okay";
639};
640
641&usbdrd3_0 {
642	status = "okay";
643};
644
645&usbdrd_dwc3_0 {
646	status = "okay";
647};
648
649&usbdrd3_1 {
650	status = "okay";
651};
652
653&usbdrd_dwc3_1 {
654	status = "okay";
655};
656
657&vopb {
658	status = "okay";
659};
660
661&vopb_mmu {
662	status = "okay";
663};
664
665&vopl {
666	status = "okay";
667};
668
669&vopl_mmu {
670	status = "okay";
671};
672