mediatek: add support for Netgear EX6250v2 series
authorWenli Looi <wlooi@ucalgary.ca>
Thu, 30 Mar 2023 19:46:19 +0000 (19:46 +0000)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 1 Jul 2023 12:42:11 +0000 (14:42 +0200)
Netgear EX6250v2, EX6400v3, EX6410v2, EX6470 are wall-plug 802.11ac
(Wi-Fi 5) extenders. Like other MT7629 devices, Wi-Fi does not work
currently as there is no driver.

Related: https://github.com/openwrt/openwrt/pull/5084

For future reference, 2.4GHz MAC = LAN+1, 5GHz MAC = LAN+2.

Specifications:
* MT7629, 256 MiB RAM, 16 MiB SPI NOR
* MT7761N (2.4GHz) / MT7762N (5GHz) - no driver
* Ethernet: 1 port 10/100/1000
* UART: 115200 baud (labeled on board)

Installation:
* Flash the factory image through the stock web interface, or TFTP to
  the bootloader. NMRP can be used to TFTP without opening the case.
* After installation, perform a factory reset. Wait for the device to
  boot, then hold the reset button for 10 seconds. This is needed
  because sysupgrade in the stock firmware will attempt to preserve its
  configuration using sysupgrade.tgz.
  See https://github.com/openwrt/openwrt/pull/4182

Revert to stock firmware:
* Flash the stock firmware to the bootloader using TFTP/NMRP.

Signed-off-by: Wenli Looi <wlooi@ucalgary.ca>
package/boot/uboot-envtools/files/mediatek_mt7629
target/linux/mediatek/dts/mt7629-netgear-ex6250-v2.dts [new file with mode: 0644]
target/linux/mediatek/image/mt7629.mk
target/linux/mediatek/mt7629/base-files/etc/board.d/01_leds
target/linux/mediatek/mt7629/base-files/etc/board.d/02_network

index a5aa2b58a61de7a79a26004a2116c3e91560223d..313fb6a44809e794b187a6dac1faf2a86e5e228f 100644 (file)
@@ -12,7 +12,8 @@ touch /etc/config/ubootenv
 board=$(board_name)
 
 case "$board" in
-iptime,a6004mx)
+iptime,a6004mx|\
+netgear,ex6250-v2)
        ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000"
        ;;
 esac
diff --git a/target/linux/mediatek/dts/mt7629-netgear-ex6250-v2.dts b/target/linux/mediatek/dts/mt7629-netgear-ex6250-v2.dts
new file mode 100644 (file)
index 0000000..5645ad7
--- /dev/null
@@ -0,0 +1,238 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/dts-v1/;
+#include <dt-bindings/input/input.h>
+#include "mt7629.dtsi"
+
+/ {
+       model = "Netgear EX6250 v2";
+       compatible = "netgear,ex6250-v2", "mediatek,mt7629";
+
+       aliases {
+               led-boot = &led_power_green;
+               led-failsafe = &led_power_red;
+               led-running = &led_power_green;
+               led-upgrade = &led_power_red;
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+               bootargs-override = "console=ttyS0,115200n8";
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               reset {
+                       label = "reset";
+                       gpios = <&pio 60 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_RESTART>;
+               };
+
+               wps {
+                       label = "wps";
+                       gpios = <&pio 58 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_WPS_BUTTON>;
+               };
+
+               ap_mode {
+                       label = "ap_mode";
+                       gpios = <&pio 54 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_0>;
+               };
+
+               extender_mode {
+                       label = "extender_mode";
+                       gpios = <&pio 53 GPIO_ACTIVE_LOW>;
+                       linux,code = <BTN_1>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_power_green: power_green {
+                       label = "green:power";
+                       gpios = <&pio 21 GPIO_ACTIVE_LOW>;
+               };
+
+               led_power_red: power_red {
+                       label = "red:power";
+                       gpios = <&pio 61 GPIO_ACTIVE_LOW>;
+               };
+
+               client_green {
+                       label = "green:client";
+                       gpios = <&pio 59 GPIO_ACTIVE_LOW>;
+               };
+
+               client_red {
+                       label = "red:client";
+                       gpios = <&pio 24 GPIO_ACTIVE_LOW>;
+               };
+
+               router_green {
+                       label = "green:router";
+                       gpios = <&pio 55 GPIO_ACTIVE_LOW>;
+               };
+
+               router_red {
+                       label = "red:router";
+                       gpios = <&pio 56 GPIO_ACTIVE_LOW>;
+               };
+
+               wps_green {
+                       label = "green:wps";
+                       gpios = <&pio 57 GPIO_ACTIVE_LOW>;
+               };
+
+               eth_green {
+                       label = "green:eth";
+                       gpios = <&pio 16 GPIO_ACTIVE_LOW>;
+               };
+
+               eth_yellow {
+                       label = "yellow:eth";
+                       gpios = <&pio 12 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&eth {
+       pinctrl-names = "default";
+       pinctrl-0 = <&eth_pins>;
+       pinctrl-1 = <&ephy_leds_pins>;
+       status = "okay";
+
+       mac@1 {
+               compatible = "mediatek,eth-mac";
+               reg = <1>;
+               phy-mode = "gmii";
+               phy-handle = <&phy0>;
+       };
+
+       mdio-bus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               phy0: ethernet-phy@0 {
+                       reg = <0>;
+               };
+       };
+};
+
+&qspi {
+       status = "okay";
+
+       pinctrl-names = "default";
+       pinctrl-0 = <&qspi_pins>;
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "Bootloader";
+                               reg = <0x0 0x60000>;
+                               read-only;
+                       };
+
+                       partition@60000 {
+                               label = "Config";
+                               reg = <0x60000 0x10000>;
+                               read-only;
+                       };
+
+                       partition@70000 {
+                               label = "Factory";
+                               reg = <0x70000 0x10000>;
+                               read-only;
+                       };
+
+                       partition@80000 {
+                               label = "firmware";
+                               reg = <0x80000 0xcd0000>;
+                               compatible = "denx,fit";
+                       };
+
+                       partition@d50000 {
+                               label = "CFG";
+                               reg = <0xd50000 0x80000>;
+                               read-only;
+                       };
+
+                       partition@dd0000 {
+                               label = "RAE";
+                               reg = <0xdd0000 0x200000>;
+                               read-only;
+                       };
+
+                       partition@fd0000 {
+                               label = "POT";
+                               reg = <0xfd0000 0x10000>;
+                               read-only;
+                       };
+
+                       partition@fe0000 {
+                               label = "LOG";
+                               reg = <0xfe0000 0x20000>;
+                               read-only;
+                       };
+               };
+       };
+};
+
+&pio {
+       eth_pins: eth-pins {
+               mux {
+                       function = "eth";
+                       groups = "mdc_mdio";
+               };
+       };
+
+       ephy_leds_pins: ephy-leds-pins {
+               mux {
+                       function = "led";
+                       groups = "ephy_leds";
+               };
+       };
+
+       qspi_pins: qspi-pins {
+               mux {
+                       function = "flash";
+                       groups = "spi_nor";
+               };
+       };
+
+       uart0_pins: uart0-pins {
+               mux {
+                       function = "uart";
+                       groups = "uart0_txd_rxd" ;
+               };
+       };
+
+       watchdog_pins: watchdog-pins {
+               mux {
+                       function = "watchdog";
+                       groups = "watchdog";
+               };
+       };
+};
+
+&uart0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&uart0_pins>;
+       status = "okay";
+};
+
+&watchdog {
+       pinctrl-names = "default";
+       pinctrl-0 = <&watchdog_pins>;
+       status = "okay";
+};
index 3f5b2e257940ffb121bb3b40edd6e5be496415b0..33c557190f64d346d32b27badcfba5a057f073e5 100644 (file)
@@ -22,3 +22,29 @@ define Device/iptime_a6004mx
   IMAGE/recovery.bin := append-kernel | pad-to 128k | append-ubi | append-metadata
 endef
 TARGET_DEVICES += iptime_a6004mx
