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