[openwrt/openwrt] mediatek: Add support for GL.iNet X3000 (Spitz AX) and XE3000 (Puli AX)
LEDE Commits
lede-commits at lists.infradead.org
Wed Mar 13 13:48:58 PDT 2024
dangole pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/d1016446dacd16a87e807478227f4f96a0a37a45
commit d1016446dacd16a87e807478227f4f96a0a37a45
Author: Jean Thomas <jean.thomas at wifirst.fr>
AuthorDate: Thu Nov 9 11:28:45 2023 +0100
mediatek: Add support for GL.iNet X3000 (Spitz AX) and XE3000 (Puli AX)
The GL.iNet X3000 and XE3000 are Wi-Fi 6 5G cellular routers, based on
MediaTek MT7981A SoC. The XE3000 is the same device as the X3000,
except for an additional battery.
Specifications:
- SoC: Filogic 820 MT7981A (1.3GHz)
- RAM: DDR4 512M
- Flash: eMMC 8G, MicroSD card slot
- WiFi: 2.4GHz and 5GHz with 6 antennas
- Ethernet:
- 1x LAN (10/100/1000M)
- 1x WAN (10/100/1000/2500M)
- 5G: Quectel RM520N-GL with two nano-SIM card slots
- USB: 1x USB 2.0 port
- UART:
- 3.3V, TX, RX, GND / 115200 8N1
MAC addresses as verified by OEM firmware:
vendor OpenWrt address source
WAN eth0 label factory 0x0a (label)
LAN eth1 label + 1
2g phy0-ap0 label + 2 factory 0x04
5g phy1-ap0 label + 3
Installation via U-Boot rescue:
1. Press and hold reset button while booting the device
2. Wait for the Internet led to blink 5 times
3. Release reset button
4. The rescue page is accessible via http://192.168.1.1
5. Select the OpenWrt sysupgrade image and start upgrade
6. Wait for the router to flash new firmware and reboot
Revert to stock firmware:
1. Download the stock firmware from GL.iNet website
2. Use the method explained above to flash the stock firmware
Switch the modem network port between PCIe and USB interfaces:
1. Connect to the AT commands (/dev/ttyUSB2) port using
e.g. minicom: minicom -D /dev/ttyUSB2
2. Check the current modem mode with 'AT+QCFG="data_interface"':
- 0,0 indicates that the network port uses the USB interface
- 1,0 indicates that the network port uses the PCIe interface
3. Switch the active interface with:
- 'AT+QCFG="data_interface",0,0' to use the USB interface
- 'AT+QCFG="data_interface",1,0' to use the PCIe interface
4. Reboot
Signed-off-by: Jean Thomas <jean.thomas at wifirst.fr>
---
.../dts/mt7981a-glinet-gl-x3000-xe3000-common.dtsi | 273 +++++++++++++++++++++
.../linux/mediatek/dts/mt7981a-glinet-gl-x3000.dts | 8 +
.../mediatek/dts/mt7981a-glinet-gl-xe3000.dts | 23 ++
.../filogic/base-files/etc/board.d/01_leds | 11 +
.../filogic/base-files/etc/board.d/02_network | 4 +-
.../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 4 +-
.../filogic/base-files/lib/upgrade/platform.sh | 6 +-
target/linux/mediatek/image/filogic.mk | 25 ++
8 files changed, 351 insertions(+), 3 deletions(-)
diff --git a/target/linux/mediatek/dts/mt7981a-glinet-gl-x3000-xe3000-common.dtsi b/target/linux/mediatek/dts/mt7981a-glinet-gl-x3000-xe3000-common.dtsi
new file mode 100644
index 0000000000..4b311dbe21
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981a-glinet-gl-x3000-xe3000-common.dtsi
@@ -0,0 +1,273 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+
+#include "mt7981.dtsi"
+
+/ {
+ chosen {
+ bootargs = "console=ttyS0,115200n8 root=PARTLABEL=rootfs rootwait";
+ };
+
+ aliases {
+ label-mac-device = &gmac0;
+ led-boot = &led_power;
+ led-failsafe = &led_power;
+ led-running = &led_power;
+ led-upgrade = &led_power;
+ };
+
+ reg_5v: regulator-5v {
+ compatible = "regulator-fixed";
+ regulator-name = "fixed-5V";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ regulator-boot-on;
+ regulator-always-on;
+ };
+
+ fan_5v: regulator-fan-5v {
+ compatible = "regulator-fixed";
+ regulator-name = "fan";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ gpio = <&pio 28 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+
+ reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&pio 1 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ gpio-export {
+ compatible = "gpio-export";
+
+ hub_power {
+ gpio-export,name = "hub_power";
+ gpio-export,output = <1>;
+ gpios = <&pio 5 GPIO_ACTIVE_HIGH>;
+ };
+
+ 5G_power {
+ gpio-export,name = "5G_power";
+ gpio-export,output = <1>;
+ gpios = <&pio 11 GPIO_ACTIVE_HIGH>;
+ };
+
+ 5G_control {
+ gpio-export,name = "5G_control";
+ gpio-export,output = <1>;
+ gpios = <&pio 9 GPIO_ACTIVE_HIGH>;
+ };
+
+ 5G_reset {
+ gpio-export,name = "5G_reset";
+ gpio-export,output = <0>;
+ gpios = <&pio 10 GPIO_ACTIVE_HIGH>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ wifi2g {
+ label = "green:wifi2g";
+ gpios = <&pio 30 GPIO_ACTIVE_LOW>;
+ };
+
+ wifi5g {
+ label = "green:wifi5g";
+ gpios = <&pio 38 GPIO_ACTIVE_LOW>;
+ };
+
+ 5g_led1 {
+ label = "green:5g:led1";
+ gpios = <&pio 6 GPIO_ACTIVE_LOW>;
+ };
+
+ 5g_led2 {
+ label = "green:5g:led2";
+ gpios = <&pio 7 GPIO_ACTIVE_LOW>;
+ };
+
+ 5g_led3 {
+ label = "green:5g:led3";
+ gpios = <&pio 8 GPIO_ACTIVE_LOW>;
+ };
+
+ 5g_led4 {
+ label = "green:5g:led4";
+ gpios = <&pio 4 GPIO_ACTIVE_HIGH>;
+ };
+
+ led_power: power {
+ label = "green:power";
+ gpios = <&pio 39 GPIO_ACTIVE_LOW>;
+ };
+
+ wan {
+ label = "green:wan";
+ gpios = <&pio 31 GPIO_ACTIVE_LOW>;
+ };
+ };
+};
+
+&uart0 {
+ status = "okay";
+};
+
+&watchdog {
+ status = "okay";
+};
+
+&mmc0 {
+ pinctrl-names = "default", "state_uhs";
+ pinctrl-0 = <&mmc0_pins_default>;
+ pinctrl-1 = <&mmc0_pins_uhs>;
+ bus-width = <8>;
+ max-frequency = <52000000>;
+ cap-mmc-highspeed;
+ vmmc-supply = <®_3p3v>;
+ non-removable;
+ status = "okay";
+
+ card at 0 {
+ compatible = "mmc-card";
+ reg = <0>;
+
+ block {
+ compatible = "block-device";
+ partitions {
+ block-partition-env {
+ partname = "u-boot-env";
+
+ nvmem-layout {
+ compatible = "u-boot,env-layout";
+ };
+ };
+
+ block-partition-factory {
+ partname = "factory";
+
+ nvmem-layout {
+ compatible = "fixed-layout";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ eeprom_factory_0: eeprom at 0 {
+ reg = <0x0 0x1000>;
+ };
+
+ macaddr_factory_a: macaddr at a {
+ compatible = "mac-base";
+ reg = <0xa 0x6>;
+ #nvmem-cell-cells = <1>;
+ };
+ };
+ };
+ };
+ };
+ };
+};
+
+&mdio_bus {
+ reset-gpios = <&pio 14 GPIO_ACTIVE_LOW>;
+ reset-delay-us = <600>;
+ reset-post-delay-us = <20000>;
+
+ phy5: ethernet-phy at 5 {
+ reg = <5>;
+ compatible = "ethernet-phy-ieee802.3-c45";
+ };
+};
+
+ð {
+ status = "okay";
+
+ gmac0: mac at 0 {
+ compatible = "mediatek,eth-mac";
+ reg = <0>;
+ phy-mode = "2500base-x";
+ phy-handle = <&phy5>;
+ nvmem-cells = <&macaddr_factory_a 0>;
+ nvmem-cell-names = "mac-address";
+ };
+
+ gmac1: mac at 1 {
+ compatible = "mediatek,eth-mac";
+ reg = <1>;
+ phy-mode = "gmii";
+ phy-handle = <&int_gbe_phy>;
+ nvmem-cells = <&macaddr_factory_a 1>;
+ nvmem-cell-names = "mac-address";
+ };
+};
+
+&pio {
+ mmc0_pins_default: mmc0-pins-default {
+ mux {
+ function = "flash";
+ groups = "emmc_8";
+ };
+ };
+ mmc0_pins_uhs: mmc0-pins-uhs {
+ mux {
+ function = "flash";
+ groups = "emmc_8";
+ };
+ };
+ pcie_pins: pcie-pins {
+ mux {
+ function = "pcie";
+ groups = "pcie_pereset", "pcie_clk", "pcie_wake";
+ };
+ };
+ pwm0_pin: pwm0-pin-g0 {
+ mux {
+ function = "pwm";
+ groups = "pwm0_1";
+ };
+ };
+};
+
+&xhci {
+ phys = <&u2port0 PHY_TYPE_USB2>;
+ vbus-supply = <®_5v>;
+ mediatek,u3p-dis-msk = <0x01>;
+ status = "okay";
+};
+
+&usb_phy {
+ status = "okay";
+};
+
+&pcie {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pcie_pins>;
+ status = "okay";
+};
+
+&pwm {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pwm0_pin>;
+};
+
+&wifi {
+ nvmem-cells = <&eeprom_factory_0>;
+ nvmem-cell-names = "eeprom";
+ status = "okay";
+};
+
+&fan {
+ pwms = <&pwm 0 40000 0>;
+ fan-supply = <&fan_5v>;
+ interrupt-parent = <&pio>;
+ interrupts = <29 IRQ_TYPE_EDGE_RISING>;
+ status = "okay";
+};
diff --git a/target/linux/mediatek/dts/mt7981a-glinet-gl-x3000.dts b/target/linux/mediatek/dts/mt7981a-glinet-gl-x3000.dts
new file mode 100644
index 0000000000..bee1ecd89a
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981a-glinet-gl-x3000.dts
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7981a-glinet-gl-x3000-xe3000-common.dtsi"
+
+/ {
+ model = "GL.iNet GL-X3000";
+ compatible = "glinet,gl-x3000", "mediatek,mt7981";
+};
diff --git a/target/linux/mediatek/dts/mt7981a-glinet-gl-xe3000.dts b/target/linux/mediatek/dts/mt7981a-glinet-gl-xe3000.dts
new file mode 100644
index 0000000000..e14b944bc9
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981a-glinet-gl-xe3000.dts
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7981a-glinet-gl-x3000-xe3000-common.dtsi"
+
+/ {
+ model = "GL.iNet GL-XE3000";
+ compatible = "glinet,gl-xe3000", "mediatek,mt7981";
+};
+
+&uart1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart1_pins>;
+ status = "okay";
+};
+
+&pio {
+ uart1_pins: uart1-pins-g1 {
+ mux {
+ function = "uart";
+ groups = "uart1_3";
+ };
+ };
+};
diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds
index b3dceb74c4..69afdfde56 100644
--- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds
+++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds
@@ -32,6 +32,17 @@ cudy,re3000-v1)
cudy,wr3000-v1)
ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan"
;;
+glinet,gl-x3000|\
+glinet,gl-xe3000)
+ ucidef_set_led_default "power" "POWER" "green:power" "1"
+ ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0"
+ ucidef_set_led_netdev "5g_1" "5G_1" "green:5g:led1" "wwan0"
+ ucidef_set_led_netdev "5g_2" "5G_2" "green:5g:led2" "wwan0"
+ ucidef_set_led_netdev "5g_3" "5G_3" "green:5g:led3" "wwan0"
+ ucidef_set_led_netdev "5g_4" "5G_4" "green:5g:led4" "wwan0"
+ ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wifi2g" "phy0-ap0"
+ ucidef_set_led_netdev "wlan5g" "WLAN5G" "green:wifi5g" "phy1-ap0"
+ ;;
mercusys,mr90x-v1)
ucidef_set_led_netdev "lan-0" "lan-0" "green:lan-0" "lan0" "link tx rx"
ucidef_set_led_netdev "lan-1" "lan-1" "green:lan-1" "lan1" "link tx rx"
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 dbda950cc5..8e4fd8003c 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
@@ -50,7 +50,9 @@ mediatek_setup_interfaces()
ucidef_set_interfaces_lan_wan "lan1" eth1
;;
glinet,gl-mt2500|\
- glinet,gl-mt3000)
+ glinet,gl-mt3000|\
+ glinet,gl-x3000|\
+ glinet,gl-xe3000)
ucidef_set_interfaces_lan_wan eth1 eth0
;;
glinet,gl-mt6000|\
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 ebee1b931f..facd2079c4 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
@@ -74,7 +74,9 @@ case "$board" in
[ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress
;;
- glinet,gl-mt6000)
+ glinet,gl-mt6000|\
+ glinet,gl-x3000|\
+ glinet,gl-xe3000)
addr=$(mmc_get_mac_binary factory 0x04)
[ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress
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 abb692fb41..4df4370f0f 100755
--- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
@@ -120,7 +120,9 @@ platform_do_upgrade() {
default_do_upgrade "$1"
;;
glinet,gl-mt2500|\
- glinet,gl-mt6000)
+ glinet,gl-mt6000|\
+ glinet,gl-x3000|\
+ glinet,gl-xe3000)
CI_KERNPART="kernel"
CI_ROOTPART="rootfs"
emmc_do_upgrade "$1"
@@ -216,6 +218,8 @@ platform_copy_config() {
acer,predator-w6|\
glinet,gl-mt2500|\
glinet,gl-mt6000|\
+ glinet,gl-x3000|\
+ glinet,gl-xe3000|\
jdcloud,re-cp-03|\
ubnt,unifi-6-plus)
emmc_copy_config
diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
index b1c043bef2..7d2fac56b6 100644
--- a/target/linux/mediatek/image/filogic.mk
+++ b/target/linux/mediatek/image/filogic.mk
@@ -535,6 +535,31 @@ define Device/glinet_gl-mt6000
endef
TARGET_DEVICES += glinet_gl-mt6000
+define Device/glinet_gl-x3000-xe3000-common
+ DEVICE_VENDOR := GL.iNet
+ DEVICE_DTS_DIR := ../dts
+ DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware mkf2fs \
+ kmod-fs-f2fs kmod-hwmon-pwmfan kmod-usb3 kmod-usb-serial-option \
+ kmod-usb-storage kmod-usb-net-qmi-wwan uqmi
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+endef
+
+define Device/glinet_gl-x3000
+ DEVICE_MODEL := GL-X3000
+ DEVICE_DTS := mt7981a-glinet-gl-x3000
+ SUPPORTED_DEVICES := glinet,gl-x3000
+ $(call Device/glinet_gl-x3000-xe3000-common)
+endef
+TARGET_DEVICES += glinet_gl-x3000
+
+define Device/glinet_gl-xe3000
+ DEVICE_MODEL := GL-XE3000
+ DEVICE_DTS := mt7981a-glinet-gl-xe3000
+ SUPPORTED_DEVICES := glinet,gl-xe3000
+ $(call Device/glinet_gl-x3000-xe3000-common)
+endef
+TARGET_DEVICES += glinet_gl-xe3000
+
define Device/h3c_magic-nx30-pro
DEVICE_VENDOR := H3C
DEVICE_MODEL := Magic NX30 Pro
More information about the lede-commits
mailing list