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