From f09e70e2e55926be161f4869d63ebdac666918c8 Mon Sep 17 00:00:00 2001 From: hanwckf Date: Fri, 20 Sep 2024 02:23:37 +0800 Subject: [PATCH] mediatek: add support for zyxel ex5700 --- package/boot/uboot-envtools/files/mediatek | 3 + package/mtk/applications/mtk-smp/files/smp.sh | 1 + .../dts/mediatek/mt7986a-zyxel-ex5700.dts | 342 ++++++++++++++++++ target/linux/mediatek/image/mt7986.mk | 18 + .../mt7986/base-files/etc/board.d/02_network | 5 + .../mt7986/base-files/lib/upgrade/platform.sh | 2 + 6 files changed, 371 insertions(+) create mode 100644 target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-zyxel-ex5700.dts diff --git a/package/boot/uboot-envtools/files/mediatek b/package/boot/uboot-envtools/files/mediatek index d057275615..bcd710aae7 100644 --- a/package/boot/uboot-envtools/files/mediatek +++ b/package/boot/uboot-envtools/files/mediatek @@ -47,6 +47,9 @@ nradio,wt9103 |\ *konka,komi-a31*) ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x80000" "1" ;; +zyxel,ex5700) + ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x4000" "0x80000" "1" + ;; esac config_load ubootenv diff --git a/package/mtk/applications/mtk-smp/files/smp.sh b/package/mtk/applications/mtk-smp/files/smp.sh index 492dc2a000..5607688ccd 100755 --- a/package/mtk/applications/mtk-smp/files/smp.sh +++ b/package/mtk/applications/mtk-smp/files/smp.sh @@ -740,6 +740,7 @@ setup_model() ruijie,rg-x60-pro* |\ jdcloud,re-cp-03 |\ tplink,tl-xdr608* |\ + zyxel,ex5700 |\ *7986*) MT7986_whnat $num_of_wifi $usbnet ;; diff --git a/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-zyxel-ex5700.dts b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-zyxel-ex5700.dts new file mode 100644 index 0000000000..626e5171c8 --- /dev/null +++ b/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-zyxel-ex5700.dts @@ -0,0 +1,342 @@ +/dts-v1/; +#include "mt7986a.dtsi" +#include "mt7986a-pinctrl.dtsi" +#include +#include +#include + +/ { + model = "Zyxel EX5700"; + compatible = "zyxel,ex5700", "mediatek,mt7986a"; + + chosen { + bootargs = "console=ttyS0,115200n1 loglevel=8 \ + earlycon=uart8250,mmio32,0x11002000"; + }; + + aliases { + led-boot = &led_status_green; + led-failsafe = &led_status_green; + led-running = &led_status_green; + led-upgrade = &led_status_amber; + }; + + memory { + reg = <0 0x40000000 0 0x40000000>; + }; + + gsw: gsw@0 { + compatible = "mediatek,mt753x"; + mediatek,ethsys = <ðsys>; + #address-cells = <1>; + #size-cells = <0>; + }; + + gpio-keys { + compatible = "gpio-keys"; + poll-interval = <20>; + + reset-button { + label = "reset"; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps-button { + label = "wps"; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + red1 { + label = "red:net"; + gpios = <&pio 23 GPIO_ACTIVE_HIGH>; + }; + + green1 { + label = "green:net"; + gpios = <&pio 25 GPIO_ACTIVE_HIGH>; + }; + + amber1 { + label = "amber:net"; + gpios = <&pio 29 GPIO_ACTIVE_HIGH>; + }; + + white2 { + label = "white:status"; + gpios = <&pio 16 GPIO_ACTIVE_HIGH>; + }; + + red2 { + label = "red:status"; + gpios = <&pio 17 GPIO_ACTIVE_HIGH>; + }; + + led_status_green: green2 { + label = "green:status"; + gpios = <&pio 31 GPIO_ACTIVE_HIGH>; + }; + + led_status_amber: amber2 { + label = "amber:status"; + gpios = <&pio 18 GPIO_ACTIVE_HIGH>; + }; + }; + + nmbm_spim_nand { + compatible = "generic,nmbm"; + #address-cells = <1>; + #size-cells = <1>; + + lower-mtd-device = <&spi_nand>; + forced-create; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00 0x100000>; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x100000 0x80000>; + }; + + partition@180000 { + label = "Factory"; + reg = <0x180000 0x200000>; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x200000>; + }; + + partition@580000 { + label = "ubi"; + reg = <0x00580000 0x1da80000>; + }; + }; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + usb_vbus: regulator-usb-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + regulator-boot-on; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + phy5: phy@5 { + compatible = "ethernet-phy-id67c9.de0a"; + phy-mode = "2500base-x"; + reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>; + reset-assert-us = <50000>; + reset-deassert-us = <20000>; + maxlinear,led-reg = <0x3c0 0x330 0x0 0x0>; + reg = <5>; + }; + + phy6: phy@6 { + compatible = "ethernet-phy-id67c9.de0a"; + phy-mode = "2500base-x"; + maxlinear,led-reg = <0x3c0 0x330 0x0 0x0>; + reg = <6>; + }; + }; +}; + +&gsw { + mediatek,mdio = <&mdio>; + mediatek,portmap = "lllll"; + mediatek,mdio_master_pinmux = <1>; + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + interrupt-parent = <&pio>; + interrupts = <66 IRQ_TYPE_LEVEL_HIGH>; + status = "okay"; + + port5: port@5 { + compatible = "mediatek,mt753x-port"; + reg = <5>; + phy-mode = "sgmii"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + port6: port@6 { + compatible = "mediatek,mt753x-port"; + /* mediatek,ssc-on; */ + reg = <6>; + phy-mode = "sgmii"; + fixed-link { + speed = <2500>; + full-duplex; + }; + }; +}; + +&xhci { + vusb33-supply = <®_3p3v>; + vbus-supply = <&usb_vbus>; + status = "okay"; +}; + +&hnat { + mtketh-wan = "eth1"; + mtketh-lan = "eth0"; + mtketh-max-gmac = <2>; + status = "okay"; +}; + +&pcie0 { + pinctrl-names = "default"; + pinctrl-0 = <&pcie0_pins>; + status = "okay"; +}; + +&wbsys { + status = "okay"; + pinctrl-names = "default", "dbdc"; + pinctrl-0 = <&wf_2g_5g_pins>; + pinctrl-1 = <&wf_dbdc_pins>; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + status = "okay"; + cs-gpios = <0>, <0>; + + spi_nand: spi_nand@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + spi-cal-enable; + spi-cal-mode = "read-data"; + spi-cal-datalen = <7>; + spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; /* 'SPINAND' */ + spi-cal-addrlen = <5>; + spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; + }; +}; + +&pio { + spi_flash_pins: spi-flash-pins-33-to-38 { + mux { + function = "flash"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = <8>; + mediatek,pull-up-adv = <0>; + }; + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = <8>; + mediatek,pull-down-adv = <0>; + }; + }; + + wf_2g_5g_pins: wf_2g_5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = ; + }; + }; + + wf_dbdc_pins: wf_dbdc-pins { + mux { + function = "wifi"; + groups = "wf_dbdc"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = ; + }; + }; +}; diff --git a/target/linux/mediatek/image/mt7986.mk b/target/linux/mediatek/image/mt7986.mk index 1b0540ded3..d97c321a54 100644 --- a/target/linux/mediatek/image/mt7986.mk +++ b/target/linux/mediatek/image/mt7986.mk @@ -534,3 +534,21 @@ define Device/tplink_tl-xdr6088 $(call Device/tplink_tl-common) endef TARGET_DEVICES += tplink_tl-xdr6088 + +define Device/zyxel_ex5700 + DEVICE_VENDOR := Zyxel + DEVICE_MODEL := EX5700 + DEVICE_DTS := mt7986a-zyxel-ex5700 + SUPPORTED_DEVICES := zyxel,ex5700 + DEVICE_DTS_DIR := $(DTS_DIR)/mediatek + DEVICE_PACKAGES := $(MT7986_USB_PKGS) + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 256k + PAGESIZE := 4096 + IMAGE_SIZE := 65536k + 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 += zyxel_ex5700 diff --git a/target/linux/mediatek/mt7986/base-files/etc/board.d/02_network b/target/linux/mediatek/mt7986/base-files/etc/board.d/02_network index 25ca8910a0..dfb1d50c3c 100755 --- a/target/linux/mediatek/mt7986/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/mt7986/base-files/etc/board.d/02_network @@ -24,6 +24,11 @@ mediatek_setup_interfaces() ucidef_add_switch "switch0" \ "1:lan:4" "2:lan:3" "3:lan:2" "4:wan" "6u@eth0" "5u@eth1" ;; + zyxel,ex5700) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" \ + "0:lan:3" "1:lan:4" "2:lan:5" "5:lan:2" "6u@eth0" + ;; bananapi,bpi-r3mini*) ucidef_set_interfaces_lan_wan "eth0" "eth1" ;; diff --git a/target/linux/mediatek/mt7986/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7986/base-files/lib/upgrade/platform.sh index 8cee36893d..7d1c2ff438 100755 --- a/target/linux/mediatek/mt7986/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7986/base-files/lib/upgrade/platform.sh @@ -150,6 +150,7 @@ platform_do_upgrade() { netcore,n60 |\ ruijie,rg-x60-pro* |\ tplink,tl-xdr608* |\ + zyxel,ex5700 |\ *snand*) nand_do_upgrade "$1" ;; @@ -184,6 +185,7 @@ platform_check_image() { glinet,gl-mt6000 |\ jdcloud,re-cp-03 |\ tplink,tl-xdr608* |\ + zyxel,ex5700 |\ *emmc*) # tar magic `ustar` magic="$(dd if="$1" bs=1 skip=257 count=5 2>/dev/null)"