]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
mediatek: add support for Zbtlink ZBT-Z8102AX v2 19216/head
authorMarius Durbaca <mariusd84@gmail.com>
Tue, 22 Oct 2024 13:15:57 +0000 (16:15 +0300)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 29 Jun 2025 13:24:37 +0000 (15:24 +0200)
Specifications:
SoC: MediaTek MT7981B
RAM: 1024MiB
Flash: SPI-NAND 128 MiB
Switch: 1 WAN, 4 LAN (Gigabit)
USB: two M.2 slots for 5G modems via USB 3.0 hub, external USB 3.0 port
Buttons: Reset, Mesh
Power: DC 12V 1A
WiFi: MT7976CN
UART: 115200n8
UART Layout:
VCC-RX-TX-GND

Installation:
1. Power down the router and hold in the Reset button.
2. While holding in the button power up the router again.
3. Hold the button in for 10 seconds and then release.
4. Use your browser to go to 192.168.1.1
5. If you see a GUI that is for flashing firmware then you have the V2 model.
If there is no GUI and the router continues to boot up normally
you have the V1 model.
6. Now use the V2 sysugrade file.

Note: Recovery GUI it can be used to recover from an incorrect firmware flash.

Based on patches adding support for this device by Yannick Chabanois (openmptcprouter)
and Dairyman (ofmodemsandmen)

Signed-off-by: Marius Durbaca <mariusd84@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/18514
(cherry picked from commit c908fc7d9591163ae4836f31b7e6db4611e6bc7e)
Link: https://github.com/openwrt/openwrt/pull/19216
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/mediatek/dts/mt7981b-zbtlink-zbt-z8102ax-v2.dts [new file with mode: 0644]
target/linux/mediatek/filogic/base-files/etc/board.d/02_network
target/linux/mediatek/filogic/base-files/etc/board.d/03_gpio_switches
target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
target/linux/mediatek/image/filogic.mk

