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