Skip to content

Commit afaea03

Browse files
committed
mediatek: add Huasifei WH3000R NAND support
**Huasifei WH3000R NAND** Wi-Fi 6 router based on MediaTek MT7981B SoC. MT7981B+MT7976CN+MT7531AE **Specifications** SoC: Filogic 820 MT7981B (1.3GHz) RAM: DDR3 512MB Flash: 256MiB Winbond SPI NAND WiFi: MT7976C: 2.4GHz 2x2, 5GHz 2x2 Ethernet: MT7531: 3x 1GbE LAN + 1x 1GbE WAN USB: 1x USB 3.0 port Two buttons: reset and mesh LEDs: RGB (red, green, blue together) UART: 3.3V, TX, RX, GND / 115200 8N1 DC power interface +---------+-------------------+--------------------------+ | | MAC | Algorithm | +---------+-------------------+--------------------------+ | LAN | 58:23:BC:xx:xx:x2 | label+1 | | WAN | 58:23:BC:xx:xx:x1 | label+0 (eeprom) | | WLAN 2g | 58:23:BC:xx:xx:x3 | label+2 | | WLAN 5g | 58:23:BC:xx:xx:x4 | label+3 | +---------+-------------------+--------------------------+ Since it's convenient for the users to check and tell MAC to their internet providers from the router label, we set WAN as a base MAC located at 'Factory', 0x4. Discussed this with the vendor. **Installation via U-Boot rescue** 1. Set static IP 192.168.1.2 on your computer and default route as 192.168.1.1 2. Connect to the LAN port and hold the reset button while booting the device. 3. Wait for the LED to blink 5 times, and release the reset button. 4. Open U-boot web page on your browser at http://192.168.1.1 5. Select the OpenWrt sysupgrade image, upload it, and start the upgrade. 6. Wait for the router to flash the new firmware. 7. Wait for the router to reboot itself. **Installation via sysupgrade** Just flash sysupgrade file via [LuCI upgrade page](http://192.168.1.1/cgi-bin/luci/admin/system/flash) without saving the settings. **Installation via SSH** Upload the file to the router `/tmp` directory, `ssh root@192.168.1.1` and issue a command: ``` sysupgrade -n /tmp/openwrt-mediatek-filogic-huasifei_wh3000r-nand-squashfs-sysupgrade.bin ``` Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
1 parent d2fabb9 commit afaea03

5 files changed

Lines changed: 310 additions & 0 deletions

File tree

