From a07f62f65a9216ddeca256ec9ae35d28629dd953 Mon Sep 17 00:00:00 2001 From: David Berdik Date: Mon, 18 May 2026 16:33:33 -0400 Subject: [PATCH] mediatek/filogic: add support for COMFAST CF-XR186 The COMFAST CF-XR186 is a WiFi repeater. The original OEM firmware is a fork of OpenWrt 21.02. To replace the OEM firmware with OpenWrt, flash the sysupgrade image through the firmware upgrade option via the OEM firmware's web UI. The OEM firmware upgrade page does not provide an option to perform a factory reset, so after the flash completes and the device reboots, perform a reset by holding in the WPS/Reset button until the WiFi LED flashes red. The led-boot, led-failsafe, led-upgrade, and led-running aliases all point at the red WLAN GPIO LED. The green and blue WLAN GPIO LEDs are used to indicate activity on the 2.4GHz and 5GHz radios. 01_leds assigns netdev triggers for those LEDs to phy0-ap0 and phy1-ap0 respectively; if neither AP interface exists (e.g. station-only repeater setups), both LEDs stay dark even when WiFi traffic is flowing. Specifications: - SoC: MediaTek MT7981B - RAM: 256MB - Flash: SPI NAND - WiFi: 2.4GHz + 5GHz (AX3000, 4x 3dBi antennas) - Ethernet: 1x 10/100/1000M - LEDs: power (not controllable), blue Ethernet, blue/green/red WiFi - Button: WPS/Reset - Power: 100-240V AC (wall plug) - UART: 115200 8N1 MAC Addresses: - LAN : 40:A5:EF:xx:xx:2D (Factory, 0xe000) - 2.4GHz: 40:A5:EF:xx:xx:2F (Factory, 0x0004) - 5GHz : 40:A5:EF:xx:xx:30 (Factory, 0x8000) Signed-off-by: David Berdik Link: https://github.com/openwrt/openwrt/pull/22471 Signed-off-by: Hauke Mehrtens --- .../mediatek/dts/mt7981b-comfast-cf-xr186.dts | 225 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 5 + .../filogic/base-files/etc/board.d/02_network | 1 + target/linux/mediatek/image/filogic.mk | 21 ++ 4 files changed, 252 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-comfast-cf-xr186.dts diff --git a/target/linux/mediatek/dts/mt7981b-comfast-cf-xr186.dts b/target/linux/mediatek/dts/mt7981b-comfast-cf-xr186.dts new file mode 100644 index 0000000000..1e7b2745e7 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-comfast-cf-xr186.dts @@ -0,0 +1,225 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include +#include + +#include "mt7981b.dtsi" + +/ { + model = "COMFAST CF-XR186"; + compatible = "comfast,cf-xr186", "mediatek,mt7981"; + + aliases { + label-mac-device = &gmac1; + serial0 = &uart0; + led-boot = &led_wifi_red; + led-failsafe = &led_wifi_red; + led-upgrade = &led_wifi_red; + led-running = &led_wifi_red; + }; + + chosen { + bootargs-override = "console=ttyS0,115200n8"; + stdout-path = "serial0:115200n8"; + }; + + memory@40000000 { + reg = <0 0x40000000 0 0x10000000>; + device_type = "memory"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_wifi_blue: wifi-blue { + color = ; + function = LED_FUNCTION_WLAN; + gpios = <&pio 6 GPIO_ACTIVE_LOW>; + }; + + led_wifi_green: wifi-green { + color = ; + function = LED_FUNCTION_WLAN; + gpios = <&pio 35 GPIO_ACTIVE_LOW>; + }; + + led_wifi_red: wifi-red { + color = ; + function = LED_FUNCTION_WLAN; + gpios = <&pio 34 GPIO_ACTIVE_LOW>; + }; + + led_lan: lan-blue { + color = ; + function = LED_FUNCTION_LAN; + gpios = <&pio 4 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&crypto { + status = "okay"; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + status = "okay"; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + nvmem-cells = <&macaddr_factory_e000 0>; + nvmem-cell-names = "mac-address"; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP"; + drive-strength = ; + bias-pull-up = ; + }; + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand: spi-nand@0 { + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <52000000>; + + spi-cal-enable; + spi-cal-mode = "read-data"; + spi-cal-datalen = <7>; + spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; + spi-cal-addrlen = <5>; + spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; + + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + read-only; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x0200000>; + read-only; + + 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>; + }; + + macaddr_factory_8000: macaddr@8000 { + compatible = "mac-base"; + reg = <0x8000 0x6>; + #nvmem-cell-cells = <1>; + }; + + macaddr_factory_e000: macaddr@e000 { + compatible = "mac-base"; + reg = <0xe000 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x4000000>; + compatible = "linux,ubi"; + }; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + + band@0 { + reg = <0>; + nvmem-cells = <&macaddr_factory_4 0>; + nvmem-cell-names = "mac-address"; + }; + + band@1 { + reg = <1>; + nvmem-cells = <&macaddr_factory_8000 0>; + nvmem-cell-names = "mac-address"; + }; +}; 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 453ad91e67..389080ddba 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 @@ -68,6 +68,11 @@ bazis,ax3000wm) ucidef_set_led_netdev "lanlink" "LANLINK" "green:lan" "eth1" "link" ucidef_set_led_netdev "internet" "internet" "blue:wan-online" "wan" "link" ;; +comfast,cf-xr186) + ucidef_set_led_netdev "lan" "LAN" "blue:lan" "eth0" "link tx rx" + ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wlan" "phy0-ap0" "link tx rx" + ucidef_set_led_netdev "wlan5g" "WLAN5G" "blue:wlan" "phy1-ap0" "link tx rx" + ;; cudy,re3000-v1|\ kebidumei,ax3000-u22|\ wavlink,wl-wn573hx3) 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 b2ae0eff5b..a48b62f17b 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 @@ -112,6 +112,7 @@ mediatek_setup_interfaces() cudy,ap3000wall-v1) ucidef_set_interface_lan "lan1 lan2 lan3 lan4 lan5" ;; + comfast,cf-xr186|\ cudy,ap3000outdoor-v1|\ cudy,ap3000-v1|\ cudy,re3000-v1|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 3bb3c66d37..ab76132bd4 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1032,6 +1032,27 @@ define Device/comfast_cf-wr632ax-ubootmod endef TARGET_DEVICES += comfast_cf-wr632ax-ubootmod +define Device/comfast_cf-xr186 + DEVICE_VENDOR := COMFAST + DEVICE_MODEL := CF-XR186 + DEVICE_DTS := mt7981b-comfast-cf-xr186 + DEVICE_DTS_DIR := ../dts + SUPPORTED_DEVICES += cf-xr186 + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware + 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 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 65536k + KERNEL_IN_UBI := 1 + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += comfast_cf-xr186 + define Device/confiabits_mt7981 DEVICE_VENDOR := Confiabits DEVICE_MODEL := MT7981