b43: N-PHY: Implement RX core state setting for rev.2 and earlier PHYs
authorGábor Stefanik <netrolller.3d@gmail.com>
Mon, 16 Aug 2010 20:39:17 +0000 (22:39 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 24 Aug 2010 20:28:13 +0000 (16:28 -0400)
Rev.3+ support coming in a later patch.

Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43/phy_n.c

index d212726d509bb6a0b736fd2ac3770a069b47eabb..a0a6554a76d1f04bcc9eba3e6da6e13b30e1bee7 100644 (file)
@@ -3085,6 +3085,44 @@ static void b43_nphy_mac_phy_clock_set(struct b43_wldev *dev, bool on)
        ssb_write32(dev->dev, SSB_TMSLOW, tmslow);
 }
 
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCoreSetState */
+static void b43_nphy_set_rx_core_state(struct b43_wldev *dev, u8 mask)
+{
+       struct b43_phy *phy = &dev->phy;
+       struct b43_phy_n *nphy = phy->n;
+       u16 buf[16];
+
+       if (0 /* FIXME clk */)
+               return;
+
+       b43_mac_suspend(dev);
+
+       if (nphy->hang_avoid)
+               b43_nphy_stay_in_carrier_search(dev, true);
+
+       b43_phy_maskset(dev, B43_NPHY_RFSEQCA, ~B43_NPHY_RFSEQCA_RXEN,
+                       (mask & 0x3) << B43_NPHY_RFSEQCA_RXEN_SHIFT);
+
+       if (mask & 0x3 != 0x3) {
+               b43_phy_write(dev, B43_NPHY_HPANT_SWTHRES, 1);
+               if (dev->phy.rev >= 3) {
+                       /* TODO */
+               }
+       } else {
+               b43_phy_write(dev, B43_NPHY_HPANT_SWTHRES, 0x1E);
+               if (dev->phy.rev >= 3) {
+                       /* TODO */
+               }
+       }
+
+       b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX);
+
+       if (nphy->hang_avoid)
+               b43_nphy_stay_in_carrier_search(dev, false);
+
+       b43_mac_enable(dev);
+}
+
 /*
  * Init N-PHY
  * http://bcm-v4.sipsolutions.net/802.11/PHY/Init/N
@@ -3211,7 +3249,7 @@ int b43_phy_initn(struct b43_wldev *dev)
        }
 
        if (nphy->phyrxchain != 3)
-               ;/* TODO N PHY RX Core Set State with phyrxchain as argument */
+               b43_nphy_set_rx_core_state(dev, nphy->phyrxchain);
        if (nphy->mphase_cal_phase_id > 0)
                ;/* TODO PHY Periodic Calibration Multi-Phase Restart */