mediatek: Add support for Linksys EA7500 v3
authorRoland Reinl <reinlroland+github@gmail.com>
Thu, 18 Jul 2024 14:10:53 +0000 (16:10 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Wed, 14 Aug 2024 22:13:20 +0000 (00:13 +0200)
Specification:
- MT7629 CPU
- MT7531 switch
- MT7761N and MT7762N wifi
- 256 MB RAM
- 128 MB NAND flash with dual-boot partitions
- 2 buttons: WPS and reset
- 1 WAN port (1G)
- 4 LAN ports (1G)
- 1 USB port

Limitations (same as other MT7629/MT7761N/MT7762N devices):
- Wifi is not working
- Second core is not working (kernel error message "CPU1: failed to come online")

Disassembly:
- There are two screws under the front rubber feet and two under the label on the bottom (in the corners towards the back, you should be able to feel them).

Serial Interface:
- UART pin header is already soldered on the board. Pinning from front to back:
1 - VCC
2 - TX
3 - RX
4 - n/a
5 - GND

GPIO:
- 1 white LED, connected to GPIO 52
- 1 reset button, connected to GPIO 60
- 1 WPS button, connected to GPIO 58

MAC Adresses:
- The MAC address printed on the device label is used for LAN and WAN
- The MAC address is stored in the devinfo partition in ASCII format (hw_mac_addr=aa:bb:cc:dd:ee)
- 2.4 GHz wifi uses MAC of the device label + 1
- 5 GHz wifi uses MAC of the device label + 2

Flashing:
- OpenWrt is only runnig in the first partition of dual boot
- To ensure to be able to go back to the factory image, flash the last OEM firmware via OEM web interface. This will ensure that the OEM firmware is present on both partitions
- Because of dual boot partitions, flashing via OEM interface is not supported
- Start a TFTP server and provide the initramfs image. Default settings:
  - Router IP: 192.168.1.1
  - TFTP server IP: 192.168.1.100
  - TFTP file name: 7531.bin
- Open the device, connect UART and select " 1. System Load Linux to SDRAM via TFTP." during startup
- Adapt the settings to your environment, if required
- After initramfs is booted, flash the sysupgrade image

Return to OEM firmware:
- Run the following commands in OpenWrt to switch to the second partition
  fw_setenv boot_part 2
  fw_setenv bootimage 2
- Reboot the device. OEM firmware will start up again

Signed-off-by: Roland Reinl <reinlroland+github@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16067
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
package/boot/uboot-envtools/files/mediatek_mt7629
package/system/mtd/src/Makefile
target/linux/mediatek/dts/mt7629-linksys-ea7500-v3.dts [new file with mode: 0644]
target/linux/mediatek/image/mt7629.mk
target/linux/mediatek/mt7629/base-files/etc/board.d/02_network
target/linux/mediatek/mt7629/base-files/etc/init.d/bootcount
target/linux/mediatek/mt7629/base-files/lib/upgrade/platform.sh

index 313fb6a44809e794b187a6dac1faf2a86e5e228f..ce09caffab509820bed4463ebfafcc7b93f1b519 100644 (file)
@@ -16,6 +16,9 @@ iptime,a6004mx|\
 netgear,ex6250-v2)
        ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000"
        ;;
+linksys,ea7500-v3)
+       ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000"
+       ;;
 esac
 
 config_load ubootenv
index 57922f330966c0a8f55787fd2464aaabeba3342b..c04affc02668d39764e0015e8e326833ee6de549 100644 (file)
@@ -12,7 +12,7 @@ obj.gemini = $(obj.wrgg)
 obj.brcm = trx.o
 obj.bcm47xx = $(obj.brcm)
 obj.bcm53xx = $(obj.brcm) $(obj.seama)
-obj.mediatek = $(obj.brcm)
+obj.mediatek = $(obj.brcm) linksys_bootcount.o
 obj.bcm63xx = imagetag.o
 obj.bmips = imagetag.o
 obj.ramips = $(obj.brcm) $(obj.seama) $(obj.tpl) $(obj.wrg) linksys_bootcount.o
