ath79: calibrate all ar9344 tl-WDRxxxx with nvmem
authorEdward Chow <equu@openmail.cc>
Wed, 9 Nov 2022 09:18:17 +0000 (17:18 +0800)
committerHauke Mehrtens <hauke@hauke-m.de>
Fri, 18 Nov 2022 19:27:52 +0000 (20:27 +0100)
Driver for both soc (2.4GHz Wifi) and pci (5 GHz) now pull the calibration
data from the nvmem subsystem.

This allows us to move the userspace caldata extraction for the pci-e ath9k
supported wifi into the device-tree definition of the device.

wmac's nodes are also changed over to use nvmem-cells over OpenWrt's
custom mtd-cal-data property.

The wifi mac address remains correct after these changes, because When both
"mac-address" and "calibration" are defined, the effective mac address
comes from the cell corresponding to "mac-address" and
mac-address-increment.

Test passed on my tplink tl-wdr4310.

Signed-off-by: Edward Chow <equu@openmail.cc>
target/linux/ath79/dts/ar9344_tplink_tl-wdr3500-v1.dts
target/linux/ath79/dts/ar9344_tplink_tl-wdr4300.dtsi
target/linux/ath79/dts/ar9344_tplink_tl-wdrxxxx.dtsi
target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom

index 77f6637188eb9e771881d168395f74992a746b80..1600e12b64481607a476a233d4bb909f32c22ce4 100644 (file)
 };
 
 &ath9k {
-       nvmem-cells = <&macaddr_uboot_1fc00>;
-       nvmem-cell-names = "mac-address";
        mac-address-increment = <1>;
 };
 
-&wmac {
-       nvmem-cells = <&macaddr_uboot_1fc00>;
-       nvmem-cell-names = "mac-address";
-};
-
 &eth1 {
        status = "okay";
 
        nvmem-cell-names = "mac-address";
        mac-address-increment = <2>;
 };
-
-&uboot {
-       compatible = "nvmem-cells";
-       #address-cells = <1>;
-       #size-cells = <1>;
-
-       macaddr_uboot_1fc00: macaddr@1fc00 {
-               reg = <0x1fc00 0x6>;
-       };
-};
index 55ddb741847b77109fd20af9fcf16a4167dff8c5..d2791aee709d9cfd2e4fc032243e71fffe5d717f 100644 (file)
        status = "okay";
 };
 
-&ath9k {
-       nvmem-cells = <&macaddr_uboot_1fc00>;
-       nvmem-cell-names = "mac-address";
-};
-
 &wmac {
-       nvmem-cells = <&macaddr_uboot_1fc00>;
-       nvmem-cell-names = "mac-address";
        mac-address-increment = <(-1)>;
 };
 
        phy-mode = "rgmii";
        phy-handle = <&phy0>;
 };
-
-&uboot {
-       compatible = "nvmem-cells";
-       #address-cells = <1>;
-       #size-cells = <1>;
-
-       macaddr_uboot_1fc00: macaddr@1fc00 {
-               reg = <0x1fc00 0x6>;
-       };
-};
index a3f4dc036d987d43ab67d5ca1876559a5d3e7c82..a2649d19e9356e9615b2ff4d8f65f3f33b46d41f 100644 (file)
        ath9k: wifi@0,0 {
                compatible = "pci168c,0033";
                reg = <0x0000 0 0 0 0>;
-               qca,no-eeprom;
                #gpio-cells = <2>;
                gpio-controller;
+               nvmem-cells = <&macaddr_uboot_1fc00>, <&cal_art_5000>;
+               nvmem-cell-names = "mac-address", "calibration";
        };
 };
 
 &wmac {
        status = "okay";
+       nvmem-cells = <&macaddr_uboot_1fc00>, <&cal_art_1000>;
+       nvmem-cell-names = "mac-address", "calibration";
+};
+
+&uboot {
+       compatible = "nvmem-cells";
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       macaddr_uboot_1fc00: macaddr@1fc00 {
+               reg = <0x1fc00 0x6>;
+       };
+};
 
-       mtd-cal-data = <&art 0x1000>;
+&art {
+       compatible = "nvmem-cells";
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       cal_art_1000: cal@1000 {
+               reg = <0x1000 0x440>;
+       };
+
+       cal_art_5000: cal@5000 {
+               reg = <0x5000 0x440>;
+       };
 };
index 924d6407afcfc29c310c101dd072561bde092795..bddaf0bdf8f35179c273095d2b26e99fb6c20378 100644 (file)
@@ -89,11 +89,6 @@ case "$FIRMWARE" in
        engenius,ecb600|\
        mercury,mw4530r-v1|\
        ocedo,raccoon|\
-       tplink,tl-wdr3500-v1|\
-       tplink,tl-wdr3600-v1|\
-       tplink,tl-wdr4300-v1|\
-       tplink,tl-wdr4300-v1-il|\
-       tplink,tl-wdr4310-v1|\
        ubnt,unifi-ap-pro|\
        watchguard,ap100|\
        watchguard,ap200|\