Skip to content

Commit b33df7b

Browse files
andros-uahauke
authored andcommitted
mediatek: add support for COMFAST CF-WR632AX
COMFAST CF-WR632AX is a compact/travel (123.4 mm * 88.7 mm * 34 mm) wireless WiFi 6 router. Specification ------------- - SoC : MediaTek MT7981B dual-core ARM Cortex-A53 1.3 GHz - RAM : DDR3 512 MiB - Flash : SPI-NAND 128 MiB (Winbond) - WLAN : MediaTek MT7976CN dual-band WiFi 6 - 2.4 GHz : b/g/n/ax, MU-MIMO (2x 5 dBi antennas) - 5 GHz : a/n/ac/ax, MU-MIMO (2x 5 dBi antennas) - Ethernet : - LAN x1 : 10/100/1000 Mbps (MT7981 internal PHY) - WAN x1 : 10/100/1000/2500 Mbps (Maxlinear GPY211C) - USB x1 : 3.0 - UART : through-hole on PCB - assignment : (RX), (TX), (GND), [VCC] - settings : 115200n8 - Buttons x1 : Reset - LEDs x3 : Status (Blue, Green, Red) - Fan x1 : PWM, 4-wire, 5 V, 0.3 A, 45 mm * 10 mm - Power : 5 VDC, 3 A, Type-C Flash instructions ------------------ WebUI Method: 1. Install the *squashfs-sysupgrade.bin image using the stock WebUI update page. 2. Press and hold the reset button after reboot to wipe the stock config. SSH Method: 1. Import stock firmware settings from backup file github.com/andros-ua/owrt-misc/blob/main/cf-wr632ax/backup.file Note: WebUI password will be reset to admin1234 after import. 2. Connect via SSH using root:openwrt credentials. 3. Upload the *squashfs-sysupgrade.bin image. 4. Use the command: sysupgrade -n All checks should pass. Return to stock --------------- Flash a stock firmware using the OpenWrt sysupgrade method. Recovery -------- Power on the router while holding the Reset button until the LED flashes 5 times. The U-Boot Flash WebUI will be available at http://192.168.1.1 or Connect UART and use the U-Boot menu to flash the firmware image or boot an OpenWrt initramfs image. OpenWrt U-Boot flash instructions --------------------------------- 1. Flash ordinary OpenWrt image. 2. Login into the device and backup everything, especially 'Factory' part. 3. Unlock mtd partitions: apk add kmod-mtd-rw insmod mtd-rw i_want_a_brick=1 4. Write new BL2 and FIP: mtd write openwrt-mediatek-filogic-comfast_cf-wr632ax-ubootmod-preloader.bin BL2 mtd write openwrt-mediatek-filogic-comfast_cf-wr632ax-ubootmod-bl31-uboot.fip FIP 5. Set static IP on your PC: ip 192.168.1.254 mask 255.255.255.0 6. Serve OpenWrt initramfs image using TFTP server. 7. Reboot device, wait for TFTP recovery to complete. 8. After OpenWrt has booted, perform sysupgrade. MAC Addresses: ---------------------------------------------------------- | Interface | MAC | Source | ---------------|-------------------|---------------------- | WAN (label) | 40:A5:EF:xx:xx:xx | Factory, 0xe000 | | LAN | 40:A5:EF:xx:xx:xx | Factory, 0xe000 + 1 | | WLAN 2.4 GHz | 40:A5:EF:xx:xx:xx | Factory, 0x4 | | WLAN 5 GHz | 40:A5:EF:xx:xx:xx | Factory, 0x8000 | ---------------------------------------------------------- Signed-off-by: Andrii Kuiukoff <[email protected]> Link: openwrt/openwrt#20382 Signed-off-by: Hauke Mehrtens <[email protected]>
1 parent 8fb644e commit b33df7b

File tree

9 files changed

+674
-0
lines changed

9 files changed

+674
-0
lines changed