Lines changed: 292 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,292 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2+
3+
/dts-v1/;
4+
#include <dt-bindings/gpio/gpio.h>
5+
#include <dt-bindings/input/input.h>
6+
#include <dt-bindings/leds/common.h>
7+
8+
#include "mt7981b.dtsi"
9+
10+
/ {
11+
model = "Huasifei WH3000R NAND";
12+
compatible = "huasifei,wh3000r-nand", "mediatek,mt7981";
13+
14+
aliases {
15+
label-mac-device = &gmac1;
16+
17+
led-boot = &led_power;
18+
led-failsafe = &led_power;
19+
led-running = &led_status;
20+
led-upgrade = &led_power;
21+
22+
serial0 = &uart0;
23+
};
24+
25+
chosen: chosen {
26+
stdout-path = "serial0:115200n8";
27+
};
28+
29+
memory {
30+
reg = <0 0x40000000 0 0x20000000>;
31+
device_type = "memory";
32+
};
33+
34+
gpio-keys {
35+
compatible = "gpio-keys";
36+
37+
button-mesh {
38+
label = "mesh";
39+
linux,code = <KEY_RFKILL>;
40+
gpios = <&pio 0 GPIO_ACTIVE_LOW>;
41+
debounce-interval = <60>;
42+
};
43+
44+
button-reset {
45+
label = "reset";
46+
linux,code = <KEY_RESTART>;
47+
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
48+
debounce-interval = <60>;
49+
};
50+
};
51+
52+
gpio-leds {
53+
compatible = "gpio-leds";
54+
55+
led_power: led_power {
56+
function = LED_FUNCTION_POWER;
57+
color = <LED_COLOR_ID_RED>;
58+
gpios = <&pio 9 GPIO_ACTIVE_LOW>;
59+
};
60+
61+
led_status: led_status {
62+
function = LED_FUNCTION_STATUS;
63+
color = <LED_COLOR_ID_GREEN>;
64+
gpios = <&pio 10 GPIO_ACTIVE_LOW>;
65+
};
66+
67+
led_internet {
68+
function = LED_FUNCTION_WAN_ONLINE;
69+
color = <LED_COLOR_ID_BLUE>;
70+
gpios = <&pio 11 GPIO_ACTIVE_LOW>;
71+
};
72+
};
73+
};
74+
75+
&eth {
76+
status = "okay";
77+
78+
gmac0: mac@0 {
79+
compatible = "mediatek,eth-mac";
80+
reg = <0>;
81+
phy-mode = "2500base-x";
82+
nvmem-cells = <&macaddr_factory_4 1>;
83+
nvmem-cell-names = "mac-address";
84+
85+
fixed-link {
86+
speed = <2500>;
87+
full-duplex;
88+
pause;
89+
};
90+
};
91+
92+
gmac1: mac@1 {
93+
compatible = "mediatek,eth-mac";
94+
reg = <1>;
95+
phy-mode = "gmii";
96+
nvmem-cells = <&macaddr_factory_4 0>;
97+
nvmem-cell-names = "mac-address";
98+
phy-handle = <&phy0>;
99+
label = "wan";
100+
};
101+
102+
mdio: mdio-bus {
103+
#address-cells = <1>;
104+
#size-cells = <0>;
105+
106+
phy0: ethernet-phy@0 {
107+
compatible = "ethernet-phy-id03a2.9461";
108+
reg = <0>;
109+
phy-mode = "gmii";
110+
nvmem-cells = <&phy_calibration>;
111+
nvmem-cell-names = "phy-cal-data";
112+
};
113+
114+
switch: switch@1f {
115+
compatible = "mediatek,mt7531";
116+
reg = <0x1f>;
117+
reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
118+
interrupt-controller;
119+
#interrupt-cells = <1>;
120+
interrupt-parent = <&pio>;
121+
interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
122+
};
123+
};
124+
};
125+
126+
&spi0 {
127+
pinctrl-names = "default";
128+
pinctrl-0 = <&spi0_flash_pins>;
129+
status = "okay";
130+
131+
spi_nand@0 {
132+
compatible = "spi-nand";
133+
reg = <0>;
134+
135+
spi-max-frequency = <52000000>;
136+
spi-tx-bus-width = <4>;
137+
spi-rx-bus-width = <4>;
138+
139+
spi-cal-enable;
140+
spi-cal-mode = "read-data";
141+
spi-cal-datalen = <7>;
142+
spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4e 0x41 0x4e 0x44>;
143+
spi-cal-addrlen = <5>;
144+
spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
145+
146+
mediatek,nmbm;
147+
mediatek,bmt-max-ratio = <1>;
148+
mediatek,bmt-max-reserved-blocks = <64>;
149+
150+
partitions {
151+
compatible = "fixed-partitions";
152+
#address-cells = <1>;
153+
#size-cells = <1>;
154+
155+
partition@0 {
156+
label = "BL2";
157+
reg = <0x0 0x100000>;
158+
read-only;
159+
};
160+
161+
partition@100000 {
162+
label = "u-boot-env";
163+
reg = <0x100000 0x80000>;
164+
read-only;
165+
};
166+
167+
partition@180000 {
168+
label = "Factory";
169+
reg = <0x180000 0x200000>;
170+
read-only;
171+
172+
nvmem-layout {
173+
compatible = "fixed-layout";
174+
#address-cells = <1>;
175+
#size-cells = <1>;
176+
177+
eeprom_factory_0: eeprom@0 {
178+
reg = <0x0 0x1000>;
179+
};
180+
181+
macaddr_factory_4: macaddr@4 {
182+
compatible = "mac-base";
183+
reg = <0x4 0x6>;
184+
#nvmem-cell-cells = <1>;
185+
};
186+
};
187+
};
188+
189+
partition@380000 {
190+
label = "FIP";
191+
reg = <0x380000 0x200000>;
192+
read-only;
193+
};
194+
195+
partition@580000 {
196+
label = "ubi";
197+
reg = <0x580000 0xe280000>;
198+
};
199+
};
200+
};
201+
};
202+
203+
&pio {
204+
spi0_flash_pins: spi0-pins {
205+
mux {
206+
function = "spi";
207+
groups = "spi0", "spi0_wp_hold";
208+
};
209+
210+
conf-pu {
211+
pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
212+
drive-strength = <MTK_DRIVE_8mA>;
213+
bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
214+
};
215+
216+
conf-pd {
217+
pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
218+
drive-strength = <MTK_DRIVE_8mA>;
219+
bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
220+
};
221+
};
222+
};
223+
224+
&switch {
225+
ports {
226+
#address-cells = <1>;
227+
#size-cells = <0>;
228+
229+
port@0 {
230+
reg = <0>;
231+
label = "lan1";
232+
};
233+
234+
port@1 {
235+
reg = <1>;
236+
label = "lan2";
237+
};
238+
239+
port@2 {
240+
reg = <2>;
241+
label = "lan3";
242+
};
243+
244+
port@6 {
245+
reg = <6>;
246+
ethernet = <&gmac0>;
247+
phy-mode = "2500base-x";
248+
249+
fixed-link {
250+
speed = <2500>;
251+
full-duplex;
252+
pause;
253+
};
254+
};
255+
};
256+
};
257+
258+
&usb_phy {
259+
status = "okay";
260+
};
261+
262+
&uart0 {
263+
status = "okay";
264+
};
265+
266+
&watchdog {
267+
status = "okay";
268+
};
269+
270+
&wifi {
271+
status = "okay";
272+
#address-cells = <1>;
273+
#size-cells = <0>;
274+
nvmem-cells = <&eeprom_factory_0>;
275+
nvmem-cell-names = "eeprom";
276+
277+
band@0 {
278+
reg = <0>;
279+
nvmem-cells = <&macaddr_factory_4 2>;
280+
nvmem-cell-names = "mac-address";
281+
};
282+
283+
band@1 {
284+
reg = <1>;
285+
nvmem-cells = <&macaddr_factory_4 3>;
286+
nvmem-cell-names = "mac-address";
287+
};
288+
};
289+
290+
&xhci {
291+
status = "okay";
292+
};

