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