diff --git a/target/linux/mediatek/dts/mt7981b-zbtlink-zbt-z8102ax-v2.dts b/target/linux/mediatek/dts/mt7981b-zbtlink-zbt-z8102ax-v2.dts
new file mode 100644 (file)
index 0000000..08fc4b9
--- /dev/null
@@ -0,0 +1,337 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT 
+
+/dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "mt7981.dtsi"
+
+/ {
+       model = "ZBT Z8102AX V2";
+       compatible = "zbtlink,zbt-z8102ax-v2", "mediatek,mt7981";
+
+       aliases {
+               serial0 = &uart0;
+               led-boot = &led_status_red;
+               led-failsafe = &led_status_red;
+               led-running = &led_status_green;
+               led-upgrade = &led_status_green;
+               label-mac-device = &gmac0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+               bootargs = "earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n8";
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               reset {
+                       label = "reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&pio 1 GPIO_ACTIVE_LOW>;
+               };
+
+               wps {
+                       label = "wps";
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&pio 0 GPIO_ACTIVE_LOW>;
+               };
+               
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_status_red: red {
+                       gpios = <&pio 9 GPIO_ACTIVE_HIGH>;
+                       color = <LED_COLOR_ID_RED>;
+                       function = LED_FUNCTION_STATUS;
+               };
+
+               led_status_green: green {
+                       gpios = <&pio 10 GPIO_ACTIVE_LOW>;
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_STATUS;
+               };
+               
+               led_status_blue: blue {
+                       gpios = <&pio 11 GPIO_ACTIVE_LOW>;
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_STATUS;
+               };
+               
+               led_status_5g1: 5g1 {
+                       gpios = <&pio 8 GPIO_ACTIVE_LOW>;
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_USB;
+                       function-enumerator = <0>;
+               };
+               
+               led_status_5g2: 5g2 {
+                       gpios = <&pio 13 GPIO_ACTIVE_LOW>;
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_USB;
+                       function-enumerator = <1>;
+               };
+       };
+
+       watchdog {
+               compatible = "linux,wdt-gpio";
+               gpios = <&pio 2 GPIO_ACTIVE_HIGH>;
+               hw_algo = "toggle";
+               hw_margin_ms = <1000>;
+       };
+
+       gpio-export {
+               compatible = "gpio-export";
+               #size-cells = <0>;
+
+               pcie {
+                       gpio-export,name = "pcie_power";
+                       gpio-export,output = <1>;
+                       gpios = <&pio 3 GPIO_ACTIVE_HIGH>;
+               };
+
+               5g1 {
+                       gpio-export,name = "5g1";
+                       gpio-export,output = <1>;
+                       gpios = <&pio 4 GPIO_ACTIVE_HIGH>;
+               };
+
+               5g2 {
+                       gpio-export,name = "5g2";
+                       gpio-export,output = <1>;
+                       gpios = <&pio 5 GPIO_ACTIVE_HIGH>;
+               };
+
+               sim1 {
+                       gpio-export,name = "sim1";
+                       gpio-export,output = <0>;
+                       gpios = <&pio 6 GPIO_ACTIVE_LOW>;
+               };
+
+               sim2 {
+                       gpio-export,name = "sim2";
+                       gpio-export,output = <0>;
+                       gpios = <&pio 7 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&eth {
+       status = "okay";
+
+       gmac0: mac@0 {
+               compatible = "mediatek,eth-mac";
+               reg = <0>;
+               phy-mode = "2500base-x";
+               nvmem-cell-names = "mac-address";
+
+               fixed-link {
+                       speed = <2500>;
+                       full-duplex;
+                       pause;
+               };
+       };
+       
+       gmac1: mac@1 {
+               compatible = "mediatek,eth-mac";
+               reg = <1>;
+               phy-mode = "gmii";
+               phy-handle = <&int_gbe_phy>;
+               nvmem-cell-names = "mac-address";
+               nvmem-cells = <&macaddr_factory_02a>;
+       };
+};
+
+&mdio_bus {
+       switch: switch@1f {
+               compatible = "mediatek,mt7531";
+               reg = <31>;
+               reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
+               interrupt-controller;
+               #interrupt-cells = <1>;
+               interrupt-parent = <&pio>;
+               interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
+       };
+};
+
+&spi0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&spi0_flash_pins>;
+       status = "okay";
+
+       spi_nand@0 {
+               compatible = "spi-nand";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               reg = <0>;
+
+               spi-max-frequency = <52000000>;
+               spi-tx-buswidth = <4>;
+               spi-rx-buswidth = <4>;
+
+               mediatek,nmbm;
+               mediatek,bmt-max-ratio = <1>;
+               mediatek,bmt-max-reserved-blocks = <64>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "bl2";
+                               reg = <0x0000000 0x0100000>;
+                               read-only;
+                       };
+
+                       partition@100000 {
+                               label = "u-boot-env";
+                               reg = <0x0100000 0x0080000>;
+                       };
+
+                       factory: partition@180000 {
+                               label = "Factory";
+                               reg = <0x0180000 0x0200000>;
+                               read-only;
+                       };
+
+                       partition@380000 {
+                               label = "FIP";
+                               reg = <0x0380000 0x0200000>;
+                               read-only;
+                       };
+
+                       nand_rootfs: partition@580000 {
+                               label = "ubi";
+                               reg = <0x0580000 0x7220000>;
+                       };
+               };
+       };
+};
+
+&switch {
+       ports {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               port@0 {
+                       reg = <0>;
+                       label = "lan1";
+                       nvmem-cell-names = "mac-address";
+                       nvmem-cells = <&macaddr_factory_004>;
+               };
+
+               port@1 {
+                       reg = <1>;
+                       label = "lan2";
+                       nvmem-cell-names = "mac-address";
+                       nvmem-cells = <&macaddr_factory_004>;
+               };
+
+               port@2 {
+                       reg = <2>;
+                       label = "lan3";
+                       nvmem-cell-names = "mac-address";
+                       nvmem-cells = <&macaddr_factory_004>;
+               };
+
+               port@3 {
+                       reg = <3>;
+                       label = "lan4";
+                       nvmem-cell-names = "mac-address";
+                       nvmem-cells = <&macaddr_factory_004>;
+               };
+
+               port@6 {
+                       reg = <6>;
+                       label = "cpu";
+                       ethernet = <&gmac0>;
+                       phy-mode = "2500base-x";
+
+                       fixed-link {
+                               speed = <2500>;
+                               full-duplex;
+                               pause;
+                       };
+               };
+       };
+};
+
+&pio {
+       gpio-line-names = 
+                       "wps",
+                       "reset",
+                       "watchdog",
+                       "pcie",
+                       "5g1",
+                       "5g2",
+                       "sim1",
+                       "sim2",
+                       "5g1_status",
+                       "red_status",
+                       "green_status",
+                       "blue_status",
+                       "",
+                       "5g2_status";
+
+       spi0_flash_pins: spi0-pins {
+               mux {
+                       function = "spi";
+                       groups = "spi0", "spi0_wp_hold";
+               };
+
+               conf-pu {
+                       pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
+                       drive-strength = <8>;
+                       mediatek,pull-up-adv = <0>; /* bias-disable */
+               };
+
+               conf-pd {
+                       pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
+                       drive-strength = <8>;
+                       mediatek,pull-up-adv = <0>; /* bias-disable */
+               };
+       };
+};
+
+&uart0 {
+       status = "okay";
+};
+
+&watchdog {
+       status = "okay";
+};
+
+&usb_phy {
+       status = "okay";
+};
+
+&xhci {
+       status = "okay";
+};
+
+&wifi {
+       status = "okay";
+        nvmem-cells = <&eeprom_factory>;
+        nvmem-cell-names = "eeprom";
+};
+
+&factory {
+       compatible = "nvmem-cells";
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       macaddr_factory_004: macaddr@004 {
+               reg = <0x004 0x6>;
+       };
+       macaddr_factory_02a: macaddr@02a {
+               reg = <0x02a 0x6>;
+       };
+        eeprom_factory: eeprom@0 {
+               reg = <0x0 0x1000>;
+       };
+};
index 11dd94aef6527a8eba8ac95fc9bc97921330054b..d7e9c1595587e0445f5726cac5cbe63d5a72a2d2 100644 (file)
@@ -52,6 +52,7 @@ mediatek_setup_interfaces()
        ruijie,rg-x60-pro|\
        unielec,u7981-01*|\
        zbtlink,zbt-z8102ax|\
