treewide: linksys: use nvmem MAC for hw_mac_addr
Some checks are pending
Build Kernel / Build all affected Kernels (push) Waiting to run

Given that Linksys is the same brand and probably use the same OEM, it
stands to reason all devinfo hw_mac_addr implementations are the same.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22092
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Rosen Penev 2026-02-18 17:57:22 -08:00 committed by Robert Marko
parent 581d10ebfc
commit ee5999cf78
20 changed files with 206 additions and 121 deletions

View file

@ -222,17 +222,6 @@ ipq40xx_setup_macs()
wan_mac=$(get_mac_label)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
linksys,ea6350v3|\
linksys,ea8300|\
linksys,mr6350|\
linksys,mr8300)
wan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
linksys,whw03)
wan_mac=$(mmc_get_mac_ascii devinfo hw_mac_addr)
lan_mac="$wan_mac"
;;
mikrotik,cap-ac|\
mikrotik,hap-ac2|\
mikrotik,hap-ac3|\

View file

@ -20,17 +20,6 @@ case "$FIRMWARE" in
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
;;
linksys,ea8300|\
linksys,mr6350|\
linksys,mr8300)
caldata_extract "ART" 0x9000 0x2f20
# OEM assigns 4 sequential MACs
ath10k_patch_mac $(macaddr_setbit_la $(macaddr_add "$(cat /sys/class/net/eth0/address)" 4))
;;
linksys,whw03)
caldata_extract_mmc "0:ART" 0x9000 0x2f20
ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3)
;;
netgear,rbr40|\
netgear,rbs40|\
netgear,rbr50|\
@ -88,16 +77,6 @@ case "$FIRMWARE" in
caldata_extract "ART" 0x1000 0x2f20
ath10k_patch_mac $(mtd_get_mac_ascii CFG1 RADIOADDR0)
;;
linksys,ea8300|\
linksys,mr6350|\
linksys,mr8300)
caldata_extract "ART" 0x1000 0x2f20
ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 2)
;;
linksys,whw03)
caldata_extract_mmc "0:ART" 0x1000 0x2f20
ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 1)
;;
mikrotik,cap-ac|\
mikrotik,hap-ac2|\
mikrotik,hap-ac3|\
@ -180,16 +159,6 @@ case "$FIRMWARE" in
caldata_extract "ART" 0x5000 0x2f20
ath10k_patch_mac $(mtd_get_mac_ascii CFG1 RADIOADDR1)
;;
linksys,ea8300|\
linksys,mr6350|\
linksys,mr8300)
caldata_extract "ART" 0x5000 0x2f20
ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3)
;;
linksys,whw03)
caldata_extract_mmc "0:ART" 0x5000 0x2f20
ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 2)
;;
mikrotik,cap-ac|\
mikrotik,hap-ac2|\
mikrotik,hap-ac3|\

View file

@ -19,19 +19,6 @@ preinit_set_mac_address() {
extreme-networks,ws-ap391x)
ip link set dev eth0 address $(mtd_get_mac_ascii CFG1 ethaddr)
;;
linksys,ea8300|\
linksys,mr6350|\
linksys,mr8300)
base_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
ip link set dev lan1 address $(macaddr_add "$base_mac" 1)
ip link set dev eth0 address $(macaddr_setbit "$base_mac" 7)
;;
linksys,whw03)
base_mac=$(mmc_get_mac_ascii devinfo hw_mac_addr)
ip link set dev eth0 address "$base_mac"
ip link set dev lan address "$base_mac"
ip link set dev wan address "$base_mac"
;;
mikrotik,wap-ac|\
mikrotik,wap-ac-lte|\
mikrotik,wap-r-ac)

View file

@ -331,6 +331,7 @@ CONFIG_NO_HZ_IDLE=y
CONFIG_NR_CPUS=4
CONFIG_NVMEM=y
CONFIG_NVMEM_LAYOUTS=y
CONFIG_NVMEM_LAYOUT_ASCII_ENV=y
CONFIG_NVMEM_LAYOUT_U_BOOT_ENV=y
CONFIG_NVMEM_QCOM_QFPROM=y
# CONFIG_NVMEM_QCOM_SEC_QFPROM is not set

View file

