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: hym8563@51 {
301		compatible = "haoyu,hym8563";
302		reg = <0x51>;
303		#clock-cells = <0>;
304		clock-frequency = <32768>;
305		clock-output-names = "hym8563";
306		pinctrl-names = "default";
307		pinctrl-0 = <&hym8563_int>;
308		interrupt-parent = <&gpio4>;
309		interrupts = <RK_PD6 IRQ_TYPE_LEVEL_LOW>;
310	};
311};
312
313&i2c3 {
314	i2c-scl-rising-time-ns = <450>;
315	i2c-scl-falling-time-ns = <15>;
316	status = "okay";
317};
318
319&io_domains {
320	status = "okay";
321	bt656-supply = <&vcca_1v8>;
322	gpio1830-supply = <&vccio_3v0>;
323	sdmmc-supply = <&vccio_sd>;
324};
325
326&pcie_phy {
327	status = "okay";
328};
329
330&pcie0 {
331	ep-gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>;
332	num-lanes = <4>;
333	pinctrl-0 = <&pcie_clkreqnb_cpm>;
334	pinctrl-names = "default";
335	vpcie0v9-supply = <&vcca_0v9>;	/* VCC_0V9_S0 */
336	vpcie1v8-supply = <&vcca_1v8>;	/* VCC_1V8_S0 */
337	vpcie3v3-supply = <&vcc3v3_pcie>;
338	status = "okay";
339};
340
341&pinctrl {
342	hym8563 {
343		hym8563_int: hym8563-int {
344			rockchip,pins = <4 RK_PD6 0 &pcfg_pull_up>;
345		};
346	};
347
348	pcie {
349		pcie_pwr: pcie-pwr {
350			rockchip,pins = <4 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>;
351		};
352	};
353
354	pmic {
355		pmic_int_l: pmic-int-l {
356			rockchip,pins = <1 RK_PC2 0 &pcfg_pull_up>;
357		};
358	};
359
360	sdio-pwrseq {
361		wifi_enable_h: wifi-enable-h {
362			rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
363		};
364	};
365
366	vbus_host {
367		usb1_en_oc: usb1-en-oc {
368			rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>;
369		};
370	};
371
372	vbus_typec {
373		usb0_en_oc: usb0-en-oc {
374			rockchip,pins = <4 RK_PD2 RK_FUNC_GPIO &pcfg_pull_up>;
375		};
376	};
377};
378
379&pmu_io_domains {
380	status = "okay";
381	pmu1830-supply = <&vcc_1v8>;
382};
383
384&sdio_pwrseq {
385	/*
386	 * On the module itself this is one of these (depending
387	 * on the actual card populated):
388	 * - SDIO_RESET_L_WL_REG_ON
389	 * - PDN (power down when low)
390	 */
391	reset-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>;
392};
393
394&sdhci {
395	bus-width = <8>;
396	mmc-hs400-1_8v;
397	mmc-hs400-enhanced-strobe;
398	non-removable;
399	status = "okay";
400};
401
402&sdmmc {
403	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
404	max-frequency = <150000000>;
405};
406
407&tcphy0 {
408	status = "okay";
409};
410
411&tsadc {
412	rockchip,hw-tshut-mode = <1>;
413	rockchip,hw-tshut-polarity = <1>;
414	status = "okay";
415};
416
417&u2phy0 {
418	status = "okay";
419
420	u2phy0_otg: otg-port {
421		phy-supply = <&vbus_typec>;
422		status = "okay";
423	};
424
425	u2phy0_host: host-port {
426		phy-supply = <&vbus_host>;
427		status = "okay";
428	};
429};
430
431
432&u2phy1 {
433	status = "okay";
434
435	u2phy1_host: host-port {
436		phy-supply = <&vbus_host>;
437		status = "okay";
438	};
439};
440
441&usb_host0_ehci {
442	status = "okay";
443};
444
445&usb_host0_ohci {
446	status = "okay";
447};
448
449&usb_host1_ehci {
450	status = "okay";
451};
452
453&usb_host1_ohci {
454	status = "okay";
455};
456
457&usbdrd3_0 {
458	status = "okay";
459};
460
461&usbdrd_dwc3_0 {
462	status = "okay";
463};
464
465&vbus_host {
466	enable-active-high;
467	gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; /* USB1_EN_OC# */
468	pinctrl-names = "default";
469	pinctrl-0 = <&usb1_en_oc>;
470};
471
472&vbus_typec {
473	enable-active-high;
474	gpio = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>; /* USB0_EN_OC# */
475	pinctrl-names = "default";
476	pinctrl-0 = <&usb0_en_oc>;
477};
478