b43: N-PHY: implement chain selection
authorRafał Miłecki <zajec5@gmail.com>
Sun, 17 Jan 2010 12:03:55 +0000 (13:03 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 19 Jan 2010 21:39:08 +0000 (16:39 -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
drivers/net/wireless/b43/phy_n.h

index 229f2d0364f2500a1ebb1e5372395b893bb7a201..90a49cfaa965a71e854eb66e610f42e0aef210d6 100644 (file)
@@ -438,6 +438,34 @@ static void b43_nphy_update_mimo_config(struct b43_wldev *dev, s32 preamble)
        b43_phy_write(dev, B43_NPHY_MIMOCFG, mimocfg);
 }
 
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/Chains */
+static void b43_nphy_update_txrx_chain(struct b43_wldev *dev)
+{
+       struct b43_phy_n *nphy = dev->phy.n;
+
+       bool override = false;
+       u16 chain = 0x33;
+
+       if (nphy->txrx_chain == 0) {
+               chain = 0x11;
+               override = true;
+       } else if (nphy->txrx_chain == 1) {
+               chain = 0x22;
+               override = true;
+       }
+
+       b43_phy_maskset(dev, B43_NPHY_RFSEQCA,
+                       ~(B43_NPHY_RFSEQCA_TXEN | B43_NPHY_RFSEQCA_RXEN),
+                       chain);
+
+       if (override)
+               b43_phy_set(dev, B43_NPHY_RFSEQMODE,
+                               B43_NPHY_RFSEQMODE_CAOVER);
+       else
+               b43_phy_mask(dev, B43_NPHY_RFSEQMODE,
+                               ~B43_NPHY_RFSEQMODE_CAOVER);
+}
+
 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxIqEst */
 static void b43_nphy_rx_iq_est(struct b43_wldev *dev, struct nphy_iq_est *est,
                                u16 samps, u8 time, bool wait)
@@ -2223,7 +2251,7 @@ int b43_phy_initn(struct b43_wldev *dev)
        b43_phy_write(dev, B43_NPHY_TXRIFS_FRDEL, 0x30);
 
        b43_nphy_update_mimo_config(dev, nphy->preamble_override);
-       /* TODO Update TX/RX chain */
+       b43_nphy_update_txrx_chain(dev);
 
        if (phy->rev < 2) {
                b43_phy_write(dev, B43_NPHY_DUP40_GFBL, 0xAA8);
index d6c92a81d3c0f95581c9d02a32131437bb28782e..f5a27661f6595ac88607f15d479105a280c3165e 100644 (file)
@@ -987,6 +987,7 @@ struct b43_phy_n {
        bool txiqlocal_coeffsvalid;
        struct b43_phy_n_txpwrindex txpwrindex[2];
 
+       u8 txrx_chain;
        u16 tx_rx_cal_phy_saveregs[11];
        u16 tx_rx_cal_radio_saveregs[22];