Skip to content

Commit 99ea96c

Browse files
fildunskyhauke
authored andcommitted
mediatek: filogic: add support for Huasifei WH3000
**Huasifei WH3000 eMMC / Fudy MT3000** Portable Wi-Fi 6 travel router based on MediaTek MT7981A SoC. MT7981B+MT7976CN+RTL8221B Dual Core 1.3GHZ **Specifications** SoC: Filogic 820 MT7981A (1.3GHz) RAM: DDR4 1GB Flash: eMMC 8GB WiFi: 2.4GHz and 5GHz with 3 antennas Ethernet: 1x WAN (10/100/1000M) 1x LAN (10/100/1000/2500M) USB: 1x USB 3.0 port Two buttons: power/reset and mode (BTN_0) LEDS: blue, red, blue+red=pink UART: 3.3V, TX, RX, GND / 115200 8N1 **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 WAN 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_wh3000-emmc-squashfs-sysupgrade.bin ``` **Factory MAC** You can find your Factory MAC which is mentioned on the box at `/dev/mmcblck0p2` partition `factory` starting from `0x4` ``` dd if=/dev/mmcblk0p2 bs=1 skip=4 count=6 | hexdump -C ``` **Enlarging a partition** Though device has 8GB eMMC, it uses only 2GB `/dev/mmcblck0p6` as `rootfs` for `/rom` and `/overlay` leaving `/dev/mmcblck0p7` as empty unused space. ``` sgdisk -p /dev/mmcblk0 ``` ``` Disk /dev/mmcblk0: 15269888 sectors, 7.3 GiB Sector size (logical/physical): 512/512 bytes Disk identifier (GUID): 2BD17853-102B-4500-AA1A-8A21D4D7984D Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 14942174 Partitions will be aligned on 1024-sector boundaries Total free space is 11197 sectors (5.5 MiB) Number Start (sector) End (sector) Size Code Name 1 8192 9215 512.0 KiB 8300 u-boot-env 2 9216 13311 2.0 MiB 8300 factory 3 13312 21503 4.0 MiB 8300 fip 4 21504 29695 4.0 MiB 8300 config 5 29696 62463 16.0 MiB 8300 kernel 6 62464 4256767 2.0 GiB 8300 rootfs 7 4257792 14940159 5.1 GiB 8300 ``` You can fix that by loading into `initramfs-kernel`, deleting empty `mmcblck0p7` partition and resizing `mmcblck0p6` ``` sysupgrade -F /tmp/openwrt-initramfs-kernel.bin ``` Install and run cfdisk ``` opkg update && opkg install cfdisk cfdisk /dev/mmcblck0 ``` - Select `mmcblck0p7` -> Delete - Select `mmcblck0p6` -> Resize -> Write -> yes -> Quit You will not see any difference in `cat /proc/partitions` after that but just flash a `sysupgrade` and you'll get the whole 7.3GB space for the `/overlay`. Co-developed-by: hecatae <horus.ra@gmail.com> Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com> Link: openwrt/openwrt#18220 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
1 parent c891ad9 commit 99ea96c

File tree

6 files changed

+213
-1
lines changed

6 files changed

+213
-1
lines changed

package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ glinet,gl-mt2500|\
6060
glinet,gl-mt6000|\
6161
glinet,gl-x3000|\
6262
glinet,gl-xe3000|\
63+
huasifei,wh3000|\
6364
nradio,c8-668gl)
6465
local envdev=$(find_mmc_part "u-boot-env")
6566
ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
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 "mt7981.dtsi"
9+
10+
/ {
11+
model = "Huasifei WH3000";
12+
compatible = "huasifei,wh3000", "mediatek,mt7981";
13+
14+
aliases {
15+
serial0 = &uart0;
16+
led-boot = &wlan_led;
17+
led-failsafe = &wlan_led;
18+
led-upgrade = &wlan_led;
19+
};
20+
21+
chosen {
22+
bootargs = "root=PARTLABEL=rootfs rootwait";
23+
stdout-path = "serial0:115200n8";
24+
};
25+
26+
gpio-keys {
27+
compatible = "gpio-keys";
28+
29+
button-mode {
30+
label = "mode";
31+
linux,code = <BTN_0>;
32+
linux,input-type = <EV_SW>;
33+
gpios = <&pio 0 GPIO_ACTIVE_LOW>;
34+
debounce-interval = <60>;
35+
};
36+
37+
button-reset {
38+
label = "reset";
39+
linux,code = <KEY_RESTART>;
40+
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
41+
};
42+
};
43+
44+
gpio-leds {
45+
compatible = "gpio-leds";
46+
47+
wan_led: led-0 {
48+
function = LED_FUNCTION_WAN;
49+
color = <LED_COLOR_ID_RED>;
50+
gpios = <&pio 11 GPIO_ACTIVE_LOW>;
51+
};
52+
53+
wlan_led: led-1 {
54+
function = LED_FUNCTION_WLAN;
55+
color = <LED_COLOR_ID_BLUE>;
56+
gpios = <&pio 10 GPIO_ACTIVE_LOW>;
57+
linux,default-trigger = "phy1tpt";
58+
};
59+
};
60+
61+
memory@40000000 {
62+
reg = <0 0x40000000 0 0x40000000>;
63+
};
64+
};
65+
66+
&eth {
67+
pinctrl-names = "default";
68+
pinctrl-0 = <&mdio_pins>;
69+
status = "okay";
70+
71+
gmac0: mac@0 {
72+
compatible = "mediatek,eth-mac";
73+
reg = <0>;
74+
nvmem-cells = <&macaddr_factory_4 2>;
75+
nvmem-cell-names = "mac-address";
76+
phy-mode = "2500base-x";
77+
phy-handle = <&phy1>;
78+
};
79+
80+
gmac1: mac@1 {
81+
compatible = "mediatek,eth-mac";
82+
reg = <1>;
83+
nvmem-cells = <&macaddr_factory_4 3>;
84+
nvmem-cell-names = "mac-address";
85+
phy-mode = "gmii";
86+
phy-handle = <&int_gbe_phy>;
87+
};
88+
};
89+
90+
&mdio_bus {
91+
phy1: ethernet-phy@1 {
92+
compatible = "ethernet-phy-ieee802.3-c45";
93+
reg = <1>;
94+
interrupts = <38 IRQ_TYPE_LEVEL_LOW>;
95+
interrupt-parent = <&pio>;
96+
reset-assert-us = <100000>;
97+
reset-deassert-us = <100000>;
98+
reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>;
99+
realtek,aldps-enable;
100+
};
101+
};
102+
103+
&mmc0 {
104+
bus-width = <8>;
105+
cap-mmc-highspeed;
106+
max-frequency = <52000000>;
107+
no-sd;
108+
no-sdio;
109+
non-removable;
110+
pinctrl-names = "default", "state_uhs";
111+
pinctrl-0 = <&mmc0_pins_default>;
112+
pinctrl-1 = <&mmc0_pins_uhs>;
113+
vmmc-supply = <&reg_3p3v>;
114+
status = "okay";
115+
116+
card@0 {
117+
compatible = "mmc-card";
118+
reg = <0>;
119+
120+
block {
121+
compatible = "block-device";
122+
123+
partitions {
124+
block-partition-factory {
125+
partname = "factory";
126+
127+
nvmem-layout {
128+
compatible = "fixed-layout";
129+
#address-cells = <1>;
130+
#size-cells = <1>;
131+
132+
eeprom_factory_0: eeprom@0 {
133+
reg = <0x0 0x1000>;
134+
};
135+
136+
macaddr_factory_4: macaddr@4 {
137+
compatible = "mac-base";
138+
reg = <0x4 0x6>;
139+
#nvmem-cell-cells = <1>;
140+
};
141+
};
142+
};
143+
};
144+
};
145+
};
146+
};
147+
148+
&pio {
149+
mmc0_pins_default: mmc0-pins-default {
150+
mux {
151+
function = "flash";
152+
groups = "emmc_45";
153+
};
154+
};
155+
156+
mmc0_pins_uhs: mmc0-pins-uhs {
157+
mux {
158+
function = "flash";
159+
groups = "emmc_45";
160+
};
161+
};
162+
};
163+
164+
&uart0 {
165+
status = "okay";
166+
};
167+
168+
&usb_phy {
169+
status = "okay";
170+
};
171+
172+
&watchdog {
173+
status = "okay";
174+
};
175+
176+
&wifi {
177+
nvmem-cells = <&eeprom_factory_0>;
178+
nvmem-cell-names = "eeprom";
179+
status = "okay";
180+
181+
band@1 {
182+
reg = <1>;
183+
nvmem-cells = <&macaddr_factory_4 1>;
184+
nvmem-cell-names = "mac-address";
185+
};
186+
};
187+
188+
&xhci {
189+
status = "okay";
190+
};

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
@@ -69,6 +69,9 @@ glinet,gl-xe3000)
6969
ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wifi2g" "phy0-ap0"
7070
ucidef_set_led_netdev "wlan5g" "WLAN5G" "green:wifi5g" "phy1-ap0"
7171
;;
72+
huasifei,wh3000)
73+
ucidef_set_led_netdev "wan" "WAN" "red:wan" "eth1" "link tx rx"
74+
;;
7275
mercusys,mr90x-v1|\
7376
mercusys,mr90x-v1-ubi)
7477
ucidef_set_led_netdev "lan-0" "lan-0" "green:lan-0" "lan0" "link tx rx"

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ mediatek_setup_interfaces()
6767
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp2" "sfp1 wan"
6868
;;
6969
bananapi,bpi-r3-mini|\
70-
edgecore,eap111)
70+
edgecore,eap111|\
71+
huasifei,wh3000)
7172
ucidef_set_interfaces_lan_wan eth0 eth1
7273
;;
7374
bananapi,bpi-r4)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ platform_do_upgrade() {
104104
glinet,gl-mt6000|\
105105
glinet,gl-x3000|\
106106
glinet,gl-xe3000|\
107+
huasifei,wh3000|\
107108
smartrg,sdg-8612|\
108109
smartrg,sdg-8614|\
109110
smartrg,sdg-8622|\
@@ -243,6 +244,7 @@ platform_copy_config() {
243244
glinet,gl-mt6000|\
244245
glinet,gl-x3000|\
245246
glinet,gl-xe3000|\
247+
huasifei,wh3000|\
246248
jdcloud,re-cp-03|\
247249
nradio,c8-668gl|\
248250
smartrg,sdg-8612|\

target/linux/mediatek/image/filogic.mk

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,21 @@ define Device/h3c_magic-nx30-pro
958958
endef
959959
TARGET_DEVICES += h3c_magic-nx30-pro
960960

961+
define Device/huasifei_wh3000
962+
DEVICE_VENDOR := Huasifei
963+
DEVICE_MODEL := WH3000
964+
DEVICE_DTS := mt7981b-huasifei-wh3000
965+
DEVICE_DTS_DIR := ../dts
966+
DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware \
967+
kmod-usb3 f2fsck mkf2fs
968+
SUPPORTED_DEVICES += huasifei,wh3000-emmc
969+
KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
970+
KERNEL_INITRAMFS := kernel-bin | lzma | \
971+
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
972+
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
973+
endef
974+
TARGET_DEVICES += huasifei_wh3000
975+
961976
define Device/jcg_q30-pro
962977
DEVICE_VENDOR := JCG
963978
DEVICE_MODEL := Q30 PRO

0 commit comments

Comments
 (0)