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