mediatek: add support for Zyxel EX5601-T0 router
authorPietro Ameruoso <p.ameruoso@live.it>
Mon, 22 May 2023 07:52:47 +0000 (09:52 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Mon, 22 May 2023 15:58:59 +0000 (17:58 +0200)
Zyxel EX5601-T0 specifics
--------------
The operator specific firmware running on the Zyxel branded
EX5601-T0 includes  U-Boot modifications affecting the OpenWrt
installation.

Partition Table
| dev  | size     | erasesize | name          |
| ---- | -------- | --------- | ------------- |
| mtd0 | 20000000 | 00040000  | "spi0.1"      |
| mtd1 | 00100000 | 00040000  | "BL2"         |
| mtd2 | 00080000 | 00040000  | "u-boot-env"  |
| mtd3 | 00200000 | 00040000  | "Factory"     |
| mtd4 | 001c0000 | 00040000  | "FIP"         |
| mtd5 | 00040000 | 00040000  | "zloader"     |
| mtd6 | 04000000 | 00040000  | "ubi"         |
| mtd7 | 04000000 | 00040000  | "ubi2"        |
| mtd8 | 15a80000 | 00040000  | "zyubi"       |

The router boots BL2 which than loads FIP (u-boot).
U-boot has hardcoded a command to always launch Zloader "mtd read zloader 0x46000000" and than "bootm". Bootargs are deactivated.
Zloader is the zyxel booloader which allow to dual-boot ubi or ubi2, by default access to zloader is blocked.
Too zloader checks that the firmware contains a particolar file called zyfwinfo.
Additional details regarding Zloader can be found here:
https://hack-gpon.github.io/zyxel/
https://forum.openwrt.org/t/adding-openwrt-support-for-zyxel-ex5601-t0/155914

Hardware
--------
SOC: MediaTek MT7986a
CPU: 4 core cortex-a53 (2000MHz)
RAM: 1GB DDR4
FLASH: 512MB SPI-NAND (Micron xxx)
WIFI: Wifi6 Mediatek MT7976 802.11ax 5 GHz 4x4 + 2.4GHZ 4x4
ETH: MediaTek MT7531 Switch + SoC
3 x builtin 1G phy (lan1, lan2, lan3)
1 x MaxLinear GPY211B 2.5 N-Base-T phy5 (lan4)
1 x MaxLinear GPY211B 2.5Gbit xor SFP/N-Base-T phy6 (wan)
USB: 1 x USB 3.2 Enhanced SuperSpeed port
UART: 3V3 115200 8N1 (Pinout: GND KEY RX TX VCC)
VOIP: 2 FXS ports for analog phones

MAC Address Table
-----------------
eth0/lan    Factory 0x002a
eth1/wan    Factory 0x0024
wifi 2.4Ghz Factory 0x0004
wifi 5Ghz   Factory 0x0004 + 1

Serial console (UART)
---------------------
+-------+-------+-------+-------+-------+
| +3.3V |  RX   |  TX   |  KEY  |  GND  |
+---+---+-------+-------+-------+-------+
    |
    +--- Don't connect

Installation
------------
Keep in mind that openwrt can only run on the UBI partition, the openwrt firmware is not able to understand the zloader bootargs.
The procedure allows restoring the UBI partition with the Zyxel firmware and retains all the OEM functionalities.

1. Unlock Zloader (this will allow to swap manually between partitions UBI and UBI2):
- Attach a usb-ttl adapter to your computer and boot the router.
- While the router is booting at some point you will read the following: `Please press Enter to activate this console.`
- As soon as you read that press enter, type root and than press enter again (just do it, don't care about the logs scrolling).
- Most likely the router is still printing the boot log, leave it boot until it stops.
- If everything went ok you should have full root access "root@EX5601-T0:/#".
- Type the following command and press enter: "fw_setenv EngDebugFlag 0x1".
- Reboot the router.
- As soon as you read `Hit any key to stop autoboot:` press Enter.
- If everything went ok you should have the following prompt: "ZHAL>".
- You have successfully unlocked zloader access, this procedure must be done only once.

2. Check the current active partition:
- Boot the router and repeat the steps above to gain root access.
- Type the following command to check the current active image: "cat /proc/cmdline".
- If `rootubi=ubi` it means that the active partition is `mtd6`
- If `rootubi=ubi2` it means that the active partition is `mtd7`
- As mentioned earlier we need to flash openwrt into ubi/mtd6 and never overwrite ubi2/mtd7 to be able to fully roll-back.
- To activate and boot from mtd7 (ubi2) enter into ZHAL> command prompt and type the following commands:
atbt 1  # unlock write
atsw    # swap boot partition
atsr    # reboot the router
- After rebooting check again with "cat /proc/cmdline" that you are correctly booting from mtd7/ubi2
- If yes proceed with the installation guide. If not probably you don't have a firmware into ubi2 or you did something wrong.

3. Flashing:
- Download the sysupgrade file for the router from openwrt, than we need to add the zyfwinfo file into the sysupgrade tar.
Zloader only checks for the magic (which is a fixed value 'EXYZ') and the crc of the file itself (256bytes).
I created a script to create a valid zyfwinfo file but you can use anything that does exactly the same:
https://raw.githubusercontent.com/pameruoso/OpenWRT-Zyxel-EX5601-T0/main/gen_zyfwinfo.sh
- Add the zyfwinfo file into the sysupgrade tar.
- Enter via telnet or ssh into the router with admin credentials
- Enter the following commands to disable the firmware and model checks
"zycli fwidcheck off" and "zycli modelcheck off"
- Open the router web interface and in the update firmware page select the "restore default settings option"
- Select the sysupgrade file and click on upload.
- The router will flash and reboot itself into openwrt from UBI

4. Restoring and going back to Zyxel firmware.
- Use the ZHAL> command line to manually swap the boot parition to UBI2 with the following:
atbt 1  # unlock write
atsw    # swap boot partition
atsr    # reboot the router
- You will boot again the Zyxel firmware you have into UBI2 and you can flash the zyxel firmware to overwrite the UBI partition and openwrt.

Working features
----------------
3 gbit lan ports
Wifi
Zyxel partitioning for coexistance with Zloader and dual boot.
WAN SFP port (only after exporting pins 57 and 10. gpiobase411)
leds
reset button
serial interface
usb port
lan ethernet 2.5 gbit port (autosense)
wan ethernet 2.5 gbit port (autosense)

Not working
----------------
voip (missing drivers or proper zyxel platform software)

Swapping the wan ethernet/sfp xor port
----------------
The way to swap the wan port between sfp and ethernet is the following:
export the pins 57 and 10.
Pin 57 is used to probe if an sfp is present.
If pin 57 value is 0 it means that an sfp is present into the cage (cat /sys/class/gpio/gpio468/value).
If pin 57 value is 1 it means that no sfp is inserted into the cage.
In conclusion by default both 57 an 10 pins are by default 1, which means that the active port is the ethernet one.
After inserting an SFP pin 57 will become 0 and you have to manually change the value of pin 10 to 0 too.
This is totally scriptable of course.

Leds description
------------
All the leds are working out of the box but the leds managed by the 2 maxlinear phy (phy 5 lan, phy6 wan).
To activate the phy5 led (rj45 ethernet port led on the back of the router) you have to use mdio-tools.
To activate the phy6 led (led on the front of the router for 2.5gbit link) you have to use mdio-tools.
Example:
Set lan5 led to fast blink on 2500/1000, slow blink on 10/100:
mdio mdio-bus mmd 5:30 raw 0x0001 0x33FC

Set wan 2.5gbit led to constant on when wan is 2.5gbit:
mdio mdio-bus mmd 6:30 raw 0x0001 0x0080

Signed-off-by: Pietro Ameruoso <p.ameruoso@live.it>
package/boot/uboot-envtools/files/mediatek_filogic
target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts [new file with mode: 0644]
target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
target/linux/mediatek/image/filogic.mk

index a685b046536beb61619b830dfabaeae8330a5095..50b9cd0e4631c9bd419ba001c82fe6b87b184eec 100644 (file)
@@ -52,6 +52,10 @@ xiaomi,redmi-router-ax6000-ubootmod)
        ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
        ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
        ;;
+zyxel,ex5601-t0)
+       local envdev=/dev/mtd$(find_mtd_index "u-boot-env")
+       ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x40000" "2"
+       ;;
 esac
 
 config_load ubootenv
