]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
mediatek: filogic: add support for Huasifei WH3000 18220/head
authorFil Dunsky <filipp.dunsky@gmail.com>
Mon, 10 Mar 2025 23:57:43 +0000 (06:57 +0700)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 6 Apr 2025 17:22:09 +0000 (19:22 +0200)
**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: https://github.com/openwrt/openwrt/pull/18220
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic
target/linux/mediatek/dts/mt7981b-huasifei-wh3000.dts [new file with mode: 0644]
target/linux/mediatek/filogic/base-files/etc/board.d/01_leds
target/linux/mediatek/filogic/base-files/etc/board.d/02_network
target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
target/linux/mediatek/image/filogic.mk

index a31413ed02bc70eb686395d7a17b8c3e24f9816b..5cc85255770002be2f94ae8c111c5f9085016068 100644 (file)
@@ -60,6 +60,7 @@ glinet,gl-mt2500|\
 glinet,gl-mt6000|\
 glinet,gl-x3000|\
 glinet,gl-xe3000|\
+huasifei,wh3000|\
 nradio,c8-668gl)
        local envdev=$(find_mmc_part "u-boot-env")
        ubootenv_add_uci_config "$envdev" "0x0" "0x80000"
diff --git a/target/linux/mediatek/dts/mt7981b-huasifei-wh3000.dts b/target/linux/mediatek/dts/mt7981b-huasifei-wh3000.dts
new file mode 100644 (file)
index 0000000..c12367b
--- /dev/null
@@ -0,0 +1,190 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+#include "mt7981.dtsi"
+
+/ {
+       model = "Huasifei WH3000";
+       compatible = "huasifei,wh3000", "mediatek,mt7981";
+
+       aliases {
+               serial0 = &uart0;
+               led-boot = &wlan_led;
+               led-failsafe = &wlan_led;
+               led-upgrade = &wlan_led;
+       };
+
+       chosen {
+               bootargs = "root=PARTLABEL=rootfs rootwait";
+               stdout-path = "serial0:115200n8";
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               button-mode {
+                       label = "mode";
+                       linux,code = <BTN_0>;
+                       linux,input-type = <EV_SW>;
+                       gpios = <&pio 0 GPIO_ACTIVE_LOW>;
+                       debounce-interval = <60>;
+               };
+
+               button-reset {
+                       label = "reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&pio 1 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+
+               wan_led: led-0 {
+                       function = LED_FUNCTION_WAN;
+                       color = <LED_COLOR_ID_RED>;
+                       gpios = <&pio 11 GPIO_ACTIVE_LOW>;
+               };
+
+               wlan_led: led-1 {
+                       function = LED_FUNCTION_WLAN;
+                       color = <LED_COLOR_ID_BLUE>;
+                       gpios = <&pio 10 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "phy1tpt";
+               };
+       };
+
+       memory@40000000 {
+               reg = <0 0x40000000 0 0x40000000>;
+       };
+};
+
+&eth {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mdio_pins>;
+       status = "okay";
+
+       gmac0: mac@0 {
+               compatible = "mediatek,eth-mac";
+               reg = <0>;
+               nvmem-cells = <&macaddr_factory_4 2>;
+               nvmem-cell-names = "mac-address";
+               phy-mode = "2500base-x";
+               phy-handle = <&phy1>;
+       };
+
+       gmac1: mac@1 {
+               compatible = "mediatek,eth-mac";
+               reg = <1>;
+               nvmem-cells = <&macaddr_factory_4 3>;
+               nvmem-cell-names = "mac-address";
+               phy-mode = "gmii";
+               phy-handle = <&int_gbe_phy>;
+       };
+};
+
+&mdio_bus {
+       phy1: ethernet-phy@1 {
+               compatible = "ethernet-phy-ieee802.3-c45";
+               reg = <1>;
+               interrupts = <38 IRQ_TYPE_LEVEL_LOW>;
+               interrupt-parent = <&pio>;
+               reset-assert-us = <100000>;
+               reset-deassert-us = <100000>;
+               reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>;
+               realtek,aldps-enable;
+       };
+};
+
+&mmc0 {
+       bus-width = <8>;
+       cap-mmc-highspeed;
+       max-frequency = <52000000>;
+       no-sd;
+       no-sdio;
+       non-removable;
+       pinctrl-names = "default", "state_uhs";
+       pinctrl-0 = <&mmc0_pins_default>;
+       pinctrl-1 = <&mmc0_pins_uhs>;
+       vmmc-supply = <&reg_3p3v>;
+       status = "okay";
+
+       card@0 {
+               compatible = "mmc-card";
+               reg = <0>;
+
+               block {
+                       compatible = "block-device";
+
+                       partitions {
+                               block-partition-factory {
+                                       partname = "factory";
+
+                                       nvmem-layout {
+                                               compatible = "fixed-layout";
+                                               #address-cells = <1>;
+                                               #size-cells = <1>;
+
+                                               eeprom_factory_0: eeprom@0 {
+                                                       reg = <0x0 0x1000>;
+                                               };
+
+                                               macaddr_factory_4: macaddr@4 {
+                                                       compatible = "mac-base";
+                                                       reg = <0x4 0x6>;
+                                                       #nvmem-cell-cells = <1>;
+                                               };
+                                       };
+                               };
+                       };
+               };
+       };
+};
+
+&pio {
+       mmc0_pins_default: mmc0-pins-default {
+               mux {
+                       function = "flash";
+                       groups = "emmc_45";
+               };
+       };
+
+       mmc0_pins_uhs: mmc0-pins-uhs {
+               mux {
+                       function = "flash";
+                       groups = "emmc_45";
+               };
+       };
+};
+
+&uart0 {
+       status = "okay";
+};
+
+&usb_phy {
+       status = "okay";
+};
+
+&watchdog {
+       status = "okay";
+};
+
+&wifi {
+       nvmem-cells = <&eeprom_factory_0>;
+       nvmem-cell-names = "eeprom";
+       status = "okay";
+
+       band@1 {
+               reg = <1>;
+               nvmem-cells = <&macaddr_factory_4 1>;
+               nvmem-cell-names = "mac-address";
+       };
+};
+
+&xhci {
+       status = "okay";
+};
index b63e33d68a942b9dda55f779c1885a0d089c7761..cc5333af2664cc77b427c9964632d84f524473f6 100644 (file)
@@ -69,6 +69,9 @@ glinet,gl-xe3000)
        ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wifi2g" "phy0-ap0"
        ucidef_set_led_netdev "wlan5g" "WLAN5G" "green:wifi5g" "phy1-ap0"
        ;;
