ath79: utilize nvmem on Netgear EX7300 v2
authorSungbo Eo <mans0n@gorani.run>
Tue, 8 Feb 2022 16:32:47 +0000 (01:32 +0900)
committerSungbo Eo <mans0n@gorani.run>
Sun, 20 Feb 2022 04:45:06 +0000 (13:45 +0900)
mtd-mac-address should no longer be used after commit 5ae2e786395c
("kernel: drop support for mtd-mac-address"). Convert it to nvmem-cells.

While at it, also convert OpenWrt's custom mtd-cal-data property and
userspace pre-calibration data extraction to the nvmem implementation.

Note: nvmem-cells in QCN5502 wmac has not been tested.

Fixes: c32008a37b81 ("ath79: add partial support for Netgear EX7300v2")
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
target/linux/ath79/dts/qcn5502_netgear_ex7300-v2.dts
target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata

index ba8dae0b362968ae68c746abeac1b9024175cda2..e5d897029dd5409d0a1d1cf70fe80332eee07928 100644 (file)
 
 &pcie {
        status = "okay";
+
+       wifi@0,0 {
+               compatible = "qcom,ath10k";
+               reg = <0 0 0 0 0>;
+
+               nvmem-cells = <&macaddr_artmtd_c>, <&precal_art_5000>;
+               nvmem-cell-names = "mac-address", "pre-calibration";
+       };
 };
 
 &pll {
                        #address-cells = <1>;
                        #size-cells = <1>;
 
-                       uboot: partition@0 {
+                       partition@0 {
                                label = "u-boot";
                                reg = <0x000000 0x040000>;
                                read-only;
                                read-only;
                        };
 
-                       artmtd: partition@fe0000 {
+                       partition@fe0000 {
                                label = "artmtd";
                                reg = <0xfe0000 0x10000>;
+
+                               compatible = "nvmem-cells";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               macaddr_artmtd_0: macaddr@0 {
+                                       reg = <0x0 0x6>;
+                               };
+
+                               macaddr_artmtd_6: macaddr@6 {
+                                       reg = <0x6 0x6>;
+                               };
+
+                               macaddr_artmtd_c: macaddr@c {
+                                       reg = <0xc 0x6>;
+                               };
                        };
 
-                       art: partition@ff0000 {
+                       partition@ff0000 {
                                label = "art";
                                reg = <0xff0000 0x10000>;
                                read-only;
+
+                               compatible = "nvmem-cells";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               cal_art_1000: cal@1000 {
+                                       reg = <0x1000 0x440>;
+                               };
+
+                               precal_art_5000: precal@5000 {
+                                       reg = <0x5000 0x2f20>;
+                               };
                        };
                };
        };
 };
 
-/*
-Does not work due to lack of QCN5502 support in ath9k.
+
 &wmac {
-       status = "okay";
+       /* Does not work due to lack of QCN5502 support in ath9k. */
+       status = "disabled";
 
-       mtd-cal-data = <&art 0x1000>;
-       mtd-mac-address = <&artmtd 0x6>;
+       nvmem-cells = <&macaddr_artmtd_6>, <&cal_art_1000>;
+       nvmem-cell-names = "mac-address", "calibration";
 };
-*/
 
 &mdio0 {
        status = "okay";
@@ -210,7 +245,8 @@ Does not work due to lack of QCN5502 support in ath9k.
 &eth0 {
        status = "okay";
 
-       mtd-mac-address = <&artmtd 0x0>;
+       nvmem-cells = <&macaddr_artmtd_0>;
+       nvmem-cell-names = "mac-address";
 
        phy-handle = <&phy5>;
        phy-mode = "sgmii";
index cf16fa23182c5c64896d829f37f2dffc406d02e4..a7ea58b50749cfb5a18b4039ac9656f0cf9d72ff 100644 (file)
@@ -219,10 +219,6 @@ case "$FIRMWARE" in
                caldata_extract "caldata" 0x5000 0x2f20
                ath10k_patch_mac $(mtd_get_mac_binary caldata 0xc)
                ;;
-       netgear,ex7300-v2)
-               caldata_extract "art" 0x5000 0x2f20
-               ath10k_patch_mac $(mtd_get_mac_binary artmtd 0xc)
-               ;;
        phicomm,k2t)
                caldata_extract "art" 0x5000 0x2f20
                ath10k_patch_mac $(k2t_get_mac "5g_mac")