[openwrt/openwrt] ramips: add support for TP-Link Archer AX23 v1

LEDE Commits lede-commits at lists.infradead.org
Tue Mar 21 06:09:28 PDT 2023


blocktrron pushed a commit to openwrt/openwrt.git, branch openwrt-22.03:
https://git.openwrt.org/3c6692ba03b0d1a755d4cd4881479c89ba4e41ca

commit 3c6692ba03b0d1a755d4cd4881479c89ba4e41ca
Author: David Bauer <mail at david-bauer.net>
AuthorDate: Tue Mar 14 02:06:40 2023 +0100

    ramips: add support for TP-Link Archer AX23 v1
    
    Hardware
    --------
    CPU:    MediaTek MT7621 DAT
    RAM:    128MB DDR3 (integrated)
    FLASH:  16MB SPI-NOR ()
    WiFi:   MediaTek MT7905 + MT7975 (2.4 / 5 DBDC) 802.11ax
    SERIAL: 115200 8N1
            LEDs - (3V3 - GND - RX - TX) - ETH ports
    
    Installation
    ------------
    
    Upload the factory image using the Web-UI.
    
    Web-Recovery
    ------------
    
    The router supports a HTTP recovery mode by holding the reset-button
    when powering on. The interface is reachable at 192.168.0.1 and supports
    installation using the factory image.
    
    Signed-off-by: David Bauer <mail at david-bauer.net>
    (cherry picked from commit 7dceef5ee554ec4ab5d2dd2ff999f4a60bf2e0f4)
---
 .../ramips/dts/mt7621_tplink_archer-ax23-v1.dts    | 203 +++++++++++++++++++++
 target/linux/ramips/image/mt7621.mk                |  12 ++
 .../ramips/mt7621/base-files/etc/board.d/01_leds   |   1 +
 .../etc/hotplug.d/ieee80211/10_fix_wifi_mac        |   7 +
 4 files changed, 223 insertions(+)

diff --git a/target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts b/target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts
new file mode 100644
index 0000000000..5c2ef1fa11
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_tplink_archer-ax23-v1.dts
@@ -0,0 +1,203 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	compatible = "tplink,archer-ax23-v1", "mediatek,mt7621-soc";
+	model = "TP-Link Archer AX23 v1";
+
+	aliases {
+		led-boot = &led_power;
+		led-failsafe = &led_power;
+		led-running = &led_power;
+		led-upgrade = &led_power;
+		label-mac-device = &gmac0;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+
+		wps {
+			label = "rfkill";
+			gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RFKILL>;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		led_power: power {
+			label = "green:power";
+			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+		};
+
+		wifi2g {
+			label = "green:wifi2g";
+			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "phy0tpt";
+		};
+
+		wifi5g {
+			label = "green:wifi5g";
+			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "phy1tpt";
+		};
+
+		wan-green {
+			label = "green:wan";
+			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+		};
+
+		wan-orange {
+			label = "orange:wan";
+			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+		};
+
+		lan {
+			label = "green:lan";
+			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+		};
+
+		wps {
+			label = "green:wps";
+			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
+		};
+	};
+};
+
+&spi0 {
+	status = "okay";
+
+	flash at 0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <80000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				label = "u-boot";
+				reg = <0x000000 0x040000>;
+				read-only;
+			};
+
+			partition at 40000 {
+				compatible = "denx,uimage";
+				label = "firmware";
+				reg = <0x040000 0xf60000>;
+			};
+
+			config: partition at fa0000 {
+				label = "config";
+				reg = <0xfa0000 0x010000>;
+				read-only;
+			};
+
+			partition at fb0000 {
+				label = "tplink";
+				reg = <0xfb0000 0x040000>;
+				read-only;
+			};
+
+			radio: partition at ff0000 {
+				label = "radio";
+				reg = <0xff0000 0x010000>;
+				read-only;
+			};
+		};
+	};
+};
+
+&pcie {
+	status = "okay";
+};
+
+&pcie1 {
+	wifi at 0,0 {
+		compatible = "mediatek,mt76";
+		reg = <0x0000 0 0 0 0>;
+		mediatek,mtd-eeprom = <&radio 0x0>;
+		nvmem-cells = <&macaddr_config_8>;
+		nvmem-cell-names = "mac-address";
+		mediatek,disable-radar-background;
+	};
+};
+
+&gmac0 {
+	nvmem-cells = <&macaddr_config_8>;
+	nvmem-cell-names = "mac-address";
+};
+
+&gmac1 {
+	status = "okay";
+	label = "wan";
+	phy-handle = <&ethphy4>;
+
+	nvmem-cells = <&macaddr_config_8>;
+	nvmem-cell-names = "mac-address";
+	mac-address-increment = <1>;
+};
+
+&mdio {
+	ethphy4: ethernet-phy at 4 {
+		reg = <4>;
+	};
+};
+
+&switch0 {
+	ports {
+		port at 0 {
+			status = "okay";
+			label = "lan1";
+		};
+
+		port at 1 {
+			status = "okay";
+			label = "lan2";
+		};
+
+		port at 2 {
+			status = "okay";
+			label = "lan3";
+		};
+
+		port at 3 {
+			status = "okay";
+			label = "lan4";
+		};
+	};
+};
+
+&state_default {
+	gpio {
+		groups = "i2c", "uart3", "jtag", "wdt";
+		function = "gpio";
+	};
+};
+
+&config {
+	compatible = "nvmem-cells";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	macaddr_config_8: macaddr at 8 {
+		reg = <0x8 0x6>;
+	};
+};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 961f8a3b75..11a1e4cb6a 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -1631,6 +1631,18 @@ define Device/totolink_x5000r
 endef
 TARGET_DEVICES += totolink_x5000r
 