+huasifei,wh3000)
+       ucidef_set_led_netdev "wan" "WAN" "red:wan" "eth1" "link tx rx"
+       ;;
 mercusys,mr90x-v1|\
 mercusys,mr90x-v1-ubi)
        ucidef_set_led_netdev "lan-0" "lan-0" "green:lan-0" "lan0" "link tx rx"
index 9ff1aaf4f8ca0abec1f215a8cb5fbd153808bc6e..64712a7cc7d65d6b326269e7314faf798e541525 100644 (file)
@@ -67,7 +67,8 @@ mediatek_setup_interfaces()
                ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp2" "sfp1 wan"
                ;;
        bananapi,bpi-r3-mini|\
-       edgecore,eap111)
+       edgecore,eap111|\
+       huasifei,wh3000)
                ucidef_set_interfaces_lan_wan eth0 eth1
                ;;
        bananapi,bpi-r4)
index 97c7ceba5a0afc079fbd203aea51bb17ea13c90f..f266b3d462e3628af1111969d7281b55123b6037 100755 (executable)
@@ -104,6 +104,7 @@ platform_do_upgrade() {
        glinet,gl-mt6000|\
        glinet,gl-x3000|\
        glinet,gl-xe3000|\
+       huasifei,wh3000|\
        smartrg,sdg-8612|\
        smartrg,sdg-8614|\
        smartrg,sdg-8622|\
@@ -243,6 +244,7 @@ platform_copy_config() {
        glinet,gl-mt6000|\
        glinet,gl-x3000|\
        glinet,gl-xe3000|\
+       huasifei,wh3000|\
        jdcloud,re-cp-03|\
        nradio,c8-668gl|\
        smartrg,sdg-8612|\
index 3a6e1ef71ca55f94743f8c4798bbc22122dc29f5..414f90a8dc55c4705b47b01463c4afcd0dd3207c 100644 (file)
@@ -958,6 +958,21 @@ define Device/h3c_magic-nx30-pro
 endef
 TARGET_DEVICES += h3c_magic-nx30-pro
 
+define Device/huasifei_wh3000
+  DEVICE_VENDOR := Huasifei
+  DEVICE_MODEL := WH3000
+  DEVICE_DTS := mt7981b-huasifei-wh3000
+  DEVICE_DTS_DIR := ../dts
+  DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware \
+       kmod-usb3 f2fsck mkf2fs
+  SUPPORTED_DEVICES += huasifei,wh3000-emmc
+  KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
+  KERNEL_INITRAMFS := kernel-bin | lzma | \
+       fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+endef
+TARGET_DEVICES += huasifei_wh3000
+
 define Device/jcg_q30-pro
   DEVICE_VENDOR := JCG
   DEVICE_MODEL := Q30 PRO