ramips: add support for Linksys E7350
authorRosen Penev <rosenp@gmail.com>
Mon, 22 Mar 2021 21:06:14 +0000 (14:06 -0700)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 10 Sep 2022 23:30:11 +0000 (01:30 +0200)
Linksys E7350 is an 802.11ax (Wi-Fi 6) router, based on MediaTek
MT7621A.

Specifications:
- SoC: MT7621 (880MHz, 2 Cores)
- RAM: 256 MB
- Flash: 128 MB NAND
- Wi-Fi:
  - MT7915D: 2.4/5 GHz (DBDC)
- Ethernet: 5x 1GiE MT7530
- USB: 1x USB 3.0
- UART: J4 (57600 baud)
  - Pinout: [3V3] (TXD) (RXD) (blank) (GND)

Notes:
* This device has a dual-boot partition scheme, but this firmware works
  only on boot partition 1.

Installation:

Upload the generated factory.bin image via the stock web firmware
updater.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
package/boot/uboot-envtools/files/ramips
target/linux/ramips/dts/mt7621_linksys_e7350.dts [new file with mode: 0644]
target/linux/ramips/image/mt7621.mk
target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
target/linux/ramips/mt7621/base-files/etc/board.d/02_network
target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
target/linux/ramips/mt7621/base-files/etc/init.d/bootcount
target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh

index 46c218c885629ef5d7b8dec3ebec4025dfe413fd..194f6561d46e382d74ce72f20c5074e43b9098a7 100644 (file)
@@ -52,6 +52,7 @@ h3c,tx1800-plus|\
 h3c,tx1801-plus|\
 h3c,tx1806|\
 jcg,q20|\
+linksys,e7350|\
 netgear,wax202)
        ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
        ;;
diff --git a/target/linux/ramips/dts/mt7621_linksys_e7350.dts b/target/linux/ramips/dts/mt7621_linksys_e7350.dts
new file mode 100644 (file)
index 0000000..0cdfcb4
--- /dev/null
@@ -0,0 +1,205 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+       compatible = "linksys,e7350", "mediatek,mt7621-soc";
+       model = "Linksys E7350";
+
+       aliases {
+               led-boot = &led_power;
+               led-failsafe = &led_power;
+               led-running = &led_power;
+               led-upgrade = &led_power;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,115200";
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               reset {
+                       label = "reset";
+                       gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_RESTART>;
+               };
+
+               wps {
+                       label = "wps";
+                       gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_WPS_BUTTON>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led-wps {
+                       color = <LED_COLOR_ID_AMBER>;
+                       function = LED_FUNCTION_WPS;
+                       gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+               };
+
+               led_power: led-power {
+                       label = "blue:power";
+                       gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+                       default-state = "on";
+               };
+
+               led-wan {
+                       color = <LED_COLOR_ID_AMBER>;
+                       function = LED_FUNCTION_WAN;
+                       gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+               };
+
+               led-wan2 {
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_WAN;
+                       gpios = <&switch0 0 GPIO_ACTIVE_LOW>;
+               };
+
+               led-lan4 {
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_LAN;
+                       function-enumerator = <4>;
+                       gpios = <&switch0 3 GPIO_ACTIVE_LOW>;
+               };
+
+               led-lan3 {
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_LAN;
+                       function-enumerator = <3>;
+                       gpios = <&switch0 6 GPIO_ACTIVE_LOW>;
+               };
+
+               led-lan2 {
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_LAN;
+                       function-enumerator = <2>;
+                       gpios = <&switch0 9 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-lan1 {
+                       color = <LED_COLOR_ID_BLUE>;
+                       function = LED_FUNCTION_LAN;
+                       function-enumerator = <1>;
+                       gpios = <&switch0 12 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&nand {
+       status = "okay";
+
+       partitions {
+               compatible = "fixed-partitions";
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               partition@0 {
+                       label = "Boot";
+                       reg = <0x0 0x80000>;
+                       read-only;
+               };
+
+               partition@80000 {
+                       label = "Config";
+                       reg = <0x80000 0x80000>;
+               };
+
+               factory: partition@100000 {
+                       label = "Factory";
+                       reg = <0x100000 0x80000>;
+                       read-only;
+               };
+
+               partition@180000 {
+                       label = "firmware";
+                       reg = <0x180000 0x3000000>;
+
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "kernel";
+                               reg = <0x0 0x400000>;
+                       };
+
+                       partition@400000 {
+                               label = "ubi";
+                               reg = <0x400000 0x2c00000>;
+                       };
+               };
+
+               partition@3180000 {
+                       label = "alt_firmware";
+                       reg = <0x3180000 0x3000000>;
+                       read-only;
+               };
+
+               partition@6180000 {
+                       label = "cbtinfo";
+                       reg = <0x6180000 0x80000>;
+                       read-only;
+               };
+               /* seems to be the end here. Can't read past 0x6200000 */
+       };
+};
+
+&pcie {
+       status = "okay";
+};
+
+&pcie1 {
+       wifi@0,0 {
+               compatible = "mediatek,mt76";
+               reg = <0x0000 0 0 0 0>;
+               mediatek,mtd-eeprom = <&factory 0x0000>;
+       };
+};
+
+&gmac1 {
+       status = "okay";
+       label = "wan";
+       phy-handle = <&ethphy0>;
+};
+
+&mdio {
+       ethphy0: ethernet-phy@0 {
+               reg = <0>;
+       };
+};
+
+&switch0 {
+       gpio-controller;
+       #gpio-cells = <2>;
+
+       ports {
+               port@1 {
+                       status = "okay";
+                       label = "lan4";
+               };
+
+               port@2 {
+                       status = "okay";
+                       label = "lan3";
+               };
+
+               port@3 {
+                       status = "okay";
+                       label = "lan2";
+               };
+
+               port@4 {
+                       status = "okay";
+                       label = "lan1";
+               };
+       };
+};
index 974299f26b29b54ef59a9efc2538ca3e36b8d015..661f44d5e99b48e7341b34eb548450ac83dece72 100644 (file)
@@ -1192,6 +1192,15 @@ define Device/linksys_e5600
 endef
 TARGET_DEVICES += linksys_e5600
 
+define Device/linksys_e7350
+  $(Device/belkin_rt1800)
+  DEVICE_VENDOR := Linksys
+  DEVICE_MODEL := E7350
+  IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | \
+       append-ubi | check-size | belkin-header GOLF 1 9.9.9
+endef
+TARGET_DEVICES += linksys_e7350
+
 define Device/linksys_ea7xxx
   $(Device/dsa-migration)
   $(Device/uimage-lzma-loader)
index aebdcd5ad9535ac0a4b98b12751b5ed09eabcf72..0ac67e967043a03c17d5bbdc2eafd09b98456af5 100644 (file)
@@ -75,6 +75,13 @@ gnubee,gb-pc2)
 linksys,e5600)
        ucidef_set_led_netdev "wan" "wan link" "blue:wan" "wan" "link"
        ;;
+linksys,e7350)
+       ucidef_set_led_netdev "lan1" "lan1" "blue:lan-1" "lan1"
+       ucidef_set_led_netdev "lan2" "lan2" "blue:lan-2" "lan2"
+       ucidef_set_led_netdev "lan3" "lan4" "blue:lan-3" "lan3"
+       ucidef_set_led_netdev "lan4" "lan4" "blue:lan-4" "lan4"
+       ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan"
+       ;;
 linksys,ea6350-v4|\
 linksys,ea7300-v1|\
 linksys,ea7300-v2|\
