b43: N-PHY: update spur avoidance to support newer devices
authorRafał Miłecki <zajec5@gmail.com>
Thu, 17 Jul 2014 17:31:06 +0000 (19:31 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 18 Jul 2014 17:45:26 +0000 (13:45 -0400)
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43/phy_n.c

index 0f0c1306b0adcfad46ec343b136bf4838cbb47bc..92bfe352ba081c3a83222b9920831268a8f3599f 100644 (file)
@@ -6099,26 +6099,45 @@ static void b43_nphy_channel_setup(struct b43_wldev *dev,
 
        if (dev->phy.rev >= 3 &&
            dev->phy.n->spur_avoid != B43_SPUR_AVOID_DISABLE) {
-               bool avoid = false;
+               u8 spuravoid = 0;
+
                if (dev->phy.n->spur_avoid == B43_SPUR_AVOID_FORCE) {
-                       avoid = true;
-               } else if (!b43_is_40mhz(dev)) {
-                       if ((ch >= 5 && ch <= 8) || ch == 13 || ch == 14)
-                               avoid = true;
-               } else { /* 40MHz */
-                       if (nphy->aband_spurwar_en &&
-                           (ch == 38 || ch == 102 || ch == 118))
-                               avoid = dev->dev->chip_id == 0x4716;
+                       spuravoid = 1;
+               } else if (phy->rev >= 19) {
+                       /* TODO */
+               } else if (phy->rev >= 18) {
+                       /* TODO */
+               } else if (phy->rev >= 17) {
+                       /* TODO: Off for channels 1-11, but check 12-14! */
+               } else if (phy->rev >= 16) {
+                       /* TODO: Off for 2 GHz, but check 5 GHz! */
+               } else if (phy->rev >= 7) {
+                       if (!b43_is_40mhz(dev)) { /* 20MHz */
+                               if (ch == 13 || ch == 14 || ch == 153)
+                                       spuravoid = 1;
+                       } else { /* 40 MHz */
+                               if (ch == 54)
+                                       spuravoid = 1;
+                       }
+               } else {
+                       if (!b43_is_40mhz(dev)) { /* 20MHz */
+                               if ((ch >= 5 && ch <= 8) || ch == 13 || ch == 14)
+                                       spuravoid = 1;
+                       } else { /* 40MHz */
+                               if (nphy->aband_spurwar_en &&
+                                   (ch == 38 || ch == 102 || ch == 118))
+                                       spuravoid = dev->dev->chip_id == 0x4716;
+                       }
                }
 
-               b43_nphy_pmu_spur_avoid(dev, avoid);
+               b43_nphy_pmu_spur_avoid(dev, spuravoid);
 
-               b43_mac_switch_freq(dev, avoid);
+               b43_mac_switch_freq(dev, spuravoid);
 
                if (dev->phy.rev == 3 || dev->phy.rev == 4)
                        ; /* TODO: reset PLL */
 
-               if (avoid)
+               if (spuravoid)
                        b43_phy_set(dev, B43_NPHY_BBCFG, B43_NPHY_BBCFG_RSTRX);
                else
                        b43_phy_mask(dev, B43_NPHY_BBCFG,