rockchip: add NanoPi R2S support
[openwrt/openwrt.git] / target / linux / rockchip / patches-5.4 / 001-rockchip-rk3328-Add-support-for-FriendlyARM-NanoPi-R.patch
1 From 749cbb7b1a4bc2244b6af8cd7d8b471d4e33c80f Mon Sep 17 00:00:00 2001
2 From: David Bauer <mail@david-bauer.net>
3 Date: Fri, 10 Jul 2020 15:57:46 +0200
4 Subject: [PATCH] rockchip: rk3328: Add support for FriendlyARM NanoPi R2S
5
6 This adds support for the NanoPi R2S from FriendlyARM.
7
8 Rockchip RK3328 SoC
9 1GB DDR4 RAM
10 Gigabit Ethernet (WAN)
11 Gigabit Ethernet (USB3) (LAN)
12 USB 2.0 Host Port
13 MicroSD slot
14 Reset button
15 WAN - LAN - SYS LED
16
17 Signed-off-by: David Bauer <mail@david-bauer.net>
18 ---
19 arch/arm64/boot/dts/rockchip/Makefile | 1 +
20 .../boot/dts/rockchip/rk3328-nanopi-r2s.dts | 334 ++++++++++++++++++
21 2 files changed, 335 insertions(+)
22 create mode 100644 arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
23
24 --- a/arch/arm64/boot/dts/rockchip/Makefile
25 +++ b/arch/arm64/boot/dts/rockchip/Makefile
26 @@ -1,6 +1,7 @@
27 # SPDX-License-Identifier: GPL-2.0
28 dtb-$(CONFIG_ARCH_ROCKCHIP) += px30-evb.dtb
29 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-evb.dtb
30 +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-nanopi-r2s.dtb
31 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-rock64.dtb
32 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3328-roc-cc.dtb
33 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3368-evb-act8846.dtb
34 --- /dev/null
35 +++ b/arch/arm64/boot/dts/rockchip/rk3328-nanopi-r2s.dts
36 @@ -0,0 +1,334 @@
37 +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
38 +/*
39 + * Copyright (c) 2020 David Bauer <mail@david-bauer.net>
40 + */
41 +
42 +/dts-v1/;
43 +
44 +#include <dt-bindings/input/input.h>
45 +#include <dt-bindings/gpio/gpio.h>
46 +#include "rk3328.dtsi"
47 +
48 +/ {
49 + model = "FriendlyARM NanoPi R2S";
50 + compatible = "friendlyarm,nanopi-r2s", "rockchip,rk3328";
51 +
52 + chosen {
53 + stdout-path = "serial2:1500000n8";
54 + };
55 +
56 + gmac_clkin: external-gmac-clock {
57 + compatible = "fixed-clock";
58 + clock-frequency = <125000000>;
59 + clock-output-names = "gmac_clkin";
60 + #clock-cells = <0>;
61 + };
62 +
63 + vcc_sd: sdmmc-regulator {
64 + compatible = "regulator-fixed";
65 + gpio = <&gpio0 RK_PD6 GPIO_ACTIVE_LOW>;
66 + pinctrl-names = "default";
67 + pinctrl-0 = <&sdmmc0m1_gpio>;
68 + regulator-name = "vcc_sd";
69 + regulator-min-microvolt = <3300000>;
70 + regulator-max-microvolt = <3300000>;
71 + vin-supply = <&vcc_io>;
72 + };
73 +
74 + vcc_sdio: sdmmcio-regulator {
75 + compatible = "regulator-gpio";
76 + gpios = <&gpio1 RK_PD4 GPIO_ACTIVE_HIGH>;
77 + enable-active-high;
78 + states = <1800000 0x1
79 + 3300000 0x0>;
80 + pinctrl-names = "default";
81 + pinctrl-0 = <&sdio_vcc_pin>;
82 + regulator-always-on;
83 + regulator-min-microvolt = <1800000>;
84 + regulator-max-microvolt = <3300000>;
85 + regulator-name = "vcc_sdio";
86 + regulator-settling-time-us = <5000>;
87 + regulator-type = "voltage";
88 + vin-supply = <&vcc_io>;
89 + };
90 +
91 + vcc_sys: vcc-sys {
92 + compatible = "regulator-fixed";
93 + regulator-name = "vcc_sys";
94 + regulator-always-on;
95 + regulator-boot-on;
96 + regulator-min-microvolt = <5000000>;
97 + regulator-max-microvolt = <5000000>;
98 + };
99 +
100 + leds {
101 + compatible = "gpio-leds";
102 +
103 + pinctrl-names = "default";
104 + pinctrl-0 = <&led_pins>;
105 +
106 + sys {
107 + gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
108 + label = "nanopi-r2s:red:sys";
109 + };
110 +
111 + lan {
112 + gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>;
113 + label = "nanopi-r2s:green:lan";
114 + };
115 +
116 + wan {
117 + gpios = <&gpio2 RK_PC2 GPIO_ACTIVE_HIGH>;
118 + label = "nanopi-r2s:green:wan";
119 + };
120 + };
121 +
122 + gpio_keys {
123 + compatible = "gpio-keys-polled";
124 + poll-interval = <100>;
125 +
126 + pinctrl-names = "default";
127 + pinctrl-0 = <&button_pins>;
128 +
129 + reset {
130 + label = "Reset Button";
131 + gpios = <&gpio0 RK_PA0 GPIO_ACTIVE_LOW>;
132 + linux,code = <KEY_RESTART>;
133 + debounce-interval = <50>;
134 + };
135 + };
136 +};
137 +
138 +&cpu0 {
139 + cpu-supply = <&vdd_arm>;
140 +};
141 +
142 +&cpu1 {
143 + cpu-supply = <&vdd_arm>;
144 +};
145 +
146 +&cpu2 {
147 + cpu-supply = <&vdd_arm>;
148 +};
149 +
150 +&cpu3 {
151 + cpu-supply = <&vdd_arm>;
152 +};
153 +
154 +&gmac2io {
155 + assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>;
156 + assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>;
157 + clock_in_out = "input";
158 + phy-supply = <&vcc_io>;
159 + phy-handle = <&rtl8211e>;
160 + phy-mode = "rgmii";
161 + pinctrl-names = "default";
162 + pinctrl-0 = <&rgmiim1_pins>;
163 + snps,aal;
164 + snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
165 + snps,reset-active-low;
166 + snps,reset-delays-us = <0 10000 50000>;
167 + tx_delay = <0x24>;
168 + rx_delay = <0x18>;
169 + status = "okay";
170 +
171 + mdio {
172 + compatible = "snps,dwmac-mdio";
173 + #address-cells = <1>;
174 + #size-cells = <0>;
175 +
176 + rtl8211e: ethernet-phy@0 {
177 + reg = <0>;
178 + };
179 + };
180 +};
181 +
182 +&i2c1 {
183 + status = "okay";
184 +
185 + rk805: rk805@18 {
186 + compatible = "rockchip,rk805";
187 + reg = <0x18>;
188 + interrupt-parent = <&gpio2>;
189 + interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
190 + #clock-cells = <1>;
191 + clock-output-names = "xin32k", "rk805-clkout2";
192 + gpio-controller;
193 + #gpio-cells = <2>;
194 + pinctrl-names = "default";
195 + pinctrl-0 = <&pmic_int_l>;
196 + rockchip,system-power-controller;
197 + wakeup-source;
198 +
199 + vcc1-supply = <&vcc_sys>;
200 + vcc2-supply = <&vcc_sys>;
201 + vcc3-supply = <&vcc_sys>;
202 + vcc4-supply = <&vcc_sys>;
203 + vcc5-supply = <&vcc_io>;
204 + vcc6-supply = <&vcc_sys>;
205 +
206 + regulators {
207 + vdd_logic: DCDC_REG1 {
208 + regulator-name = "vdd_logic";
209 + regulator-min-microvolt = <712500>;
210 + regulator-max-microvolt = <1450000>;
211 + regulator-ramp-delay = <12500>;
212 + regulator-always-on;
213 + regulator-boot-on;
214 + regulator-state-mem {
215 + regulator-on-in-suspend;
216 + regulator-suspend-microvolt = <1000000>;
217 + };
218 + };
219 +
220 + vdd_arm: DCDC_REG2 {
221 + regulator-name = "vdd_arm";
222 + regulator-min-microvolt = <712500>;
223 + regulator-max-microvolt = <1450000>;
224 + regulator-ramp-delay = <12500>;
225 + regulator-always-on;
226 + regulator-boot-on;
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 + regulator-state-mem {
238 + regulator-on-in-suspend;
239 + };
240 + };
241 +
242 + vcc_io: DCDC_REG4 {
243 + regulator-name = "vcc_io";
244 + regulator-min-microvolt = <3300000>;
245 + regulator-max-microvolt = <3300000>;
246 + regulator-always-on;
247 + regulator-boot-on;
248 + regulator-state-mem {
249 + regulator-on-in-suspend;
250 + regulator-suspend-microvolt = <3300000>;
251 + };
252 + };
253 +
254 + vcc_18: LDO_REG1 {
255 + regulator-name = "vcc_18";
256 + regulator-min-microvolt = <1800000>;
257 + regulator-max-microvolt = <1800000>;
258 + regulator-always-on;
259 + regulator-boot-on;
260 + regulator-state-mem {
261 + regulator-on-in-suspend;
262 + regulator-suspend-microvolt = <1800000>;
263 + };
264 + };
265 +
266 + vcc18_emmc: LDO_REG2 {
267 + regulator-name = "vcc18_emmc";
268 + regulator-min-microvolt = <1800000>;
269 + regulator-max-microvolt = <1800000>;
270 + regulator-always-on;
271 + regulator-boot-on;
272 + regulator-state-mem {
273 + regulator-on-in-suspend;
274 + regulator-suspend-microvolt = <1800000>;
275 + };
276 + };
277 +
278 + vdd_10: LDO_REG3 {
279 + regulator-name = "vdd_10";
280 + regulator-min-microvolt = <1000000>;
281 + regulator-max-microvolt = <1000000>;
282 + regulator-always-on;
283 + regulator-boot-on;
284 + regulator-state-mem {
285 + regulator-on-in-suspend;
286 + regulator-suspend-microvolt = <1000000>;
287 + };
288 + };
289 + };
290 + };
291 +};
292 +
293 +&io_domains {
294 + status = "okay";
295 +
296 + vccio1-supply = <&vcc_io>;
297 + vccio2-supply = <&vcc18_emmc>;
298 + vccio3-supply = <&vcc_sdio>;
299 + vccio4-supply = <&vcc_18>;
300 + vccio5-supply = <&vcc_io>;
301 + vccio6-supply = <&vcc_io>;
302 + pmuio-supply = <&vcc_io>;
303 +};
304 +
305 +&pinctrl {
306 + leds {
307 + led_pins: led-pins {
308 + rockchip,pins = <0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>,
309 + <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>,
310 + <2 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
311 + };
312 + };
313 +
314 + button {
315 + button_pins: button-pins {
316 + rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
317 + };
318 + };
319 +
320 + pmic {
321 + pmic_int_l: pmic-int-l {
322 + rockchip,pins = <2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;
323 + };
324 + };
325 +
326 + sd {
327 + sdio_vcc_pin: sdio-vcc-pin {
328 + rockchip,pins = <1 RK_PD4 RK_FUNC_GPIO &pcfg_pull_up>;
329 + };
330 + };
331 +};
332 +
333 +&sdmmc {
334 + bus-width = <4>;
335 + cap-mmc-highspeed;
336 + cap-sd-highspeed;
337 + disable-wp;
338 + max-frequency = <150000000>;
339 + pinctrl-names = "default";
340 + pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>;
341 + vmmc-supply = <&vcc_sd>;
342 + vqmmc-supply = <&vcc_sdio>;
343 + status = "okay";
344 +};
345 +
346 +&tsadc {
347 + rockchip,hw-tshut-mode = <0>;
348 + rockchip,hw-tshut-polarity = <0>;
349 + status = "okay";
350 +};
351 +
352 +&uart2 {
353 + status = "okay";
354 +};
355 +
356 +&u2phy {
357 + status = "okay";
358 +
359 + u2phy_host: host-port {
360 + status = "okay";
361 + };
362 +};
363 +
364 +&usb_host0_ehci {
365 + status = "okay";
366 +};
367 +
368 +&usb_host0_ohci {
369 + status = "okay";
370 +};