mediatek: refresh mt7981 support

This commit is contained in:
coolsnowwolf 2025-06-28 21:10:40 +08:00
parent d0d82a4fc6
commit 218cfcd6b9
9 changed files with 222 additions and 67 deletions

View File

@ -8,21 +8,69 @@
compatible = "cmcc,rax3000m-emmc", "mediatek,mt7981"; compatible = "cmcc,rax3000m-emmc", "mediatek,mt7981";
chosen { chosen {
bootargs = "root=PARTLABEL=rootfs rootwait rootfstype=squashfs,f2fs"; bootargs = "root=PARTLABEL=rootfs rootwait";
}; };
}; };
&gmac0 {
nvmem-cells = <&macaddr_factory_2a>;
nvmem-cell-names = "mac-address";
};
&gmac1 {
nvmem-cells = <&macaddr_factory_24>;
nvmem-cell-names = "mac-address";
};
&mmc0 { &mmc0 {
bus-width = <8>; bus-width = <8>;
cap-mmc-highspeed;
max-frequency = <26000000>; max-frequency = <26000000>;
no-sd;
no-sdio;
non-removable; non-removable;
pinctrl-names = "default", "state_uhs"; pinctrl-names = "default", "state_uhs";
pinctrl-0 = <&mmc0_pins_default>; pinctrl-0 = <&mmc0_pins_default>;
pinctrl-1 = <&mmc0_pins_uhs>; pinctrl-1 = <&mmc0_pins_uhs>;
vmmc-supply = <&reg_3p3v>; vmmc-supply = <&reg_3p3v>;
#address-cells = <1>;
#size-cells = <0>;
status = "okay"; status = "okay";
card@0 {
compatible = "mmc-card";
reg = <0>;
block {
compatible = "block-device";
partitions {
block-partition-factory {
partname = "factory";
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
eeprom_factory_0: eeprom@0 {
reg = <0x0 0x1000>;
};
macaddr_factory_24: macaddr@24 {
compatible = "mac-base";
reg = <0x24 0x6>;
#nvmem-cell-cells = <1>;
};
macaddr_factory_2a: macaddr@2a {
compatible = "mac-base";
reg = <0x2a 0x6>;
#nvmem-cell-cells = <1>;
};
};
};
};
};
};
}; };
&pio { &pio {
@ -40,3 +88,8 @@
}; };
}; };
}; };
&wifi {
nvmem-cells = <&eeprom_factory_0>;
nvmem-cell-names = "eeprom";
};

View File

@ -12,15 +12,25 @@
}; };
}; };
&gmac0 {
nvmem-cells = <&macaddr_factory_2a>;
nvmem-cell-names = "mac-address";
};
&gmac1 {
nvmem-cells = <&macaddr_factory_24>;
nvmem-cell-names = "mac-address";
};
&spi0 { &spi0 {
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&spi0_flash_pins>; pinctrl-0 = <&spi0_flash_pins>;
status = "okay"; status = "okay";
spi_nand: flash@0 { flash@0 {
compatible = "spi-nand";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
compatible = "spi-nand";
reg = <0>; reg = <0>;
spi-max-frequency = <52000000>; spi-max-frequency = <52000000>;
@ -50,6 +60,24 @@
label = "factory"; label = "factory";
reg = <0x180000 0x200000>; reg = <0x180000 0x200000>;
read-only; read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
macaddr_factory_24: macaddr@24 {
compatible = "mac-base";
reg = <0x24 0x6>;
#nvmem-cell-cells = <1>;
};
macaddr_factory_2a: macaddr@2a {
compatible = "mac-base";
reg = <0x2a 0x6>;
#nvmem-cell-cells = <1>;
};
};
}; };
partition@380000 { partition@380000 {

View File

@ -12,6 +12,16 @@
}; };
}; };
&gmac0 {
nvmem-cells = <&macaddr_factory_2a>;
nvmem-cell-names = "mac-address";
};
&gmac1 {
nvmem-cells = <&macaddr_factory_24>;
nvmem-cell-names = "mac-address";
};
&mmc0 { &mmc0 {
bus-width = <8>; bus-width = <8>;
cap-mmc-highspeed; cap-mmc-highspeed;
@ -21,7 +31,46 @@
pinctrl-0 = <&mmc0_pins_default>; pinctrl-0 = <&mmc0_pins_default>;
pinctrl-1 = <&mmc0_pins_uhs>; pinctrl-1 = <&mmc0_pins_uhs>;
vmmc-supply = <&reg_3p3v>; vmmc-supply = <&reg_3p3v>;
#address-cells = <1>;
#size-cells = <0>;
status = "okay"; status = "okay";
card@0 {
compatible = "mmc-card";
reg = <0>;
block {
compatible = "block-device";
partitions {
block-partition-factory {
partname = "factory";
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
eeprom_factory_0: eeprom@0 {
reg = <0x0 0x1000>;
};
macaddr_factory_24: macaddr@24 {
compatible = "mac-base";
reg = <0x24 0x6>;
#nvmem-cell-cells = <1>;
};
macaddr_factory_2a: macaddr@2a {
compatible = "mac-base";
reg = <0x2a 0x6>;
#nvmem-cell-cells = <1>;
};
};
};
};
};
};
}; };
&pio { &pio {
@ -39,3 +88,8 @@
}; };
}; };
}; };
&wifi {
nvmem-cells = <&eeprom_factory_0>;
nvmem-cell-names = "eeprom";
};