index 5b9eca0779970276e86ac2a4a8fec8afefb98680..f3913a1d1cd2bea707efb864b976f293309df25e 100644 (file)
@@ -205,7 +205,8 @@ ramips_setup_macs()
                wan_mac=$lan_mac
                label_mac=$lan_mac
                ;;
-       belkin,rt1800)
+       belkin,rt1800|\
+       linksys,e7350)
                lan_mac=$(mtd_get_mac_ascii Config lan_hwaddr)
                wan_mac=$(mtd_get_mac_ascii Config wan_hwaddr)
                label_mac=$lan_mac
index 98bc6c1ccf9ff2f8bafdb8f3da43caac555551e5..3c2872ae2cbddefe0a9bf9af89172941da4dff12 100644 (file)
@@ -84,7 +84,8 @@ case "$board" in
                [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
                [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
                ;;
-       belkin,rt1800)
+       belkin,rt1800|\
+       linksys,e7350)
                hw_mac_addr=$(mtd_get_mac_ascii Config wan_hwaddr)
                [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
                [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
index a77fc41f0773230de5cb224e98ebbd3e890ea877..99b318a922c3aae643d5c7de5d093cc67b4f58c9 100755 (executable)
@@ -23,6 +23,7 @@ boot() {
                mtd resetbc s_env || true
                ;;
        belkin,rt1800|\
+       linksys,e7350|\
        samknows,whitebox-v8)
                fw_setenv bootcount 0
                ;;
index 997b4d35ffe9f7c44a0370e4bc0a1f31979e2d21..05907536fe479842e98e7a978bdd1531c2f62257 100755 (executable)
@@ -71,6 +71,7 @@ platform_do_upgrade() {
        iptime,t5004|\
        jcg,q20|\
        linksys,e5600|\
+       linksys,e7350|\
        linksys,ea6350-v4|\
        linksys,ea7300-v1|\
        linksys,ea7300-v2|\