target/linux/mediatek/filogic/base-files/etc/board.d/01_leds

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ glinet,gl-xe3000)
123123
huasifei,wh3000)
124124
ucidef_set_led_netdev "wan" "WAN" "red:wan" "eth1" "link tx rx"
125125
;;
126+
huasifei,wh3000r-nand)
127+
ucidef_set_led_netdev "wan" "WAN" "blue:wan-online" "wan" "link"
128+
;;
126129
iptime,ax3000q)
127130
ucidef_set_led_netdev "wan" "WAN" "amber:wan" "wan" "link tx rx"
128131
;;

target/linux/mediatek/filogic/base-files/etc/board.d/02_network

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ mediatek_setup_interfaces()
5353
creatlentem,clt-r30b1|\
5454
creatlentem,clt-r30b1-112m|\
5555
cudy,wr3000-v1|\
56+
huasifei,wh3000r-nand|\
5657
jcg,q30-pro|\
5758
keenetic,kn-3711|\
5859
keenetic,kn-3811|\

target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ platform_do_upgrade() {
233233
cudy,wr3000p-v1|\
234234
huasifei,wh3000-pro-nand|\
235235
jiorouter,ax6000-jidu6101)
236+
huasifei,wh3000r-nand)
236237
CI_UBIPART="ubi"
237238
nand_do_upgrade "$1"
238239
;;

target/linux/mediatek/image/filogic.mk

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,6 +1843,19 @@ define Device/huasifei_wh3000-pro-nand
18431843
endef
18441844
TARGET_DEVICES += huasifei_wh3000-pro-nand
18451845

1846+
define Device/huasifei_wh3000r-nand
1847+
DEVICE_VENDOR := Huasifei
1848+
DEVICE_MODEL := WH3000R
1849+
DEVICE_VARIANT := NAND
1850+
DEVICE_DTS := mt7981b-huasifei-wh3000r-nand
1851+
DEVICE_DTS_DIR := ../dts
1852+
IMAGE_SIZE := 231936k
1853+
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
1854+
DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware \
1855+
kmod-usb3
1856+
endef
1857+
TARGET_DEVICES += huasifei_wh3000r-nand
1858+
18461859
define Device/imou_hx21
18471860
DEVICE_VENDOR := Imou
18481861
DEVICE_MODEL := HX21

0 commit comments

Comments
 (0)