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	pinctrl-names = "default";
181	pinctrl-0 = <&fephyled_linkm1>, <&fephyled_rxm1>;
182	status = "okay";
183};
184
185&i2c1 {
186	status = "okay";
187
188	rk805: pmic@18 {
189		compatible = "rockchip,rk805";
190		reg = <0x18>;
191		interrupt-parent = <&gpio2>;
192		interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
193		#clock-cells = <1>;
194		clock-output-names = "xin32k", "rk805-clkout2";
195		gpio-controller;
196		#gpio-cells = <2>;
197		pinctrl-names = "default";
198		pinctrl-0 = <&pmic_int_l>;
199		rockchip,system-power-controller;
200		wakeup-source;
201
202		vcc1-supply = <&vcc_sys>;
203		vcc2-supply = <&vcc_sys>;
204		vcc3-supply = <&vcc_sys>;
205		vcc4-supply = <&vcc_sys>;
206		vcc5-supply = <&vcc_io>;
207		vcc6-supply = <&vcc_sys>;
208
209		regulators {
210			vdd_log: DCDC_REG1 {
211				regulator-name = "vdd_log";
212				regulator-always-on;
213				regulator-boot-on;
214				regulator-min-microvolt = <712500>;
215				regulator-max-microvolt = <1450000>;
216				regulator-ramp-delay = <12500>;
217
218				regulator-state-mem {
219					regulator-on-in-suspend;
220					regulator-suspend-microvolt = <1000000>;
221				};
222			};
223
224			vdd_arm: DCDC_REG2 {
225				regulator-name = "vdd_arm";
226				regulator-always-on;
227				regulator-boot-on;
228				regulator-min-microvolt = <712500>;
229				regulator-max-microvolt = <1450000>;
230				regulator-ramp-delay = <12500>;
231
232				regulator-state-mem {
233					regulator-on-in-suspend;
234					regulator-suspend-microvolt = <950000>;
235				};
236			};
237
238			vcc_ddr: DCDC_REG3 {
239				regulator-name = "vcc_ddr";
240				regulator-always-on;
241				regulator-boot-on;
242
243				regulator-state-mem {
244					regulator-on-in-suspend;
245				};
246			};
247
248			vcc_io: DCDC_REG4 {
249				regulator-name = "vcc_io";
250				regulator-always-on;
251				regulator-boot-on;
252				regulator-min-microvolt = <3300000>;
253				regulator-max-microvolt = <3300000>;
254
255				regulator-state-mem {
256					regulator-on-in-suspend;
257					regulator-suspend-microvolt = <3300000>;
258				};
259			};
260
261			vcc_18: LDO_REG1 {
262				regulator-name = "vcc_18";
263				regulator-always-on;
264				regulator-boot-on;
265				regulator-min-microvolt = <1800000>;
266				regulator-max-microvolt = <1800000>;
267
268				regulator-state-mem {
269					regulator-on-in-suspend;
270					regulator-suspend-microvolt = <1800000>;
271				};
272			};
273
274			vcc18_emmc: LDO_REG2 {
275				regulator-name = "vcc18_emmc";
276				regulator-always-on;
277				regulator-boot-on;
278				regulator-min-microvolt = <1800000>;
279				regulator-max-microvolt = <1800000>;
280
281				regulator-state-mem {
282					regulator-on-in-suspend;
283					regulator-suspend-microvolt = <1800000>;
284				};
285			};
286
287			vdd_10: LDO_REG3 {
288				regulator-name = "vdd_10";
289				regulator-always-on;
290				regulator-boot-on;
291				regulator-min-microvolt = <1000000>;
292				regulator-max-microvolt = <1000000>;
293
294				regulator-state-mem {
295					regulator-on-in-suspend;
296					regulator-suspend-microvolt = <1000000>;
297				};
298			};
299		};
300	};
301};
302
303&i2s1 {
304	status = "okay";
305};
306
307&io_domains {
308	pmuio-supply = <&vcc_io>;
309	vccio1-supply = <&vcc_io>;
310	vccio2-supply = <&vcc18_emmc>;
311	vccio3-supply = <&vcc_io>;
312	vccio4-supply = <&vcc_io>;
313	vccio5-supply = <&vcc_io>;
314	vccio6-supply = <&vcc_io>;
315	status = "okay";
316};
317
318&pinctrl {
319	ephy {
320		eth_phy_int_pin: eth-phy-int-pin {
321			rockchip,pins = <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_down>;
322		};
323
324		eth_phy_reset_pin: eth-phy-reset-pin {
325			rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>;
326		};
327	};
328
329	leds {
330		led_pin: led-pin {
331			rockchip,pins = <3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
332		};
333	};
334
335	pmic {
336		pmic_int_l: pmic-int-l {
337			rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;
338		};
339	};
340
341	usb3 {
342		usb30_host_drv: usb30-host-drv {
343			rockchip,pins = <3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
344		};
345	};
346
347	wifi {
348		wifi_en: wifi-en {
349			rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
350		};
351	};
352};
353
354&sdmmc {
355	bus-width = <4>;
356	cap-sd-highspeed;
357	disable-wp;
358	pinctrl-names = "default";
359	pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>;
360	vmmc-supply = <&vcc_sd>;
361	status = "okay";
362};
363
364&saradc {
365	vref-supply = <&vcc_18>;
366	status = "okay";
367};
368
369&tsadc {
370	status = "okay";
371};
372
373&u2phy {
374	status = "okay";
375};
376
377&u2phy_host {
378	status = "okay";
379};
380
381&uart2 {
382	status = "okay";
383};
384
385&usb_host0_ehci {
386	status = "okay";
387};
388