mediatek: add support for Acer Predator W6d and Acer Vero W6m
authorGeorge Oldfort <openwrt@10099.de>
Mon, 11 Nov 2024 10:18:19 +0000 (11:18 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 23 Nov 2024 18:33:42 +0000 (19:33 +0100)
This commit adds support for two variants of the already supported router
Acer Predator Connect W6: The Acer Predator Connect W6d (W6 without 6 GHz
wifi) and the Acer Connect Vero W6m (W6 without 2.5G eth1 port, usb3 port,
and the 6 on-board gpio RGB LEDs, and with a KTD2026 RGB LED controller
instead of the KTD2061 LED controller of the W6/W6d).

The device tree for the W6m refers to the KTD202x driver suggested in
PR #16860.

Patching target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
removes the code repetition in (old) lines 121 to 124 on the occasion.

This is the last of four commits into which the original commit was split
to make reviews easier and more targeted.

Signed-off-by: George Oldfort <openwrt@10099.de>
Link: https://github.com/openwrt/openwrt/pull/16861
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/boot/uboot-envtools/files/mediatek_filogic
target/linux/mediatek/dts/mt7986a-acer-predator-w6d.dts [new file with mode: 0644]
target/linux/mediatek/dts/mt7986a-acer-vero-w6m.dts [new file with mode: 0644]
target/linux/mediatek/filogic/base-files/etc/board.d/02_network
target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh
target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
target/linux/mediatek/image/filogic.mk

index 7571af002094eabebe077acd886a3c6c3e2844fa..b637f4328778a1bf69859db701a608c3a32c6f0c 100644 (file)
@@ -50,6 +50,8 @@ zyxel,ex5601-t0-ubootmod)
        ubootenv_add_ubi_default
        ;;
 acer,predator-w6|\
+acer,predator-w6d|\
+acer,vero-w6m|\
 glinet,gl-mt2500|\
 glinet,gl-mt6000|\
 glinet,gl-x3000|\