@ -93,11 +93,8 @@
qcom,ath10k-calibration-variant = "linksys-ea8300-fcc";
};
&pcie_bridge0 {
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x00010000 0 0 0 0>;
ieee80211-freq-limit = <5490000 5835000>;
qcom,ath10k-calibration-variant = "linksys-ea8300-fcc";
};
&wifi2 {
status = "okay";
ieee80211-freq-limit = <5490000 5835000>;
qcom,ath10k-calibration-variant = "linksys-ea8300-fcc";
};

View file

@ -18,7 +18,7 @@
// Top panel LEDs, above Linksys logo
leds {
compatible = "gpio-leds";
led_blue: led-blue {
color = <LED_COLOR_ID_BLUE>;
function = LED_FUNCTION_STATUS;
@ -64,7 +64,7 @@
reset-delay-us = <2000>;
reset-post-delay-us = <5000>;
};
&tlmm {
status = "okay";

View file

@ -79,11 +79,8 @@
qcom,ath10k-calibration-variant = "linksys-mr8300-v0-fcc";
};
&pcie_bridge0 {
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x00010000 0 0 0 0>;
ieee80211-freq-limit = <5490000 5835000>;
qcom,ath10k-calibration-variant = "linksys-mr8300-v0-fcc";
};
&wifi2 {
status = "okay";
ieee80211-freq-limit = <5490000 5835000>;
qcom,ath10k-calibration-variant = "linksys-mr8300-v0-fcc";
};

View file

@ -54,14 +54,72 @@
sd-ldo-gpios = <&tlmm 33 GPIO_ACTIVE_LOW>;
vqmmc-supply = <&vqmmc>;
card@0 {
compatible = "mmc-card";
reg = <0>;
block {
compatible = "block-device";
partitions {
block-partition-art {
partname = "art";
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_1000: pre-calibration@1000 {
reg = <0x1000 0x2f20>;
};
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
precal_art_9000: pre-calibration@9000 {
reg = <0x9000 0x2f20>;
};
};
};
block-partition-devinfo {
partname = "devinfo";
nvmem-layout {
compatible = "ascii-eq-delim-env";
#address-cells = <1>;
#size-cells = <1>;
hw_mac_addr: hw_mac_addr {
compatible = "mac-base";
#nvmem-cell-cells = <1>;
};
};
};
};
};
};
};
&gmac {
nvmem-cells = <&hw_mac_addr 0>;
nvmem-cell-names = "mac-address";
};
&wifi0 {
qcom,ath10k-calibration-variant = "linksys-whw03";
nvmem-cells = <&precal_art_1000>, <&hw_mac_addr 1>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
&wifi1 {
qcom,ath10k-calibration-variant = "linksys-whw03";
nvmem-cells = <&precal_art_5000>, <&hw_mac_addr 2>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
&pcie_bridge0 {
@ -70,5 +128,7 @@
reg = <0x00010000 0 0 0 0>;
ieee80211-freq-limit = <5490000 5835000>;
qcom,ath10k-calibration-variant = "linksys-whw03";
nvmem-cells = <&precal_art_9000>, <&hw_mac_addr 3>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};

View file

@ -8,7 +8,6 @@
/ {
aliases {
ethernet0 = &gmac;
led-boot = &led_blue;
led-failsafe = &led_red;
led-running = &led_blue;

View file

@ -25,12 +25,6 @@
bootargs-append = " root=/dev/ubiblock0_0 rootfstype=squashfs ro";
};
aliases {
// TODO: Verify if the ethernet0 alias is needed
ethernet0 = &gmac;
};
soc {
tcsr@1949000 {
compatible = "qcom,tcsr";
@ -141,6 +135,24 @@
label = "ART";
reg = <0x400000 0x80000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
precal_art_1000: pre-calibration@1000 {
reg = <0x1000 0x2f20>;
};
precal_art_5000: pre-calibration@5000 {
reg = <0x5000 0x2f20>;
};
precal_art_9000: pre-calibration@9000 {
reg = <0x9000 0x2f20>;
};
};
};
partition@480000 {
@ -165,6 +177,17 @@
label = "devinfo";
reg = <0x740000 0x40000>;
read-only;
nvmem-layout {
compatible = "ascii-eq-delim-env";
#address-cells = <1>;
#size-cells = <1>;
hw_mac_addr: hw_mac_addr {
compatible = "mac-base";
#nvmem-cell-cells = <1>;
};
};
};
partition@780000 {
@ -291,6 +314,9 @@
&gmac {
status = "okay";
nvmem-cells = <&hw_mac_addr 1>;
nvmem-cell-names = "mac-address";
};
&switch {
@ -315,4 +341,28 @@
&swport5 {
status = "okay";
nvmem-cells = <&hw_mac_addr 0>;
nvmem-cell-names = "mac-address";
};
&wifi0 {
nvmem-cells = <&precal_art_1000>, <&hw_mac_addr 2>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
&wifi1 {
nvmem-cells = <&precal_art_5000>, <&hw_mac_addr 3>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
&pcie_bridge0 {
wifi2: wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x00010000 0 0 0 0>;
nvmem-cells = <&precal_art_9000>, <&hw_mac_addr 4>;
nvmem-cell-names = "pre-calibration", "mac-address";
status = "disabled";
};
};

View file

@ -17,10 +17,6 @@ case "$board" in
[ "$PHYNBR" = "0" ] && echo $(mtd_get_mac_ascii CFG1 RADIOADDR0) > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && echo $(mtd_get_mac_ascii CFG1 RADIOADDR1) > /sys${DEVPATH}/macaddress
;;
linksys,ea7500-v1|\
linksys,ea8500)
macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) $(($PHYNBR + 1)) > /sys${DEVPATH}/macaddress
;;
esac
OPATH=${DEVPATH##/devices/platform/}

View file

@ -58,8 +58,8 @@
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x10000 0 0 0 0>;
nvmem-cells = <&precal_art_1000>;
nvmem-cell-names = "pre-calibration";
nvmem-cells = <&precal_art_1000>, <&hw_mac_addr 1>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};
@ -71,8 +71,8 @@
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x10000 0 0 0 0>;
nvmem-cells = <&precal_art_5000>;
nvmem-cell-names = "pre-calibration";
nvmem-cells = <&precal_art_5000>, <&hw_mac_addr 2>;
nvmem-cell-names = "pre-calibration", "mac-address";
};
};

View file

@ -14,6 +14,7 @@
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
label-mac-device = &gmac0;
serial0 = &uart0;
};
@ -212,6 +213,18 @@
label = "devinfo";
reg = <0x51c0000 0x40000>;
read-only;
nvmem-layout {
compatible = "ascii-eq-delim-env";
#address-cells = <1>;
#size-cells = <1>;
hw_mac_addr: hw_mac_addr {
compatible = "mac-base";
#nvmem-cell-cells = <1>;
};
};
};
partition@5200000 {
@ -272,6 +285,16 @@
};
};
&gmac0 {
nvmem-cells = <&hw_mac_addr 0>;
nvmem-cell-names = "mac-address";
};
&gmac1 {
nvmem-cells = <&hw_mac_addr 0>;
nvmem-cell-names = "mac-address";
};
&ssusb {
vusb33-supply = <&reg_3p3v>;
vbus-supply = <&reg_5v>;

View file

@ -29,11 +29,6 @@ mediatek_setup_macs()
local board="$1"
case $board in
linksys,ea7500-v3)
lan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
wan_mac=$lan_mac
label_mac=$lan_mac
;;
netgear,ex6250-v2)
lan_mac=$(mtd_get_mac_ascii Config mac)
label_mac=$lan_mac

