ramips: add support for MeiG SLT866 4G CPE
authorDaniel Golle <daniel@makrotopia.org>
Tue, 24 Oct 2023 17:05:28 +0000 (18:05 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Fri, 3 Nov 2023 21:16:29 +0000 (21:16 +0000)
Hardware:
 - SoC: Mediatek MT7621 (MT7621AT)
 - Flash: 32 MiB SPI-NOR (Macronix MX25L25635E)
 - RAM: 128 MiB
 - Ethernet: Built-in, 2 x 1GbE
 - 3G/4G Modem: MEIG SLM828 (currently only supported with ModemManager)
 - SLIC: Si32185 (unsupported)
 - Power: 12V via barrel connector
 - Wifi 2.4GHz: Mediatek MT7603BE 802.11b/g/b
 - Wifi 5GHz: Mediatek MT7613BE 802.11ac/n/a
 - LEDs: 8x (7 controllable)
 - Buttons: 2x (RESET, WPS)

Installing OpenWrt:
 - sysupgrade image is compatible with vendor firmware.

Recovery:
 - Connect to any of the Ethernet ports, configure local IP:
   10.10.10.3/24 (or 192.168.10.19/24, depending on OEM)
 - Provide firmware file named 'mt7621.img' on TFTP server.
 - Hold down both, RESET and WPS, then power on the board.
 - Watch network traffic using tcpdump or wireshark in realtime to
   observe progress of device requesting firmware. Once download has
   completed, release both buttons and wait until firmware comes up.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
target/linux/ramips/dts/mt7621_meig_slt866.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

diff --git a/target/linux/ramips/dts/mt7621_meig_slt866.dts b/target/linux/ramips/dts/mt7621_meig_slt866.dts
new file mode 100644 (file)
index 0000000..19d2f0f
--- /dev/null
@@ -0,0 +1,245 @@
+#include "mt7621.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+       compatible = "meig,slt866", "mediatek,mt7621-soc";
+       model = "MeiG SLT866";
+
+       aliases {
+               led-boot = &led_internet;
+               led-failsafe = &led_internet;
+               led-upgrade = &led_internet;
+               label-mac-device = &gmac1;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               signal4 {
+                       label = "blue:signal4";
+                       gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
+               };
+
+               lanwan {
+                       label = "blue:lanwan";
+                       gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
+               };
+
+               led_internet: internet {
+                       label = "blue:internet";
+                       gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;
+               };
+
+               wifi {
+                       label = "blue:wifi";
+                       gpios = <&gpio 9 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "phy0tpt";
+               };
+
+               signal3 {
+                       label = "blue:signal3";
+                       gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
+               };
+
+               signal2 {
+                       label = "blue:signal2";
+                       gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
+               };
+
+               signal1 {
+                       label = "blue:signal1";
+                       gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               reset {
+                       label = "reset";
+                       gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_RESTART>;
+               };
+
+               wps {
+                       label = "wps";
+                       gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_WPS_BUTTON>;
+               };
+       };
+
+       regulator-pa-5g {
+               compatible = "regulator-fixed";
+               regulator-name = "pa-5g";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&gpio 7 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+               regulator-boot-on;
+               regulator-always-on;
+       };
+};
+
+&state_default {
+       gpio {
+               groups = "jtag", "uart2", "uart3", "wdt";
+               function = "gpio";
+       };
+};
+
+&spi0 {
+       status = "okay";
+
+       flash@0 {
+               reg = <0>;
+               compatible = "jedec,spi-nor";
+               spi-max-frequency = <20000000>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "Bootloader";
+                               reg = <0x0 0x30000>;
+                               read-only;
+                       };
+
+                       partition@30000 {
+                               label = "Config";
+                               reg = <0x30000 0x10000>;
+                       };
+
+                       partition@40000 {
+                               label = "Factory";
+                               reg = <0x40000 0x10000>;
+                               read-only;
+                               compatible = "nvmem-cells";
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       eeprom_factory_0: eeprom@0 {
+                                               reg = <0x0 0x200>;
+                                       };
+
+                                       eeprom_factory_8000: eeprom@8000 {
+                                               reg = <0x8000 0x4da8>;
+                                       };
+                               };
+                       };
+
+                       partition@50000 {
+                               label = "firmware";
+                               compatible = "denx,uimage";
+                               reg = <0x50000 0xf90000>;
+                       };
+
+                       partition@fe0000 {
+                               label = "m_custom";
+                               reg = <0xfe0000 0x20000>;
+                               read-only;
+                               compatible = "nvmem-cells";
+
+                               nvmem-layout {
+                                       compatible = "fixed-layout";
+
+                                       #address-cells = <1>;
+                                       #size-cells = <1>;
+
+                                       macaddr_custom_0: macaddr@0 {
+                                               reg = <0x0 0xc>;
+                                               compatible = "mac-base";
+                                               #nvmem-cell-cells = <1>;
+                                       };
+
+                                       macaddr_custom_40: macaddr@40 {
+                                               reg = <0x40 0xc>;
+                                               compatible = "mac-base";
+                                               #nvmem-cell-cells = <1>;
+                                       };
+
+                                       macaddr_custom_100: macaddr@100 {
+                                               reg = <0x100 0xc>;
+                                               compatible = "mac-base";
+                                               #nvmem-cell-cells = <1>;
+                                       };
+
+                                       macaddr_custom_140: macaddr@140 {
+                                               reg = <0x140 0xc>;
+                                               compatible = "mac-base";
+                                               #nvmem-cell-cells = <1>;
+                                       };
+                               };
+                       };
+
+                       partition@1000000 {
+                               label = "fota_bak";
+                               reg = <0x1000000 0x1000000>;
+                               read-only;
+                       };
+               };
+       };
+};
+
+&ethernet {
+       pinctrl-names = "default";
+       pinctrl-0 = <&mdio_pins>;
+};
+
+&gmac0 {
+       nvmem-cells = <&macaddr_custom_40 0>;
+       nvmem-cell-names = "mac-address";
+};
+
+&gmac1 {
+       status = "okay";
+       label = "wan";
+       phy-handle = <&ethphy4>;
+
+       nvmem-cells = <&macaddr_custom_0 0>;
+       nvmem-cell-names = "mac-address";
+};
+
+&mdio {
+       ethphy4: ethernet-phy@4 {
+               reg = <4>;
+       };
+};
+
+&switch0 {
+       ports {
+               port@3 {
+                       status = "okay";
+                       label = "lan";
+               };
+       };
+};
+
+&pcie {
+       status = "okay";
+};
+
+&pcie0 {
+       mt76@0,0 {
+               compatible = "mediatek,mt76";
+               reg = <0x0000 0 0 0 0>;
+               nvmem-cells = <&eeprom_factory_0>, <&macaddr_custom_100 0>;
+               nvmem-cell-names = "eeprom", "mac-address";
+       };
+};
+
+&pcie1 {
+       mt76@0,0 {
+               compatible = "mediatek,mt76";
+               reg = <0x0000 0 0 0 0>;
+               ieee80211-freq-limit = <5000000 6000000>;
+               nvmem-cells = <&eeprom_factory_8000>, <&macaddr_custom_140 0>;
+               nvmem-cell-names = "eeprom", "mac-address";
+       };
+};
index 65510fccf1b77928af47d473442bc0d520a85bbd..f7288d5c2992915ac35f9b8210845f2fe3b01d3f 100644 (file)
@@ -1616,6 +1616,17 @@ define Device/mediatek_mt7621-eval-board
 endef
 TARGET_DEVICES += mediatek_mt7621-eval-board
 
