mt7981: add support for sn-r1-longlife

---
half speed of emmc to make it long life
This commit is contained in:
Yuzhii0718
2026-03-05 13:22:50 +08:00
committed by zerowrt-bot
parent fe43f9b2f2
commit 6a4c07c88f
10 changed files with 243 additions and 204 deletions

View File

@@ -63,6 +63,8 @@ CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_ruijie_rg-x30e-pro-stock=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_ruijie_rg-x30e-pro-stock=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_sn_r1=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_sn_r1=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_sn_r1-longlife=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_sn_r1-longlife=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_xiaomi_mi-router-ax3000t=y
CONFIG_TARGET_DEVICE_PACKAGES_mediatek_mt7981_DEVICE_xiaomi_mi-router-ax3000t=""
CONFIG_TARGET_DEVICE_mediatek_mt7981_DEVICE_xiaomi_mi-router-ax3000t-stock=y

View File

@@ -18,7 +18,7 @@ cmcc,xr30-emmc |\
glinet,gl-mt6000 |\
jdcloud,re-cp-03 |\
philips,hy3000 |\
sn,r1)
sn,r1*)
env_dev=$(find_mmc_part "u-boot-env")
[ -n "$env_dev" ] && ubootenv_add_uci_config "$env_dev" "0" "0x80000"
;;

View File

@@ -767,7 +767,7 @@ setup_model()
nradio,wt9103 |\
ruijie,rg-x30e* |\
philips,hy3000 |\
sn,r1 |\
sn,r1* |\
*7981*)
MT7981_whnat $num_of_wifi $usbnet
;;

View File

@@ -0,0 +1,200 @@
/dts-v1/;
#include "mt7981.dtsi"
/ {
chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 \
earlycon=uart8250,mmio32,0x11002000 \
root=PARTLABEL=rootfs rootfstype=squashfs,f2fs";
};
aliases {
led-boot = &status_red_led;
led-failsafe = &status_red_led;
led-running = &status_blue_led;
led-upgrade = &status_yellow_led;
};
leds {
compatible = "gpio-leds";
status_blue_led: led-0 {
label = "blue:status";
gpios = <&pio 11 GPIO_ACTIVE_HIGH>;
};
status_yellow_led: led-1 {
label = "yellow:status";
gpios = <&pio 12 GPIO_ACTIVE_HIGH>;
};
status_red_led: led-2 {
label = "red:status";
gpios = <&pio 13 GPIO_ACTIVE_HIGH>;
};
};
gpio-keys {
compatible = "gpio-keys";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
};
wps {
label = "wps";
gpios = <&pio 0 GPIO_ACTIVE_HIGH>;
linux,code = <BTN_9>;
linux,input-type = <EV_SW>;
};
};
memory {
reg = <0 0x40000000 0 0x10000000>;
};
reg_3p3v: regulator-3p3v {
compatible = "regulator-fixed";
regulator-name = "fixed-3.3V";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
regulator-always-on;
};
gsw: gsw@0 {
compatible = "mediatek,mt753x";
mediatek,ethsys = <&ethsys>;
#address-cells = <1>;
#size-cells = <0>;
};
};
&uart0 {
status = "okay";
};
&watchdog {
status = "okay";
};
&eth {
status = "okay";
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
phy-mode = "gmii";
phy-handle = <&phy0>;
};
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
phy0: ethernet-phy@0 {
compatible = "ethernet-phy-id03a2.9461";
reg = <0>;
phy-mode = "gmii";
nvmem-cells = <&phy_calibration>;
nvmem-cell-names = "phy-cal-data";
};
};
};
&gsw {
mediatek,mdio = <&mdio>;
mediatek,portmap = "wllll";
mediatek,mdio_master_pinmux = <0>;
reset-gpios = <&pio 39 0>;
interrupt-parent = <&pio>;
interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
status = "okay";
port5: port@5 {
compatible = "mediatek,mt753x-port";
reg = <5>;
phy-mode = "sgmii";
fixed-link {
speed = <2500>;
full-duplex;
};
};
port6: port@6 {
compatible = "mediatek,mt753x-port";
mediatek,ssc-on;
reg = <6>;
phy-mode = "sgmii";
fixed-link {
speed = <2500>;
full-duplex;
};
};
};
&hnat {
mtketh-wan = "eth0.2";
mtketh-ppd = "eth0.1";
mtketh-lan = "eth0";
mtketh-max-gmac = <1>;
status = "okay";
};
&spi1 {
pinctrl-names = "default";
pinctrl-0 = <&spic_pins>;
status = "disabled";
};
&pio {
spic_pins: spi1-pins {
mux {
function = "spi";
groups = "spi1_1";
};
};
mmc0_pins_default: mmc0-pins-default {
mux {
function = "flash";
groups = "emmc_45";
};
};
mmc0_pins_uhs: mmc0-pins-uhs {
mux {
function = "flash";
groups = "emmc_45";
};
};
pcie_pins: pcie-pins {
mux {
function = "pcie";
groups = "pcie_pereset", "pcie_clk", "pcie_wake";
};
};
};
&pcie {
pinctrl-names = "default";
pinctrl-0 = <&pcie_pins>;
status = "okay";
};