diff --git a/target/linux/mediatek/dts/mt7986a-acer-predator-w6d.dts b/target/linux/mediatek/dts/mt7986a-acer-predator-w6d.dts
new file mode 100644 (file)
index 0000000..b2c35a6
--- /dev/null
@@ -0,0 +1,182 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+#include "mt7986a-acer-w6-common.dtsi"
+
+/ {
+       model = "Acer Predator Connect W6d";
+       compatible = "acer,predator-w6d", "mediatek,mt7986a";
+
+       aliases {
+               serial0 = &uart0;
+               led-boot = &led_status_blue;
+               led-failsafe = &led_status_blue;
+               led-running = &led_status_green;
+               led-upgrade = &led_status_red;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_status_red: led-0 {
+                       color = <LED_COLOR_ID_RED>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <0>;
+                       gpios = <&pio 1 GPIO_ACTIVE_HIGH>;
+               };
+
+               led_status_green: led-1 {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <0>;
+                       gpios = <&pio 2 GPIO_ACTIVE_HIGH>;
+               };
+
+               led_status_blue: led-2 {
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <0>;
+                       gpios = <&pio 36 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-3 {
+                       color = <LED_COLOR_ID_RED>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <1>;
+                       gpios = <&pio 35 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-4 {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <1>;
+                       gpios = <&pio 34 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-5 {
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <1>;
+                       gpios = <&pio 33 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-6 {
+                       color = <LED_COLOR_ID_RED>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <2>;
+                       gpios = <&pio 38 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-7 {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <2>;
+                       gpios = <&pio 37 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-8 {
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <2>;
+                       gpios = <&pio 26 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-9 {
+                       color = <LED_COLOR_ID_RED>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <3>;
+                       gpios = <&pio 25 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-10 {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <3>;
+                       gpios = <&pio 24 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-11 {
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <3>;
+                       gpios = <&pio 23 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-12 {
+                       color = <LED_COLOR_ID_RED>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <4>;
+                       gpios = <&pio 28 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-13 {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <4>;
+                       gpios = <&pio 27 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-14 {
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <4>;
+                       gpios = <&pio 32 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-15 {
+                       color = <LED_COLOR_ID_RED>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <5>;
+                       gpios = <&pio 45 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-16 {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <5>;
+                       gpios = <&pio 44 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-17 {
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_STATUS;
+                       function-enumerator = <5>;
+                       gpios = <&pio 43 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&ssusb {
+       vusb33-supply = <&reg_3p3v>;
+       vbus-supply = <&reg_5v>;
+       status = "okay";
+};
+
+&usb_phy {
+       status = "okay";
+};
+
+&eth {
+       gmac1: mac@1 {
+               compatible = "mediatek,eth-mac";
+               reg = <1>;
+               phy-mode = "2500base-x";
+               phy-handle = <&phy6>;
+       };
+};
+
+&mdio {
+       phy6: phy@6 {
+               compatible = "ethernet-phy-ieee802.3-c45";
+               reg = <6>;
+               reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>;
+               reset-assert-us = <10000>;
+               reset-deassert-us = <10000>;
+               /* LED0: nc ; LED1: nc ; LED2: amber ; LED3: green */
+               mxl,led-config = <0x0 0x0 0x370 0x380>;
+       };
+};
+
+&swport0 {
+       label = "game";
+};
diff --git a/target/linux/mediatek/dts/mt7986a-acer-vero-w6m.dts b/target/linux/mediatek/dts/mt7986a-acer-vero-w6m.dts
new file mode 100644 (file)
index 0000000..7927efc
--- /dev/null
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+#include "mt7986a-acer-w6-common.dtsi"
+
+/ {
+       model = "Acer Connect Vero W6m";
+       compatible = "acer,vero-w6m", "mediatek,mt7986a";
+
+       aliases {
+               serial0 = &uart0;
+               led-boot = &led_status;
+               led-failsafe = &led_status;
+               led-running = &led_status;
+               led-upgrade = &led_status;
+       };
+};
+
+&i2c0 {
+       led-controller@30 {
+               compatible = "kinetic,ktd2026";
+               reg = <0x30>;
+               vin-supply = <&reg_5v>;
+               vio-supply = <&reg_3p3v>;
+
+               led_status: multi-led {
+                       color = <LED_COLOR_ID_RGB>;
+                       function = LED_FUNCTION_STATUS;
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       led@0 {
+                               reg = <0>;
+                               color = <LED_COLOR_ID_RED>;
+                       };
+
+                       led@1 {
+                               reg = <1>;
+                               color = <LED_COLOR_ID_GREEN>;
+                       };
+
+                       led@2 {
+                               reg = <2>;
+                               color = <LED_COLOR_ID_BLUE>;
+                       };
+               };
+       };
+};
+
+&nvmem {
+       eeprom_factory_a0000: eeprom@a0000 {
+               reg = <0xa0000 0x1000>;
+       };
+};
+
+&slot0 {
+       radio0: mt7915@0,0 {
+               reg = <0x0000 0 0 0 0>;
+               nvmem-cells = <&eeprom_factory_a0000>;
+               nvmem-cell-names = "eeprom";
+       };
+};
+
+&swport0 {
+       label = "internet";
+};
index 2bcead83045912f7e41f8f2908900d5ceea9c053..7bfc61a26902a26905d702aeb97b03d44a5acf53 100644 (file)
@@ -18,9 +18,13 @@ mediatek_setup_interfaces()
        acelink,ew-7886cax)
                ucidef_set_interface_lan "eth0" "dhcp"
                ;;
-       acer,predator-w6)
+       acer,predator-w6|\
+       acer,predator-w6d)
                ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 game" eth1
                ;;
+       acer,vero-w6m)
+               ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" internet
+               ;;
        arcadyan,mozart)
                ucidef_set_interfaces_lan_wan "lan0 eth1" eth2
                ;;
@@ -132,7 +136,9 @@ mediatek_setup_macs()
        local label_mac=""
 
        case $board in
-       acer,predator-w6)
+       acer,predator-w6|\
+       acer,predator-w6d|\
+       acer,vero-w6m)
                wan_mac=$(mmc_get_mac_ascii u-boot-env WANMAC)
                lan_mac=$(mmc_get_mac_ascii u-boot-env LANMAC)
                ;;
index f7f00c9a83bd7162d641ba0ef01b1a325af5552d..f87cc0646edbb29da545914035afecedcba817b5 100644 (file)
@@ -17,11 +17,16 @@ case "$board" in
                [ "$PHYNBR" = "0" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress
                [ "$PHYNBR" = "1" ] && macaddr_setbit_la $addr > /sys${DEVPATH}/macaddress
                ;;
-       acer,predator-w6)
+       acer,predator-w6|\
+       acer,vero-w6m)
                [ "$PHYNBR" = "0" ] && mmc_get_mac_ascii u-boot-env 2gMAC > /sys${DEVPATH}/macaddress
                [ "$PHYNBR" = "1" ] && mmc_get_mac_ascii u-boot-env 6gMAC > /sys${DEVPATH}/macaddress
                [ "$PHYNBR" = "2" ] && mmc_get_mac_ascii u-boot-env 5gMAC > /sys${DEVPATH}/macaddress
                ;;
+       acer,predator-w6d)
+               [ "$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
+               ;;
        asus,rt-ax59u)
                CI_UBIPART="UBI_DEV"
                addr=$(mtd_get_mac_binary_ubi "Factory" 0x4)
index 0d7da89ceaabf5084372a3cedf90a02ca67eb616..9d279898ac58cd1ba4a9e7757b49e3aaaff38285 100644 (file)
@@ -2,7 +2,8 @@
 
 preinit_set_mac_address() {
        case $(board_name) in
-       acer,predator-w6)
+       acer,predator-w6|\
+       acer,predator-w6d)
                $(mmc_get_mac_ascii u-boot-env WANMAC)
                $(mmc_get_mac_ascii u-boot-env LANMAC)
                ip link set dev lan1 address "$lan_mac"
@@ -11,6 +12,14 @@ preinit_set_mac_address() {
                ip link set dev game 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)
+               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 internet address "$wan_mac"
+               ;;
        asus,tuf-ax4200|\
        asus,tuf-ax6000)
                CI_UBIPART="UBI_DEV"
index cfd77b62d7affb07876bfd7a4c9b76bfee576441..ce334b2c8eecbb8f4eef9f92f20be238289add3b 100755 (executable)
@@ -91,7 +91,13 @@ platform_do_upgrade() {
                fit_do_upgrade "$1"
                ;;
        acer,predator-w6|\
+       acer,predator-w6d|\
+       acer,vero-w6m|\
        arcadyan,mozart|\
+       glinet,gl-mt2500|\
+       glinet,gl-mt6000|\
+       glinet,gl-x3000|\
+       glinet,gl-xe3000|\
        smartrg,sdg-8612|\
        smartrg,sdg-8614|\
        smartrg,sdg-8622|\
@@ -115,14 +121,6 @@ platform_do_upgrade() {
        yuncore,ax835)
                default_do_upgrade "$1"
                ;;
-       glinet,gl-mt2500|\
-       glinet,gl-mt6000|\
-       glinet,gl-x3000|\
-       glinet,gl-xe3000)
-               CI_KERNPART="kernel"
-               CI_ROOTPART="rootfs"
-               emmc_do_upgrade "$1"
-               ;;
        mercusys,mr90x-v1|\
        tplink,re6000xd)
                CI_UBIPART="ubi0"
@@ -204,6 +202,8 @@ platform_copy_config() {
                fi
                ;;
        acer,predator-w6|\
+       acer,predator-w6d|\
+       acer,vero-w6m|\
        arcadyan,mozart|\
        glinet,gl-mt2500|\
        glinet,gl-mt6000|\
index 838a433bf4a5ac34fe8e6fbc7ae889c7c469af51..072cae0d1f47edaf1aadb830e2871264ab98629a 100644 (file)
@@ -165,6 +165,36 @@ define Device/acer_predator-w6
 endef
 TARGET_DEVICES += acer_predator-w6
 
+define Device/acer_predator-w6d
+  DEVICE_VENDOR := Acer
+  DEVICE_MODEL := Predator Connect W6d
+  DEVICE_DTS := mt7986a-acer-predator-w6d
+  DEVICE_DTS_DIR := ../dts
+  DEVICE_DTS_LOADADDR := 0x47000000
+  DEVICE_PACKAGES := kmod-usb3 kmod-mt7915e kmod-mt7916-firmware kmod-mt7986-firmware mt7986-wo-firmware e2fsprogs f2fsck mkf2fs
+  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-w6d
+
+define Device/acer_vero-w6m
+  DEVICE_VENDOR := Acer
+  DEVICE_MODEL := Connect Vero W6m
+  DEVICE_DTS := mt7986a-acer-vero-w6m
+  DEVICE_DTS_DIR := ../dts
+  DEVICE_DTS_LOADADDR := 0x47000000
+  DEVICE_PACKAGES := kmod-leds-ktd202x kmod-mt7915e kmod-mt7916-firmware kmod-mt7986-firmware mt7986-wo-firmware e2fsprogs f2fsck mkf2fs
+  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_vero-w6m
+
 define Device/adtran_smartrg
   DEVICE_VENDOR := Adtran
   DEVICE_DTS_DIR := ../dts