mpc85xx: use NVMEM for wifi

Userspace handling is deprecated. No need for any of this.

Calibration size was adjusted to 440, which is the standard value for
ath9k radios.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16125
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Rosen Penev 2024-08-09 13:40:27 -07:00 committed by Robert Marko
parent e031ea8aab
commit 7ac8279bd4
3 changed files with 28 additions and 36 deletions

View file

@ -1,33 +0,0 @@
#!/bin/sh
[ -e /lib/firmware/$FIRMWARE ] && exit 0
. /lib/functions/caldata.sh
board=$(board_name)
case "$FIRMWARE" in
"pci_wmac0.eeprom")
case $board in
tplink,tl-wdr4900-v1)
caldata_extract "caldata" 0x1000 0x800
ath9k_patch_mac $(mtd_get_mac_binary u-boot 0x4fc00)
;;
*)
caldata_die "board $board is not supported yet"
;;
esac
;;
"pci_wmac1.eeprom")
case $board in
tplink,tl-wdr4900-v1)
caldata_extract "caldata" 0x5000 0x800
ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary u-boot 0x4fc00) -1)
;;
*)
caldata_die "board $board is not supported yet"
;;
esac
;;
esac

View file

@ -92,6 +92,20 @@
reg = <0x00ff0000 0x00010000>; reg = <0x00ff0000 0x00010000>;
label = "caldata"; label = "caldata";
read-only; read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
cal_caldata_1000: calibration@1000 {
reg = <0x1000 0x440>;
};
cal_caldata_5000: calibration@5000 {
reg = <0x5000 0x440>;
};
};
}; };
}; };
}; };
@ -153,7 +167,6 @@
nvmem-cells = <&macaddr_uboot_4fc00 1>; nvmem-cells = <&macaddr_uboot_4fc00 1>;
nvmem-cell-names = "mac-address"; nvmem-cell-names = "mac-address";
}; };
port@2 { port@2 {
@ -252,6 +265,13 @@
0x1000000 0x0 0x0 0x1000000 0x0 0x0
0x1000000 0x0 0x0 0x1000000 0x0 0x0
0x0 0x100000>; 0x0 0x100000>;
wifi@0,0 {
compatible = "pci168c,0033";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&cal_caldata_1000>, <&macaddr_uboot_4fc00 0>;
nvmem-cell-names = "calibration", "mac-address";
};
}; };
}; };
@ -267,6 +287,13 @@
0x1000000 0x0 0x0 0x1000000 0x0 0x0
0x1000000 0x0 0x0 0x1000000 0x0 0x0
0x0 0x100000>; 0x0 0x100000>;
wifi@0,0 {
compatible = "pci168c,0030";
reg = <0x0000 0 0 0 0>;
nvmem-cells = <&cal_caldata_5000>, <&macaddr_uboot_4fc00 (-1)>;
nvmem-cell-names = "calibration", "mac-address";
};
}; };
}; };

View file

@ -58,14 +58,12 @@ static struct gpio_led tl_wdr4900_v1_wmac_leds_gpio[] = {
static struct ath9k_platform_data tl_wdr4900_v1_wmac0_data = { static struct ath9k_platform_data tl_wdr4900_v1_wmac0_data = {
.led_pin = 0, .led_pin = 0,
.eeprom_name = "pci_wmac0.eeprom",
.leds = tl_wdr4900_v1_wmac_leds_gpio, .leds = tl_wdr4900_v1_wmac_leds_gpio,
.num_leds = ARRAY_SIZE(tl_wdr4900_v1_wmac_leds_gpio), .num_leds = ARRAY_SIZE(tl_wdr4900_v1_wmac_leds_gpio),
}; };
static struct ath9k_platform_data tl_wdr4900_v1_wmac1_data = { static struct ath9k_platform_data tl_wdr4900_v1_wmac1_data = {
.led_pin = 0, .led_pin = 0,
.eeprom_name = "pci_wmac1.eeprom",
}; };
static void tl_wdr4900_v1_pci_wmac_fixup(struct pci_dev *dev) static void tl_wdr4900_v1_pci_wmac_fixup(struct pci_dev *dev)