+define Device/tplink_archer-ax23-v1
+  $(Device/dsa-migration)
+  $(Device/tplink-safeloader)
+  DEVICE_MODEL := Archer AX23
+  DEVICE_VARIANT := v1
+  DEVICE_PACKAGES := kmod-mt7915e -uboot-envtools
+  TPLINK_BOARD_ID := ARCHER-AX23-V1
+  KERNEL := $(KERNEL_DTB) | uImage lzma
+  IMAGE_SIZE := 15744k
+endef
+TARGET_DEVICES += tplink_archer-ax23-v1
+
 define Device/tplink_archer-a6-v3
   $(Device/dsa-migration)
   $(Device/tplink-safeloader)
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
index aad2e32b36..18a26cdfc0 100644
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
@@ -112,6 +112,7 @@ oraybox,x3a)
 	ucidef_set_led_netdev "lan" "lan link" "green:status" "br-lan"
 	;;
 tplink,archer-a6-v3|\
+tplink,archer-ax23-v1|\
 tplink,archer-c6-v3|\
 tplink,archer-c6u-v1)
 	ucidef_set_led_netdev "lan" "LAN" "green:lan" "br-lan"
diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
index b92a4dcda6..34840c5ba3 100644
--- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
@@ -98,6 +98,13 @@ case "$board" in
 		hw_mac_addr="$(mtd_get_mac_binary factory 0x4)"
 		[ "$PHYNBR" = "1" ] &&  macaddr_add $hw_mac_addr "0x100000" > /sys${DEVPATH}/macaddress
 		;;
+	tplink,archer-ax23-v1)
+		hw_mac_addr="$(mtd_get_mac_binary config 0x8)"
+		# 2.4 GHz MAC is MAC in EEPROm while 5GHz is EEPROM_MAC -1
+		# However, mac80211 assigns consecutive addresses for each VAP
+		# Which leads to conflicting addresses. Set the LA bit for 5Ghz instead.
+		[ "$PHYNBR" = "1" ] &&  macaddr_setbit_la "$hw_mac_addr" > "/sys${DEVPATH}/macaddress"
+		;;
 	tplink,eap615-wall-v1)
 		hw_mac_addr="$(mtd_get_mac_binary product-info 0x8)"
 		macaddr_add "$hw_mac_addr" "$PHYNBR" > "/sys${DEVPATH}/macaddress"




More information about the lede-commits mailing list