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