Skip to content

Commit f044574

Browse files
committed
mediatek: add support for ZyXEL NWA50AX Pro
Hardware -------- CPU: Mediatek MT7981 RAM: 512M DDR4 FLASH: 256M NAND ETH: MaxLinear GPY211 (2.5GbE N Base-T) WiFi: Mediatek MT7981 (2.4GHz 2T2R:2 5GHz 3T3R:2 802.11ax) BTN: 1x Reset LED: 1x Multi-Color UART Console ------------ Available below the rubber cover next to the ethernet port. Settings: 115200 8N1 Layout: <12V> <LAN> GND-RX-TX-VCC Logic-Level is 3V3. Don't connect VCC to your UART adapter! Installation Web-UI ------------------- Upload the Factory image using the devices Web-Interface. As the device uses a dual-image partition layout, OpenWrt can only installed on Slot A. This requires the current active image prior flashing the device to be on Slot B. In case this is not the case, OpenWrt will boot only one time, returning to the ZyXEL firmware the second boot. If this happens, first install a ZyXEL firmware upgrade of any version and install OpenWrt after that. Installation TFTP / Recovery ---------------------------- This installation routine is especially useful in case of a bricked device. Attach to the UART console header of the device. Interrupt the boot procedure by pressing Enter. The bootloader has a reduced command-set available from CLI, but more commands can be executed by abusing the atns command. Boot a OpenWrt initramfs image available on a TFTP server at 192.168.1.66. Rename the image to nwa50axpro-openwrt-initramfs.bin. $ atnf nwa50axpro-openwrt-initramfs.bin $ atna 192.168.1.88 $ atns "192.168.1.66; tftpboot; setenv fdt_high 0xffffffffffffffff; bootm" Upon booting, set the booted image to the correct slot: $ zyxel-bootconfig /dev/mtd9 get-status $ zyxel-bootconfig /dev/mtd9 set-image-status 0 valid $ zyxel-bootconfig /dev/mtd9 set-active-image 0 Copy the OpenWrt sysupgrade image to the device using scp. Write the sysupgrade image to NAND using sysupgrade. $ sysupgrade -n image.bin Signed-off-by: David Bauer <mail@david-bauer.net>
1 parent 548c437 commit f044574

File tree

6 files changed

+298
-1
lines changed

6 files changed

+298
-1
lines changed

package/utils/zyxel-bootconfig/files/95_apply_bootconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apply_bootconfig() {
33

44
case $(board_name) in
55
zyxel,nwa50ax|\
6+
zyxel,nwa50ax-pro|\
67
zyxel,nwa55axe)
78
mtd_idx=$(find_mtd_index "bootconfig")
89
zyxel-bootconfig "/dev/mtd$mtd_idx" set-image-status 0 valid

