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