+define Device/meig_slt866
+  $(Device/dsa-migration)
+  IMAGE_SIZE := 15104k
+  DEVICE_VENDOR := MeiG
+  DEVICE_MODEL := SLT866
+  DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap \
+       kmod-usb-net-qmi-wwan kmod-usb-serial-option kmod-usb3 \
+       kmod-usb-net-rndis
+endef
+TARGET_DEVICES += meig_slt866
+
 define Device/mercusys_mr70x-v1
   $(Device/dsa-migration)
   $(Device/tplink-safeloader)
index d50e58131d7560a33ddb91af2be0643330252e9a..bebd0c6d4bc463a8a42278129981164e3d3cff7e 100644 (file)
@@ -138,6 +138,10 @@ linksys,ea8100-v2)
        ucidef_set_led_netdev "lan4" "lan4 link" "green:lan4" "lan4" "link"
        ucidef_set_led_netdev "wan" "wan link" "green:wan" "wan" "link"
        ;;
+meig,slt866)
+       ucidef_set_led_netdev "lan" "eth" "blue:lanwan" "lan" "link tx rx"
+       ucidef_set_led_netdev "wwan0" "net" "blue:internet" "wwan0" "link tx rx"
+       ;;
 mikrotik,routerboard-760igs)
        ucidef_set_led_netdev "sfp" "SFP" "blue:sfp" "sfp"
        ;;
index 2fa70a213d3362855a6a5432c9e4b0cc453d05d9..e7f72106dd135714e3eef9c9fb54e339344056c5 100644 (file)
@@ -157,7 +157,8 @@ ramips_setup_interfaces()
                ucidef_set_interface "qtn" ifname "eth1" protocol "static" ipaddr "1.1.1.1" netmask "255.255.255.0"
                ;;
        comfast,cf-e390ax|\
-       comfast,cf-ew72-v2)
+       comfast,cf-ew72-v2|\
+       meig,slt866)
                ucidef_set_interfaces_lan_wan "lan" "wan"
                ;;
        *)