+
+define Device/netgear_ex6250-v2
+  DEVICE_VENDOR := NETGEAR
+  DEVICE_MODEL := EX6250
+  DEVICE_VARIANT := v2
+  DEVICE_ALT0_VENDOR := NETGEAR
+  DEVICE_ALT0_MODEL := EX6400
+  DEVICE_ALT0_VARIANT := v3
+  DEVICE_ALT1_VENDOR := NETGEAR
+  DEVICE_ALT1_MODEL := EX6410
+  DEVICE_ALT1_VARIANT := v2
+  DEVICE_ALT2_VENDOR := NETGEAR
+  DEVICE_ALT2_MODEL := EX6470
+  DEVICE_DTS := mt7629-netgear-ex6250-v2
+  DEVICE_DTS_DIR := ../dts
+  DEVICE_PACKAGES := uboot-envtools
+  NETGEAR_ENC_MODEL := EX6250v2
+  NETGEAR_ENC_REGION := US
+  NETGEAR_ENC_HW_ID_LIST := 1010000003630000_NETGEAR;1010000003540000_NETGEAR
+  NETGEAR_ENC_MODEL_LIST := EX6250v2;EX6400v3;EX6470;EX6410v2
+  IMAGE_SIZE := 13120k
+  IMAGES += factory.img
+  IMAGE/factory.img := append-kernel | pad-to 128k | append-rootfs | \
+       pad-rootfs | check-size | netgear-encrypted-factory
+endef
+TARGET_DEVICES += netgear_ex6250-v2
index 42b6fcbbb352653ef2eee3ae78467109976121ca..c42ab4713b9ad94086ec08ceb37d0928216dce2f 100644 (file)
@@ -9,6 +9,10 @@ case $board in
 iptime,a6004mx)
        ucidef_set_led_netdev "wan" "WAN" "orange:wan" "eth1"
        ;;
+netgear,ex6250-v2)
+       ucidef_set_led_netdev "eth_act" "LAN act" "yellow:eth" "eth0" "tx rx"
+       ucidef_set_led_netdev "eth_link" "LAN link" "green:eth" "eth0" "link"
+       ;;
 esac
 
 board_config_flush
index 4254f39ca0aa644ada6cf7637d08251dce0e483d..db931c8334e9628ad6908e3e6be7d2b91bbde404 100644 (file)
@@ -16,6 +16,9 @@ mediatek_setup_interfaces()
                ucidef_add_switch "switch0" \
                        "0:lan" "1:lan" "2:lan" "3:lan" "6@eth0"
                ;;
+       netgear,ex6250-v2)
+               ucidef_set_interface_lan "eth0"
+               ;;
        esac
 }
 
@@ -24,7 +27,15 @@ mediatek_setup_macs()
        local board="$1"
 
        case $board in
+       netgear,ex6250-v2)
+               lan_mac=$(mtd_get_mac_ascii Config mac)
+               label_mac=$lan_mac
+               ;;
        esac
+
+       [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
+       [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
+       [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
 }
 
 board_config_update