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";
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 {
bus-width = <8>;
cap-mmc-highspeed;
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>;
#address-cells = <1>;
#size-cells = <0>;
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 {
@ -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 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_flash_pins>;
status = "okay";
spi_nand: flash@0 {
flash@0 {
compatible = "spi-nand";
#address-cells = <1>;
#size-cells = <1>;
compatible = "spi-nand";
reg = <0>;
spi-max-frequency = <52000000>;
@ -31,59 +41,77 @@
mediatek,bmt-max-reserved-blocks = <64>;
partitions {
compatible = "fixed-partitions";
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "bl2";
reg = <0x00000 0x0100000>;
read-only;
};
partition@100000 {
label = "u-boot-env";
reg = <0x100000 0x80000>;
};
factory: partition@180000 {
label = "factory";
reg = <0x180000 0x200000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "bl2";
reg = <0x00000 0x0100000>;
read-only;
macaddr_factory_24: macaddr@24 {
compatible = "mac-base";
reg = <0x24 0x6>;
#nvmem-cell-cells = <1>;
};
partition@100000 {
label = "u-boot-env";
reg = <0x100000 0x80000>;
macaddr_factory_2a: macaddr@2a {
compatible = "mac-base";
reg = <0x2a 0x6>;
#nvmem-cell-cells = <1>;
};
};
};
factory: partition@180000 {
label = "factory";
reg = <0x180000 0x200000>;
read-only;
};
partition@380000 {
label = "fip";
reg = <0x380000 0x200000>;
read-only;
};
partition@380000 {
label = "fip";
reg = <0x380000 0x200000>;
read-only;
};
partition@580000 {
label = "ubi";
reg = <0x580000 0x7200000>;
};
partition@580000 {
label = "ubi";
reg = <0x580000 0x7200000>;
};
};
};
};
&pio {
spi0_flash_pins: spi0-pins {
mux {
function = "spi";
groups = "spi0", "spi0_wp_hold";
};
mux {
function = "spi";
groups = "spi0", "spi0_wp_hold";
};
conf-pu {
pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
drive-strength = <8>;
mediatek,pull-up-adv = <0>; /* bias-disable */
};
conf-pu {
pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
drive-strength = <8>;
mediatek,pull-up-adv = <0>; /* bias-disable */
};
conf-pd {
pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
drive-strength = <8>;
mediatek,pull-up-adv = <0>; /* bias-disable */
};
conf-pd {
pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
drive-strength = <8>;
mediatek,pull-up-adv = <0>; /* bias-disable */
};
};
};

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 {
bus-width = <8>;
cap-mmc-highspeed;
@ -21,7 +31,46 @@
pinctrl-0 = <&mmc0_pins_default>;
pinctrl-1 = <&mmc0_pins_uhs>;
vmmc-supply = <&reg_3p3v>;
#address-cells = <1>;
#size-cells = <0>;
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 {
@ -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 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_flash_pins>;

View File

@ -66,9 +66,6 @@
reg = <0>;
phy-mode = "2500base-x";
nvmem-cells = <&macaddr_factory_2a>;
nvmem-cell-names = "mac-address";
fixed-link {
speed = <2500>;
full-duplex;
@ -81,9 +78,6 @@
reg = <1>;
phy-mode = "gmii";
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)
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)
label_mac="$(get_mac_binary "/dev/mmcblk0boot1" 0xa)"
wan_mac="$label_mac"

View File

@ -7,15 +7,6 @@
board=$(board_name)
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")
case "$board" in
asus,tuf-ax4200)

View File

@ -381,6 +381,22 @@ define Device/cmcc_xr30-nand
endef
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
DEVICE_VENDOR := Cudy
DEVICE_MODEL := TR3000