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