From b7e81d210b403ab7fb2cad70a26e78d63f80b6ce Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 12 Nov 2023 14:10:23 +0100 Subject: [PATCH 01/10] iptables: backport patch fixing bug with string module Backport patch fixing critical bug with string module merged upstream. Fixes: #13812 Signed-off-by: Christian Marangi (cherry picked from commit 3d6b89c5140acb9228ec89bde09b53dafdead070) --- package/network/utils/iptables/Makefile | 2 +- ...-string-Review-parse_string-function.patch | 40 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 package/network/utils/iptables/patches/070-extensions-string-Review-parse_string-function.patch diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index aded1b7b1fdda5..45a2b49070e3da 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=iptables PKG_VERSION:=1.8.8 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:=https://netfilter.org/projects/iptables/files PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 diff --git a/package/network/utils/iptables/patches/070-extensions-string-Review-parse_string-function.patch b/package/network/utils/iptables/patches/070-extensions-string-Review-parse_string-function.patch new file mode 100644 index 00000000000000..cfcb6c77f3864c --- /dev/null +++ b/package/network/utils/iptables/patches/070-extensions-string-Review-parse_string-function.patch @@ -0,0 +1,40 @@ +From da5b32fb4656ab69fe1156eb7e36c7c961839e8a Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Wed, 8 Jun 2022 13:45:13 +0200 +Subject: [PATCH] extensions: string: Review parse_string() function + +* Compare against sizeof(info->pattern) which is more clear than having + to know that this buffer is of size XT_STRING_MAX_PATTERN_SIZE + +* Invert the check and error early to reduce indenting + +* Pass info->patlen to memcpy() to avoid reading past end of 's' + +Signed-off-by: Phil Sutter +--- + extensions/libxt_string.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +--- a/extensions/libxt_string.c ++++ b/extensions/libxt_string.c +@@ -78,14 +78,13 @@ static void string_init(struct xt_entry_ + + static void + parse_string(const char *s, struct xt_string_info *info) +-{ ++{ + /* xt_string does not need \0 at the end of the pattern */ +- if (strlen(s) <= XT_STRING_MAX_PATTERN_SIZE) { +- memcpy(info->pattern, s, XT_STRING_MAX_PATTERN_SIZE); +- info->patlen = strnlen(s, XT_STRING_MAX_PATTERN_SIZE); +- return; +- } +- xtables_error(PARAMETER_PROBLEM, "STRING too long \"%s\"", s); ++ if (strlen(s) > sizeof(info->pattern)) ++ xtables_error(PARAMETER_PROBLEM, "STRING too long \"%s\"", s); ++ ++ info->patlen = strnlen(s, sizeof(info->pattern)); ++ memcpy(info->pattern, s, info->patlen); + } + + static void From 101988c61a50e5a8094e5d90f37b75a28bd3ddeb Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 12 Nov 2023 16:15:07 +0100 Subject: [PATCH 02/10] scripts/getver.sh: prevent asking for negative rev-parse With the case of asking an invalid version that is too big, getver.sh might return an invalid output in the form of HEAD~-2260475641. This is caused by BASE_REV - GET_REV using a negative number. Prevent this by checking if BASE_REV - GET_REV actually return 0 or a positive number and set REV variable accordingly. With the following change, invalid revision number will result in unknown printed instead of the invalid HEAD~-NUMBERS output. Signed-off-by: Christian Marangi (cherry picked from commit 9e49e0a6c4535d345084cc62c594be5cad23b911) --- scripts/getver.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/getver.sh b/scripts/getver.sh index 49260a22603fb0..61906040b18f97 100755 --- a/scripts/getver.sh +++ b/scripts/getver.sh @@ -21,7 +21,7 @@ try_git() { r*) GET_REV="$(echo $GET_REV | tr -d 'r')" BASE_REV="$(git rev-list ${REBOOT}..HEAD 2>/dev/null | wc -l | awk '{print $1}')" - REV="$(git rev-parse HEAD~$((BASE_REV - GET_REV)))" + [ $((BASE_REV - GET_REV)) -ge 0 ] && REV="$(git rev-parse HEAD~$((BASE_REV - GET_REV)))" ;; *) BRANCH="$(git rev-parse --abbrev-ref HEAD)" From a58a86693f8593974ff7c26bb42e280b62a8724c Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 12 Nov 2023 21:20:49 +0100 Subject: [PATCH 03/10] OpenWrt v23.05.1: adjust config defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 + version.date | 1 + 5 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 version create mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index d467db5627f543..d93bbf792bef85 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 -src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 -src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 -src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 +src-git packages https://git.openwrt.org/feed/packages.git^9671ba6eb02e0069ffec4da3c705af1e56cf93cd +src-git luci https://git.openwrt.org/project/luci.git^5a811622d8216fdae46e1b486b471f593dee222a +src-git routing https://git.openwrt.org/feed/routing.git^83ef3784a9092cfd0a900cc28e2ed4e13671d667 +src-git telephony https://git.openwrt.org/feed/telephony.git^9746ae8f964e18f04b64fbe1956366954ff223f8 diff --git a/include/version.mk b/include/version.mk index 924bf8354121a3..a22dbd422dc62c 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.1) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23619-101988c61a) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.1) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index 9a728638133756..f408f2530fdb85 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" + default "https://downloads.openwrt.org/releases/23.05.1" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default y + default n help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version new file mode 100644 index 00000000000000..e0460a5880d683 --- /dev/null +++ b/version @@ -0,0 +1 @@ +r23619-101988c61a diff --git a/version.date b/version.date new file mode 100644 index 00000000000000..4af571f4f82538 --- /dev/null +++ b/version.date @@ -0,0 +1 @@ +1699802379 From ce62c25c08010f81dd78748161dcc99457ee03b8 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 12 Nov 2023 21:21:21 +0100 Subject: [PATCH 04/10] OpenWrt v23.05.1: revert to branch defaults Signed-off-by: Hauke Mehrtens --- feeds.conf.default | 8 ++++---- include/version.mk | 6 +++--- package/base-files/image-config.in | 4 ++-- version | 1 - version.date | 1 - 5 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 version delete mode 100644 version.date diff --git a/feeds.conf.default b/feeds.conf.default index d93bbf792bef85..d467db5627f543 100644 --- a/feeds.conf.default +++ b/feeds.conf.default @@ -1,4 +1,4 @@ -src-git packages https://git.openwrt.org/feed/packages.git^9671ba6eb02e0069ffec4da3c705af1e56cf93cd -src-git luci https://git.openwrt.org/project/luci.git^5a811622d8216fdae46e1b486b471f593dee222a -src-git routing https://git.openwrt.org/feed/routing.git^83ef3784a9092cfd0a900cc28e2ed4e13671d667 -src-git telephony https://git.openwrt.org/feed/telephony.git^9746ae8f964e18f04b64fbe1956366954ff223f8 +src-git packages https://git.openwrt.org/feed/packages.git;openwrt-23.05 +src-git luci https://git.openwrt.org/project/luci.git;openwrt-23.05 +src-git routing https://git.openwrt.org/feed/routing.git;openwrt-23.05 +src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-23.05 diff --git a/include/version.mk b/include/version.mk index a22dbd422dc62c..924bf8354121a3 100644 --- a/include/version.mk +++ b/include/version.mk @@ -23,13 +23,13 @@ PKG_CONFIG_DEPENDS += \ sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1)))) VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER)) -VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05.1) +VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),23.05-SNAPSHOT) VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_CODE)) -VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),r23619-101988c61a) +VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION)) VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO)) -VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05.1) +VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),https://downloads.openwrt.org/releases/23.05-SNAPSHOT) VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST)) VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt) diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in index f408f2530fdb85..9a728638133756 100644 --- a/package/base-files/image-config.in +++ b/package/base-files/image-config.in @@ -190,7 +190,7 @@ if VERSIONOPT config VERSION_REPO string prompt "Release repository" - default "https://downloads.openwrt.org/releases/23.05.1" + default "https://downloads.openwrt.org/releases/23.05-SNAPSHOT" help This is the repository address embedded in the image, it defaults to the trunk snapshot repo; the url may contain the following placeholders: @@ -266,7 +266,7 @@ if VERSIONOPT config VERSION_CODE_FILENAMES bool prompt "Revision code in filenames" - default n + default y help Enable this to include the revision identifier or the configured version code into the firmware image, SDK- and Image Builder archive diff --git a/version b/version deleted file mode 100644 index e0460a5880d683..00000000000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -r23619-101988c61a diff --git a/version.date b/version.date deleted file mode 100644 index 4af571f4f82538..00000000000000 --- a/version.date +++ /dev/null @@ -1 +0,0 @@ -1699802379 From 65bf66f7274a0f992836516df9f6033c07aa6b27 Mon Sep 17 00:00:00 2001 From: Usama Nassir Date: Fri, 19 May 2023 03:35:51 +0300 Subject: [PATCH 05/10] ramips: Add support for ComFast CF-E390AX Add support for ComFast CF-E390AX. It is a 802.11 wifi6 cieling AP, based on MediaTek MT7261AT. Specifications: SoC: MediaTek MT7621AT RAM: 128 MiB Flash: 16 MiB NOR (Macronix mx25l12805d) Wireless: MT7915E (2.4G) 802.11ax/b/g/n MT7915E (5G) 802.11ac/ax/n Ethernet: 2 x 1Gbs Button: 1 x "Reset" button LED: 1x Blue LED + 1x Red LED + 1x green LED Power: PoE Manufacturer Page: http://en.comfast.com.cn/index.php?m=content&c=index&a=show&catid=84&id=75 Flash Layout: 0x000000000000-0x000000030000 : "bootloader" 0x000000030000-0x000000040000 : "config" 0x000000050000-0x000000060000 : "factory" 0x000000090000-0x000001000000 : "firmware" First install: 1. Set device into http firmware fail safe upload mode by pressing the reset button for 10 seconds while powering it on. Once the LED stops flashing, safe mode will be running. 2. Set PC IP address to 192.168.1.2 3. Browse to 192.168.1.1 and upload the factory image using the web interface. Signed-off-by: Usama Nassir (cherry picked from commit f24c9b9d863c2635e472e83028d28cc8d0a7c7c6) --- .../ramips/dts/mt7621_comfast_cf-e390ax.dts | 135 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 14 ++ .../mt7621/base-files/etc/board.d/02_network | 8 ++ .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 4 + 4 files changed, 161 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_comfast_cf-e390ax.dts diff --git a/target/linux/ramips/dts/mt7621_comfast_cf-e390ax.dts b/target/linux/ramips/dts/mt7621_comfast_cf-e390ax.dts new file mode 100644 index 00000000000000..80600470e77ec2 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_comfast_cf-e390ax.dts @@ -0,0 +1,135 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + compatible = "comfast,cf-e390ax", "mediatek,mt7621-soc"; + model = "COMFAST CF-E390AX"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: status_green { + label = "green:status"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + led_status_blue: status_blue { + label = "blue:status"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + led_status_red: status_red { + label = "red:status"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + }; + + aliases { + led-boot = &led_status_green; + led-failsafe = &led_status_red; + led-running = &led_status_blue; + led-upgrade = &led_status_red; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + }; +}; + +&spi0 { + status = "okay"; + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <14000000>; + 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>; + read-only; + }; + + factory: partition@50000 { + label = "factory"; + reg = <0x50000 0x10000>; + read-only; + }; + + partition@90000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x90000 0xf70000>; + }; + }; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_e000: macaddr@e000 { + reg = <0xe000 0x6>; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "wan"; + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + }; + + port@4 { + status = "okay"; + label = "lan"; + }; + }; +}; + diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 57adcb7da2ee4d..2b0b698514b71c 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -513,6 +513,20 @@ define Device/bolt_arion endef TARGET_DEVICES += bolt_arion +define Device/comfast_cf-e390ax + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 15808k + DEVICE_VENDOR := ComFast + DEVICE_MODEL := CF-E390AX + DEVICE_PACKAGES := kmod-mt7915-firmware -uboot-envtools + IMAGES += factory.bin + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ + check-size | append-metadata + IMAGE/factory.bin := append-kernel | append-rootfs | pad-rootfs | check-size +endef +TARGET_DEVICES += comfast_cf-e390ax + define Device/cudy_m1800 $(Device/dsa-migration) DEVICE_VENDOR := Cudy diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 839663bbd0df5b..5990ee314d272f 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -145,6 +145,9 @@ ramips_setup_interfaces() ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ucidef_set_interface "qtn" ifname "eth1" protocol "static" ipaddr "1.1.1.1" netmask "255.255.255.0" ;; + comfast,cf-e390ax) + ucidef_set_interfaces_lan_wan "lan" "wan" + ;; *) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; @@ -198,6 +201,11 @@ ramips_setup_macs() lan_mac=$wan_mac label_mac=$wan_mac ;; + comfast,cf-e390ax) + lan_mac=$(cat /sys/class/net/eth0/address) + label_mac=$lan_mac + wan_mac=$(macaddr_add "$lan_mac" 1) + ;; dlink,dir-860l-b1) lan_mac=$(mtd_get_mac_ascii factory lanmac) wan_mac=$(mtd_get_mac_ascii factory wanmac) diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 3467e783f04826..0443fd2ba73457 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -27,6 +27,10 @@ case "$board" in hw_mac_addr=$(macaddr_unsetbit $hw_mac_addr 28) [ "$PHYNBR" = "1" ] && macaddr_setbit_la $hw_mac_addr > /sys${DEVPATH}/macaddress ;; + comfast,cf-e390ax) + [ "$PHYNBR" = "0" ] && echo -n "$(mtd_get_mac_binary factory 0x0004)" > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && echo -n "$(mtd_get_mac_binary factory 0x8004)" > /sys${DEVPATH}/macaddress + ;; cudy,x6-v1|\ cudy,x6-v2) hw_mac_addr="$(mtd_get_mac_binary bdinfo 0xde00)" From 275f7e07ee0ba4d0797cb8ef2ff2077fcc26f1ea Mon Sep 17 00:00:00 2001 From: "Alexey D. Filimonov" Date: Sat, 19 Aug 2023 00:26:59 +0300 Subject: [PATCH 06/10] ramips: cf-ew72-v2: Add support for COMFAST CF-EW72 V2 Add support for COMFAST CF-EW72 V2 Hardware: - SoC: Mediatek MT7621 (MT7621DAT or MT7621AT) - Flash: 16 MiB NOR - RAM: 128 MiB - Ethernet: Built-in, 2 x 1GbE - Power: only 802.3af PD on any port, injector supplied in the box - PoE passthrough: No - Wifi 2.4GHz: Mediatek MT7603BE 802.11b/g/b - Wifi 5GHz: Mediatek MT7613BEN 802.11ac/n/a - LEDs: 8x (only 1 is both visible and controllable, see below) - Buttons: 1x (RESET) Installing OpenWrt: Flashing is done using Mediatek U-Boot System Recovery Mode - make wired connection with 2 cables like this: - - PC (LAN) <-> PoE Injector (LAN) - - PoE Injector (POE) <-> CF-EW72 V2 (LAN). Leave unconnected to CF-EW72 V2 yet. - configure 192.168.1.(2-254)/24 static ip address on your PC LAN - press and keep pressed RESET button on device - power the device by plugging PoE Injector (POE) <-> CF-EW72 V2 (LAN) cable - wait for about 10 seconds until wifi led stops blinking and release RESET button - navigate from your PC to http://192.168.1.1 and upload OpenWrt *-factory.bin firmware file - proceed until router starts blinking with wifi led again (flashing) and stops (rebooting to OpenWrt) MAC addresses as verified by OEM firmware: vendor OpenWrt address LAN lan\eth0 label WAN wan label + 1 2g phy0 label + 2 5g phy1 label + 3 The label MAC address was found in 0xe000. LEDs detailed: The only both visible and controllable indicator is blue:wlan LED. It is not bound by default to indicate activity of any wireless interfaces. Place (WAN->ANT) | Num | GPIO | LED name (LuCI) | Note -----------------|-----|----------------------------------------------------------------------------------------- power | 1 | | | POWER LED. Not controlled with GPIO. hidden_led_2 | 2 | 13 | blue:hidden_led_2 | This LED does not have proper hole in shell. wan | 3 | | | WAN LED. Not controlled with GPIO. hidden_led_4 | 4 | 16 | blue:hidden_led_4 | This LED does not have proper hole in shell. lan | 5 | | | LAN LED. Not controlled with GPIO. noconn_led_6 | 6 | | | Not controlled with GPIO, possibly not connected wlan | 7 | 15 | blue:wlan | WLAN LED. Wireless indicator. noconn_led_8 | 8 | | | Not controlled with GPIO, possibly not connected mt76-phy0 and mt76-phy1 leds also exist in OpenWrt, but do not exist on board. Signed-off-by: Alexey D. Filimonov (cherry picked from commit ff95f859ebf710d2914472a3feeeb0d187d14459) --- .../ramips/dts/mt7621_comfast_cf-ew72-v2.dts | 192 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 15 ++ .../mt7621/base-files/etc/board.d/02_network | 3 +- 3 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 target/linux/ramips/dts/mt7621_comfast_cf-ew72-v2.dts diff --git a/target/linux/ramips/dts/mt7621_comfast_cf-ew72-v2.dts b/target/linux/ramips/dts/mt7621_comfast_cf-ew72-v2.dts new file mode 100644 index 00000000000000..8b7b4a035ea2d3 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_comfast_cf-ew72-v2.dts @@ -0,0 +1,192 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + compatible = "comfast,cf-ew72-v2", "mediatek,mt7621-soc"; + model = "COMFAST CF-EW72 V2"; + + // There are at least two HW variants of cf-ew72-v2: + // With external RAM chip and with integrated RAM (RAM chip not soldered). + // Both act same. + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + // The only both visible and controllable indicator is wifi LED. + // CF-EW72 have 8 LEDs: + // "wlan" is the only LED is controllable with GPIO and have proper hole in shell. + // "power", "wan" and "lan" LEDs have proper holes in shell, but can not be controlled with GPIO + // "hidden_led_2" and "hidden_led_4" can be controlled with GPIO, but have no proper holes in shell + // "hidden_led_2" is between POWER and WAN LEDs + // "hidden_led_4" is between WAN and LAN LEDs + // "noconn_led_6" and "noconn_led_8" exist, but have no proper holes in shell and not controlled: + // "noconn_led_6" is between LAN and WLAN LEDs + // "noconn_led_8" is after WLAN LED + + // LED "hidden_led_2" between POWER and WAN LEDs is controllable with GPIO, but it has no proper hole in shell; + // LED "hidden_led_4" between WAN and LAN LEDs is controllable with GPIO, but it has no proper hole in shell; + + // TABLE of LEDs. All leds are blue. + // + // Place (WAN->ANT) | Num | GPIO | LED name (LuCI) | Note + // -----------------|-----|----------------------------------------------------------------------------------------- + // power | 1 | | | POWER LED. Not controlled with GPIO. + // hidden_led_2 | 2 | 13 | blue:hidden_led_2 | This LED does not have proper hole in shell. + // wan | 3 | | | WAN LED. Not controlled with GPIO. + // hidden_led_4 | 4 | 16 | blue:hidden_led_4 | This LED does not have proper hole in shell. + // lan | 5 | | | LAN LED. Not controlled with GPIO. + // noconn_led_6 | 6 | | | Not controlled with GPIO, possibly not connected + // wlan | 7 | 15 | blue:wlan | WLAN LED. Wireless indicator. + // noconn_led_8 | 8 | | | Not controlled with GPIO, possibly not connected + + hidden_led_2_blue { + label = "blue:hidden_led_2"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + hidden_led_4_blue { + label = "blue:hidden_led_4"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + + wlan_blue { + label = "blue:wlan"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + }; + + aliases { + label-mac-device = &wan; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "w25q128"; + reg = <0>; + spi-max-frequency = <10000000>; + m25p,fast-read; + 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>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + compatible = "nvmem-cells"; + reg = <0x40000 0x10000>; + read-only; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + macaddr_factory_e000: macaddr@e000 { + compatible = "mac-base"; + reg = <0xe000 0x6>; + #nvmem-cell-cells = <1>; + }; + + // Serial number can be found in "factory" at 0xE100. + // it starts and ends with double quotes `"` and is ASCII string + }; + }; + + partition@50000 { + label = "firmware"; + compatible = "denx,uimage"; + reg = <0x50000 0xfb0000>; + }; + }; + }; +}; + +&gpio { + groups = "i2c", "uart2", "uart3", "sdhci", "jtag"; + function = "gpio"; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_e000 0>; + nvmem-cell-names = "mac-address"; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi_2_4_ghz: wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + // Wi-Fi device reads it's MAC address from EEPROM (&factory + 4) + // adding anything related to mac-address here will cause use random MAC + }; +}; + +&pcie1 { + wifi_5_0_ghz: wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + // Wi-Fi device reads it's MAC address from EEPROM, (&factory + 0x8000 + 4) + // adding anything related to mac-address here will cause use random MAC. + }; +}; + +&pcie2 { + status = "disabled"; +}; + +&switch0 { + mediatek,mcm; + ports { + wan: port@0 { + status = "okay"; + label = "wan"; + nvmem-cells = <&macaddr_factory_e000 1>; + nvmem-cell-names = "mac-address"; + }; + + lan: port@1 { + status = "okay"; + label = "lan"; + nvmem-cells = <&macaddr_factory_e000 0>; + nvmem-cell-names = "mac-address"; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 2b0b698514b71c..a5e3828c390a00 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -527,6 +527,21 @@ define Device/comfast_cf-e390ax endef TARGET_DEVICES += comfast_cf-e390ax +define Device/comfast_cf-ew72-v2 + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 15808k + DEVICE_VENDOR := ComFast + DEVICE_MODEL := CF-EW72 V2 + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap \ + -uboot-envtools + IMAGES += factory.bin + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ + check-size | append-metadata + IMAGE/factory.bin := append-kernel | append-rootfs | pad-rootfs | check-size +endef +TARGET_DEVICES += comfast_cf-ew72-v2 + define Device/cudy_m1800 $(Device/dsa-migration) DEVICE_VENDOR := Cudy diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 5990ee314d272f..827d97e540e00f 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -145,7 +145,8 @@ ramips_setup_interfaces() ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ucidef_set_interface "qtn" ifname "eth1" protocol "static" ipaddr "1.1.1.1" netmask "255.255.255.0" ;; - comfast,cf-e390ax) + comfast,cf-e390ax|\ + comfast,cf-ew72-v2) ucidef_set_interfaces_lan_wan "lan" "wan" ;; *) From a00fc406b9adb37039b3b6f7f8914477b1f8caae Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 26 Oct 2023 03:46:44 +0100 Subject: [PATCH 07/10] kernel: add support MeigLink SLM828 modem Another Qualcomm-based USB-connected modem, offering endpoints 0 : rndis_host (link to voip subsystem listening on 169.254.5.100) 1 : rndis_host (?) 2 : option (?) 3 : option (at) 4 : option (at) 5 : option (?) 6 : GobiNet (qmi) 7 : ? Add support for this modem in rndis_host, option and qmi_wwan driver which allows the modem to be used with ModemManager. Signed-off-by: Daniel Golle (cherry picked from commit f32baf6a65fbe294b9eb7b93f39b2aea1c3402ae) --- .../780-usb-net-MeigLink_modem_support.patch | 34 +++++++++-- .../781-usb-net-rndis-support-asr.patch | 56 +++++++++++++++++++ 2 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 target/linux/generic/hack-5.15/781-usb-net-rndis-support-asr.patch diff --git a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch index e5667c17438d24..304f5480a3febf 100644 --- a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch @@ -10,26 +10,52 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c -@@ -1086,6 +1086,7 @@ static const struct usb_device_id produc +@@ -1080,12 +1080,18 @@ static const struct usb_device_id produc + USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x581d, USB_CLASS_VENDOR_SPEC, 1, 7), + .driver_info = (unsigned long)&qmi_wwan_info, + }, ++ { /* Meiglink SGM828 */ ++ USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d49, USB_CLASS_VENDOR_SPEC, 0x10, 0x05), ++ .driver_info = (unsigned long)&qmi_wwan_info, ++ }, ++ + {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0125)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ + {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0306)}, /* Quectel EP06/EG06/EM06 */ + {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0620)}, /* Quectel EM160R-GL */ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL */ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0801)}, /* Quectel RM520N */ -+ {QMI_MATCH_FF_FF_FF(0x05c6, 0xf601)}, /* MeigLink SLM750 */ ++ {QMI_MATCH_FF_FF_FF(0x05c6, 0xf601)}, /* MeigLink SLM750 */ /* 3. Combined interface devices matching on interface number */ {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c -@@ -247,6 +247,8 @@ static void option_instat_callback(struc +@@ -247,6 +247,11 @@ static void option_instat_callback(struc #define UBLOX_PRODUCT_R410M 0x90b2 /* These Yuga products use Qualcomm's vendor ID */ #define YUGA_PRODUCT_CLM920_NC5 0x9625 +/* These MeigLink products use Qualcomm's vendor ID */ +#define MEIGLINK_PRODUCT_SLM750 0xf601 ++ ++#define MEIGLINK_VENDOR_ID 0x2dee ++#define MEIGLINK_PRODUCT_SLM828 0x4d49 #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1185,6 +1187,11 @@ static const struct usb_device_id option +@@ -1144,6 +1149,11 @@ static const struct usb_device_id option + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000), /* SIMCom SIM5218 */ + .driver_info = NCTRL(0) | NCTRL(1) | NCTRL(2) | NCTRL(3) | RSVD(4) }, ++ /* MeiG */ ++ { USB_DEVICE_AND_INTERFACE_INFO(MEIGLINK_VENDOR_ID, MEIGLINK_PRODUCT_SLM828, USB_CLASS_VENDOR_SPEC, 0x10, 0x01) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(MEIGLINK_VENDOR_ID, MEIGLINK_PRODUCT_SLM828, USB_CLASS_VENDOR_SPEC, 0x10, 0x02) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(MEIGLINK_VENDOR_ID, MEIGLINK_PRODUCT_SLM828, USB_CLASS_VENDOR_SPEC, 0x10, 0x03) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(MEIGLINK_VENDOR_ID, MEIGLINK_PRODUCT_SLM828, USB_CLASS_VENDOR_SPEC, 0x10, 0x04) }, + /* Quectel products using Qualcomm vendor ID */ + { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)}, + { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20), +@@ -1185,6 +1195,11 @@ static const struct usb_device_id option .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, diff --git a/target/linux/generic/hack-5.15/781-usb-net-rndis-support-asr.patch b/target/linux/generic/hack-5.15/781-usb-net-rndis-support-asr.patch new file mode 100644 index 00000000000000..9934bb8078efe4 --- /dev/null +++ b/target/linux/generic/hack-5.15/781-usb-net-rndis-support-asr.patch @@ -0,0 +1,56 @@ +--- a/drivers/net/usb/rndis_host.c ++++ b/drivers/net/usb/rndis_host.c +@@ -630,6 +630,16 @@ static const struct driver_info zte_rndi + .tx_fixup = rndis_tx_fixup, + }; + ++static const struct driver_info asr_rndis_info = { ++ .description = "Asr RNDIS device", ++ .flags = FLAG_WWAN | FLAG_POINTTOPOINT | FLAG_FRAMING_RN | FLAG_NO_SETINT | FLAG_NOARP, ++ .bind = rndis_bind, ++ .unbind = rndis_unbind, ++ .status = rndis_status, ++ .rx_fixup = rndis_rx_fixup, ++ .tx_fixup = rndis_tx_fixup, ++}; ++ + /*-------------------------------------------------------------------------*/ + + static const struct usb_device_id products [] = { +@@ -666,6 +676,36 @@ static const struct usb_device_id produc + USB_INTERFACE_INFO(USB_CLASS_WIRELESS_CONTROLLER, 1, 3), + .driver_info = (unsigned long) &rndis_info, + }, { ++ /* Quectel EG060V rndis device */ ++ USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x6004, ++ USB_CLASS_WIRELESS_CONTROLLER, 1, 3), ++ .driver_info = (unsigned long) &asr_rndis_info, ++}, { ++ /* Quectel EC200A rndis device */ ++ USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x6005, ++ USB_CLASS_WIRELESS_CONTROLLER, 1, 3), ++ .driver_info = (unsigned long) &asr_rndis_info, ++}, { ++ /* Quectel EC200T rndis device */ ++ USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x6026, ++ USB_CLASS_WIRELESS_CONTROLLER, 1, 3), ++ .driver_info = (unsigned long) &asr_rndis_info, ++}, { ++ /* Simcom A7906E rndis device */ ++ USB_DEVICE_AND_INTERFACE_INFO(0x1e0e, 0x9011, ++ USB_CLASS_WIRELESS_CONTROLLER, 1, 3), ++ .driver_info = (unsigned long) &asr_rndis_info, ++}, { ++ /* Meig SLM770A */ ++ USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d57, ++ USB_CLASS_WIRELESS_CONTROLLER, 1, 3), ++ .driver_info = (unsigned long) &asr_rndis_info, ++}, { ++ /* Meig SLM828 */ ++ USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d49, ++ USB_CLASS_WIRELESS_CONTROLLER, 1, 3), ++ .driver_info = (unsigned long) &asr_rndis_info, ++}, { + /* Novatel Verizon USB730L */ + USB_INTERFACE_INFO(USB_CLASS_MISC, 4, 1), + .driver_info = (unsigned long) &rndis_info, From 03e26f856fe3a7508436bbb3acc394708cf9ac8c Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 26 Oct 2023 03:50:40 +0100 Subject: [PATCH 08/10] kernel: support reading hex MAC address from NVMEM In addition to binary and ASCII-formatted MAC addresses, add support for processing hexadecimal encoded MAC addresses from NVMEM. Signed-off-by: Daniel Golle (cherry picked from commit 7db87d7c6846977402899b27881824b3df4f50ab) --- ...-support-mac-base-fixed-layout-cells.patch | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/target/linux/generic/pending-5.15/804-nvmem-core-support-mac-base-fixed-layout-cells.patch b/target/linux/generic/pending-5.15/804-nvmem-core-support-mac-base-fixed-layout-cells.patch index 6791b63ac09d90..95f29b1865dd5f 100644 --- a/target/linux/generic/pending-5.15/804-nvmem-core-support-mac-base-fixed-layout-cells.patch +++ b/target/linux/generic/pending-5.15/804-nvmem-core-support-mac-base-fixed-layout-cells.patch @@ -20,10 +20,11 @@ string. --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -7,9 +7,11 @@ +@@ -7,9 +7,12 @@ */ #include ++#include +#include #include #include @@ -32,7 +33,7 @@ string. #include #include #include -@@ -696,6 +698,37 @@ static int nvmem_validate_keepouts(struc +@@ -696,6 +699,62 @@ static int nvmem_validate_keepouts(struc return 0; } @@ -66,25 +67,55 @@ string. + + return 0; +} ++ ++static int nvmem_mac_base_hex_read(void *context, const char *id, int index, unsigned int offset, ++ void *buf, size_t bytes) ++{ ++ u8 mac[ETH_ALEN], *hexstr; ++ int i; ++ ++ if (WARN_ON(bytes != 2 * ETH_ALEN)) ++ return -EINVAL; ++ ++ hexstr = (u8 *)buf; ++ for (i = 0; i < ETH_ALEN; i++) { ++ if (!isxdigit(hexstr[i * 2]) || !isxdigit(hexstr[i * 2 + 1])) ++ return -EINVAL; ++ ++ mac[i] = (hex_to_bin(hexstr[i * 2]) << 4) | hex_to_bin(hexstr[i * 2 + 1]); ++ } ++ ++ if (index) ++ eth_addr_add(mac, index); ++ ++ ether_addr_copy(buf, mac); ++ ++ return 0; ++} + static int nvmem_add_cells_from_dt(struct nvmem_device *nvmem, struct device_node *np) { struct nvmem_layout *layout = nvmem->layout; -@@ -731,6 +764,20 @@ static int nvmem_add_cells_from_dt(struc +@@ -731,6 +790,25 @@ static int nvmem_add_cells_from_dt(struc if (layout && layout->fixup_cell_info) layout->fixup_cell_info(nvmem, layout, &info); + if (of_device_is_compatible(np, "fixed-layout")) { + if (of_device_is_compatible(child, "mac-base")) { -+ if (info.bytes == 6) { ++ if (info.bytes == ETH_ALEN) { + info.raw_len = info.bytes; + info.bytes = ETH_ALEN; + info.read_post_process = nvmem_mac_base_raw_read; ++ } else if (info.bytes == 2 * ETH_ALEN) { ++ info.raw_len = info.bytes; ++ info.bytes = ETH_ALEN; ++ info.read_post_process = nvmem_mac_base_hex_read; + } else if (info.bytes == 3 * ETH_ALEN - 1) { + info.raw_len = info.bytes; + info.bytes = ETH_ALEN; + info.read_post_process = nvmem_mac_base_ascii_read; + } ++ + } + } + From ce62536aca9d0aae9b21c3d19cd8ad6acba7b029 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 29 Oct 2023 16:01:05 +0000 Subject: [PATCH 09/10] uboot-envtools: add environment config for MeiG SLT866 Add configuration to access U-Boot environment on MeiG SLT866. Signed-off-by: Daniel Golle (cherry picked from commit f8414f1a6fa0b784117353a93d821fa923da1aaf) --- package/boot/uboot-envtools/files/ramips | 1 + 1 file changed, 1 insertion(+) diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 8c7ce71c49f5dd..83b54388e3e731 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -20,6 +20,7 @@ alfa-network,tube-e4g|\ engenius,epg600|\ engenius,esr600h|\ linksys,re7000|\ +meig,slt866|\ sitecom,wlr-4100-v1-002|\ zyxel,keenetic-lite-iii-a) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000" From b38b5c42997e527f91e653a4b6d77a5717d3cd14 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 24 Oct 2023 18:05:28 +0100 Subject: [PATCH 10/10] ramips: add support for MeiG SLT866 4G CPE 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 (cherry picked from commit bc335f296740ac386e1ef09a49f1844419b0ccf9) --- .../linux/ramips/dts/mt7621_meig_slt866.dts | 245 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 11 + .../mt7621/base-files/etc/board.d/01_leds | 4 + .../mt7621/base-files/etc/board.d/02_network | 3 +- 4 files changed, 262 insertions(+), 1 deletion(-) create mode 100644 target/linux/ramips/dts/mt7621_meig_slt866.dts diff --git a/target/linux/ramips/dts/mt7621_meig_slt866.dts b/target/linux/ramips/dts/mt7621_meig_slt866.dts new file mode 100644 index 00000000000000..19d2f0f6fc42a6 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_meig_slt866.dts @@ -0,0 +1,245 @@ +#include "mt7621.dtsi" +#include +#include +#include + +/ { + 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 = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + 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; + }; + }; + }; +}; + +ðernet { + 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 = <ðphy4>; + + 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"; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index a5e3828c390a00..8a194d6bc1bee4 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1552,6 +1552,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) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 3ceac604342cc2..784a4ba0d914e9 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -137,6 +137,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" ;; diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 827d97e540e00f..4b23afc1cf2910 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -146,7 +146,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" ;; *)