mediatek: Add support for Xiaomi Redmi Router AX6S
[openwrt/staging/wigyori.git] / target / linux / sunxi / patches-5.4 / 101-sunxi-h5-add-support-for-nanopi-r1s-h5.patch
1 From 9962cb9be2db877c232aaf00db40125c0d7bf4bc Mon Sep 17 00:00:00 2001
2 From: Chukun Pan <amadeus@jmu.edu.cn>
3 Date: Mon, 17 May 2021 00:35:22 +0800
4 Subject: [PATCH] arm64: dts: allwinner: h5: Add NanoPi R1S H5 support
5
6 The NanoPi R1S H5 is a open source board made by FriendlyElec.
7 It has the following features:
8
9 - Allwinner H5, Quad-core Cortex-A53
10 - 512MB DDR3 RAM
11 - 10/100/1000M Ethernet x 2
12 - RTL8189ETV WiFi 802.11b/g/n
13 - USB 2.0 host port (A)
14 - MicroSD Slot
15 - Serial Debug Port
16 - 5V 2A DC power-supply
17
18 Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
19 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
20 Link: https://lore.kernel.org/r/20210516163523.9484-2-amadeus@jmu.edu.cn
21 ---
22 arch/arm64/boot/dts/allwinner/Makefile | 1 +
23 .../dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts | 195 ++++++++++++++++++
24 2 files changed, 196 insertions(+)
25 create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts
26
27 --- a/arch/arm64/boot/dts/allwinner/Makefile
28 +++ b/arch/arm64/boot/dts/allwinner/Makefile
29 @@ -17,6 +17,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-em
30 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-libretech-all-h3-cc.dtb
31 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-neo2.dtb
32 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-neo-plus2.dtb
33 +dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-r1s-h5.dtb
34 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-pc2.dtb
35 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-prime.dtb
36 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-zero-plus.dtb
37 --- /dev/null
38 +++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-r1s-h5.dts
39 @@ -0,0 +1,190 @@
40 +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
41 +/*
42 + * Copyright (C) 2021 Chukun Pan <amadeus@jmu.edu.cn>
43 + *
44 + * Based on sun50i-h5-nanopi-neo-plus2.dts, which is:
45 + * Copyright (C) 2017 Antony Antony <antony@phenome.org>
46 + * Copyright (C) 2016 ARM Ltd.
47 + */
48 +
49 +/dts-v1/;
50 +#include "sun50i-h5.dtsi"
51 +
52 +#include <dt-bindings/gpio/gpio.h>
53 +#include <dt-bindings/input/input.h>
54 +
55 +/ {
56 + model = "FriendlyARM NanoPi R1S H5";
57 + compatible = "friendlyarm,nanopi-r1s-h5", "allwinner,sun50i-h5";
58 +
59 + aliases {
60 + ethernet0 = &emac;
61 + ethernet1 = &rtl8189etv;
62 + serial0 = &uart0;
63 + };
64 +
65 + chosen {
66 + stdout-path = "serial0:115200n8";
67 + };
68 +
69 + leds {
70 + compatible = "gpio-leds";
71 +
72 + sys {
73 + label = "nanopi:red:sys";
74 + gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>;
75 + linux,default-trigger = "heartbeat";
76 + };
77 +
78 + lan {
79 + label = "nanopi:green:lan";
80 + gpios = <&pio 0 9 GPIO_ACTIVE_HIGH>;
81 + };
82 +
83 + wan {
84 + label = "nanopi:green:wan";
85 + gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>;
86 + };
87 + };
88 +
89 + r-gpio-keys {
90 + compatible = "gpio-keys";
91 +
92 + reset {
93 + label = "reset";
94 + linux,code = <KEY_RESTART>;
95 + gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
96 + };
97 + };
98 +
99 + reg_gmac_3v3: gmac-3v3 {
100 + compatible = "regulator-fixed";
101 + regulator-name = "gmac-3v3";
102 + regulator-min-microvolt = <3300000>;
103 + regulator-max-microvolt = <3300000>;
104 + startup-delay-us = <100000>;
105 + enable-active-high;
106 + gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
107 + };
108 +
109 + reg_vcc3v3: vcc3v3 {
110 + compatible = "regulator-fixed";
111 + regulator-name = "vcc3v3";
112 + regulator-min-microvolt = <3300000>;
113 + regulator-max-microvolt = <3300000>;
114 + };
115 +
116 + reg_usb0_vbus: usb0-vbus {
117 + compatible = "regulator-fixed";
118 + regulator-name = "usb0-vbus";
119 + regulator-min-microvolt = <5000000>;
120 + regulator-max-microvolt = <5000000>;
121 + enable-active-high;
122 + gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
123 + status = "okay";
124 + };
125 +
126 + vdd_cpux: gpio-regulator {
127 + compatible = "regulator-gpio";
128 + regulator-name = "vdd-cpux";
129 + regulator-type = "voltage";
130 + regulator-boot-on;
131 + regulator-always-on;
132 + regulator-min-microvolt = <1100000>;
133 + regulator-max-microvolt = <1300000>;
134 + regulator-ramp-delay = <50>; /* 4ms */
135 + gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>;
136 + gpios-states = <0x1>;
137 + states = <1100000 0x0>, <1300000 0x1>;
138 + };
139 +
140 + wifi_pwrseq: wifi_pwrseq {
141 + compatible = "mmc-pwrseq-simple";
142 + reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
143 + post-power-on-delay-ms = <200>;
144 + };
145 +};
146 +
147 +&cpu0 {
148 + cpu-supply = <&vdd_cpux>;
149 +};
150 +
151 +&ehci1 {
152 + status = "okay";
153 +};
154 +
155 +&ehci2 {
156 + status = "okay";
157 +};
158 +
159 +&emac {
160 + pinctrl-names = "default";
161 + pinctrl-0 = <&emac_rgmii_pins>;
162 + phy-supply = <&reg_gmac_3v3>;
163 + phy-handle = <&ext_rgmii_phy>;
164 + phy-mode = "rgmii";
165 + status = "okay";
166 +};
167 +
168 +&external_mdio {
169 + ext_rgmii_phy: ethernet-phy@7 {
170 + compatible = "ethernet-phy-ieee802.3-c22";
171 + reg = <7>;
172 + };
173 +};
174 +
175 +&i2c0 {
176 + status = "okay";
177 +
178 + eeprom@51 {
179 + compatible = "microchip,24c02";
180 + reg = <0x51>;
181 + pagesize = <16>;
182 + };
183 +};
184 +
185 +&mmc0 {
186 + vmmc-supply = <&reg_vcc3v3>;
187 + bus-width = <4>;
188 + cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
189 + status = "okay";
190 +};
191 +
192 +&mmc1 {
193 + vmmc-supply = <&reg_vcc3v3>;
194 + vqmmc-supply = <&reg_vcc3v3>;
195 + mmc-pwrseq = <&wifi_pwrseq>;
196 + bus-width = <4>;
197 + non-removable;
198 + status = "okay";
199 +
200 + rtl8189etv: sdio_wifi@1 {
201 + reg = <1>;
202 + };
203 +};
204 +
205 +&ohci1 {
206 + status = "okay";
207 +};
208 +
209 +&ohci2 {
210 + status = "okay";
211 +};
212 +
213 +&uart0 {
214 + pinctrl-names = "default";
215 + pinctrl-0 = <&uart0_pa_pins>;
216 + status = "okay";
217 +};
218 +
219 +&usb_otg {
220 + dr_mode = "peripheral";
221 + status = "okay";
222 +};
223 +
224 +&usbphy {
225 + /* USB Type-A port's VBUS is always on */
226 + usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
227 + usb0_vbus-supply = <&reg_usb0_vbus>;
228 + status = "okay";
229 +};