From: Marius Durbaca Date: Tue, 22 Oct 2024 13:15:57 +0000 (+0300) Subject: mediatek: add support for Zbtlink ZBT-Z8102AX v2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F18514%2Fhead;p=thirdparty%2Fopenwrt.git mediatek: add support for Zbtlink ZBT-Z8102AX v2 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 Link: https://github.com/openwrt/openwrt/pull/18514 Signed-off-by: Hauke Mehrtens --- 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 index 00000000000..6557b0ff4a4 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-zbtlink-zbt-z8102ax-v2.dts @@ -0,0 +1,337 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include + +#include "mt7981b.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 = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: red { + gpios = <&pio 9 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_status_green: green { + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_status_blue: blue { + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led_status_5g1: 5g1 { + gpios = <&pio 8 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_USB; + function-enumerator = <0>; + }; + + led_status_5g2: 5g2 { + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + color = ; + 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>; + }; + }; +}; + +ð { + 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>; + }; +}; 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 861928d82da..a96ea99bc90 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 @@ -57,6 +57,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 diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/03_gpio_switches b/target/linux/mediatek/filogic/base-files/etc/board.d/03_gpio_switches index 4cbec1ef078..1fe74f2b6fd 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/03_gpio_switches @@ -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" 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 5ca1ca462f5..c42399cf645 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 @@ -185,6 +185,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) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 337403411a1..b977d6117e0 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -2015,6 +2015,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