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