diff --git a/target/linux/mediatek/dts/mt7629-linksys-ea7500-v3.dts b/target/linux/mediatek/dts/mt7629-linksys-ea7500-v3.dts
new file mode 100644 (file)
index 0000000..70b7cde
--- /dev/null
@@ -0,0 +1,300 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/dts-v1/;
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+#include "mt7629.dtsi"
+
+/ {
+       model = "Linksys EA7500 v3";
+       compatible = "linksys,ea7500-v3", "mediatek,mt7629";
+
+       aliases {
+               led-boot = &led_power;
+               led-failsafe = &led_power;
+               led-running = &led_power;
+               led-upgrade = &led_power;
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+               bootargs-override = "console=ttyS0,115200n8";
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_power: power {
+                       function = LED_FUNCTION_POWER;
+                       color = <LED_COLOR_ID_WHITE>;
+                       gpios = <&pio 52 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               reset {
+                       label = "reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&pio 60 GPIO_ACTIVE_LOW>;
+               };
+
+               wps {
+                       label = "wps";
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&pio 58 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       memory@40000000 {
+               device_type = "memory";
+               reg = <0x40000000 0x10000000>;
+       };
+
+       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;
+       };
+
+       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;
+       };
+};
+
+&eth {
+       pinctrl-names = "default";
+       pinctrl-0 = <&eth_pins>;
+       pinctrl-1 = <&ephy_leds_pins>;
+       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 = "gmii";
+               phy-handle = <&phy0>;
+       };
+
+       mdio: mdio-bus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               phy0: ethernet-phy@0 {
+                       reg = <0>;
+               };
+
+               switch@1f {
+                       compatible = "mediatek,mt7531";
+                       reg = <31>;
+                       reset-gpios = <&pio 28 0>;
+                       interrupt-controller;
+                       #interrupt-cells = <1>;
+                       interrupt-parent = <&pio>;
+                       interrupts = <6 IRQ_TYPE_LEVEL_HIGH>;
+
+                       ports {
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               port@0 {
+                                       reg = <0>;
+                                       label = "lan1";
+                               };
+
+                               port@1 {
+                                       reg = <1>;
+                                       label = "lan2";
+                               };
+
+                               port@2 {
+                                       reg = <2>;
+                                       label = "lan3";
+                               };
+
+                               port@3 {
+                                       reg = <3>;
+                                       label = "lan4";
+                               };
+
+                               port@6 {
+                                       reg = <6>;
+                                       ethernet = <&gmac0>;
+                                       phy-mode = "2500base-x";
+
+                                       fixed-link {
+                                               speed = <2500>;
+                                               full-duplex;
+                                               pause;
+                                       };
+                               };
+                       };
+               };
+       };
+};
+
+&bch {
+       status = "okay";
+};
+
+&snfi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&serial_nand_pins>;
+       status = "okay";
+       flash@0 {
+               compatible = "spi-nand";
+               reg = <0>;
+               spi-tx-bus-width = <4>;
+               spi-rx-bus-width = <4>;
+               nand-ecc-engine = <&snfi>;
+               mediatek,bmt-v2;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "Bootloader";
+                               reg = <0x0 0x100000>;
+                               read-only;
+                       };
+
+                       partition@100000 {
+                               label = "Config";
+                               reg = <0x100000 0x40000>;
+                       };
+
+                       partition@140000 {
+                               label = "Factory";
+                               reg = <0x140000 0x80000>;
+                               read-only;
+                       };
+
+                       partition@1c0000 {
+                               label = "kernel";
+                               reg = <0x1c0000 0x800000>;
+                       };
+
+                       partition@9c0000 {
+                               label = "ubi";
+                               reg = <0x9c0000 0x2000000>;
+                       };
+
+                       partition@29c0000 {
+                               label = "Kernel2";
+                               reg = <0x29c0000 0x2800000>;
+                               read-only;
+                       };
+
+                       partition@51c0000 {
+                               label = "devinfo";
+                               reg = <0x51c0000 0x40000>;
+                               read-only;
+                       };
+
+                       partition@5200000 {
+                               label = "sysdiag";
+                               reg = <0x5200000 0x100000>;
+                               read-only;
+                       };
+
+                       partition@5300000 {
+                               label = "syscfg";
+                               reg = <0x5300000 0x2000000>;
+                               read-only;
+                       };
+
+                       partition@7300000 {
+                               label = "s_env";
+                               reg = <0x7300000 0x40000>;
+                       };
+               };
+       };
+};
+
+&pio {
+       eth_pins: eth-pins {
+               mux {
+                       function = "eth";
+                       groups = "mdc_mdio";
+               };
+       };
+
+       ephy_leds_pins: ephy-leds-pins {
+               mux {
+                       function = "led";
+                       groups = "ephy_leds";
+               };
+       };
+
+       /* Serial NAND is shared pin with SPI-NOR */
+       serial_nand_pins: serial-nand-pins {
+               mux {
+                       function = "flash";
+                       groups = "snfi";
+               };
+       };
+
+       uart0_pins: uart0-pins {
+               mux {
+                       function = "uart";
+                       groups = "uart0_txd_rxd" ;
+               };
+       };
+
+       watchdog_pins: watchdog-pins {
+               mux {
+                       function = "watchdog";
+                       groups = "watchdog";
+               };
+       };
+};
+
+&ssusb {
+       vusb33-supply = <&reg_3p3v>;
+       vbus-supply = <&reg_5v>;
+       status = "okay";
+};
+
+&u3phy0 {
+       status = "okay";
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pins>;
+       status = "okay";
+};
+
+&watchdog {
+       pinctrl-names = "default";
+       pinctrl-0 = <&watchdog_pins>;
+       status = "okay";
+
+       interrupt-controller;
+       #interrupt-cells = <1>;
+       interrupt-parent = <&pio>;
+       interrupts = <GIC_SPI 0x80 IRQ_TYPE_EDGE_FALLING>;
+};
index 9f0ea98950f2ac9755e0f026c7534e5759b54e79..57c0a5bc549cd2f4163d7d4dd9a98a8662b3feea 100644 (file)
@@ -27,6 +27,22 @@ define Device/iptime_a6004mx
 endef
 TARGET_DEVICES += iptime_a6004mx
 
