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