b43: N-PHY: fix RSSI selection
authorRafał Miłecki <zajec5@gmail.com>
Tue, 30 Nov 2010 21:33:14 +0000 (22:33 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 2 Dec 2010 20:16:44 +0000 (15:16 -0500)
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 85a7a60c54bf1afec51f4ab55afe203f39623d9f..1d0847624bb4c9cac996f67057e7fff8ed75c3f7 100644 (file)
@@ -1822,27 +1822,39 @@ static void b43_nphy_rev2_rssi_select(struct b43_wldev *dev, u8 code, u8 type)
                                (type + 1) << 4);
        }
 
-       /* TODO use some definitions */
        if (code == 0) {
-               b43_phy_maskset(dev, B43_NPHY_AFECTL_OVER, 0xCFFF, 0);
+               b43_phy_mask(dev, B43_NPHY_AFECTL_OVER, ~0x3000);
                if (type < 3) {
-                       b43_phy_maskset(dev, B43_NPHY_RFCTL_CMD, 0xFEC7, 0);
-                       b43_phy_maskset(dev, B43_NPHY_RFCTL_OVER, 0xEFDC, 0);
-                       b43_phy_maskset(dev, B43_NPHY_RFCTL_CMD, 0xFFFE, 0);
+                       b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
+                               ~(B43_NPHY_RFCTL_CMD_RXEN |
+                                 B43_NPHY_RFCTL_CMD_CORESEL));
+                       b43_phy_mask(dev, B43_NPHY_RFCTL_OVER,
+                               ~(0x1 << 12 |
+                                 0x1 << 5 |
+                                 0x1 << 1 |
+                                 0x1));
+                       b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
+                               ~B43_NPHY_RFCTL_CMD_START);
                        udelay(20);
-                       b43_phy_maskset(dev, B43_NPHY_RFCTL_OVER, 0xFFFE, 0);
+                       b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, ~0x1);
                }
        } else {
-               b43_phy_maskset(dev, B43_NPHY_AFECTL_OVER, 0xCFFF,
-                               0x3000);
+               b43_phy_set(dev, B43_NPHY_AFECTL_OVER, 0x3000);
                if (type < 3) {
                        b43_phy_maskset(dev, B43_NPHY_RFCTL_CMD,
-                                       0xFEC7, 0x0180);
-                       b43_phy_maskset(dev, B43_NPHY_RFCTL_OVER,
-                                       0xEFDC, (code << 1 | 0x1021));
-                       b43_phy_maskset(dev, B43_NPHY_RFCTL_CMD, 0xFFFE, 0x1);
+                               ~(B43_NPHY_RFCTL_CMD_RXEN |
+                                 B43_NPHY_RFCTL_CMD_CORESEL),
+                               (B43_NPHY_RFCTL_CMD_RXEN |
+                                code << B43_NPHY_RFCTL_CMD_CORESEL_SHIFT));
+                       b43_phy_set(dev, B43_NPHY_RFCTL_OVER,
+                               (0x1 << 12 |
+                                 0x1 << 5 |
+                                 0x1 << 1 |
+                                 0x1));
+                       b43_phy_set(dev, B43_NPHY_RFCTL_CMD,
+                               B43_NPHY_RFCTL_CMD_START);
                        udelay(20);
-                       b43_phy_maskset(dev, B43_NPHY_RFCTL_OVER, 0xFFFE, 0);
+                       b43_phy_mask(dev, B43_NPHY_RFCTL_OVER, ~0x1);
                }
        }
 }