From 0cfd15552e335528743f1fcc4961959126788bf5 Mon Sep 17 00:00:00 2001 From: Mikhail Zhilkin Date: Wed, 2 Nov 2022 08:44:46 +0000 Subject: [PATCH] ramips: add support for Rostelecom RT-SF-1 Rostelecom RT-SF-1 is a wireless WiFi 5 router manufactured by Sercomm company. Device specification -------------------- SoC Type: MediaTek MT7621AT RAM: 256 MiB Flash: 256 MiB, Micron MT29F2G08ABAGA3W Wireless 2.4 GHz (MT7603EN): b/g/n, 2x2 Wireless 5 GHz (MT7615E): a/n/ac, 4x4 Ethernet: 5xGbE (WAN, LAN1, LAN2, LAN3, LAN4) USB ports: 1xUSB3.0 ZigBee: 3.0, EFR32 MG1B232GG Button: 2 buttons (Reset & WPS) LEDs: - 1x Status (RGB) - 1x 2.4G (blue, hardware, mt76-phy0) - 1x 5G (blue, hardware, mt76-phy1) Power: 12 VDC, 1.5 A Connector type: barrel Bootloader: U-Boot Installation ----------------- 1. Remove dots from the OpenWrt factory image filename 2. Login to the router web interface 3. Update firmware using web interface with the OpenWrt factory image 4. If OpenWrt is booted, then no further steps are required. Enjoy! Otherwise (Stock firmware has booted again) proceed to the next step. 5. Update firmware using web interface with any version of the Stock firmware 6. Update firmware using web interface with the OpenWrt factory image Revert to stock --------------- Change bootflag to Sercomm1 in OpenWrt CLI and then reboot: printf 1 | dd bs=1 seek=7 count=1 of=/dev/mtdblock3 Recovery -------- Use sercomm-recovery tool. Link: https://github.com/danitool/sercomm-recovery MAC Addresses ------------- +-----+------------+------------+ | use | address | example | +-----+------------+------------+ | LAN | label | *:72, *:d2 | | WAN | label + 11 | *:7d, *:dd | | 2g | label + 2 | *:74, *:d4 | | 5g | label + 3 | *:75, *:d5 | +-----+------------+------------+ The label MAC address was found in Factory 0x21000 Signed-off-by: Mikhail Zhilkin --- package/boot/uboot-envtools/files/ramips | 3 +- .../ramips/dts/mt7621_rostelecom_rt-sf-1.dts | 30 +++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 13 ++++++++ .../mt7621/base-files/etc/board.d/01_leds | 3 +- .../mt7621/base-files/etc/init.d/bootcount | 3 +- .../mt7621/base-files/lib/upgrade/platform.sh | 1 + 6 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_rostelecom_rt-sf-1.dts diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 70d70dfed05..6c649bfaccf 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -32,7 +32,8 @@ ampedwireless,ally-r1900k) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000" "4" ;; beeline,smartbox-giga|\ -beeline,smartbox-turbo) +beeline,smartbox-turbo|\ +rostelecom,rt-sf-1) ubootenv_add_uci_config "/dev/mtd0" "0x80000" "0x1000" "0x20000" ;; buffalo,wsr-1166dhp|\ diff --git a/target/linux/ramips/dts/mt7621_rostelecom_rt-sf-1.dts b/target/linux/ramips/dts/mt7621_rostelecom_rt-sf-1.dts new file mode 100644 index 00000000000..c476cf94957 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_rostelecom_rt-sf-1.dts @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_sercomm_dxx_nand_256m.dtsi" + +/ { + compatible = "rostelecom,rt-sf-1", "mediatek,mt7621-soc"; + model = "Rostelecom RT-SF-1"; +}; + +&pcie0 { + wifi@0,0 { + nvmem-cells = <&macaddr_factory_21000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(3)>; + }; +}; + +&pcie1 { + wifi@0,0 { + nvmem-cells = <&macaddr_factory_21000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(2)>; + }; +}; + +&gmac1 { + nvmem-cells = <&macaddr_factory_21000>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <(11)>; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index de10da7cb66..e7b38aaacf0 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1740,6 +1740,19 @@ define Device/renkforce_ws-wn530hp3-a endef TARGET_DEVICES += renkforce_ws-wn530hp3-a +define Device/rostelecom_rt-sf-1 + $(Device/sercomm_dxx) + IMAGE_SIZE := 32768k + SERCOMM_HWID := DKG + SERCOMM_HWVER := 10110 + SERCOMM_SWVER := 1026 + DEVICE_VENDOR := Rostelecom + DEVICE_MODEL := RT-SF-1 + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware \ + kmod-usb3 uboot-envtools +endef +TARGET_DEVICES += rostelecom_rt-sf-1 + define Device/samknows_whitebox-v8 $(Device/dsa-migration) $(Device/uimage-lzma-loader) 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 a3c233a20fc..98db9fb9fc7 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 @@ -25,7 +25,8 @@ asus,rt-n56u-b1) ;; beeline,smartbox-flash|\ beeline,smartbox-giga|\ -beeline,smartbox-turbo) +beeline,smartbox-turbo|\ +rostelecom,rt-sf-1) ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" ;; belkin,rt1800) diff --git a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount index 99b318a922c..597c2da60fb 100755 --- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount +++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount @@ -8,7 +8,8 @@ boot() { [ -n "$(fw_printenv bootcount bootchanged 2>/dev/null)" ] &&\ echo -e "bootcount\nbootchanged\n" | /usr/sbin/fw_setenv -s - ;; - beeline,smartbox-turbo) + beeline,smartbox-turbo|\ + rostelecom,rt-sf-1) [[ $(hexdump -n 1 -e '/1 "%1d"' -s $((0x20001)) /dev/mtd3) == \ $((0xff)) ]] || printf '\xff' | dd of=/dev/mtdblock3 \ count=1 bs=1 seek=$((0x20001)) diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index d380ea66f75..95bba16194c 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -95,6 +95,7 @@ platform_do_upgrade() { netgear,wax202|\ netis,wf2881|\ raisecom,msg1500-x-00|\ + rostelecom,rt-sf-1|\ sercomm,na502|\ sercomm,na502s|\ sim,simax1800t|\