From d6138f353da41d735c0610e040383470b7faac6d Mon Sep 17 00:00:00 2001 From: hanwckf Date: Tue, 12 Nov 2024 02:33:49 +0800 Subject: [PATCH] mediatek: add support for xiaomi ax3000t with an8855 variant --- ...-xiaomi-mi-router-ax3000t-an8855-stock.dts | 32 +++++++++++++++++++ ...mt7981-xiaomi-mi-router-ax3000t-an8855.dts | 32 +++++++++++++++++++ .../dts/mediatek/mt7981-xiaomi-mi-router.dtsi | 7 ++++ target/linux/mediatek/image/mt7981.mk | 29 +++++++++++++++++ .../mt7981/base-files/etc/board.d/02_network | 9 +++++- .../mt7981/base-files/lib/upgrade/platform.sh | 4 +++ 6 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-xiaomi-mi-router-ax3000t-an8855-stock.dts create mode 100644 target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-xiaomi-mi-router-ax3000t-an8855.dts diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-xiaomi-mi-router-ax3000t-an8855-stock.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-xiaomi-mi-router-ax3000t-an8855-stock.dts new file mode 100644 index 0000000000..e7a715fe9c --- /dev/null +++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-xiaomi-mi-router-ax3000t-an8855-stock.dts @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981-xiaomi-mi-router-ax3000t-stock.dts" + +/ { + model = "Xiaomi Mi Router AX3000T with AN8855 (stock layout)"; + compatible = "xiaomi,mi-router-ax3000t-an8855-stock", "mediatek,mt7981"; +}; + +&gsw { + status = "disabled"; +}; + +&gsw_an8855 { + airoha,mdio = <&mdio>; + reset-gpios = <&pio 39 0>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + status = "okay"; + + port@5 { + compatible = "airoha,an8855-port"; + reg = <5>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-xiaomi-mi-router-ax3000t-an8855.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-xiaomi-mi-router-ax3000t-an8855.dts new file mode 100644 index 0000000000..732b7823f4 --- /dev/null +++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-xiaomi-mi-router-ax3000t-an8855.dts @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include "mt7981-xiaomi-mi-router-ax3000t.dts" + +/ { + model = "Xiaomi Mi Router AX3000T with AN8855"; + compatible = "xiaomi,mi-router-ax3000t-an8855", "mediatek,mt7981"; +}; + +&gsw { + status = "disabled"; +}; + +&gsw_an8855 { + airoha,mdio = <&mdio>; + reset-gpios = <&pio 39 0>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + status = "okay"; + + port@5 { + compatible = "airoha,an8855-port"; + reg = <5>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + }; + }; +}; diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-xiaomi-mi-router.dtsi b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-xiaomi-mi-router.dtsi index 4d7e754985..41ec148a5f 100644 --- a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-xiaomi-mi-router.dtsi +++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-xiaomi-mi-router.dtsi @@ -61,6 +61,13 @@ #size-cells = <0>; }; + gsw_an8855: gsw@1 { + compatible = "airoha,an8855"; + #mediatek,ethsys = <ðsys>; + #address-cells = <1>; + #size-cells = <0>; + }; + nmbm_spim_nand: nmbm_spim_nand { compatible = "generic,nmbm"; diff --git a/target/linux/mediatek/image/mt7981.mk b/target/linux/mediatek/image/mt7981.mk index 0fa8f2dfca..79dfe1fa4c 100644 --- a/target/linux/mediatek/image/mt7981.mk +++ b/target/linux/mediatek/image/mt7981.mk @@ -433,6 +433,35 @@ define Device/xiaomi_mi-router-ax3000t endef TARGET_DEVICES += xiaomi_mi-router-ax3000t +define Device/xiaomi_mi-router-ax3000t-an8855-stock + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := Mi Router AX3000T with AN8855 (stock layout) + DEVICE_DTS := mt7981-xiaomi-mi-router-ax3000t-an8855-stock + DEVICE_DTS_DIR := $(DTS_DIR)/mediatek + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 34816k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += xiaomi_mi-router-ax3000t-an8855-stock + +define Device/xiaomi_mi-router-ax3000t-an8855 + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := Mi Router AX3000T with AN8855 + DEVICE_DTS := mt7981-xiaomi-mi-router-ax3000t-an8855 + DEVICE_DTS_DIR := $(DTS_DIR)/mediatek + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 114688k + KERNEL_IN_UBI := 1 + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += xiaomi_mi-router-ax3000t-an8855 + define Device/glinet_gl-mt3000 DEVICE_VENDOR := GL.iNet DEVICE_MODEL := GL-MT3000 diff --git a/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network index 78ab041e69..ae85c00913 100755 --- a/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/mt7981/base-files/etc/board.d/02_network @@ -23,12 +23,19 @@ mediatek_setup_interfaces() *2500wan-p5*) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan ;; - xiaomi,mi-router-ax3000t* |\ + xiaomi,mi-router-ax3000t|\ + xiaomi,mi-router-ax3000t-stock|\ xiaomi,mi-router-wr30u*) ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "0:wan" "6u@eth0" "5u@eth1" ;; + xiaomi,mi-router-ax3000t-an8855|\ + xiaomi,mi-router-ax3000t-an8855-stock) + ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "3:lan" "0:wan" "5t@eth0" + ;; *360,t7*) ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_add_switch "switch0" \ diff --git a/target/linux/mediatek/mt7981/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7981/base-files/lib/upgrade/platform.sh index 363d495c28..63a30d92e7 100644 --- a/target/linux/mediatek/mt7981/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7981/base-files/lib/upgrade/platform.sh @@ -177,6 +177,7 @@ xiaomi_mt7981_initial_setup() local board=$(board_name) case "$board" in xiaomi,mi-router-ax3000t-stock|\ + xiaomi,mi-router-ax3000t-an8855-stock|\ xiaomi,mi-router-wr30u-stock) fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),34816k(ubi),34816k(ubi1),32768k(overlay),12288k(data),256k(KF)" ;; @@ -189,6 +190,7 @@ platform_do_upgrade() { case "$board" in xiaomi,mi-router-wr30u-112m|\ xiaomi,mi-router-ax3000t|\ + xiaomi,mi-router-ax3000t-an8855|\ *mt3000* |\ glinet,x3000-emmc |\ *xe3000* |\ @@ -223,6 +225,7 @@ platform_do_upgrade() { emmc_do_upgrade "$1" ;; xiaomi,mi-router-ax3000t-stock|\ + xiaomi,mi-router-ax3000t-an8855-stock|\ xiaomi,mi-router-wr30u-stock) xiaomi_mt7981_nand_upgrade_tar "$1" ;; @@ -296,6 +299,7 @@ platform_pre_upgrade() { case "$board" in xiaomi,mi-router-ax3000t-stock|\ + xiaomi,mi-router-ax3000t-an8855-stock|\ xiaomi,mi-router-wr30u-stock) xiaomi_mt7981_initial_setup ;;