View File

@@ -0,0 +1,21 @@
/dts-v1/;
#include "mt7981-sn-r1-common.dtsi"
/ {
model = "SN R1-Longlife";
compatible = "sn,r1-longlife", "mediatek,mt7981";
};
&mmc0 {
bus-width = <8>;
max-frequency = <26000000>;
no-sd;
no-sdio;
non-removable;
pinctrl-names = "default", "state_uhs";
pinctrl-0 = <&mmc0_pins_default>;
pinctrl-1 = <&mmc0_pins_uhs>;
vmmc-supply = <&reg_3p3v>;
non-removable;
status = "okay";
};

View File

@@ -1,163 +1,9 @@
/dts-v1/;
#include "mt7981.dtsi"
#include "mt7981-sn-r1-common.dtsi"
/ {
model = "SN R1";
compatible = "sn,r1", "mediatek,mt7981";
chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 \
earlycon=uart8250,mmio32,0x11002000 \
root=PARTLABEL=rootfs rootfstype=squashfs,f2fs";
};
aliases {
led-boot = &status_red_led;
led-failsafe = &status_red_led;
led-running = &status_blue_led;
led-upgrade = &status_yellow_led;
};
leds {
compatible = "gpio-leds";
status_blue_led: led-0 {
label = "blue:status";
gpios = <&pio 11 GPIO_ACTIVE_HIGH>;
};
status_yellow_led: led-1 {
label = "yellow:status";
gpios = <&pio 12 GPIO_ACTIVE_HIGH>;
};
status_red_led: led-2 {
label = "red:status";
gpios = <&pio 13 GPIO_ACTIVE_HIGH>;
};
};
gpio-keys {
compatible = "gpio-keys";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
};
wps {
label = "wps";
gpios = <&pio 0 GPIO_ACTIVE_HIGH>;
linux,code = <BTN_9>;
linux,input-type = <EV_SW>;
};
};
memory {
reg = <0 0x40000000 0 0x10000000>;
};
reg_3p3v: regulator-3p3v {
compatible = "regulator-fixed";
regulator-name = "fixed-3.3V";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
regulator-always-on;
};
gsw: gsw@0 {
compatible = "mediatek,mt753x";
mediatek,ethsys = <&ethsys>;
#address-cells = <1>;
#size-cells = <0>;
};
};
&uart0 {
status = "okay";
};
&watchdog {
status = "okay";
};
&eth {
status = "okay";
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
phy-mode = "gmii";
phy-handle = <&phy0>;
};
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
phy0: ethernet-phy@0 {
compatible = "ethernet-phy-id03a2.9461";
reg = <0>;
phy-mode = "gmii";
nvmem-cells = <&phy_calibration>;
nvmem-cell-names = "phy-cal-data";
};
};
};
&gsw {
mediatek,mdio = <&mdio>;
mediatek,portmap = "wllll";
mediatek,mdio_master_pinmux = <0>;
reset-gpios = <&pio 39 0>;
interrupt-parent = <&pio>;
interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
status = "okay";
port5: port@5 {
compatible = "mediatek,mt753x-port";
reg = <5>;
phy-mode = "sgmii";
fixed-link {
speed = <2500>;
full-duplex;
};
};
port6: port@6 {
compatible = "mediatek,mt753x-port";
mediatek,ssc-on;
reg = <6>;
phy-mode = "sgmii";
fixed-link {
speed = <2500>;
full-duplex;
};
};
};
&hnat {
mtketh-wan = "eth0.2";
mtketh-ppd = "eth0.1";
mtketh-lan = "eth0";
mtketh-max-gmac = <1>;
status = "okay";
};
&mmc0 {
@@ -174,45 +20,3 @@
non-removable;
status = "okay";
};
&spi1 {
pinctrl-names = "default";
pinctrl-0 = <&spic_pins>;
status = "disabled";
};
&pio {
spic_pins: spi1-pins {
mux {
function = "spi";
groups = "spi1_1";
};
};
mmc0_pins_default: mmc0-pins-default {
mux {
function = "flash";
groups = "emmc_45";
};
};
mmc0_pins_uhs: mmc0-pins-uhs {
mux {
function = "flash";
groups = "emmc_45";
};
};
pcie_pins: pcie-pins {
mux {
function = "pcie";
groups = "pcie_pereset", "pcie_clk", "pcie_wake";
};
};
};
&pcie {
pinctrl-names = "default";
pinctrl-0 = <&pcie_pins>;
status = "okay";
};