scripts/mkits-zyxel-fit-filogic.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Licensed under the terms of the GNU GPL License version 2 or later.
4+
# Author: David Bauer <mail@david-bauer.net>, based on mkits-zyxel-factory.sh.
5+
6+
usage() {
7+
echo "Usage: `basename $0` output file compat-models"
8+
exit 1
9+
}
10+
11+
# We need at least 3 arguments
12+
[ "$#" -lt 3 ] && usage
13+
14+
# Target output file
15+
OUTPUT="$1"; shift
16+
FILE="$1"; shift
17+
MODELS="$1"; shift
18+
19+
# Create a default, fully populated DTS file
20+
echo "\
21+
/dts-v1/;
22+
23+
/ {
24+
timestamp = <0x684090B4>;
25+
description = \"Zyxel FIT (Flattened Image Tree)\";
26+
compat-models = [${MODELS}];
27+
fw_version = \"9.99(###.1)\";
28+
#address-cells = <1>;
29+
30+
images {
31+
ubi {
32+
data = /incbin/(\"${FILE}\");
33+
type = \"firmware\";
34+
compression = \"none\";
35+
hash {
36+
algo = \"sha256\";
37+
};
38+
};
39+
};
40+
};" > ${OUTPUT}
Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
/dts-v1/;
2+
3+
#include "mt7981.dtsi"
4+
5+
/ {
6+
model = "ZyXEL NWA50AX Pro";
7+
compatible = "zyxel,nwa50ax-pro", "mediatek,mt7981";
8+
9+
aliases {
10+
led-boot = &led_green;
11+
led-failsafe = &led_red;
12+
led-running = &led_green;
13+
led-upgrade = &led_red;
14+
serial0 = &uart0;
15+
label-mac-device = &gmac1;
16+
};
17+
18+
chosen {
19+
stdout-path = "serial0:115200n8";
20+
};
21+
22+
gpio-keys {
23+
compatible = "gpio-keys";
24+
25+
reset {
26+
label = "reset";
27+
linux,code = <KEY_RESTART>;
28+
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
29+
};
30+
};
31+
32+
leds {
33+
compatible = "gpio-leds";
34+
35+
led_green: led@0 {
36+
label = "green:system";
37+
gpios = <&pio 4 GPIO_ACTIVE_HIGH>;
38+
};
39+
40+
led@1 {
41+
label = "blue:system";
42+
gpios = <&pio 6 GPIO_ACTIVE_HIGH>;
43+
};
44+
45+
led_red: led@2 {
46+
label = "red:system";
47+
gpios = <&pio 7 GPIO_ACTIVE_HIGH>;
48+
};
49+
};
50+
};
51+
52+
&uart0 {
53+
status = "okay";
54+
};
55+
56+
&watchdog {
57+
status = "okay";
58+
};
59+
60+
&eth {
61+
pinctrl-names = "default";
62+
pinctrl-0 = <&mdio_pins>;
63+
64+
status = "okay";
65+
66+
gmac1: mac@1 {
67+
compatible = "mediatek,eth-mac";
68+
reg = <1>;
69+
phy-mode = "2500base-x";
70+
71+
phy-handle = <&phy0>;
72+
73+
nvmem-cells = <&macaddr_mrd_1fff8>;
74+
nvmem-cell-names = "mac-address";
75+
};
76+
};
77+
78+
&mdio_bus {
79+
reset-gpios = <&pio 12 GPIO_ACTIVE_LOW>;
80+
reset-delay-us = <1500000>;
81+
reset-post-delay-us = <1000000>;
82+
83+
phy0: ethernet-phy@5 {
84+
reg = <5>;
85+
compatible = "ethernet-phy-ieee802.3-c45";
86+
};
87+
};
88+
89+
&spi0 {
90+
pinctrl-names = "default";
91+
pinctrl-0 = <&spi0_flash_pins>;
92+
status = "okay";
93+
94+
spi_nand: flash@0 {
95+
#address-cells = <1>;
96+
#size-cells = <1>;
97+
compatible = "spi-nand";
98+
reg = <0>;
99+
spi-max-frequency = <52000000>;
100+
101+
spi-cal-enable;
102+
spi-cal-mode = "read-data";
103+
spi-cal-datalen = <7>;
104+
spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>;
105+
spi-cal-addrlen = <5>;
106+
spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
107+
108+
spi-tx-buswidth = <4>;
109+
spi-rx-buswidth = <4>;
110+
mediatek,nmbm;
111+
mediatek,bmt-max-ratio = <1>;
112+
mediatek,bmt-max-reserved-blocks = <64>;
113+
114+
mediatek,bmt-remap-range =
115+
<0x0 0x580000>,
116+
<0xef00000 0xef80000>;
117+
118+
partitions {
119+
compatible = "fixed-partitions";
120+
#address-cells = <1>;
121+
#size-cells = <1>;
122+
123+
partition@0 {
124+
label = "BL2";
125+
reg = <0x00000 0x0100000>;
126+
read-only;
127+
};
128+
129+
partition@100000 {
130+
label = "u-boot-env";
131+
reg = <0x0100000 0x0080000>;
132+
};
133+
134+
factory: partition@180000 {
135+
label = "Factory";
136+
reg = <0x180000 0x0200000>;
137+
read-only;
138+
139+
compatible = "nvmem-cells";
140+
#address-cells = <1>;
141+
#size-cells = <1>;
142+
143+
macaddr: macaddr@a {
144+
reg = <0xa 0x6>;
145+
};
146+
};
147+
148+
partition@380000 {
149+
label = "FIP";
150+
reg = <0x380000 0x0200000>;
151+
read-only;
152+
};
153+
154+
partition@580000 {
155+
label = "ubi";
156+
reg = <0x580000 0x3200000>;
157+
};
158+
159+
partition@3780000 {
160+
label = "ubi_1";
161+
reg = <0x3780000 0x3200000>;
162+
read-only;
163+
};
164+
165+
partition@6980000 {
166+
label = "rootfs-data";
167+
reg = <0x6980000 0x3c00000>;
168+
read-only;
169+
};
170+
171+
partition@a580000 {
172+
label = "logs";
173+
reg = <0xa580000 0x3a80000>;
174+
read-only;
175+
};
176+
177+
partition@e000000 {
178+
label = "myzyxel";
179+
reg = <0xe000000 0xf00000>;
180+
read-only;
181+
};
182+
183+
partition@ef00000 {
184+
label = "bootconfig";
185+
reg = <0xef00000 0x80000>;
186+
};
187+
188+
partition@ef80000 {
189+
label = "mrd";
190+
reg = <0xef80000 0x80000>;
191+
read-only;
192+
193+
compatible = "nvmem-cells";
194+
#address-cells = <1>;
195+
#size-cells = <1>;
196+
197+
macaddr_mrd_1fff8: macaddr@1fff8 {
198+
reg = <0x1fff8 0x6>;
199+
};
200+
};
201+
};
202+
};
203+
};
204+
205+
&pio {
206+
spi0_flash_pins: spi0-pins {
207+
mux {
208+
function = "spi";
209+
groups = "spi0", "spi0_wp_hold";
210+
};
211+
};
212+
213+
pwm_pins: pwm0-pins {
214+
mux {
215+
function = "pwm";
216+
groups = "pwm0_1";
217+
};
218+
};
219+
};
220+
221+
&wifi {
222+
status = "okay";
223+
224+
mediatek,mtd-eeprom = <&factory 0x0>;
225+
};

target/linux/mediatek/filogic/base-files/etc/board.d/02_network

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ mediatek_setup_interfaces()
1111
asus,tuf-ax4200)
1212
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1
1313
;;
14-
netgear,wax220)
14+
netgear,wax220|\
15+
zyxel,nwa50ax-pro)
1516
ucidef_set_interface_lan "eth0"
1617
;;
1718
bananapi,bpi-r3)

