1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * (C) Copyright 2020 Chen-Yu Tsai <wens@csie.org>
4 *
5 * Based on ./rk3328-rock64.dts, which is
6 *
7 * Copyright (c) 2017 PINE64
8 */
9
10/dts-v1/;
11
12#include <dt-bindings/gpio/gpio.h>
13#include <dt-bindings/input/input.h>
14#include <dt-bindings/leds/common.h>
15#include <dt-bindings/pinctrl/rockchip.h>
16
17#include "rk3328.dtsi"
18
19/ {
20	model = "Radxa ROCK Pi E";
21	compatible = "radxa,rockpi-e", "rockchip,rk3328";
22
23	chosen {
24		stdout-path = "serial2:1500000n8";
25	};
26
27	adc-keys {
28		compatible = "adc-keys";
29		io-channels = <&saradc 0>;
30		io-channel-names = "buttons";
31		keyup-threshold-microvolt = <1750000>;
32
33		/* This button is unpopulated out of the factory. */
34		button-recovery {
35			label = "Recovery";
36			linux,code = <KEY_VENDOR>;
37			press-threshold-microvolt = <10000>;
38		};
39	};
40
41	gmac_clkin: external-gmac-clock {
42		compatible = "fixed-clock";
43		clock-frequency = <125000000>;
44		clock-output-names = "gmac_clkin";
45		#clock-cells = <0>;
46	};
47
48	leds {
49		compatible = "gpio-leds";
50		pinctrl-0 = <&led_pin>;
51		pinctrl-names = "default";
52
53		led-0 {
54			color = <LED_COLOR_ID_BLUE>;
55			gpios = <&gpio3 RK_PA5 GPIO_ACTIVE_LOW>;
56			linux,default-trigger = "heartbeat";
57		};
58	};
59
60	vcc_sd: sdmmc-regulator {
61		compatible = "regulator-fixed";
62		gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>;
63		pinctrl-names = "default";
64		pinctrl-0 = <&sdmmc0m1_pin>;
65		regulator-name = "vcc_sd";
66		regulator-boot-on;
67		vin-supply = <&vcc_io>;
68	};
69
70	vcc_host_5v: vcc-host-5v-regulator {
71		compatible = "regulator-fixed";
72		gpio = <&gpio3 RK_PA7 GPIO_ACTIVE_HIGH>;
73		pinctrl-names = "default";
74		pinctrl-0 = <&usb30_host_drv>;
75		enable-active-high;
76		regulator-name = "vcc_host_5v";
77		regulator-always-on;
78		regulator-boot-on;
79		vin-supply = <&vcc_sys>;
80	};
81
82	vcc_sys: vcc-sys {
83		compatible = "regulator-fixed";
84		regulator-name = "vcc_sys";
85		regulator-always-on;
86		regulator-boot-on;
87		regulator-min-microvolt = <5000000>;
88		regulator-max-microvolt = <5000000>;
89	};
90
91	vcc_wifi: vcc-wifi-regulator {
92		compatible = "regulator-fixed";
93		gpio = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>;
94		pinctrl-names = "default";
95		pinctrl-0 = <&wifi_en>;
96		regulator-name = "vcc_wifi";
97		regulator-always-on;
98		regulator-boot-on;
99		vin-supply = <&vcc_io>;
100	};
101};
102
103&analog_sound {
104	status = "okay";
105};
106
107&codec {
108	status = "okay";
109};
110
111&cpu0 {
112	cpu-supply = <&vdd_arm>;
113};
114
115&cpu1 {
116	cpu-supply = <&vdd_arm>;
117};
118
119&cpu2 {
120	cpu-supply = <&vdd_arm>;
121};
122
123&cpu3 {
124	cpu-supply = <&vdd_arm>;
125};
126
127&emmc {
128	bus-width = <8>;
129	cap-mmc-highspeed;
130	mmc-ddr-1_8v;
131	mmc-hs200-1_8v;
132	non-removable;
133	pinctrl-names = "default";
134	pinctrl-0 = <&emmc_clk>, <&emmc_cmd>, <&emmc_bus8>;
135	vmmc-supply = <&vcc_io>;
136	vqmmc-supply = <&vcc18_emmc>;
137	status = "okay";
138};
139
140&gmac2io {
141	assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>;
142	assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>;
143	clock_in_out = "input";
144	phy-handle = <&rtl8211e>;
145	phy-mode = "rgmii";
146	phy-supply = <&vcc_io>;
147	pinctrl-names = "default";
148	pinctrl-0 = <&rgmiim1_pins>;
149	snps,aal;
150	snps,rxpbl = <0x4>;
151	snps,txpbl = <0x4>;
152	tx_delay = <0x26>;
153	rx_delay = <0x11>;
154	status = "okay";
155
156	mdio {
157		compatible = "snps,dwmac-mdio";
158		#address-cells = <1>;
159		#size-cells = <0>;
160
161		rtl8211e: ethernet-phy@1 {
162			reg = <1>;
163			pinctrl-0 = <&eth_phy_int_pin>, <&eth_phy_reset_pin>;
164			pinctrl-names = "default";
165			interrupt-parent = <&gpio1>;
166			interrupts = <24 IRQ_TYPE_LEVEL_LOW>;
167			reset-assert-us = <10000>;
168			reset-deassert-us = <50000>;
169			reset-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
170		};
171	};
172};
173
174&gmac2phy {
175	pinctrl-names = "default";
176	pinctrl-0 = <&fephyled_linkm1>, <&fephyled_rxm1>;
177	status = "okay";
178};
179
180&i2c1 {
181	status = "okay";
182
183	rk805: pmic@18 {
184		compatible = "rockchip,rk805";
185		reg = <0x18>;
186		interrupt-parent = <&gpio2>;
187		interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
188		#clock-cells = <1>;
189		clock-output-names = "xin32k", "rk805-clkout2";
190		gpio-controller;
191		#gpio-cells = <2>;
192		pinctrl-names = "default";
193		pinctrl-0 = <&pmic_int_l>;
194		rockchip,system-power-controller;
195		wakeup-source;
196
197		vcc1-supply = <&vcc_sys>;
198		vcc2-supply = <&vcc_sys>;
199		vcc3-supply = <&vcc_sys>;
200		vcc4-supply = <&vcc_sys>;
201		vcc5-supply = <&vcc_io>;
202		vcc6-supply = <&vcc_sys>;
203
204		regulators {
205			vdd_log: DCDC_REG1 {
206				regulator-name = "vdd_log";
207				regulator-always-on;
208				regulator-boot-on;
209				regulator-min-microvolt = <712500>;
210				regulator-max-microvolt = <1450000>;
211				regulator-ramp-delay = <12500>;
212
213				regulator-state-mem {
214					regulator-on-in-suspend;
215					regulator-suspend-microvolt = <1000000>;
216				};
217			};
218
219			vdd_arm: DCDC_REG2 {
220				regulator-name = "vdd_arm";
221				regulator-always-on;
222				regulator-boot-on;
223				regulator-min-microvolt = <712500>;
224				regulator-max-microvolt = <1450000>;
225				regulator-ramp-delay = <12500>;
226
227				regulator-state-mem {
228					regulator-on-in-suspend;
229					regulator-suspend-microvolt = <950000>;
230				};
231			};
232
233			vcc_ddr: DCDC_REG3 {
234				regulator-name = "vcc_ddr";
235				regulator-always-on;
236				regulator-boot-on;
237
238				regulator-state-mem {
239					regulator-on-in-suspend;
240				};
241			};
242
243			vcc_io: DCDC_REG4 {
244				regulator-name = "vcc_io";
245				regulator-always-on;
246				regulator-boot-on;
247				regulator-min-microvolt = <3300000>;
248				regulator-max-microvolt = <3300000>;
249
250				regulator-state-mem {
251					regulator-on-in-suspend;
252					regulator-suspend-microvolt = <3300000>;
253				};
254			};
255
256			vcc_18: LDO_REG1 {
257				regulator-name = "vcc_18";
258				regulator-always-on;
259				regulator-boot-on;
260				regulator-min-microvolt = <1800000>;
261				regulator-max-microvolt = <1800000>;
262
263				regulator-state-mem {
264					regulator-on-in-suspend;
265					regulator-suspend-microvolt = <1800000>;
266				};
267			};
268
269			vcc18_emmc: LDO_REG2 {
270				regulator-name = "vcc18_emmc";
271				regulator-always-on;
272				regulator-boot-on;
273				regulator-min-microvolt = <1800000>;
274				regulator-max-microvolt = <1800000>;
275
276				regulator-state-mem {
277					regulator-on-in-suspend;
278					regulator-suspend-microvolt = <1800000>;
279				};
280			};
281
282			vdd_10: LDO_REG3 {
283				regulator-name = "vdd_10";
284				regulator-always-on;
285				regulator-boot-on;
286				regulator-min-microvolt = <1000000>;
287				regulator-max-microvolt = <1000000>;
288
289				regulator-state-mem {
290					regulator-on-in-suspend;
291					regulator-suspend-microvolt = <1000000>;
292				};
293			};
294		};
295	};
296};
297
298&i2s1 {
299	status = "okay";
300};
301
302&io_domains {
303	pmuio-supply = <&vcc_io>;
304	vccio1-supply = <&vcc_io>;
305	vccio2-supply = <&vcc18_emmc>;
306	vccio3-supply = <&vcc_io>;
307	vccio4-supply = <&vcc_io>;
308	vccio5-supply = <&vcc_io>;
309	vccio6-supply = <&vcc_io>;
310	status = "okay";
311};
312
313&pinctrl {
314	ephy {
315		eth_phy_int_pin: eth-phy-int-pin {
316			rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_down>;
317		};
318
319		eth_phy_reset_pin: eth-phy-reset-pin {
320			rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>;
321		};
322	};
323
324	leds {
325		led_pin: led-pin {
326			rockchip,pins = <3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
327		};
328	};
329
330	pmic {
331		pmic_int_l: pmic-int-l {
332			rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;
333		};
334	};
335
336	usb3 {
337		usb30_host_drv: usb30-host-drv {
338			rockchip,pins = <3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
339		};
340	};
341
342	wifi {
343		wifi_en: wifi-en {
344			rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
345		};
346	};
347};
348
349&sdmmc {
350	bus-width = <4>;
351	cap-sd-highspeed;
352	disable-wp;
353	pinctrl-names = "default";
354	pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>;
355	vmmc-supply = <&vcc_sd>;
356	status = "okay";
357};
358
359&saradc {
360	vref-supply = <&vcc_18>;
361	status = "okay";
362};
363
364&tsadc {
365	status = "okay";
366};
367
368&u2phy {
369	status = "okay";
370};
371
372&u2phy_host {
373	status = "okay";
374};
375
376&uart2 {
377	status = "okay";
378};
379
380&usb_host0_ehci {
381	status = "okay";
382};
383