View File

@@ -833,3 +833,15 @@ define Device/sn_r1
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += sn_r1
define Device/sn_r1-longlife
DEVICE_VENDOR := SN
DEVICE_MODEL := R1-Longlife
DEVICE_DTS := mt7981-sn-r1-longlife
DEVICE_DTS_DIR := $(DTS_DIR)/mediatek
SUPPORTED_DEVICES := sn,r1-longlife
DEVICE_PACKAGES := f2fsck losetup mkf2fs f2fs-tools kmod-fs-f2fs kmod-mmc \
luci-app-samba4 e2fsprogs kmod-nvme mmc-utils
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += sn_r1-longlife

View File

@@ -103,7 +103,7 @@ mediatek_setup_interfaces()
ucidef_add_switch "switch0" \
"0:lan:1" "2:lan:2" "3:lan:3" "4:wan" "6u@eth0" "5u@eth1"
;;
sn,r1)
sn,r1*)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan:4" "0:wan" "6t@eth0"
@@ -285,7 +285,7 @@ mediatek_setup_macs()
echo "MacAddress=$b1mac" >> ${b1dat}
fi
;;
sn,r1)
sn,r1*)
lan_mac=$(mmc_get_mac_binary factory 0x2a)
wan_mac=$(mmc_get_mac_binary factory 0x24)
label_mac=$wan_mac

View File

@@ -19,7 +19,7 @@ do_extract_caldata() {
cmcc,xr30-emmc |\
cmcc,rax3000m-emmc |\
philips,hy3000 |\
sn,r1)
sn,r1*)
FIRMWARE=MT7981_iPAiLNA_EEPROM.bin
caldata_validate && exit 0
caldata_extract_mmc "factory" 0x0 0x1000

View File

@@ -220,7 +220,7 @@ platform_do_upgrade() {
cmcc,rax3000m-emmc |\
cmcc,xr30-emmc |\
philips,hy3000 |\
sn,r1 |\
sn,r1* |\
*emmc*)
CI_KERNPART="kernel"
CI_ROOTPART="rootfs"
@@ -272,7 +272,7 @@ platform_check_image() {
newland,nl-wr9103 |\
nradio,wt9103 |\
philips,hy3000 |\
sn,r1 |\
sn,r1* |\
*snand* |\
*emmc* |\
routerich,ax3000)