View file

@ -245,6 +245,7 @@ CONFIG_NO_HZ_IDLE=y
CONFIG_NR_CPUS=2
CONFIG_NVMEM=y
CONFIG_NVMEM_LAYOUTS=y
CONFIG_NVMEM_LAYOUT_ASCII_ENV=y
# CONFIG_NVMEM_LAYOUT_ADTRAN is not set
# CONFIG_NVMEM_MTK_EFUSE is not set
CONFIG_NVMEM_SYSFS=y

View file

@ -15,6 +15,7 @@
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
label-mac-device = &gmac0;
};
chosen {
@ -116,6 +117,18 @@
label = "devinfo";
reg = <0x140000 0x40000>;
read-only;
nvmem-layout {
compatible = "ascii-eq-delim-env";
#address-cells = <1>;
#size-cells = <1>;
hw_mac_addr: hw_mac_addr {
compatible = "mac-base";
#nvmem-cell-cells = <1>;
};
};
};
partition@180000 {
@ -155,8 +168,8 @@
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&eeprom_factory_0>;
nvmem-cell-names = "eeprom";
nvmem-cells = <&eeprom_factory_0>, <&hw_mac_addr 1>;
nvmem-cell-names = "eeprom", "mac-address";
};
};
@ -164,15 +177,23 @@
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&eeprom_factory_8000>;
nvmem-cell-names = "eeprom";
nvmem-cells = <&eeprom_factory_8000>, <&hw_mac_addr 2>;
nvmem-cell-names = "eeprom", "mac-address";
};
};
&gmac0 {
nvmem-cells = <&hw_mac_addr 0>;
nvmem-cell-names = "mac-address";
};
&gmac1 {
status = "okay";
label = "wan";
phy-handle = <&ethphy4>;
nvmem-cells = <&hw_mac_addr 0>;
nvmem-cell-names = "mac-address";
};
&ethphy4 {

View file

@ -12,6 +12,7 @@
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
label-mac-device = &gmac0;
};
chosen {
@ -130,6 +131,18 @@
label = "devinfo";
reg = <0x140000 0x40000>;
read-only;
nvmem-layout {
compatible = "ascii-eq-delim-env";
#address-cells = <1>;
#size-cells = <1>;
hw_mac_addr: hw_mac_addr {
compatible = "mac-base";
#nvmem-cell-cells = <1>;
};
};
};
partition@180000 {
@ -183,8 +196,8 @@
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&eeprom_factory_0>;
nvmem-cell-names = "eeprom";
nvmem-cells = <&eeprom_factory_0>, <&hw_mac_addr 1>;
nvmem-cell-names = "eeprom", "mac-address";
};
};
@ -192,15 +205,23 @@
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&eeprom_factory_8000>;
nvmem-cell-names = "eeprom";
nvmem-cells = <&eeprom_factory_8000>, <&hw_mac_addr 2>;
nvmem-cell-names = "eeprom", "mac-address";
};
};
&gmac0 {
nvmem-cells = <&hw_mac_addr 0>;
nvmem-cell-names = "mac-address";
};
&gmac1 {
status = "okay";
label = "wan";
phy-handle = <&ethphy0>;
nvmem-cells = <&hw_mac_addr 0>;
nvmem-cell-names = "mac-address";
};
&ethphy0 {

View file

@ -293,17 +293,6 @@ ramips_setup_macs()
wan_mac=$lan_mac
label_mac=$lan_mac
;;
linksys,e5600|\
linksys,ea6350-v4|\
linksys,ea7300-v1|\
linksys,ea7300-v2|\
linksys,ea7500-v2|\
linksys,ea8100-v1|\
linksys,ea8100-v2)
lan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
wan_mac=$lan_mac
label_mac=$lan_mac
;;
belkin,rt1800|\
linksys,e7350)
lan_mac=$(mtd_get_mac_ascii Config lan_hwaddr)

View file

@ -117,17 +117,6 @@ case "$board" in
[ "$PHYNBR" = "1" ] && \
macaddr_setbit_la "$(mtd_get_mac_binary rf-eeprom 0x4)" > /sys${DEVPATH}/macaddress
;;
linksys,e5600|\
linksys,ea6350-v4|\
linksys,ea7300-v1|\
linksys,ea7300-v2|\
linksys,ea7500-v2|\
linksys,ea8100-v1|\
linksys,ea8100-v2)
hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
;;
belkin,rt1800|\
linksys,e7350)
hw_mac_addr=$(mtd_get_mac_ascii Config wan_hwaddr)

View file

@ -200,6 +200,7 @@ CONFIG_NO_HZ_IDLE=y
CONFIG_NR_CPUS=4
CONFIG_NVMEM=y
CONFIG_NVMEM_LAYOUTS=y
CONFIG_NVMEM_LAYOUT_ASCII_ENV=y
CONFIG_NVMEM_LAYOUT_MIKROTIK=y
CONFIG_NVMEM_LAYOUT_U_BOOT_ENV=y
CONFIG_OF=y