+       zbtlink,zbt-z8102ax-v2|\
        zyxel,ex5601-t0-stock|\
        zyxel,ex5601-t0-ubootmod)
                ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1
index 4cbec1ef078db310b3afaf03e428c755a264e65c..1fe74f2b6fd4566788d0cbd74ec0c590a410efe0 100644 (file)
@@ -5,7 +5,8 @@ board_config_update
 board=$(board_name)
 
 case "$board" in
-zbtlink,zbt-z8102ax)
+zbtlink,zbt-z8102ax|\
+zbtlink,zbt-z8102ax-v2)
        ucidef_add_gpio_switch "5g1" "Power 1st modem" "5g1" "1"
        ucidef_add_gpio_switch "5g2" "Power 2nd modem" "5g2" "1"
        ucidef_add_gpio_switch "pcie" "Power PCIe port" "pcie" "1"
index 01e943617a7cd6292b2e411c2b34ba85e2f983f2..8a100d525bb0cbaf5b56cec819e5ef3e4dcc8c63 100644 (file)
@@ -177,6 +177,7 @@ case "$board" in
        routerich,ax3000|\
        routerich,ax3000-ubootmod|\
        zbtlink,zbt-z8102ax|\
+       zbtlink,zbt-z8102ax-v2|\
        zbtlink,zbt-z8103ax|\
        zyxel,ex5601-t0-stock|\
        zyxel,ex5601-t0-ubootmod)
index f1d2a40a17792cb391c8a08eee2f9dfb060f06f1..ffdc0412e64e3481421c39aa9ca9a7f3bf4d92c7 100644 (file)
@@ -1850,6 +1850,23 @@ define Device/zbtlink_zbt-z8102ax
 endef
 TARGET_DEVICES += zbtlink_zbt-z8102ax
 
+define Device/zbtlink_zbt-z8102ax-v2
+  DEVICE_VENDOR := Zbtlink
+  DEVICE_MODEL := ZBT-Z8102AX-V2
+  DEVICE_DTS := mt7981b-zbtlink-zbt-z8102ax-v2
+  DEVICE_DTS_DIR := ../dts
+  DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 kmod-usb-net-qmi-wwan kmod-usb-serial-option
+  KERNEL_IN_UBI := 1
+  UBINIZE_OPTS := -E 5
+  BLOCKSIZE := 128k
+  PAGESIZE := 2048
+  IMAGE_SIZE := 65536k
+  IMAGES += factory.bin
+  IMAGE/factory.bin := append-ubi | check-size $$(IMAGE_SIZE)
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+endef
+TARGET_DEVICES += zbtlink_zbt-z8102ax-v2
+
 define Device/zbtlink_zbt-z8103ax
   DEVICE_VENDOR := Zbtlink
   DEVICE_MODEL := ZBT-Z8103AX