ath79: calibrate dlink dir-825 b1 with nvmem
authorEdward Chow <equu@openmail.cc>
Sun, 20 Nov 2022 05:49:45 +0000 (13:49 +0800)
committerChristian Lamparter <chunkeey@gmail.com>
Sun, 26 Mar 2023 14:39:37 +0000 (16:39 +0200)
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.

Currently, only ethernet devices uses the mac address of
"mac-address-ascii" cells, while PCI ath9k devices uses the mac address
within calibration data.

Signed-off-by: Edward Chow <equu@openmail.cc>
(restored switch configuration in 02_network, integrated caldata into
partition)
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
target/linux/ath79/dts/ar7161_dlink_dir-825-b1.dts
target/linux/ath79/generic/base-files/etc/board.d/02_network
target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom

index 6934a8f952bec892801ce7c0ee6f58a7d9f478ce..0e39be7d0bb97cb3a19daff9e0891197a19241b7 100644 (file)
        ath9k0: wifi@0,11 {
                compatible = "pci168c,0029";
                reg = <0x8800 0 0 0 0>;
-               qca,no-eeprom;
+               nvmem-cells = <&macaddr_lan>, <&cal_art_1000>;
+               nvmem-cell-names = "mac-address-ascii", "calibration";
                #gpio-cells = <2>;
                gpio-controller;
        };
        ath9k1: wifi@0,12 {
                compatible = "pci168c,0029";
                reg = <0x9000 0 0 0 0>;
-               qca,no-eeprom;
+               nvmem-cells = <&macaddr_wan>, <&cal_art_5000>;
+               nvmem-cell-names = "mac-address-ascii", "calibration";
+               mac-address-increment = <1>;
                #gpio-cells = <2>;
                gpio-controller;
        };
                        };
 
                        partition@660000 {
+                               compatible = "nvmem-cells";
                                label = "caldata";
                                reg = <0x660000 0x010000>;
                                read-only;
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               cal_art_1000: cal@1000 {
+                                       reg = <0x1000 0xeb8>;
+                               };
+
+                               cal_art_5000: cal@5000 {
+                                       reg = <0x5000 0xeb8>;
+                               };
+
+                               macaddr_lan: macaddr@ffa0 {
+                                       reg = <0xffa0 0x11>;
+                               };
+
+                               macaddr_wan: macaddr@ffb4 {
+                                       reg = <0xffb4 0x11>;
+                               };
                        };
 
                        fwconcat1: partition@670000 {
 
        pll-data = <0x11110000 0x00001099 0x00991099>;
 
+       nvmem-cells = <&macaddr_lan>;
+       nvmem-cell-names = "mac-address-ascii";
+
        fixed-link {
                speed = <1000>;
                full-duplex;
 
        pll-data = <0x11110000 0x00001099 0x00991099>;
 
+       nvmem-cells = <&macaddr_wan>;
+       nvmem-cell-names = "mac-address-ascii";
+
        phy-handle = <&phy4>;
 };
+
index 31ea891d5727bafd906d587c618df771e7968e85..1e439b1e2f481b4d7d5cc657a9da66cc0e65b83d 100644 (file)
@@ -634,7 +634,6 @@ ath79_setup_macs()
        dlink,dir-629-a1)
                wan_mac=$(mtd_get_mac_text "mfcdata" 0x6a)
                ;;
-       dlink,dir-825-b1|\
        trendnet,tew-673gru)
                lan_mac=$(mtd_get_mac_text "caldata" 0xffa0)
                wan_mac=$(mtd_get_mac_text "caldata" 0xffb4)
index 9827508c04a5d4432a3a598047343f2743fc04fc..022f5e2947774254230270edc996a0c750f25979 100644 (file)
@@ -124,7 +124,6 @@ case "$FIRMWARE" in
        buffalo,wzr-hp-ag300h)
                caldata_extract "art" 0x1000 0xeb8
                ;;
-       dlink,dir-825-b1|\
        trendnet,tew-673gru)
                caldata_extract "caldata" 0x1000 0xeb8
                ath9k_patch_mac_crc $(mtd_get_mac_text "caldata" 0xffa0) 0x20c
@@ -143,7 +142,6 @@ case "$FIRMWARE" in
        buffalo,wzr-hp-ag300h)
                caldata_extract "art" 0x5000 0xeb8
                ;;
-       dlink,dir-825-b1|\
        trendnet,tew-673gru)
                caldata_extract "caldata" 0x5000 0xeb8
                ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_text "caldata" 0xffb4) 1) 0x20c