1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Based on rk3328-nanopi-r2s.dts, which is:
4 *   Copyright (c) 2020 David Bauer <[email protected]>
5 */
6
7/dts-v1/;
8
9#include <dt-bindings/gpio/gpio.h>
10#include <dt-bindings/leds/common.h>
11#include "rk3328.dtsi"
12
13/ {
14	aliases {
15		ethernet0 = &gmac2io;
16		ethernet1 = &rtl8153;
17		mmc0 = &sdmmc;
18	};
19
20	chosen {
21		stdout-path = "serial2:1500000n8";
22	};
23
24	gmac_clk: gmac-clock {
25		compatible = "fixed-clock";
26		clock-frequency = <125000000>;
27		clock-output-names = "gmac_clkin";
28		#clock-cells = <0>;
29	};
30
31	leds {
32		compatible = "gpio-leds";
33		pinctrl-0 = <&lan_led_pin>, <&sys_led_pin>, <&wan_led_pin>;
34		pinctrl-names = "default";
35
36		led-0 {
37			function = LED_FUNCTION_LAN;
38			color = <LED_COLOR_ID_GREEN>;
39			gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>;
40		};
41
42		led-1 {
43			function = LED_FUNCTION_STATUS;
44			color = <LED_COLOR_ID_RED>;
45			gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
46			linux,default-trigger = "heartbeat";
47		};
48
49		led-2 {
50			function = LED_FUNCTION_WAN;
51			color = <LED_COLOR_ID_GREEN>;
52			gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_HIGH>;
53		};
54	};
55
56	vcc_sd: regulator-sdmmc {
57		compatible = "regulator-fixed";
58		gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>;
59		pinctrl-0 = <&sdmmc0m1_pin>;
60		pinctrl-names = "default";
61		regulator-name = "vcc_sd";
62		regulator-boot-on;
63		vin-supply = <&vcc_io>;
64	};
65
66	vcc_sys: regulator-vcc-sys {
67		compatible = "regulator-fixed";
68		regulator-name = "vcc_sys";
69		regulator-always-on;
70		regulator-boot-on;
71		regulator-min-microvolt = <5000000>;
72		regulator-max-microvolt = <5000000>;
73	};
74
75	vdd_5v_lan: regulator-vdd-5v-lan {
76		compatible = "regulator-fixed";
77		enable-active-high;
78		gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>;
79		pinctrl-0 = <&lan_vdd_pin>;
80		pinctrl-names = "default";
81		regulator-name = "vdd_5v_lan";
82		regulator-always-on;
83		regulator-boot-on;
84		vin-supply = <&vcc_sys>;
85	};
86};
87
88&cpu0 {
89	cpu-supply = <&vdd_arm>;
90};
91
92&cpu1 {
93	cpu-supply = <&vdd_arm>;
94};
95
96&cpu2 {
97	cpu-supply = <&vdd_arm>;
98};
99
100&cpu3 {
101	cpu-supply = <&vdd_arm>;
102};
103
104&display_subsystem {
105	status = "disabled";
106};
107
108&gmac2io {
109	assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>;
110	assigned-clock-parents = <&gmac_clk>, <&gmac_clk>;
111	clock_in_out = "input";
112	phy-supply = <&vcc_io>;
113	pinctrl-0 = <&rgmiim1_pins>;
114	pinctrl-names = "default";
115
116	mdio {
117		compatible = "snps,dwmac-mdio";
118		#address-cells = <1>;
119		#size-cells = <0>;
120	};
121};
122
123&i2c1 {
124	status = "okay";
125
126	rk805: pmic@18 {
127		compatible = "rockchip,rk805";
128		reg = <0x18>;
129		interrupt-parent = <&gpio1>;
130		interrupts = <24 IRQ_TYPE_LEVEL_LOW>;
131		#clock-cells = <1>;
132		clock-output-names = "xin32k", "rk805-clkout2";
133		gpio-controller;
134		#gpio-cells = <2>;
135		pinctrl-0 = <&pmic_int_l>;
136		pinctrl-names = "default";
137		system-power-controller;
138		wakeup-source;
139
140		vcc1-supply = <&vcc_sys>;
141		vcc2-supply = <&vcc_sys>;
142		vcc3-supply = <&vcc_sys>;
143		vcc4-supply = <&vcc_sys>;
144		vcc5-supply = <&vcc_io>;
145		vcc6-supply = <&vcc_sys>;
146
147		regulators {
148			vdd_log: DCDC_REG1 {
149				regulator-name = "vdd_log";
150				regulator-always-on;
151				regulator-boot-on;
152				regulator-min-microvolt = <712500>;
153				regulator-max-microvolt = <1450000>;
154				regulator-ramp-delay = <12500>;
155
156				regulator-state-mem {
157					regulator-on-in-suspend;
158					regulator-suspend-microvolt = <1000000>;
159				};
160			};
161
162			vdd_arm: DCDC_REG2 {
163				regulator-name = "vdd_arm";
164				regulator-always-on;
165				regulator-boot-on;
166				regulator-min-microvolt = <712500>;
167				regulator-max-microvolt = <1450000>;
168				regulator-ramp-delay = <12500>;
169
170				regulator-state-mem {
171					regulator-on-in-suspend;
172					regulator-suspend-microvolt = <950000>;
173				};
174			};
175
176			vcc_ddr: DCDC_REG3 {
177				regulator-name = "vcc_ddr";
178				regulator-always-on;
179				regulator-boot-on;
180
181				regulator-state-mem {
182					regulator-on-in-suspend;
183				};
184			};
185
186			vcc_io: DCDC_REG4 {
187				regulator-name = "vcc_io";
188				regulator-always-on;
189				regulator-boot-on;
190				regulator-min-microvolt = <3300000>;
191				regulator-max-microvolt = <3300000>;
192
193				regulator-state-mem {
194					regulator-on-in-suspend;
195					regulator-suspend-microvolt = <3300000>;
196				};
197			};
198
199			vcc_18: LDO_REG1 {
200				regulator-name = "vcc_18";
201				regulator-always-on;
202				regulator-boot-on;
203				regulator-min-microvolt = <1800000>;
204				regulator-max-microvolt = <1800000>;
205
206				regulator-state-mem {
207					regulator-on-in-suspend;
208					regulator-suspend-microvolt = <1800000>;
209				};
210			};
211
212			vcc18_emmc: LDO_REG2 {
213				regulator-name = "vcc18_emmc";
214				regulator-always-on;
215				regulator-boot-on;
216				regulator-min-microvolt = <1800000>;
217				regulator-max-microvolt = <1800000>;
218
219				regulator-state-mem {
220					regulator-on-in-suspend;
221					regulator-suspend-microvolt = <1800000>;
222				};
223			};
224
225			vdd_10: LDO_REG3 {
226				regulator-name = "vdd_10";
227				regulator-always-on;
228				regulator-boot-on;
229				regulator-min-microvolt = <1000000>;
230				regulator-max-microvolt = <1000000>;
231
232				regulator-state-mem {
233					regulator-on-in-suspend;
234					regulator-suspend-microvolt = <1000000>;
235				};
236			};
237		};
238	};
239};
240
241&io_domains {
242	pmuio-supply = <&vcc_io>;
243	vccio1-supply = <&vcc_io>;
244	vccio2-supply = <&vcc18_emmc>;
245	vccio3-supply = <&vcc_io>;
246	vccio4-supply = <&vcc_io>;
247	vccio5-supply = <&vcc_io>;
248	vccio6-supply = <&vcc_io>;
249	status = "okay";
250};
251
252&pinctrl {
253	gmac2io {
254		eth_phy_reset_pin: eth-phy-reset-pin {
255			rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>;
256		};
257	};
258
259	leds {
260		lan_led_pin: lan-led-pin {
261			rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
262		};
263
264		sys_led_pin: sys-led-pin {
265			rockchip,pins = <3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
266		};
267
268		wan_led_pin: wan-led-pin {
269			rockchip,pins = <2 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
270		};
271	};
272
273	lan {
274		lan_vdd_pin: lan-vdd-pin {
275			rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
276		};
277	};
278
279	pmic {
280		pmic_int_l: pmic-int-l {
281			rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>;
282		};
283	};
284};
285
286&pwm2 {
287	status = "okay";
288};
289
290&sdmmc {
291	bus-width = <4>;
292	cap-sd-highspeed;
293	disable-wp;
294	pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>;
295	pinctrl-names = "default";
296	vmmc-supply = <&vcc_sd>;
297	status = "okay";
298};
299
300&spi0 {
301	status = "okay";
302
303	flash@0 {
304		compatible = "jedec,spi-nor";
305		reg = <0>;
306		spi-max-frequency = <50000000>;
307	};
308};
309
310&tsadc {
311	rockchip,hw-tshut-mode = <0>;
312	rockchip,hw-tshut-polarity = <0>;
313	status = "okay";
314};
315
316&u2phy {
317	status = "okay";
318};
319
320&u2phy_host {
321	status = "okay";
322};
323
324&u2phy_otg {
325	status = "okay";
326};
327
328&uart2 {
329	status = "okay";
330};
331
332&usb20_otg {
333	dr_mode = "host";
334	status = "okay";
335};
336
337&usbdrd3 {
338	dr_mode = "host";
339	status = "okay";
340	#address-cells = <1>;
341	#size-cells = <0>;
342
343	/* Second port is for USB 3.0 */
344	rtl8153: device@2 {
345		compatible = "usbbda,8153";
346		reg = <2>;
347	};
348};
349
350&usb_host0_ehci {
351	status = "okay";
352};
353
354&usb_host0_ohci {
355	status = "okay";
356};
357