mpc85xx: use NVMEM for wifi
authorRosen Penev <rosenp@gmail.com>
Fri, 9 Aug 2024 20:40:27 +0000 (13:40 -0700)
committerRobert Marko <robimarko@gmail.com>
Wed, 21 Aug 2024 19:39:24 +0000 (21:39 +0200)
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>
target/linux/mpc85xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom [deleted file]
target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts
target/linux/mpc85xx/files/arch/powerpc/platforms/85xx/tl_wdr4900_v1.c

diff --git a/target/linux/mpc85xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/mpc85xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
deleted file mode 100644 (file)
index be6ee40..0000000
+++ /dev/null
@@ -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
index 0b22360562996cd6123fb4292a5868cfdf273887..d8162f0dff5503188b69a56bd1e179bc2a6de45a 100644 (file)
                                                reg = <0x00ff0000 0x00010000>;
                                                label = "caldata";
                                                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>;
+                                                       };
+                                               };
                                        };
                                };
                        };
 
                                                nvmem-cells = <&macaddr_uboot_4fc00 1>;
                                                nvmem-cell-names = "mac-address";
-
                                        };
 
                                        port@2 {
                                  0x1000000 0x0 0x0
                                  0x1000000 0x0 0x0
                                  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";
+                       };
                };
        };
 
                                  0x1000000 0x0 0x0
                                  0x1000000 0x0 0x0
                                  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";
+                       };
                };
        };
 
index 87a97e65c897ca0f061eca2c6dd21371719887b4..095f1fb77d59612640f19e0a63954fe85da9a2cb 100644 (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 = {
        .led_pin = 0,
-       .eeprom_name = "pci_wmac0.eeprom",
        .leds = 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 = {
        .led_pin = 0,
-       .eeprom_name = "pci_wmac1.eeprom",
 };
 
 static void tl_wdr4900_v1_pci_wmac_fixup(struct pci_dev *dev)