View File

@ -12,6 +12,16 @@
}; };
}; };
&gmac0 {
nvmem-cells = <&macaddr_factory_2a>;
nvmem-cell-names = "mac-address";
};
&gmac1 {
nvmem-cells = <&macaddr_factory_24>;
nvmem-cell-names = "mac-address";
};
&spi0 { &spi0 {
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&spi0_flash_pins>; pinctrl-0 = <&spi0_flash_pins>;

View File

@ -66,9 +66,6 @@
reg = <0>; reg = <0>;
phy-mode = "2500base-x"; phy-mode = "2500base-x";
nvmem-cells = <&macaddr_factory_2a>;
nvmem-cell-names = "mac-address";
fixed-link { fixed-link {
speed = <2500>; speed = <2500>;
full-duplex; full-duplex;
@ -81,9 +78,6 @@
reg = <1>; reg = <1>;
phy-mode = "gmii"; phy-mode = "gmii";
phy-handle = <&int_gbe_phy>; phy-handle = <&int_gbe_phy>;
nvmem-cells = <&macaddr_factory_24>;
nvmem-cell-names = "mac-address";
}; };
}; };

View File

@ -0,0 +1,19 @@
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
#include "mt7981b-cudy-tr3000-v1.dts"
/ {
model = "Cudy TR3000 256MB v1";
compatible = "cudy,tr3000-256mb-v1", "mediatek,mt7981";
};
&spi0 {
flash@0 {
partitions {
partition@5c0000 {
label = "ubi";
reg = <0x5c0000 0xe600000>;
};
};
};
};

View File

@ -108,16 +108,6 @@ mediatek_setup_macs()
bananapi,bpi-r4) bananapi,bpi-r4)
wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1) wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1)
;; ;;
cmcc,rax3000m-emmc)
wan_mac=$(mmc_get_mac_binary factory 0x2a)
lan_mac=$(mmc_get_mac_binary factory 0x24)
label_mac=$wan_mac
;;
cmcc,rax3000m-nand)
wan_mac=$(mtd_get_mac_binary factory 0x2a)
lan_mac=$(mtd_get_mac_binary factory 0x24)
label_mac=$lan_mac
;;
glinet,gl-mt2500) glinet,gl-mt2500)
label_mac="$(get_mac_binary "/dev/mmcblk0boot1" 0xa)" label_mac="$(get_mac_binary "/dev/mmcblk0boot1" 0xa)"
wan_mac="$label_mac" wan_mac="$label_mac"

View File

@ -7,15 +7,6 @@
board=$(board_name) board=$(board_name)
case "$FIRMWARE" in case "$FIRMWARE" in
"mediatek/mt7981_eeprom_mt7976_dbdc.bin")
case "$board" in
cmcc,rax3000m-emmc|\
cmcc,xr30-emmc|\
huasifei,wh3000-emmc)
caldata_extract_mmc "factory" 0x0 0x1000
;;
esac
;;
"mediatek/mt7986_eeprom_mt7976_dbdc.bin") "mediatek/mt7986_eeprom_mt7976_dbdc.bin")
case "$board" in case "$board" in
asus,tuf-ax4200) asus,tuf-ax4200)

View File

@ -381,6 +381,22 @@ define Device/cmcc_xr30-nand
endef endef
TARGET_DEVICES += cmcc_xr30-nand TARGET_DEVICES += cmcc_xr30-nand
define Device/cudy_tr3000-256mb-v1
DEVICE_VENDOR := Cudy
DEVICE_MODEL := TR3000
DEVICE_VARIANT := 256mb v1
DEVICE_DTS := mt7981b-cudy-tr3000-256mb-v1
DEVICE_DTS_DIR := ../dts
SUPPORTED_DEVICES += R103
UBINIZE_OPTS := -E 5
BLOCKSIZE := 128k
PAGESIZE := 2048
KERNEL_IN_UBI := 1
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
DEVICE_PACKAGES := kmod-usb3 kmod-mt7981-firmware mt7981-wo-firmware
endef
TARGET_DEVICES += cudy_tr3000-256mb-v1
define Device/cudy_tr3000-mod define Device/cudy_tr3000-mod
DEVICE_VENDOR := Cudy DEVICE_VENDOR := Cudy
DEVICE_MODEL := TR3000 DEVICE_MODEL := TR3000