+define Device/linksys_ea7500-v3
+  $(Device/uimage-lzma-loader)
+  DEVICE_VENDOR := Linksys
+  DEVICE_MODEL := EA7500
+  DEVICE_VARIANT := v3
+  DEVICE_DTS := mt7629-linksys-ea7500-v3
+  DEVICE_DTS_DIR := ../dts
+  DEVICE_PACKAGES := kmod-usb3 uboot-envtools
+  IMAGE_SIZE := 40m
+  UBINIZE_OPTS := -E 5
+  BLOCKSIZE := 128k
+  PAGESIZE := 2048
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata | check-size
+endef
+TARGET_DEVICES += linksys_ea7500-v3
+
 define Device/netgear_ex6250-v2
   DEVICE_VENDOR := NETGEAR
   DEVICE_MODEL := EX6250
index df042f8ad27d4f87747c325426287e8b2121b9c5..875ed34dcc61c01d8c90604bfe43cd33dfac8989 100644 (file)
@@ -8,7 +8,8 @@ mediatek_setup_interfaces()
        local board="$1"
 
        case $board in
-       iptime,a6004mx)
+       iptime,a6004mx|\
+       linksys,ea7500-v3)
                ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth1"
                ;;
        mediatek,mt7629-rfb)
@@ -28,6 +29,11 @@ mediatek_setup_macs()
        local board="$1"
 
        case $board in
+       linksys,ea7500-v3)
+               lan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
+               wan_mac=$lan_mac
+               label_mac=$lan_mac
+               ;;
        netgear,ex6250-v2)
                lan_mac=$(mtd_get_mac_ascii Config mac)
                label_mac=$lan_mac
index a6b8fac1d9e4d12293a8f78cc2f1d49b89635811..959944fef87cd0fddc385373fbea7d790d44e2e4 100755 (executable)
@@ -13,5 +13,8 @@ boot() {
                        exit 1
                fi
                ;;
+       linksys,ea7500-v3)
+               mtd resetbc s_env || true
+               ;;
        esac
 }
index f10ad14b4964a638fed5d12c13fb727dcc2f6080..ebd3678c2ec8b757a2e0cbec408fa0a2f024dfab 100755 (executable)
@@ -12,6 +12,11 @@ platform_do_upgrade() {
        iptime,a6004mx)
                nand_do_upgrade "$1"
                ;;
+       linksys,ea7500-v3)
+               fw_setenv boot_part 1
+               fw_setenv bootimage 1
+               nand_do_upgrade "$1"
+               ;;
        *)
                default_do_upgrade "$1"
                ;;