target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,9 @@ case "$board" in
6161
addr=$(mtd_get_mac_binary "Factory" 0x4)
6262
[ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress
6363
;;
64+
zyxel,nwa50ax-pro)
65+
hw_mac_addr="$(mtd_get_mac_binary mrd 0x1fff8)"
66+
[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
67+
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
68+
;;
6469
esac

target/linux/mediatek/image/filogic.mk

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ define Build/append-gl-metadata
7575
}
7676
endef
7777

78+
define Build/zyxel-nwa-fit-filogic
79+
$(TOPDIR)/scripts/mkits-zyxel-fit-filogic.sh \
80+
$@.its $@ "80 e1 ff ff ff ff ff ff ff ff"
81+
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
82+
@mv $@.new $@
83+
endef
84+
7885
define Device/asus_tuf-ax4200
7986
DEVICE_VENDOR := ASUS
8087
DEVICE_MODEL := TUF-AX4200
@@ -423,3 +430,21 @@ define Device/zyxel_ex5601-t0-stock
423430
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd
424431
endef
425432
TARGET_DEVICES += zyxel_ex5601-t0-stock
433+
434+
define Device/zyxel_nwa50ax-pro
435+
DEVICE_VENDOR := ZyXEL
436+
DEVICE_MODEL := NWA50AX Pro
437+
DEVICE_DTS := mt7981b-zyxel-nwa50ax-pro
438+
DEVICE_DTS_DIR := ../dts
439+
DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware zyxel-bootconfig
440+
DEVICE_DTS_LOADADDR := 0x44000000
441+
UBINIZE_OPTS := -E 5
442+
BLOCKSIZE := 128k
443+
PAGESIZE := 2048
444+
IMAGE_SIZE := 51200k
445+
KERNEL_IN_UBI := 1
446+
IMAGES += factory.bin
447+
IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) | zyxel-nwa-fit-filogic
448+
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
449+
endef
450+
TARGET_DEVICES += zyxel_nwa50ax-pro

0 commit comments

Comments
 (0)