aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/filogic/base-files
diff options
context:
space:
mode:
authorDavid Bauer <mail@david-bauer.net>2023-01-26 17:39:43 +0100
committerDavid Bauer <mail@david-bauer.net>2023-03-24 20:30:29 +0100
commite7c399bee677e9bac66e1bea697aefb8d828edfe (patch)
tree2b8fd16d510e19253da3a189a81883644956fea5 /target/linux/mediatek/filogic/base-files
parent652d5ac1526ffb5e5d5894dbde4064b2d56723e0 (diff)
downloadupstream-e7c399bee677e9bac66e1bea697aefb8d828edfe.tar.gz
upstream-e7c399bee677e9bac66e1bea697aefb8d828edfe.tar.bz2
upstream-e7c399bee677e9bac66e1bea697aefb8d828edfe.zip
filogic: add support for ASUS TUF-AX4200
Hardware -------- SOC: MediaTek MT7986 RAM: 512MB DDR3 FLASH: 256MB SPI-NAND (Winbond W25N02KV) WIFI: Mediatek MT7986 DBDC 802.11ax 2.4/5 GHz ETH: MediaTek MT7531 Switch MaxLinear GPY211C 2.5 N-Base-T PHY UART: 3V3 115200 8N1 (Pinout silkscreened / Do not ocnnect VCC) Installation ------------ 1. Download the OpenWrt initramfs image. Copy the image to a TFTP server reachable at 192.168.1.66/24. Rename the image to tufax4200.bin. 2. Connect the TFTP server to the AX4200. Conect to the serial console, interrupt the autoboot process by pressing '4' when prompted. 3. Download & Boot the OpenWrt initramfs image. $ setenv ipaddr 192.168.1.1 $ setenv serverip 192.168.1.66 $ tftpboot 0x46000000 tufax4200.bin $ bootm 0x46000000 4. Wait for OpenWrt to boot. Transfer the sysupgrade image to the device using scp and install using sysupgrade. $ sysupgrade -n <path-to-sysupgrade.bin> Missing features ---------------- - The LAN port LEDs are driven by the switch but OpenWrt does not correctly configure the output. Signed-off-by: David Bauer <mail@david-bauer.net>
Diffstat (limited to 'target/linux/mediatek/filogic/base-files')
-rw-r--r--target/linux/mediatek/filogic/base-files/etc/board.d/02_network10
-rw-r--r--target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata21
-rw-r--r--target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac9
-rw-r--r--target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh14
-rwxr-xr-xtarget/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh5
5 files changed, 59 insertions, 0 deletions
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 13f52587c3..3d76e4d502 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
@@ -8,6 +8,10 @@ mediatek_setup_interfaces()
local board="$1"
case $board in
+ asus,tuf-ax4200)
+ CI_UBIPART="UBI_DEV"
+ ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth1"
+ ;;
mediatek,mt7986a-rfb|\
mediatek,mt7986b-rfb)
ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" eth1
@@ -34,6 +38,12 @@ mediatek_setup_macs()
local label_mac=""
case $board in
+ asus,tuf-ax4200)
+ CI_UBIPART="UBI_DEV"
+ addr=$(mtd_get_mac_binary_ubi "Factory" 0x4)
+ wan_mac="${addr}"
+ lan_mac="${addr}"
+ ;;
xiaomi,redmi-router-ax6000-stock|\
xiaomi,redmi-router-ax6000-ubootmod)
wan_mac=$(mtd_get_mac_ascii Bdata ethaddr_wan)
diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata
new file mode 100644
index 0000000000..0fe4c69988
--- /dev/null
+++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+[ -e /lib/firmware/$FIRMWARE ] && exit 0
+
+. /lib/functions/caldata.sh
+
+board=$(board_name)
+
+case "$FIRMWARE" in
+"mediatek/mt7986_eeprom_mt7976_dbdc.bin")
+ case "$board" in
+ asus,tuf-ax4200)
+ CI_UBIPART="UBI_DEV"
+ caldata_extract_ubi "Factory" 0x0 0x1000
+ ;;
+ esac
+ ;;
+*)
+ exit 1
+ ;;
+esac
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 fd822e3d4c..ecaf2eadcd 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
@@ -10,6 +10,15 @@ PHYNBR=${DEVPATH##*/phy}
board=$(board_name)
case "$board" in
+ asus,tuf-ax4200)
+ CI_UBIPART="UBI_DEV"
+ addr=$(mtd_get_mac_binary_ubi "Factory" 0x4)
+ # Originally, phy0 is phy1 mac with LA bit set. However, this would conflict
+ # addresses on mutiple VIFs with the other radio. Set LA bit and increment
+ # mac-address instead.
+ [ "$PHYNBR" = "0" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress
+ [ "$PHYNBR" = "1" ] && echo "$addr" > /sys${DEVPATH}/macaddress
+ ;;
bananapi,bpi-r3)
addr=$(macaddr_add $(cat /sys/class/net/eth0/address) 2)
[ "$PHYNBR" = "0" ] && macaddr_unsetbit $addr 6 > /sys${DEVPATH}/macaddress
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
new file mode 100644
index 0000000000..ec078741c9
--- /dev/null
+++ b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh
@@ -0,0 +1,14 @@
+. /lib/functions/system.sh
+
+preinit_set_mac_address() {
+ case $(board_name) in
+ asus,tuf-ax4200)
+ CI_UBIPART="UBI_DEV"
+ addr=$(mtd_get_mac_binary_ubi "Factory" 0x4)
+ ip link set dev eth0 address "$addr"
+ ip link set dev eth1 address "$addr"
+ ;;
+ esac
+}
+
+boot_hook_add preinit_main preinit_set_mac_address
diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
index 9a389d59b1..ca09741030 100755
--- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
@@ -42,6 +42,11 @@ platform_do_upgrade() {
local board=$(board_name)
case "$board" in
+ asus,tuf-ax4200)
+ CI_UBIPART="UBI_DEV"
+ CI_KERNPART="linux"
+ nand_do_upgrade "$1"
+ ;;
bananapi,bpi-r3)
local rootdev="$(cmdline_get_var root)"
rootdev="${rootdev##*/}"