From: Qing W Date: Thu, 21 Aug 2025 22:55:42 +0000 (-0400) Subject: mediatek: Add support for Acer Predator Connect W6x X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=refs%2Fpull%2F19754%2Fhead;p=thirdparty%2Fopenwrt.git mediatek: Add support for Acer Predator Connect W6x Product name: Acer Predator Connect W6x Product link: https://www.acer.com/us-en/predator/networking/wi-fi/predator-connect-w6x/pdp/FF.G2TTA.001 * Specifications: SOC: MT7986AV RAM: 1024MB Flash: 256 MB SPI NAND Ports: 4 LAN (1G) & 1 WAN (2.5G) WIFI: MT7976GN + MT7976AN LED: 1, ws2812b controller * Installation via UART: 1. Configure TFTP server with IP 192.168.1.66. Copy `openwrt-mediatek-filogic-acer_predator-w6x-initramfs-kernel.bin` to TFTP root and rename to `predator.bin` 2. Interrupt boot by pressing 0 on startup or select `U-Boot Console` in U-Boot Boot Menu. 3. Run setenv `serverip 192.168.1.66; setenv ipaddr 192.168.1.1; tftpboot 0x46000000 predator.bin; fdt addr $(fdtcontroladdr); fdt rm /signature; bootm` in uboot console. 4. Wait for boot complete on Openwrt initramfs env. ** You can back up the MTD partitions at this point. Refer to Backup Instructions section. 5. On client PC, transfer `openwrt-mediatek-filogic-acer_predator-w6x-squashfs-sysupgrade.bin` to /tmp/ - `scp -O openwrt-mediatek-filogic-acer_predator-w6x-squashfs-sysupgrade.bin root@192.168.1.1:/tmp/sysupgrade.bin` 6. On router, run sysupgrade - `sysupgrade -n /tmp/sysupgrade.bin` Should now boot to Openwrt. Ensure it boots automatically to Openwrt by replugging the power. * Backup Instructions: Layout from stock firmware: ``` [ 0.968731] Creating 10 MTD partitions on "nmbm_spim_nand": [ 0.974297] 0x000000000000-0x000000100000 : "BL2" [ 0.979424] 0x000000100000-0x000000180000 : "u-boot-env" [ 0.985032] 0x000000180000-0x000000380000 : "Factory" [ 0.990379] 0x000000380000-0x000000580000 : "FIP" [ 0.995378] 0x000000580000-0x000000600000 : "prod" [ 1.000461] 0x000000600000-0x000000700000 : "dual" [ 1.005527] 0x000000700000-0x000000800000 : "pot" [ 1.010516] 0x000000800000-0x000006c00000 : "ubi" [ 1.015626] 0x000006c00000-0x00000d000000 : "ubi1" [ 1.020801] 0x00000d000000-0x00000d800000 : "storage" ``` Mapping in initramfs env: ``` dev: size erasesize name mtd0: 00100000 00020000 "bl2" mtd1: 00080000 00020000 "u-boot-env" mtd2: 00200000 00020000 "factory" mtd3: 00200000 00020000 "fip" mtd4: 00020000 00020000 "prod" mtd5: 00100000 00020000 "dual" mtd6: 00100000 00020000 "pot" mtd7: 06400000 00020000 "ubi" mtd8: 06400000 00020000 "ubi1" mtd9: 00800000 00020000 "storage" ``` 1. While in openwrt initramfs environment, back up all the partitions by running the following: ``` cat /dev/mtd0 > /tmp/bl2.bin cat /dev/mtd1 > /tmp/u-boot-env.bin cat /dev/mtd2 > /tmp/factgory.bin cat /dev/mtd3 > /tmp/fip.bin cat /dev/mtd4 > /tmp/prod.bin cat /dev/mtd5 > /tmp/dual.bin cat /dev/mtd6 > /tmp/pot.bin cat /dev/mtd7 > /tmp/ubi.bin cat /dev/mtd8 > /tmp/ubi1.bin cat /dev/mtd9 > /tmp/storage.bin ``` 2. Transfer files to client PC for safekeeping. On client PC, run `scp -O root@192.168.1.1:/tmp/*.bin ./` * Restore to Stock Firmware: 1. Boot to openwrt initramfs env. 2. Confirm layout matches as follows by running `cat /proc/mtd`. Ensure dev `mtd7` is named `ubi`: ``` dev: size erasesize name mtd0: 00100000 00020000 "bl2" mtd1: 00080000 00020000 "u-boot-env" mtd2: 00200000 00020000 "factory" mtd3: 00200000 00020000 "fip" mtd4: 00020000 00020000 "prod" mtd5: 00100000 00020000 "dual" mtd6: 00100000 00020000 "pot" mtd7: 06400000 00020000 "ubi" mtd8: 06400000 00020000 "ubi1" mtd9: 00800000 00020000 "storage" ``` 3. Detach `ubi` partition - `ubidetach -p /dev/mtd7` 4. Transfer stock firmware's `ubi.bin` to router from client PC: `scp -O ubi.bin root@192.168.1.1/tmp/` 5. Format and replace with backup `ubiformat /dev/mtd7 -y -f /tmp/ubi.bin` 6. Reboot and you should now be back on stock firmware. * LEDS: LED color can be controlled by specifying values in GRB format in `/sys/class/leds/rgb:status/multi_intensity`. Default is `255 255 255` (white). Example: `echo '75 0 130' > /sys/class/leds/rgb:status/multi_intensity` LED brightness can be changed by specifying the value from 0-255 in /sys/class/leds/rgb:status/brightness. Default is `255` (full brightness). Example: `echo 100 > /sys/class/leds/rgb:status/brightness` For persistence across reboots, put the relevant command(s) in /etc/rc.local. * Notes: root access on stock firmware: Before flashing openwrt, and while in openwrt initramfs env: 1. Mount /dev/ubi0_2: `mkdir /tmp/ubi0_2; mount -t ubifs /dev/ubi0_2 /tmp/ubi0_2` 2. Modify `/tmp/ubi0_2/upper/etc/passwd` and change line with `root:x:0:0...` to `root::0:0...`, remove the `x`. 3. Save and reboot. 4. You should now be able to log in with root and empty password while booted in stock firmware. While on Openwrt, subsequent upgrades can be made by sysupgrade, or via Luci. UART should not be necessary unless you want to revert to stock firmeware. Signed-off-by: Qing W Link: https://github.com/openwrt/openwrt/pull/19754 Signed-off-by: Hauke Mehrtens --- diff --git a/target/linux/mediatek/dts/mt7986a-acer-predator-w6x.dts b/target/linux/mediatek/dts/mt7986a-acer-predator-w6x.dts new file mode 100644 index 00000000000..d46497ec331 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-acer-predator-w6x.dts @@ -0,0 +1,352 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include +#include + +#include "mt7986a.dtsi" + +/ { + model = "Acer Predator Connect W6x"; + compatible = "acer,predator-w6x", "mediatek,mt7986a"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@0 { + reg = <0 0x40000000 0 0x20000000>; + }; + + reg_1p8v: regulator-1p8v { + compatible = "regulator-fixed"; + regulator-name = "fixed-1.8V"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_5v: regulator-5v { + compatible = "regulator-fixed"; + regulator-name = "fixed-5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + regulator-always-on; + }; + + gpio-keys { + compatible = "gpio-keys"; + + factory { + label = "factory"; + linux,code = ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&crypto { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy-handle = <&phy6>; + }; + + mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + reset-assert-us = <10000>; + reset-deassert-us = <10000>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + label = "lan1"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan3"; + }; + + port@4 { + reg = <4>; + label = "lan4"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; + + phy6: phy@6 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <6>; + + }; + }; +}; + +&pio { + spi_flash_pins: spi-flash-pins-33-to-38 { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; /* bias-disable */ + }; + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + mediatek,pull-down-adv = <0>; /* bias-disable */ + }; + }; + + spi_led_pins: spic-pins-29-to-32 { + mux { + function = "spi"; + groups = "spi1_2"; + }; + }; + + wf_2g_5g_pins: wf_2g_5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + + wf_dbdc_pins: wf-dbdc-pins { + mux { + function = "wifi"; + groups = "wf_dbdc"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + status = "okay"; + + spi_nand@0 { + compatible = "spi-nand"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bl2"; + reg = <0x0 0x100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x100000 0x80000>; + }; + + partition@180000 { + label = "factory"; + reg = <0x180000 0x200000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + }; + }; + + partition@380000 { + label = "fip"; + reg = <0x380000 0x200000>; + read-only; + }; + + partition@580000 { + label = "prod"; + reg = <0x580000 0x20000>; + read-only; + }; + + partition@600000 { + label = "dual"; + reg = <0x600000 0x100000>; + read-only; + }; + + partition@700000 { + label = "pot"; + reg = <0x700000 0x100000>; + read-only; + }; + + partition@800000 { + label = "ubi"; + reg = <0x800000 0x6400000>; + }; + + partition@6C00000 { + label = "ubi1"; + reg = <0x6C00000 0x6400000>; + }; + + partition@D000000 { + label = "storage"; + reg = <0xD000000 0x800000>; + }; + }; + }; +}; + +&spi1 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_led_pins>; + status = "okay"; + + ws2812b@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "worldsemi,ws2812b"; + reg = <0>; + spi-max-frequency = <3000000>; + + led_status_rgb: led@0 { + reg = <0>; + function = LED_FUNCTION_STATUS; + color = ; + color-index = ; + }; + }; +}; + +&ssusb { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; + status = "okay"; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + pinctrl-names = "default", "dbdc"; + pinctrl-0 = <&wf_2g_5g_pins>; + pinctrl-1 = <&wf_dbdc_pins>; + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index 62a01612862..f2b773636cf 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -16,6 +16,9 @@ acer,predator-w6d) ucidef_set_led_netdev "internet" "INTERNET" "mdio-bus:06:amber:wan" "eth1" "link_10 link_100 link_1000 tx rx" ucidef_set_led_netdev "internet" "INTERNET" "mdio-bus:06:green:wan" "eth1" "link_2500 tx rx" ;; +acer,predator-w6x) + ucidef_set_led_netdev "wan" "wan" "rgb:status" "eth1" + ;; asus,rt-ax52|\ snr,snr-cpe-ax2) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link tx rx" diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index 64efde9155d..c5709f74f4d 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -25,6 +25,9 @@ mediatek_setup_interfaces() acer,predator-w6d) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 game" eth1 ;; + acer,predator-w6x) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1 + ;; acer,vero-w6m) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" internet ;; @@ -179,6 +182,11 @@ mediatek_setup_macs() wan_mac=$(mmc_get_mac_ascii u-boot-env WANMAC) lan_mac=$(mmc_get_mac_ascii u-boot-env LANMAC) ;; + acer,predator-w6x) + wan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) + lan_mac=$(macaddr_add "$wan_mac" 1) + label_mac=$wan_mac + ;; bananapi,bpi-r3|\ bananapi,bpi-r3-mini|\ bananapi,bpi-r4) diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 02ae06a4ab0..e54056d165d 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -27,6 +27,11 @@ case "$board" in [ "$PHYNBR" = "0" ] && mmc_get_mac_ascii u-boot-env 2gMAC > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && mmc_get_mac_ascii u-boot-env 5gMAC > /sys${DEVPATH}/macaddress ;; + acer,predator-w6x) + hw_mac_addr="$(mtd_get_mac_ascii u-boot-env ethaddr)" + [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 3 > /sys${DEVPATH}/macaddress + ;; asus,rt-ax59u) CI_UBIPART="UBI_DEV" addr=$(mtd_get_mac_binary_ubi "Factory" 0x4) diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh index 5b9e5bd7ad7..f5032a2a369 100644 --- a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh +++ b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh @@ -12,6 +12,15 @@ preinit_set_mac_address() { ip link set dev game address "$lan_mac" ip link set dev eth1 address "$wan_mac" ;; + acer,predator-w6x) + wan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) + lan_mac=$(macaddr_add "$wan_mac" 1) + ip link set dev lan1 address "$lan_mac" + ip link set dev lan2 address "$lan_mac" + ip link set dev lan3 address "$lan_mac" + ip link set dev lan4 address "$lan_mac" + ip link set dev eth1 address "$wan_mac" + ;; acer,vero-w6m) wan_mac=$(mmc_get_mac_ascii u-boot-env WANMAC) lan_mac=$(mmc_get_mac_ascii u-boot-env LANMAC) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index b1c3398014f..434ae115761 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -191,6 +191,23 @@ define Device/acer_predator-w6d endef TARGET_DEVICES += acer_predator-w6d +define Device/acer_predator-w6x + DEVICE_VENDOR := Acer + DEVICE_MODEL := Predator Connect W6x + DEVICE_DTS := mt7986a-acer-predator-w6x + DEVICE_DTS_DIR := ../dts + DEVICE_DTS_LOADADDR := 0x47000000 + KERNEL_IN_UBI := 1 + UBOOTENV_IN_UBI := 1 + DEVICE_PACKAGES := kmod-usb3 kmod-leds-ws2812b kmod-mt7915e kmod-mt7986-firmware mt7986-wo-firmware + IMAGES := sysupgrade.bin + 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 += acer_predator-w6x + define Device/acer_vero-w6m DEVICE_VENDOR := Acer DEVICE_MODEL := Connect Vero W6m