1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd
4 * Copyright (c) 2019 Vamrs Limited
5 * Copyright (c) 2019 Amarula Solutions(India)
6 */
7
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/pinctrl/rockchip.h>
10#include <dt-bindings/pwm/pwm.h>
11
12/ {
13	compatible = "vamrs,rk3399pro-vmarc-som", "rockchip,rk3399pro";
14
15	aliases {
16		mmc0 = &sdmmc;
17		mmc1 = &sdhci;
18	};
19
20	vcc3v3_pcie: vcc-pcie-regulator {
21		compatible = "regulator-fixed";
22		enable-active-high;
23		gpio = <&gpio4 RK_PD4 GPIO_ACTIVE_HIGH>;
24		pinctrl-names = "default";
25		pinctrl-0 = <&pcie_pwr>;
26		regulator-name = "vcc3v3_pcie";
27		regulator-always-on;
28		regulator-boot-on;
29		vin-supply = <&vcc5v0_sys>;
30	};
31};
32
33&cpu_l0 {
34	cpu-supply = <&vdd_cpu_l>;
35};
36
37&cpu_l1 {
38	cpu-supply = <&vdd_cpu_l>;
39};
40
41&cpu_l2 {
42	cpu-supply = <&vdd_cpu_l>;
43};
44
45&cpu_l3 {
46	cpu-supply = <&vdd_cpu_l>;
47};
48
49&emmc_phy {
50	status = "okay";
51};
52
53&gmac {
54	assigned-clocks = <&cru SCLK_RMII_SRC>;
55	phy-supply = <&vcc_lan>;
56	snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
57};
58
59&hdmi {
60	ddc-i2c-bus = <&i2c3>;
61	pinctrl-names = "default";
62	pinctrl-0 = <&hdmi_cec>;
63};
64
65&i2c0 {
66	clock-frequency = <400000>;
67	i2c-scl-falling-time-ns = <30>;
68	i2c-scl-rising-time-ns = <180>;
69	status = "okay";
70
71	rk809: pmic@20 {
72		compatible = "rockchip,rk809";
73		reg = <0x20>;
74		interrupt-parent = <&gpio1>;
75		interrupts = <RK_PC2 IRQ_TYPE_LEVEL_LOW>;
76		#clock-cells = <1>;
77		clock-output-names = "rk808-clkout1", "rk808-clkout2";
78		pinctrl-names = "default";
79		pinctrl-0 = <&pmic_int_l>;
80		rockchip,system-power-controller;
81		wakeup-source;
82
83		vcc1-supply = <&vcc5v0_sys>;
84		vcc2-supply = <&vcc5v0_sys>;
85		vcc3-supply = <&vcc5v0_sys>;
86		vcc4-supply = <&vcc5v0_sys>;
87		vcc5-supply = <&vcc_buck5>;
88		vcc6-supply = <&vcc_buck5>;
89		vcc7-supply = <&vcc5v0_sys>;
90		vcc8-supply = <&vcc3v3_sys>;
91		vcc9-supply = <&vcc5v0_sys>;
92
93		regulators {
94			vdd_log: DCDC_REG1 {
95				regulator-name = "vdd_log";
96				regulator-always-on;
97				regulator-boot-on;
98				regulator-min-microvolt = <750000>;
99				regulator-max-microvolt = <1350000>;
100				regulator-initial-mode = <0x2>;
101				regulator-state-mem {
102					regulator-off-in-suspend;
103					regulator-suspend-microvolt = <900000>;
104				};
105			};
106
107			vdd_cpu_l: DCDC_REG2 {
108				regulator-name = "vdd_cpu_l";
109				regulator-always-on;
110				regulator-boot-on;
111				regulator-min-microvolt = <750000>;
112				regulator-max-microvolt = <1350000>;
113				regulator-ramp-delay = <6001>;
114				regulator-initial-mode = <0x2>;
115				regulator-state-mem {
116					regulator-off-in-suspend;
117				};
118			};
119
120			vcc_ddr: DCDC_REG3 {
121				regulator-name = "vcc_ddr";
122				regulator-always-on;
123				regulator-boot-on;
124				regulator-initial-mode = <0x2>;
125				regulator-state-mem {
126					regulator-on-in-suspend;
127				};
128			};
129
130			vcc3v3_sys: DCDC_REG4 {
131				regulator-name = "vcc3v3_sys";
132				regulator-always-on;
133				regulator-boot-on;
134				regulator-min-microvolt = <3300000>;
135				regulator-max-microvolt = <3300000>;
136				regulator-initial-mode = <0x2>;
137				regulator-state-mem {
138					regulator-on-in-suspend;
139					regulator-suspend-microvolt = <3300000>;
140				};
141			};
142
143			vcc_buck5: DCDC_REG5 {
144				regulator-name = "vcc_buck5";
145				regulator-always-on;
146				regulator-boot-on;
147				regulator-min-microvolt = <2200000>;
148				regulator-max-microvolt = <2200000>;
149				regulator-state-mem {
150					regulator-on-in-suspend;
151					regulator-suspend-microvolt = <2200000>;
152				};
153			};
154
155			vcca_0v9: LDO_REG1 {
156				regulator-name = "vcca_0v9";
157				regulator-always-on;
158				regulator-boot-on;
159				regulator-min-microvolt = <900000>;
160				regulator-max-microvolt = <900000>;
161				regulator-state-mem {
162					regulator-on-in-suspend;
163					regulator-suspend-microvolt = <900000>;
164				};
165			};
166
167			vcc_1v8: LDO_REG2 {
168				regulator-name = "vcc_1v8";
169				regulator-always-on;
170				regulator-boot-on;
171				regulator-min-microvolt = <1800000>;
172				regulator-max-microvolt = <1800000>;
173				regulator-state-mem {
174					regulator-on-in-suspend;
175					regulator-suspend-microvolt = <1800000>;
176				};
177			};
178
179			vcc_0v9: LDO_REG3 {
180				regulator-name = "vcc_0v9";
181				regulator-always-on;
182				regulator-boot-on;
183				regulator-min-microvolt = <900000>;
184				regulator-max-microvolt = <900000>;
185				regulator-state-mem {
186					regulator-on-in-suspend;
187					regulator-suspend-microvolt = <900000>;
188				};
189			};
190
191			vcca_1v8: LDO_REG4 {
192				regulator-name = "vcca_1v8";
193				regulator-always-on;
194				regulator-boot-on;
195				regulator-min-microvolt = <1850000>;
196				regulator-max-microvolt = <1850000>;
197				regulator-state-mem {
198					regulator-on-in-suspend;
199					regulator-suspend-microvolt = <1850000>;
200				};
201			};
202
203			/*
204			 * As per BSP, but schematic not showing any regulator
205			 * pin for LD05.
206			 */
207			vdd1v5_dvp: LDO_REG5 {
208				regulator-name = "vdd1v5_dvp";
209				regulator-always-on;
210				regulator-boot-on;
211				regulator-min-microvolt = <1500000>;
212				regulator-max-microvolt = <1500000>;
213				regulator-state-mem {
214					regulator-off-in-suspend;
215				};
216			};
217
218			vcc_1v5: LDO_REG6 {
219				regulator-name = "vcc_1v5";
220				regulator-always-on;
221				regulator-boot-on;
222				regulator-min-microvolt = <1500000>;
223				regulator-max-microvolt = <1500000>;
224				regulator-state-mem {
225					regulator-off-in-suspend;
226				};
227			};
228
229			vccio_3v0: LDO_REG7 {
230				regulator-name = "vccio_3v0";
231				regulator-always-on;
232				regulator-boot-on;
233				regulator-min-microvolt = <3000000>;
234				regulator-max-microvolt = <3000000>;
235				regulator-state-mem {
236					regulator-off-in-suspend;
237				};
238			};
239
240			vccio_sd: LDO_REG8 {
241				regulator-name = "vccio_sd";
242				regulator-always-on;
243				regulator-boot-on;
244				regulator-min-microvolt = <1800000>;
245				regulator-max-microvolt = <3300000>;
246				regulator-state-mem {
247					regulator-off-in-suspend;
248				};
249			};
250
251			/*
252			 * As per BSP, but schematic not showing any regulator
253			 * pin for LD09.
254			 */
255			vcc_sd: LDO_REG9 {
256				regulator-name = "vcc_sd";
257				regulator-always-on;
258				regulator-boot-on;
259				regulator-min-microvolt = <3300000>;
260				regulator-max-microvolt = <3300000>;
261				regulator-state-mem {
262					regulator-off-in-suspend;
263				};
264			};
265
266			vcc5v0_usb2: SWITCH_REG1 {
267				regulator-name = "vcc5v0_usb2";
268				regulator-min-microvolt = <5000000>;
269				regulator-max-microvolt = <5000000>;
270				regulator-state-mem {
271					regulator-on-in-suspend;
272					regulator-suspend-microvolt = <5000000>;
273				};
274			};
275
276			vccio_3v3: vcc_lan: SWITCH_REG2 {
277				regulator-name = "vccio_3v3";
278				regulator-always-on;
279				regulator-boot-on;
280				regulator-min-microvolt = <3300000>;
281				regulator-max-microvolt = <3300000>;
282				regulator-state-mem {
283					regulator-off-in-suspend;
284				};
285			};
286		};
287	};
288};
289
290&i2c1 {
291	i2c-scl-falling-time-ns = <30>;
292	i2c-scl-rising-time-ns = <140>;
293	status = "okay";
294};
295
296&i2c2 {
297	clock-frequency = <400000>;
298	status = "okay";
299
300	hym8563: rtc@51 {
301		compatible = "haoyu,hym8563";
302		reg = <0x51>;
303		#clock-cells = <0>;
304		clock-output-names = "hym8563";
305		pinctrl-names = "default";
306		pinctrl-0 = <&hym8563_int>;
307		interrupt-parent = <&gpio4>;
308		interrupts = <RK_PD6 IRQ_TYPE_LEVEL_LOW>;
309	};
310};
311
312&i2c3 {
313	i2c-scl-rising-time-ns = <450>;
314	i2c-scl-falling-time-ns = <15>;
315	status = "okay";
316};
317
318&io_domains {
319	status = "okay";
320	bt656-supply = <&vcca_1v8>;
321	gpio1830-supply = <&vccio_3v0>;
322	sdmmc-supply = <&vccio_sd>;
323};
324
325&pcie_phy {
326	status = "okay";
327};
328
329&pcie0 {
330	ep-gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>;
331	num-lanes = <4>;
332	pinctrl-0 = <&pcie_clkreqnb_cpm>;
333	pinctrl-names = "default";
334	vpcie0v9-supply = <&vcca_0v9>;	/* VCC_0V9_S0 */
335	vpcie1v8-supply = <&vcca_1v8>;	/* VCC_1V8_S0 */
336	vpcie3v3-supply = <&vcc3v3_pcie>;
337	status = "okay";
338};
339
340&pinctrl {
341	hym8563 {
342		hym8563_int: hym8563-int {
343			rockchip,pins = <4 RK_PD6 0 &pcfg_pull_up>;
344		};
345	};
346
347	pcie {
348		pcie_pwr: pcie-pwr {
349			rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>;
350		};
351	};
352
353	pmic {
354		pmic_int_l: pmic-int-l {
355			rockchip,pins = <1 RK_PC2 0 &pcfg_pull_up>;
356		};
357	};
358
359	sdio-pwrseq {
360		wifi_enable_h: wifi-enable-h {
361			rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
362		};
363	};
364
365	vbus_host {
366		usb1_en_oc: usb1-en-oc {
367			rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>;
368		};
369	};
370
371	vbus_typec {
372		usb0_en_oc: usb0-en-oc {
373			rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>;
374		};
375	};
376};
377
378&pmu_io_domains {
379	status = "okay";
380	pmu1830-supply = <&vcc_1v8>;
381};
382
383&sdio_pwrseq {
384	/*
385	 * On the module itself this is one of these (depending
386	 * on the actual card populated):
387	 * - SDIO_RESET_L_WL_REG_ON
388	 * - PDN (power down when low)
389	 */
390	reset-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>;
391};
392
393&sdhci {
394	bus-width = <8>;
395	mmc-hs400-1_8v;
396	mmc-hs400-enhanced-strobe;
397	non-removable;
398	status = "okay";
399};
400
401&sdmmc {
402	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
403	max-frequency = <150000000>;
404};
405
406&tcphy0 {
407	status = "okay";
408};
409
410&tsadc {
411	rockchip,hw-tshut-mode = <1>;
412	rockchip,hw-tshut-polarity = <1>;
413	status = "okay";
414};
415
416&u2phy0 {
417	status = "okay";
418
419	u2phy0_otg: otg-port {
420		phy-supply = <&vbus_typec>;
421		status = "okay";
422	};
423
424	u2phy0_host: host-port {
425		phy-supply = <&vbus_host>;
426		status = "okay";
427	};
428};
429
430
431&u2phy1 {
432	status = "okay";
433
434	u2phy1_host: host-port {
435		phy-supply = <&vbus_host>;
436		status = "okay";
437	};
438};
439
440&usb_host0_ehci {
441	status = "okay";
442};
443
444&usb_host0_ohci {
445	status = "okay";
446};
447
448&usb_host1_ehci {
449	status = "okay";
450};
451
452&usb_host1_ohci {
453	status = "okay";
454};
455
456&usbdrd3_0 {
457	status = "okay";
458};
459
460&usbdrd_dwc3_0 {
461	status = "okay";
462};
463
464&vbus_host {
465	enable-active-high;
466	gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; /* USB1_EN_OC# */
467	pinctrl-names = "default";
468	pinctrl-0 = <&usb1_en_oc>;
469};
470
471&vbus_typec {
472	enable-active-high;
473	gpio = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>; /* USB0_EN_OC# */
474	pinctrl-names = "default";
475	pinctrl-0 = <&usb0_en_oc>;
476};
477