diff --git a/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts b/target/linux/mediatek/dts/mt7986a-zyxel-ex5601-t0-stock.dts
new file mode 100644 (file)
index 0000000..07a3e8d
--- /dev/null
@@ -0,0 +1,560 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)\r
+/*\r
+ * Copyright (C) 2021 MediaTek Inc.\r
+ * Author: Sam.Shih <sam.shih@mediatek.com>\r
+ */\r
+\r
+/dts-v1/;\r
+#include "mt7986a.dtsi"\r
+#include <dt-bindings/gpio/gpio.h>\r
+#include <dt-bindings/input/input.h>\r
+\r
+/ {\r
+       model = "Zyxel EX5601-T0";\r
+       compatible = "zyxel,ex5601-t0", "mediatek,mt7986a-rfb-snand";\r
+\r
+       aliases {\r
+               serial0 = &uart0;\r
+       };\r
+\r
+       chosen {\r
+               stdout-path = "serial0:115200n8";\r
+       };\r
+\r
+       memory {\r
+               reg = <0 0x40000000 0 0x40000000>;\r
+       };\r
+\r
+       reg_1p8v: regulator-1p8v {\r
+               compatible = "regulator-fixed";\r
+               regulator-name = "fixed-1.8V";\r
+               regulator-min-microvolt = <1800000>;\r
+               regulator-max-microvolt = <1800000>;\r
+               regulator-boot-on;\r
+               regulator-always-on;\r
+       };\r
+\r
+       reg_3p3v: regulator-3p3v {\r
+               compatible = "regulator-fixed";\r
+               regulator-name = "fixed-3.3V";\r
+               regulator-min-microvolt = <3300000>;\r
+               regulator-max-microvolt = <3300000>;\r
+               regulator-boot-on;\r
+               regulator-always-on;\r
+       };\r
+\r
+       reg_5v: regulator-5v {\r
+               compatible = "regulator-fixed";\r
+               regulator-name = "fixed-5V";\r
+               regulator-min-microvolt = <5000000>;\r
+               regulator-max-microvolt = <5000000>;\r
+               regulator-boot-on;\r
+               regulator-always-on;\r
+       };\r
+\r
+       gpio-keys {\r
+               compatible = "gpio-keys";\r
+               poll-interval = <20>;\r
+\r
+               reset-button {\r
+                       label = "reset";\r
+                       gpios = <&pio 21 GPIO_ACTIVE_LOW>;\r
+                       linux,code = <KEY_RESTART>;\r
+               };\r
+\r
+               wlan-button {\r
+                       label = "wlan";\r
+                       gpios = <&pio 11 GPIO_ACTIVE_LOW>;\r
+                       linux,code = <KEY_WLAN>;\r
+               };\r
+               wps-button {\r
+                       label = "wps";\r
+                       gpios = <&pio 56 GPIO_ACTIVE_LOW>;\r
+                       linux,code = <KEY_WPS_BUTTON>;\r
+               };\r
+       };\r
+\r
+       zyleds {\r
+               compatible = "gpio-leds";\r
+\r
+               led_green_wifi24g {\r
+                       label = "zyled-green-wifi24g";\r
+                       gpios = <&pio 1 GPIO_ACTIVE_LOW>;\r
+                       default-state = "off";\r
+               };\r
+\r
+               led_green_wifi5g {\r
+                       label = "zyled-green-wifi5g";\r
+                       gpios = <&pio 2 GPIO_ACTIVE_LOW>;\r
+                       default-state = "off";\r
+               };\r
+\r
+               led_green_inet {\r
+                       label = "zyled-green-inet";\r
+                       gpios = <&pio 14 GPIO_ACTIVE_LOW>;\r
+                       default-state = "off";\r
+               };\r
+\r
+               led_red_inet {\r
+                       label = "zyled-red-inet";\r
+                       gpios = <&pio 15 GPIO_ACTIVE_LOW>;\r
+                       default-state = "off";\r
+               };\r
+\r
+               led_green_pwr {\r
+                       label = "zyled-green-pwr";\r
+                       gpios = <&pio 13 GPIO_ACTIVE_LOW>;\r
+                       linux,default-trigger = "timer"; /* Default blinking */\r
+                       led-pattern = <125 125>; /* Fast blink is 4 HZ */\r
+               };\r
+\r
+               led_red_pwr {\r
+                       label = "zyled-red-pwr";\r
+                       gpios = <&pio 12 GPIO_ACTIVE_LOW>;\r
+                       default-state = "off";\r
+               };\r
+\r
+               led_green_fxs {\r
+                       label = "zyled-green-fxs";\r
+                       gpios = <&pio 16 GPIO_ACTIVE_HIGH>;\r
+                       default-state = "off";\r
+               };\r
+\r
+               led_amber_fxs {\r
+                       label = "zyled-amber-fxs";\r
+                       gpios = <&pio 17 GPIO_ACTIVE_HIGH>;\r
+                       default-state = "off";\r
+               };\r
+\r
+               led_amber_wps24g {\r
+                       label = "zyled-amber-wps24g";\r
+                       gpios = <&pio 18 GPIO_ACTIVE_HIGH>;\r
+                       default-state = "off";\r
+               };\r
+\r
+               led_amber_wps5g {\r
+                       label = "zyled-amber-wps5g";\r
+                       gpios = <&pio 19 GPIO_ACTIVE_HIGH>;\r
+                       default-state = "off";\r
+               };\r
+\r
+               led_green_lan {\r
+                       label = "zyled-green-lan";\r
+                       gpios = <&pio 20 GPIO_ACTIVE_HIGH>;\r
+                       default-state = "off";\r
+               };\r
+\r
+               led_green_sfp {\r
+                       label = "zyled-green-sfp";\r
+                       gpios = <&pio 24 GPIO_ACTIVE_HIGH>;\r
+                       default-state = "off";\r
+               };\r
+\r
+       };\r
+\r
+};\r
+\r
+&eth {\r
+       status = "okay";\r
+\r
+       gmac0: mac@0 {\r
+               compatible = "mediatek,eth-mac";\r
+               reg = <0>;\r
+               phy-mode = "2500base-x";\r
+\r
+               nvmem-cells = <&macaddr_factory_002a>;\r
+               nvmem-cell-names = "mac-address";\r
+\r
+               fixed-link {\r
+                       speed = <2500>;\r
+                       full-duplex;\r
+                       pause;\r
+               };\r
+       };\r
+\r
+       gmac1: mac@1 {\r
+               compatible = "mediatek,eth-mac";\r
+               reg = <1>;\r
+               phy-mode = "2500base-x";\r
+               phy = <&phy6>;\r
+\r
+               nvmem-cells = <&macaddr_factory_0024>;\r
+               nvmem-cell-names = "mac-address";\r
+       };\r
+\r
+       mdio: mdio-bus {\r
+               #address-cells = <1>;\r
+               #size-cells = <0>;\r
+               reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>;\r
+               reset-delay-us = <1500000>;\r
+               reset-post-delay-us = <1000000>;\r
+\r
+               phy5: phy@5 {\r
+                       compatible = "ethernet-phy-ieee802.3-c45";\r
+                       reg = <5>;\r
+               };\r
+\r
+               phy6: phy@6 {\r
+                       compatible = "ethernet-phy-ieee802.3-c45";\r
+                       reg = <6>;\r
+               };\r
+\r
+               switch@0 {\r
+                       compatible = "mediatek,mt7531";\r
+                       reg = <31>;\r
+                       reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>;\r
+\r
+                       ports {\r
+                               #address-cells = <1>;\r
+                               #size-cells = <0>;\r
+\r
+                               port@1 {\r
+                                       reg = <1>;\r
+                                       label = "lan1";\r
+                               };\r
+\r
+                               port@2 {\r
+                                       reg = <2>;\r
+                                       label = "lan2";\r
+                               };\r
+\r
+                               port@3 {\r
+                                       reg = <3>;\r
+                                       label = "lan3";\r
+                               };\r
+\r
+                               port@5 {\r
+                                       reg = <5>;\r
+                                       label = "lan4";\r
+                                       phy-mode = "2500base-x";\r
+                                       phy = <&phy5>;\r
+                               };\r
+\r
+                               port@6 {\r
+                                       reg = <6>;\r
+                                       ethernet = <&gmac0>;\r
+                                       phy-mode = "2500base-x";\r
+\r
+                                       fixed-link {\r
+                                               speed = <2500>;\r
+                                               full-duplex;\r
+                                               pause;\r
+                                       };\r
+                               };\r
+                       };\r
+               };\r
+       };\r
+};\r
+\r
+&wmac {\r
+       status = "okay";\r
+       pinctrl-names = "default", "dbdc";\r
+       pinctrl-0 = <&wf_2g_5g_pins>;\r
+       pinctrl-1 = <&wf_dbdc_pins>;\r
+       mediatek,mtd-eeprom = <&factory 0x0>;\r
+       nvmem-cells = <&macaddr_factory_0004>;\r
+       nvmem-cell-names = "mac-address";\r
+};\r
+\r
+&crypto {\r
+       status = "okay";\r
+};\r
+\r
+&mmc0 {\r
+       pinctrl-names = "default", "state_uhs";\r
+       pinctrl-0 = <&mmc0_pins_default>;\r
+       pinctrl-1 = <&mmc0_pins_uhs>;\r
+       bus-width = <8>;\r
+       max-frequency = <200000000>;\r
+       cap-mmc-highspeed;\r
+       mmc-hs200-1_8v;\r
+       mmc-hs400-1_8v;\r
+       hs400-ds-delay = <0x14014>;\r
+       vmmc-supply = <&reg_3p3v>;\r
+       vqmmc-supply = <&reg_1p8v>;\r
+       non-removable;\r
+       no-sd;\r
+       no-sdio;\r
+       status = "disabled";\r
+};\r
+\r
+&pcie {\r
+       pinctrl-names = "default";\r
+       pinctrl-0 = <&pcie_pins>;\r
+       status = "okay";\r
+};\r
+\r
+&pcie_phy {\r
+       status = "okay";\r
+};\r
+\r
+&pio {\r
+       mmc0_pins_default: mmc0-pins {\r
+               mux {\r
+                       function = "emmc";\r
+                       groups = "emmc_51";\r
+               };\r
+               conf-cmd-dat {\r
+                       pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2",\r
+                              "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5",\r
+                              "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD";\r
+                       input-enable;\r
+                       drive-strength = <4>;\r
+                       mediatek,pull-up-adv = <1>;     /* pull-up 10K */\r
+               };\r
+               conf-clk {\r
+                       pins = "EMMC_CK";\r
+                       drive-strength = <6>;\r
+                       mediatek,pull-down-adv = <2>;   /* pull-down 50K */\r
+               };\r
+               conf-ds {\r
+                       pins = "EMMC_DSL";\r
+                       mediatek,pull-down-adv = <2>;   /* pull-down 50K */\r
+               };\r
+               conf-rst {\r
+                       pins = "EMMC_RSTB";\r
+                       drive-strength = <4>;\r
+                       mediatek,pull-up-adv = <1>;     /* pull-up 10K */\r
+               };\r
+       };\r
+\r
+       mmc0_pins_uhs: mmc0-uhs-pins {\r
+               mux {\r
+                       function = "emmc";\r
+                       groups = "emmc_51";\r
+               };\r
+               conf-cmd-dat {\r
+                       pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2",\r
+                              "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5",\r
+                              "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD";\r
+                       input-enable;\r
+                       drive-strength = <4>;\r
+                       mediatek,pull-up-adv = <1>;     /* pull-up 10K */\r
+               };\r
+               conf-clk {\r
+                       pins = "EMMC_CK";\r
+                       drive-strength = <6>;\r
+                       mediatek,pull-down-adv = <2>;   /* pull-down 50K */\r
+               };\r
+               conf-ds {\r
+                       pins = "EMMC_DSL";\r
+                       mediatek,pull-down-adv = <2>;   /* pull-down 50K */\r
+               };\r
+               conf-rst {\r
+                       pins = "EMMC_RSTB";\r
+                       drive-strength = <4>;\r
+                       mediatek,pull-up-adv = <1>;     /* pull-up 10K */\r
+               };\r
+       };\r
+\r
+       pcie_pins: pcie-pins {\r
+               mux {\r
+                       function = "pcie";\r
+                       groups = "pcie_clk", "pcie_wake", "pcie_pereset";\r
+               };\r
+       };\r
+\r
+       spic_pins_g2: spic-pins-29-to-32 {\r
+               mux {\r
+                       function = "spi";\r
+                       groups = "spi1_2";\r
+               };\r
+       };\r
+\r
+       spi_flash_pins: spi-flash-pins-33-to-38 {\r
+               mux {\r
+                       function = "spi";\r
+                       groups = "spi0", "spi0_wp_hold";\r
+               };\r
+               conf-pu {\r
+                       pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";\r
+                       drive-strength = <8>;\r
+                       mediatek,pull-up-adv = <0>;     /* bias-disable */\r
+               };\r
+               conf-pd {\r
+                       pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";\r
+                       drive-strength = <8>;\r
+                       mediatek,pull-down-adv = <0>;   /* bias-disable */\r
+               };\r
+       };\r
+\r
+       uart1_pins: uart1-pins {\r
+               mux {\r
+                       function = "uart";\r
+                       groups = "uart1";\r
+               };\r
+       };\r
+\r
+       uart2_pins: uart2-pins {\r
+               mux {\r
+                       function = "uart";\r
+                       groups = "uart2";\r
+               };\r
+       };\r
+\r
+       wf_2g_5g_pins: wf_2g_5g-pins {\r
+               mux {\r
+                       function = "wifi";\r
+                       groups = "wf_2g", "wf_5g";\r
+               };\r
+               conf {\r
+                       pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4",\r
+                              "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6",\r
+                              "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10",\r
+                              "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1",\r
+                              "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0",\r
+                              "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8",\r
+                              "WF1_TOP_CLK", "WF1_TOP_DATA";\r
+                       drive-strength = <4>;\r
+               };\r
+       };\r
+\r
+       wf_dbdc_pins: wf_dbdc-pins {\r
+               mux {\r
+                       function = "wifi";\r
+                       groups = "wf_dbdc";\r
+               };\r
+               conf {\r
+                       pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4",\r
+                              "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6",\r
+                              "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10",\r
+                              "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1",\r
+                              "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0",\r
+                              "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8",\r
+                              "WF1_TOP_CLK", "WF1_TOP_DATA";\r
+                       drive-strength = <4>;\r
+               };\r
+       };\r
+};\r
+\r
+&spi0 {\r
+       pinctrl-names = "default";\r
+       pinctrl-0 = <&spi_flash_pins>;\r
+       cs-gpios = <0>, <0>;\r
+       #address-cells = <1>;\r
+       #size-cells = <0>;\r
+       status = "okay";\r
+\r
+       spi_nand: spi_nand@0 {\r
+               #address-cells = <1>;\r
+               #size-cells = <1>;\r
+               compatible = "spi-nand";\r
+               reg = <1>;\r
+               spi-max-frequency = <10000000>;\r
+               spi-tx-buswidth = <4>;\r
+               spi-rx-buswidth = <4>;\r
+\r
+               partitions {\r
+                       compatible = "fixed-partitions";\r
+                       #address-cells = <1>;\r
+                       #size-cells = <1>;\r
+\r
+                       partition@0 {\r
+                               label = "BL2";\r
+                               reg = <0x00000 0x0100000>;\r
+                               read-only;\r
+                       };\r
+\r
+                       partition@100000 {\r
+                               label = "u-boot-env";\r
+                               reg = <0x0100000 0x0080000>;\r
+                       };\r
+\r
+                       factory: partition@180000 {\r
+                               label = "Factory";\r
+                               reg = <0x180000 0x0200000>;\r
+                               read-only;\r
+                       };\r
+\r
+                       partition@380000 {\r
+                               label = "FIP";\r
+                               reg = <0x380000 0x01C0000>;\r
+                               read-only;\r
+                       };\r
+\r
+                       partition@540000 {\r
+                               label = "zloader";\r
+                               reg = <0x540000 0x0040000>;\r
+                               read-only;\r
+                       };\r
+\r
+                       partition@580000 {\r
+                               label = "ubi";\r
+                               reg = <0x580000 0x4000000>;\r
+                       };\r
+\r
+                       partition@4580000 {\r
+                               label = "ubi2";\r
+                               reg = <0x4580000 0x4000000>;\r
+                               read-only;\r
+                       };\r
+\r
+                       partition@8580000 {\r
+                               label = "zyubi";\r
+                               reg = <0x8580000 0x15A80000>;\r
+                       };\r
+               };\r
+       };\r
+};\r
+\r
+&spi1 {\r
+       pinctrl-names = "default";\r
+       pinctrl-0 = <&spic_pins_g2>;\r
+       status = "okay";\r
+\r
+       proslic_spi: proslic_spi@0 {\r
+               compatible = "silabs,proslic_spi";\r
+               reg = <0>;\r
+               spi-max-frequency = <10000000>;\r
+               spi-cpha = <1>;\r
+               spi-cpol = <1>;\r
+               channel_count = <1>;\r
+               debug_level = <4>;       /* 1 = TRC, 2 = DBG, 4 = ERR */\r
+               reset_gpio = <&pio 7 GPIO_ACTIVE_HIGH>;\r
+               ig,enable-spi = <1>;     /* 1: Enable, 0: Disable */\r
+       };\r
+};\r
+\r
+&ssusb {\r
+       vusb33-supply = <&reg_3p3v>;\r
+       vbus-supply = <&reg_5v>;\r
+       status = "okay";\r
+};\r
+\r
+&uart0 {\r
+       status = "okay";\r
+};\r
+\r
+&uart1 {\r
+       pinctrl-names = "default";\r
+       pinctrl-0 = <&uart1_pins>;\r
+       status = "okay";\r
+};\r
+\r
+&uart2 {\r
+       pinctrl-names = "default";\r
+       pinctrl-0 = <&uart2_pins>;\r
+       status = "okay";\r
+};\r
+\r
+&usb_phy {\r
+       status = "okay";\r
+};\r
+\r
+&factory {\r
+       compatible = "nvmem-cells";\r
+       #address-cells = <1>;\r
+       #size-cells = <1>;\r
+\r
+       macaddr_factory_0004: macaddr@0004 {\r
+               reg = <0x0004 0x6>;\r
+       };\r
+\r
+       macaddr_factory_0024: macaddr@0024 {\r
+               reg = <0x0024 0x6>;\r
+       };\r
+\r
+       macaddr_factory_002a: macaddr@002a {\r
+               reg = <0x002a 0x6>;\r
+       };\r
+};\r
index 8088b98eb6e054140e0cf90361a7c6548166c70c..a56e5bc6893096f59e559c07eb1f0ad338087363 100644 (file)
@@ -37,4 +37,8 @@ case "$board" in
        tplink,tl-xdr6088)
                [ "$PHYNBR" = "0" ] && get_mac_label > /sys${DEVPATH}/macaddress
                ;;
+       zyxel,ex5601-t0)
+               addr=$(mtd_get_mac_binary "Factory" 0x4)
+               [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress
+               ;;
 esac
index 7159917ff45bbe33a302b889a776357ba0ef34ca..92d1dcfad24991dbab9545a7e2a1bb6427836784 100644 (file)
@@ -294,3 +294,26 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
 endif
 endef
 TARGET_DEVICES += xiaomi_redmi-router-ax6000-ubootmod
+
+define Device/zyxel_ex5601-t0-stock
+  DEVICE_VENDOR := Zyxel
+  DEVICE_MODEL := EX5601-T0  (stock layout)
+  DEVICE_DTS := mt7986a-zyxel-ex5601-t0-stock
+  DEVICE_DTS_DIR := ../dts
+  DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware
+  SUPPORTED_DEVICES := mediatek,mt7986a-rfb-snand
+  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
+  KERNEL = kernel-bin | lzma | \
+       fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
+  KERNEL_INITRAMFS = kernel-bin | lzma | \
+       fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd
+  DTC_FLAGS += -@ --space 32768
+endef
+TARGET_DEVICES += zyxel_ex5601-t0-stock