b43: N-PHY: implement setting RF sequence
authorRafał Miłecki <zajec5@gmail.com>
Sat, 30 Jan 2010 19:18:07 +0000 (20:18 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 1 Feb 2010 20:40:07 +0000 (15:40 -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 78e0cf6c78ca7fcbb7b688dae7a242df7d64a14c..6392da25efed06197b3ff86d32143290a17a861c 100644 (file)
@@ -64,6 +64,8 @@ enum b43_nphy_rf_sequence {
        B43_RFSEQ_UPDATE_GAINU,
 };
 
+static void b43_nphy_set_rf_sequence(struct b43_wldev *dev, u8 cmd,
+                                       u8 *events, u8 *delays, u8 length);
 static void b43_nphy_force_rf_sequence(struct b43_wldev *dev,
                                       enum b43_nphy_rf_sequence seq);
 
@@ -827,8 +829,8 @@ static void b43_nphy_gain_crtl_workarounds(struct b43_wldev *dev)
                                                B43_NPHY_TABLE_DATALO, 3 * j);
                        }
 
-                       /* TODO: b43_nphy_set_rf_sequence(dev, 5,
-                                       rfseq_events, rfseq_delays, 3);*/
+                       b43_nphy_set_rf_sequence(dev, 5,
+                                       rfseq_events, rfseq_delays, 3);
                        b43_phy_maskset(dev, B43_NPHY_OVER_DGAIN1,
                                (u16)~B43_NPHY_OVER_DGAIN_CCKDGECV,
                                0x5A << B43_NPHY_OVER_DGAIN_CCKDGECV_SHIFT);
@@ -911,8 +913,8 @@ static void b43_nphy_workarounds(struct b43_wldev *dev)
                        delays1[0] = 0x1;
                        delays1[5] = 0x14;
                }
-               /*TODO:b43_nphy_set_rf_sequence(dev, 0, events1, delays1, 7);*/
-               /*TODO:b43_nphy_set_rf_sequence(dev, 1, events2, delays2, 7);*/
+               b43_nphy_set_rf_sequence(dev, 0, events1, delays1, 7);
+               b43_nphy_set_rf_sequence(dev, 1, events2, delays2, 7);
 
                b43_nphy_gain_crtl_workarounds(dev);
 
@@ -1131,6 +1133,31 @@ static void b43_nphy_tx_pwr_ctrl_coef_setup(struct b43_wldev *dev)
                b43_nphy_stay_in_carrier_search(dev, false);
 }
 
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetRfSeq */
+static void b43_nphy_set_rf_sequence(struct b43_wldev *dev, u8 cmd,
+                                       u8 *events, u8 *delays, u8 length)
+{
+       struct b43_phy_n *nphy = dev->phy.n;
+       u8 i;
+       u8 end = (dev->phy.rev >= 3) ? 0x1F : 0x0F;
+       u16 offset1 = cmd << 4;
+       u16 offset2 = offset1 + 0x80;
+
+       if (nphy->hang_avoid)
+               b43_nphy_stay_in_carrier_search(dev, true);
+
+       b43_ntab_write_bulk(dev, B43_NTAB8(7, offset1), length, events);
+       b43_ntab_write_bulk(dev, B43_NTAB8(7, offset2), length, delays);
+
+       for (i = length; i < 16; i++) {
+               b43_ntab_write(dev, B43_NTAB8(7, offset1 + i), end);
+               b43_ntab_write(dev, B43_NTAB8(7, offset2 + i), 1);
+       }
+
+       if (nphy->hang_avoid)
+               b43_nphy_stay_in_carrier_search(dev, false);
+}
+
 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ForceRFSeq */
 static void b43_nphy_force_rf_sequence(struct b43_wldev *dev,
                                       enum b43_nphy_rf_sequence seq)