uboot-sunxi: add support for FriendlyARM NanoPi R1S H5
[openwrt/staging/dedeckeh.git] / package / boot / uboot-sunxi / patches / 253-sunxi-h5-add-support-for-nanopi-r1s-h5.patch
1 From e7510d24cab4741f72489b9d67c2d42b18fe5374 Mon Sep 17 00:00:00 2001
2 From: Chukun Pan <amadeus@jmu.edu.cn>
3 Date: Sun, 10 Oct 2021 21:36:57 +0800
4 Subject: [PATCH] sunxi: Add support for FriendlyARM NanoPi R1S H5
5
6 This adds support for the NanoPi R1S H5 board.
7
8 Allwinner H5 SoC
9 512MB DDR3 RAM
10 10/100/1000M Ethernet x 2
11 RTL8189ETV WiFi 802.11b/g/n
12 USB 2.0 host port (A)
13 MicroSD Slot
14 Reset button
15 Serial Debug Port
16 WAN - LAN - SYS LED
17
18 Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
19 ---
20 arch/arm/dts/Makefile | 1 +
21 arch/arm/dts/sun50i-h5-nanopi-r1s-h5.dts | 195 +++++++++++++++++++++++
22 board/sunxi/MAINTAINERS | 5 +
23 configs/nanopi_r1s_h5_defconfig | 14 ++
24 4 files changed, 215 insertions(+)
25 create mode 100644 arch/arm/dts/sun50i-h5-nanopi-r1s-h5.dts
26 create mode 100644 configs/nanopi_r1s_h5_defconfig
27
28 diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
29 index b8a382d1539..ed3d360bb10 100644
30 --- a/arch/arm/dts/Makefile
31 +++ b/arch/arm/dts/Makefile
32 @@ -638,6 +638,7 @@ dtb-$(CONFIG_MACH_SUN50I_H5) += \
33 sun50i-h5-libretech-all-h5-cc.dtb \
34 sun50i-h5-nanopi-neo2.dtb \
35 sun50i-h5-nanopi-neo-plus2.dtb \
36 + sun50i-h5-nanopi-r1s-h5.dtb \
37 sun50i-h5-orangepi-zero-plus.dtb \
38 sun50i-h5-orangepi-pc2.dtb \
39 sun50i-h5-orangepi-prime.dtb \
40 diff --git a/arch/arm/dts/sun50i-h5-nanopi-r1s-h5.dts b/arch/arm/dts/sun50i-h5-nanopi-r1s-h5.dts
41 new file mode 100644
42 index 00000000000..55bcdf8d1a0
43 --- /dev/null
44 +++ b/arch/arm/dts/sun50i-h5-nanopi-r1s-h5.dts
45 @@ -0,0 +1,190 @@
46 +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
47 +/*
48 + * Copyright (C) 2021 Chukun Pan <amadeus@jmu.edu.cn>
49 + *
50 + * Based on sun50i-h5-nanopi-neo-plus2.dts, which is:
51 + * Copyright (C) 2017 Antony Antony <antony@phenome.org>
52 + * Copyright (C) 2016 ARM Ltd.
53 + */
54 +
55 +/dts-v1/;
56 +#include "sun50i-h5.dtsi"
57 +
58 +#include <dt-bindings/gpio/gpio.h>
59 +#include <dt-bindings/input/input.h>
60 +
61 +/ {
62 + model = "FriendlyARM NanoPi R1S H5";
63 + compatible = "friendlyarm,nanopi-r1s-h5", "allwinner,sun50i-h5";
64 +
65 + aliases {
66 + ethernet0 = &emac;
67 + ethernet1 = &rtl8189etv;
68 + serial0 = &uart0;
69 + };
70 +
71 + chosen {
72 + stdout-path = "serial0:115200n8";
73 + };
74 +
75 + leds {
76 + compatible = "gpio-leds";
77 +
78 + sys {
79 + label = "nanopi:red:sys";
80 + gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>;
81 + linux,default-trigger = "heartbeat";
82 + };
83 +
84 + lan {
85 + label = "nanopi:green:lan";
86 + gpios = <&pio 0 9 GPIO_ACTIVE_HIGH>;
87 + };
88 +
89 + wan {
90 + label = "nanopi:green:wan";
91 + gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>;
92 + };
93 + };
94 +
95 + r-gpio-keys {
96 + compatible = "gpio-keys";
97 +
98 + reset {
99 + label = "reset";
100 + linux,code = <KEY_RESTART>;
101 + gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
102 + };
103 + };
104 +
105 + reg_gmac_3v3: gmac-3v3 {
106 + compatible = "regulator-fixed";
107 + regulator-name = "gmac-3v3";
108 + regulator-min-microvolt = <3300000>;
109 + regulator-max-microvolt = <3300000>;
110 + startup-delay-us = <100000>;
111 + enable-active-high;
112 + gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
113 + };
114 +
115 + reg_vcc3v3: vcc3v3 {
116 + compatible = "regulator-fixed";
117 + regulator-name = "vcc3v3";
118 + regulator-min-microvolt = <3300000>;
119 + regulator-max-microvolt = <3300000>;
120 + };
121 +
122 + reg_usb0_vbus: usb0-vbus {
123 + compatible = "regulator-fixed";
124 + regulator-name = "usb0-vbus";
125 + regulator-min-microvolt = <5000000>;
126 + regulator-max-microvolt = <5000000>;
127 + enable-active-high;
128 + gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
129 + status = "okay";
130 + };
131 +
132 + vdd_cpux: gpio-regulator {
133 + compatible = "regulator-gpio";
134 + regulator-name = "vdd-cpux";
135 + regulator-type = "voltage";
136 + regulator-boot-on;
137 + regulator-always-on;
138 + regulator-min-microvolt = <1100000>;
139 + regulator-max-microvolt = <1300000>;
140 + regulator-ramp-delay = <50>; /* 4ms */
141 + gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>;
142 + gpios-states = <0x1>;
143 + states = <1100000 0x0>, <1300000 0x1>;
144 + };
145 +
146 + wifi_pwrseq: wifi_pwrseq {
147 + compatible = "mmc-pwrseq-simple";
148 + reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
149 + post-power-on-delay-ms = <200>;
150 + };
151 +};
152 +
153 +&cpu0 {
154 + cpu-supply = <&vdd_cpux>;
155 +};
156 +
157 +&ehci1 {
158 + status = "okay";
159 +};
160 +
161 +&ehci2 {
162 + status = "okay";
163 +};
164 +
165 +&emac {
166 + pinctrl-names = "default";
167 + pinctrl-0 = <&emac_rgmii_pins>;
168 + phy-supply = <&reg_gmac_3v3>;
169 + phy-handle = <&ext_rgmii_phy>;
170 + phy-mode = "rgmii-id";
171 + status = "okay";
172 +};
173 +
174 +&external_mdio {
175 + ext_rgmii_phy: ethernet-phy@7 {
176 + compatible = "ethernet-phy-ieee802.3-c22";
177 + reg = <7>;
178 + };
179 +};
180 +
181 +&i2c0 {
182 + status = "okay";
183 +
184 + eeprom@51 {
185 + compatible = "microchip,24c02";
186 + reg = <0x51>;
187 + pagesize = <16>;
188 + };
189 +};
190 +
191 +&mmc0 {
192 + vmmc-supply = <&reg_vcc3v3>;
193 + bus-width = <4>;
194 + cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
195 + status = "okay";
196 +};
197 +
198 +&mmc1 {
199 + vmmc-supply = <&reg_vcc3v3>;
200 + vqmmc-supply = <&reg_vcc3v3>;
201 + mmc-pwrseq = <&wifi_pwrseq>;
202 + bus-width = <4>;
203 + non-removable;
204 + status = "okay";
205 +
206 + rtl8189etv: sdio_wifi@1 {
207 + reg = <1>;
208 + };
209 +};
210 +
211 +&ohci1 {
212 + status = "okay";
213 +};
214 +
215 +&ohci2 {
216 + status = "okay";
217 +};
218 +
219 +&uart0 {
220 + pinctrl-names = "default";
221 + pinctrl-0 = <&uart0_pa_pins>;
222 + status = "okay";
223 +};
224 +
225 +&usb_otg {
226 + dr_mode = "peripheral";
227 + status = "okay";
228 +};
229 +
230 +&usbphy {
231 + /* USB Type-A port's VBUS is always on */
232 + usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
233 + usb0_vbus-supply = <&reg_usb0_vbus>;
234 + status = "okay";
235 +};
236 diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS
237 index 2543c94de79..56a0ee3689b 100644
238 --- a/board/sunxi/MAINTAINERS
239 +++ b/board/sunxi/MAINTAINERS
240 @@ -358,6 +358,11 @@ M: Jelle van der Waa <jelle@vdwaa.nl>
241 S: Maintained
242 F: configs/nanopi_neo_air_defconfig
243
244 +NANOPI-R1S-H5 BOARD
245 +M: Chukun Pan <amadeus@jmu.edu.cn>
246 +S: Maintained
247 +F: configs/nanopi_r1s_h5_defconfig
248 +
249 NANOPI-A64 BOARD
250 M: Jagan Teki <jagan@amarulasolutions.com>
251 S: Maintained
252 diff --git a/configs/nanopi_r1s_h5_defconfig b/configs/nanopi_r1s_h5_defconfig
253 new file mode 100644
254 index 00000000000..27cf172d72a
255 --- /dev/null
256 +++ b/configs/nanopi_r1s_h5_defconfig
257 @@ -0,0 +1,14 @@
258 +CONFIG_ARM=y
259 +CONFIG_ARCH_SUNXI=y
260 +CONFIG_SPL=y
261 +CONFIG_MACH_SUN50I_H5=y
262 +CONFIG_DRAM_CLK=672
263 +CONFIG_DRAM_ZQ=3881977
264 +# CONFIG_DRAM_ODT_EN is not set
265 +CONFIG_MACPWR="PD6"
266 +CONFIG_MMC_SUNXI_SLOT_EXTRA=2
267 +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
268 +CONFIG_DEFAULT_DEVICE_TREE="sun50i-h5-nanopi-r1s-h5"
269 +CONFIG_SUN8I_EMAC=y
270 +CONFIG_USB_EHCI_HCD=y
271 +CONFIG_USB_OHCI_HCD=y