ath79: mynet-wifi-rangeextender: use nvmem

Userspace handling is deprecated.

Instead of reading nonstandard wl0_hwaddr, read et0macaddr and
increment. Avoids needing to patch driver.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2024-06-15 14:06:45 -07:00
parent 38214732b6
commit 63a9b86336
5 changed files with 28 additions and 11 deletions

View File

@ -110,14 +110,35 @@
};
nvram: partition@7e0000 {
compatible = "brcm,nvram";
label = "nvram";
reg = <0x7e0000 0x10000>;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
et0macaddr: et0macaddr {
#nvmem-cell-cells = <1>;
};
};
};
partition@7f0000 {
label = "art";
reg = <0x7f0000 0x10000>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
cal_art_1000: calibration@1000 {
reg = <0x1000 0x440>;
};
};
};
};
};
@ -129,8 +150,8 @@
ath9k: wifi@0,0 {
compatible = "pci168c,0030";
reg = <0x0000 0 0 0 0>;
qca,no-eeprom;
/* wifi MAC is stored in nvram */
nvmem-cells = <&cal_art_1000>, <&et0macaddr 1>;
nvmem-cell-names = "calibration", "mac-address";
};
};
@ -147,10 +168,12 @@
pll-data = <0x02000000 0x00000101 0x00001313>;
/* ethernet MAC is stored in nvram */
phy-mode = "rgmii-id";
phy-handle = <&phy4>;
nvmem-cells = <&et0macaddr 0>;
nvmem-cell-names = "mac-address";
gmac-config {
device = <&gmac>;
rgmii-gmac0 = <1>;

View File

@ -841,9 +841,6 @@ ath79_setup_macs()
wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n ar7100_esa)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
wd,mynet-wifi-rangeextender)
lan_mac=$(nvram get et0macaddr)
;;
xiaomi,aiot-ac2350)
lan_mac=$(mtd_get_mac_binary art 0x1002)
;;

View File

@ -53,10 +53,6 @@ case "$FIRMWARE" in
ubnt,rocket-m)
caldata_extract "art" 0x1000 0x1000
;;
wd,mynet-wifi-rangeextender)
caldata_extract "art" 0x1000 0x440
ath9k_patch_mac $(nvram get wl0_hwaddr)
;;
*)
caldata_die "board $board is not supported yet"
;;

View File

@ -18,6 +18,7 @@ CONFIG_MTD_SPI_NOR_SWP_DISABLE=y
# CONFIG_MTD_SPI_NOR_SWP_DISABLE_ON_VOLATILE is not set
CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y
CONFIG_MTD_SPLIT_EVA_FW=y
CONFIG_NVMEM_BRCM_NVRAM=y
CONFIG_NVMEM_SYSFS=y
CONFIG_NVMEM_U_BOOT_ENV=y
CONFIG_REALTEK_PHY=y

View File

@ -3226,7 +3226,7 @@ define Device/wd_mynet-wifi-rangeextender
SOC := ar9344
DEVICE_VENDOR := Western Digital
DEVICE_MODEL := My Net Wi-Fi Range Extender
DEVICE_PACKAGES := rssileds nvram -swconfig
DEVICE_PACKAGES := rssileds -swconfig
IMAGE_SIZE := 7808k
ADDPATTERN_ID := mynet-rext
ADDPATTERN_VERSION := 1.00.01