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