Skip to content

Commit 2adce83

Browse files
committed
mediatek: add Huasifei WH3000R NAND support
**Huasifei WH3000R NAND** Wi-Fi 6 router based on MediaTek MT7981B SoC. MT7981B+MT7976CN+MT7531AE The same hardware platform is also used by an OEM-branded variant marketed as "wwGate AX3000", therefore the compatible string "wwgate,ax3000" is added to SUPPORTED_DEVICES for sysupgrade compatibility. **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 8de4185 commit 2adce83

6 files changed

Lines changed: 304 additions & 1 deletion

File tree

Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
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 {
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+
nvmem-cells = <&eeprom_factory_0>;
272+
nvmem-cell-names = "eeprom";
273+
status = "okay";
274+
};
275+
276+
&xhci {
277+
status = "okay";
278+
};

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
@@ -118,6 +118,9 @@ glinet,gl-xe3000)
118118
huasifei,wh3000)
119119
ucidef_set_led_netdev "wan" "WAN" "red:wan" "eth1" "link tx rx"
120120
;;
121+
huasifei,wh3000r-nand)
122+
ucidef_set_led_netdev "wan" "WAN" "blue:wan-online" "wan" "link"
123+
;;
121124
iptime,ax3000q)
122125
ucidef_set_led_netdev "wan" "WAN" "amber:wan" "wan" "link tx rx"
123126
;;

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/etc/hotplug.d/ieee80211/11_fix_wifi_mac

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ case "$board" in
131131
[ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress
132132
[ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress
133133
;;
134+
huasifei,wh3000r-nand)
135+
addr=$(cat /sys/class/net/eth0/address)
136+
[ "$PHYNBR" = "0" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress
137+
[ "$PHYNBR" = "1" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress
138+
;;
134139
iptime,ax3000q)
135140
addr=$(mtd_get_mac_binary "Factory" 0x4)
136141
[ "$PHYNBR" = "1" ] && macaddr_setbit_la $addr > /sys${DEVPATH}/macaddress

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ platform_do_upgrade() {
208208
buffalo,wsr-6000ax8|\
209209
cudy,wr3000h-v1|\
210210
cudy,wr3000p-v1|\
211-
huasifei,wh3000-pro-nand)
211+
huasifei,wh3000-pro-nand|\
212+
huasifei,wh3000r-nand)
212213
CI_UBIPART="ubi"
213214
nand_do_upgrade "$1"
214215
;;
@@ -363,6 +364,7 @@ platform_check_image() {
363364
;;
364365
creatlentem,clt-r30b1|\
365366
creatlentem,clt-r30b1-112m|\
367+
huasifei,wh3000r-nand|\
366368
nradio,c8-668gl)
367369
# tar magic `ustar`
368370
magic="$(dd if="$1" bs=1 skip=257 count=5 2>/dev/null)"

target/linux/mediatek/image/filogic.mk

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,20 @@ define Device/huasifei_wh3000-pro-nand
18221822
endef
18231823
TARGET_DEVICES += huasifei_wh3000-pro-nand
18241824

1825+
define Device/huasifei_wh3000r-nand
1826+
DEVICE_VENDOR := Huasifei
1827+
DEVICE_MODEL := WH3000R
1828+
DEVICE_VARIANT := NAND
1829+
SUPPORTED_DEVICES += wwgate,ax3000
1830+
DEVICE_DTS := mt7981b-huasifei-wh3000r-nand
1831+
DEVICE_DTS_DIR := ../dts
1832+
IMAGE_SIZE := 231936k
1833+
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
1834+
DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware \
1835+
kmod-usb3
1836+
endef
1837+
TARGET_DEVICES += huasifei_wh3000r-nand
1838+
18251839
define Device/imou_hx21
18261840
DEVICE_VENDOR := Imou
18271841
DEVICE_MODEL := HX21

0 commit comments

Comments
 (0)