package/boot/uboot-mediatek/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,18 @@ define U-Boot/mt7981_cmcc_rax3000m-nand-ddr4
291291
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr4
292292
endef
293293

294+
define U-Boot/mt7981_comfast_cf-wr632ax
295+
NAME:=COMFAST CF-WR632AX
296+
BUILD_SUBTARGET:=filogic
297+
BUILD_DEVICES:=comfast_cf-wr632ax-ubootmod
298+
UBOOT_CONFIG:=mt7981_comfast_cf-wr632ax
299+
UBOOT_IMAGE:=u-boot.fip
300+
BL2_BOOTDEV:=spim-nand
301+
BL2_SOC:=mt7981
302+
BL2_DDRTYPE:=ddr3
303+
DEPENDS:=+trusted-firmware-a-mt7981-spim-nand-ddr3
304+
endef
305+
294306
define U-Boot/mt7981_cudy_tr3000-v1
295307
NAME:=Cudy TR3000 v1
296308
BUILD_SUBTARGET:=filogic
@@ -1053,6 +1065,7 @@ UBOOT_TARGETS := \
10531065
mt7981_cmcc_rax3000m-emmc-ddr4 \
10541066
mt7981_cmcc_rax3000m-nand-ddr3 \
10551067
mt7981_cmcc_rax3000m-nand-ddr4 \
1068+
mt7981_comfast_cf-wr632ax \
10561069
mt7981_cudy_tr3000-v1 \
10571070
mt7981_gatonetworks_gdsp \
10581071
mt7981_glinet_gl-mt2500 \
Lines changed: 323 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,323 @@
1+
--- /dev/null
2+
+++ b/arch/arm/dts/mt7981-comfast-cf-wr632ax.dts
3+
@@ -0,0 +1,153 @@
4+
+// SPDX-License-Identifier: GPL-2.0-or-later
5+
+
6+
+/dts-v1/;
7+
+#include "mt7981.dtsi"
8+
+#include <dt-bindings/gpio/gpio.h>
9+
+#include <dt-bindings/input/linux-event-codes.h>
10+
+
11+
+/ {
12+
+ #address-cells = <1>;
13+
+ #size-cells = <1>;
14+
+ model = "COMFAST CF-WR632AX";
15+
+ compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
16+
+
17+
+ chosen {
18+
+ stdout-path = &uart0;
19+
+ tick-timer = &timer0;
20+
+ };
21+
+
22+
+ memory@40000000 {
23+
+ device_type = "memory";
24+
+ reg = <0x40000000 0x20000000>;
25+
+ };
26+
+
27+
+ gpio-keys {
28+
+ compatible = "gpio-keys";
29+
+
30+
+ button-reset {
31+
+ label = "reset";
32+
+ linux,code = <KEY_RESTART>;
33+
+ gpios = <&pio 1 GPIO_ACTIVE_LOW>;
34+
+ };
35+
+ };
36+
+
37+
+ gpio-leds {
38+
+ compatible = "gpio-leds";
39+
+
40+
+ led_status_blue: led-0 {
41+
+ label = "blue:status";
42+
+ gpios = <&pio 8 GPIO_ACTIVE_LOW>;
43+
+ default-state = "off";
44+
+ };
45+
+
46+
+ led_status_green: led-1 {
47+
+ label = "green:status";
48+
+ gpios = <&pio 35 GPIO_ACTIVE_LOW>;
49+
+ default-state = "off";
50+
+ };
51+
+
52+
+ led_status_red: led-2 {
53+
+ label = "red:status";
54+
+ gpios = <&pio 34 GPIO_ACTIVE_LOW>;
55+
+ default-state = "on";
56+
+ };
57+
+ };
58+
+};
59+
+
60+
+&eth {
61+
+ status = "okay";
62+
+ mediatek,gmac-id = <1>;
63+
+ phy-mode = "gmii";
64+
+ phy-handle = <&phy0>;
65+
+
66+
+ mdio {
67+
+ phy0: ethernet-phy@0 {
68+
+ compatible = "ethernet-phy-id03a2.9461";
69+
+ reg = <0x0>;
70+
+ phy-mode = "gmii";
71+
+ };
72+
+ };
73+
+};
74+
+
75+
+&pio {
76+
+ spi_flash_pins: spi0-pins-func-1 {
77+
+ mux {
78+
+ function = "flash";
79+
+ groups = "spi0", "spi0_wp_hold";
80+
+ };
81+
+
82+
+ conf-pu {
83+
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
84+
+ drive-strength = <MTK_DRIVE_4mA>;
85+
+ bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
86+
+ };
87+
+
88+
+ conf-pd {
89+
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
90+
+ drive-strength = <MTK_DRIVE_4mA>;
91+
+ bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
92+
+ };
93+
+ };
94+
+};
95+
+
96+
+&spi0 {
97+
+ #address-cells = <1>;
98+
+ #size-cells = <0>;
99+
+ pinctrl-names = "default";
100+
+ pinctrl-0 = <&spi_flash_pins>;
101+
+ status = "okay";
102+
+ must_tx;
103+
+ enhance_timing;
104+
+ dma_ext;
105+
+ ipm_design;
106+
+ support_quad;
107+
+ tick_dly = <2>;
108+
+ sample_sel = <0>;
109+
+
110+
+ spi_nand@0 {
111+
+ compatible = "spi-nand";
112+
+ reg = <0>;
113+
+ spi-max-frequency = <52000000>;
114+
+
115+
+ partitions {
116+
+ compatible = "fixed-partitions";
117+
+ #address-cells = <1>;
118+
+ #size-cells = <1>;
119+
+
120+
+ partition@0 {
121+
+ label = "bl2";
122+
+ reg = <0x0 0x100000>;
123+
+ };
124+
+
125+
+ partition@100000 {
126+
+ label = "u-boot-env";
127+
+ reg = <0x100000 0x80000>;
128+
+ };
129+
+
130+
+ partition@180000 {
131+
+ label = "factory";
132+
+ reg = <0x180000 0x200000>;
133+
+ };
134+
+
135+
+ partition@380000 {
136+
+ label = "fip";
137+
+ reg = <0x380000 0x200000>;
138+
+ };
139+
+
140+
+ partition@580000 {
141+
+ label = "ubi";
142+
+ reg = <0x580000 0x7a80000>;
143+
+ compatible = "linux,ubi";
144+
+ };
145+
+ };
146+
+ };
147+
+};
148+
+
149+
+&uart0 {
150+
+ mediatek,force-highspeed;
151+
+ status = "okay";
152+
+};
153+
+
154+
+&watchdog {
155+
+ status = "disabled";
156+
+};
157+
--- /dev/null
158+
+++ b/configs/mt7981_comfast_cf-wr632ax_defconfig
159+
@@ -0,0 +1,107 @@
160+
+CONFIG_ARM=y
161+
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
162+
+CONFIG_POSITION_INDEPENDENT=y
163+
+CONFIG_ARCH_MEDIATEK=y
164+
+CONFIG_TEXT_BASE=0x41e00000
165+
+CONFIG_SYS_MALLOC_F_LEN=0x4000
166+
+CONFIG_NR_DRAM_BANKS=1
167+
+CONFIG_DEFAULT_DEVICE_TREE="mt7981-comfast-cf-wr632ax"
168+
+CONFIG_OF_LIBFDT_OVERLAY=y
169+
+CONFIG_TARGET_MT7981=y
170+
+CONFIG_SYS_LOAD_ADDR=0x46000000
171+
+CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
172+
+CONFIG_DEBUG_UART_BASE=0x11002000
173+
+CONFIG_DEBUG_UART_CLOCK=40000000
174+
+CONFIG_DEBUG_UART=y
175+
+CONFIG_FIT=y
176+
+CONFIG_BOOTDELAY=30
177+
+CONFIG_AUTOBOOT_KEYED=y
178+
+CONFIG_AUTOBOOT_MENU_SHOW=y
179+
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-comfast-cf-wr632ax.dtb"
180+
+CONFIG_LOGLEVEL=7
181+
+CONFIG_PRE_CONSOLE_BUFFER=y
182+
+CONFIG_LOG=y
183+
+# CONFIG_BOARD_INIT is not set
184+
+CONFIG_BOARD_LATE_INIT=y
185+
+CONFIG_HUSH_PARSER=y
186+
+CONFIG_SYS_PROMPT="MT7981> "
187+
+CONFIG_CMD_CPU=y
188+
+CONFIG_CMD_LICENSE=y
189+
+CONFIG_CMD_BOOTMENU=y
190+
+CONFIG_CMD_ASKENV=y
191+
+CONFIG_CMD_ERASEENV=y
192+
+CONFIG_CMD_ENV_FLAGS=y
193+
+CONFIG_CMD_STRINGS=y
194+
+CONFIG_CMD_DM=y
195+
+CONFIG_CMD_GPIO=y
196+
+CONFIG_CMD_GPT=y
197+
+CONFIG_CMD_MTD=y
198+
+CONFIG_CMD_PART=y
199+
+CONFIG_CMD_TFTPSRV=y
200+
+CONFIG_CMD_RARP=y
201+
+CONFIG_CMD_CDP=y
202+
+CONFIG_CMD_SNTP=y
203+
+CONFIG_CMD_LINK_LOCAL=y
204+
+CONFIG_CMD_DHCP=y
205+
+CONFIG_CMD_DNS=y
206+
+CONFIG_CMD_PING=y
207+
+CONFIG_CMD_PXE=y
208+
+CONFIG_CMD_CACHE=y
209+
+CONFIG_CMD_PSTORE=y
210+
+CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
211+
+CONFIG_CMD_UUID=y
212+
+CONFIG_CMD_HASH=y
213+
+CONFIG_CMD_SMC=y
214+
+CONFIG_CMD_UBI=y
215+
+CONFIG_CMD_UBI_RENAME=y
216+
+CONFIG_OF_EMBED=y
217+
+CONFIG_ENV_OVERWRITE=y
218+
+CONFIG_ENV_IS_IN_UBI=y
219+
+CONFIG_ENV_REDUNDANT=y
220+
+CONFIG_ENV_UBI_PART="ubi"
221+
+CONFIG_ENV_UBI_VOLUME="ubootenv"
222+
+CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
223+
+CONFIG_ENV_RELOC_GD_ENV_ADDR=y
224+
+CONFIG_ENV_USE_DEFAULT_ENV_TEXT_FILE=y
225+
+CONFIG_ENV_DEFAULT_ENV_TEXT_FILE="defenvs/comfast_cf-wr632ax_env"
226+
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
227+
+CONFIG_VERSION_VARIABLE=y
228+
+CONFIG_NETCONSOLE=y
229+
+CONFIG_USE_IPADDR=y
230+
+CONFIG_IPADDR="192.168.1.1"
231+
+CONFIG_USE_SERVERIP=y
232+
+CONFIG_SERVERIP="192.168.1.254"
233+
+CONFIG_NET_RANDOM_ETHADDR=y
234+
+CONFIG_REGMAP=y
235+
+CONFIG_SYSCON=y
236+
+CONFIG_BUTTON=y
237+
+CONFIG_BUTTON_GPIO=y
238+
+CONFIG_CLK=y
239+
+CONFIG_GPIO_HOG=y
240+
+CONFIG_LED=y
241+
+CONFIG_LED_BLINK=y
242+
+CONFIG_LED_GPIO=y
243+
+# CONFIG_MMC is not set
244+
+CONFIG_MTD=y
245+
+CONFIG_DM_MTD=y
246+
+CONFIG_MTD_SPI_NAND=y
247+
+CONFIG_MTD_UBI_FASTMAP=y
248+
+CONFIG_PHY_FIXED=y
249+
+CONFIG_MEDIATEK_ETH=y
250+
+CONFIG_PHY=y
251+
+CONFIG_PINCTRL=y
252+
+CONFIG_PINCONF=y
253+
+CONFIG_PINCTRL_MT7981=y
254+
+CONFIG_POWER_DOMAIN=y
255+
+CONFIG_MTK_POWER_DOMAIN=y
256+
+CONFIG_DM_REGULATOR=y
257+
+CONFIG_DM_REGULATOR_FIXED=y
258+
+CONFIG_DM_REGULATOR_GPIO=y
259+
+CONFIG_RAM=y
260+
+CONFIG_DM_SERIAL=y
261+
+CONFIG_MTK_SERIAL=y
262+
+CONFIG_SPI=y
263+
+CONFIG_DM_SPI=y
264+
+CONFIG_MTK_SPIM=y
265+
+CONFIG_ZSTD=y
266+
+CONFIG_HEXDUMP=y
267+
--- /dev/null
268+
+++ b/defenvs/comfast_cf-wr632ax_env
269+
@@ -0,0 +1,54 @@
270+
+ipaddr=192.168.1.1
271+
+serverip=192.168.1.254
272+
+loadaddr=0x46000000
273+
+console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
274+
+bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
275+
+bootconf=config-1
276+
+bootdelay=0
277+
+bootfile=openwrt-mediatek-filogic-comfast_cf-wr632ax-ubootmod-initramfs-recovery.itb
278+
+bootfile_bl2=openwrt-mediatek-filogic-comfast_cf-wr632ax-ubootmod-preloader.bin
279+
+bootfile_fip=openwrt-mediatek-filogic-comfast_cf-wr632ax-ubootmod-bl31-uboot.fip
280+
+bootfile_upg=openwrt-mediatek-filogic-comfast_cf-wr632ax-ubootmod-squashfs-sysupgrade.itb
281+
+bootled_pwr=red:status
282+
+bootled_rec=blue:status
283+
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
284+
+bootmenu_default=0
285+
+bootmenu_delay=0
286+
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )
287+
+bootmenu_0=Initialize environment.=run _firstboot
288+
+bootmenu_0d=Run default boot command.=run boot_default
289+
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
290+
+bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
291+
+bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
292+
+bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
293+
+bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
294+
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
295+
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to NAND.[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
296+
+bootmenu_8=Reboot.=reset
297+
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
298+
+boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
299+
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
300+
+boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
301+
+boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
302+
+boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
303+
+boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
304+
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
305+
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
306+
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
307+
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
308+
+boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
309+
+reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
310+
+mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
311+
+mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
312+
+ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic || run ubi_format
313+
+ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset
314+
+ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi
315+
+ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs
316+
+ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery
317+
+ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
318+
+ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
319+
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
320+
+_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
321+
+_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first
322+
+_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title
323+
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title [33m$ver[0m"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ abt,asr3000|\
2626
acer,predator-w6x-ubootmod|\
2727
asus,zenwifi-bt8-ubootmod|\
2828
cmcc,a10-ubootmod|\
29+
comfast,cf-wr632ax-ubootmod|\
2930
cudy,tr3000-v1-ubootmod|\
3031
h3c,magic-nx30-pro|\
3132
jcg,q30-pro|\
@@ -99,6 +100,7 @@ iptime,ax3000m)
99100
;;
100101
asiarf,ap7986-003|\
101102
cetron,ct3003|\
103+
comfast,cf-wr632ax|\
102104
edgecore,eap111|\
103105
netgear,wax220|\
104106
zbtlink,zbt-z8102ax|\

0 commit comments

Comments
 (0)