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