b43: N-PHY: update CCA reset
authorRafał Miłecki <zajec5@gmail.com>
Fri, 15 Jan 2010 12:36:43 +0000 (13:36 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 15 Jan 2010 22:05:33 +0000 (17:05 -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 c16c98538f65fdba7768a94b9d7b642addd676d9..c9d2b7738aefe85b6e52b32e160011aca56eb8c6 100644 (file)
@@ -343,18 +343,34 @@ static void b43_nphy_workarounds(struct b43_wldev *dev)
        b43_phy_write(dev, B43_NPHY_PHASETR_B2, 0x20);
 }
 
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/BmacPhyClkFgc */
+static void b43_nphy_bmac_clock_fgc(struct b43_wldev *dev, bool force)
+{
+       u32 tmslow;
+
+       if (dev->phy.type != B43_PHYTYPE_N)
+               return;
+
+       tmslow = ssb_read32(dev->dev, SSB_TMSLOW);
+       if (force)
+               tmslow |= SSB_TMSLOW_FGC;
+       else
+               tmslow &= ~SSB_TMSLOW_FGC;
+       ssb_write32(dev->dev, SSB_TMSLOW, tmslow);
+}
+
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CCA */
 static void b43_nphy_reset_cca(struct b43_wldev *dev)
 {
        u16 bbcfg;
 
-       ssb_write32(dev->dev, SSB_TMSLOW,
-                   ssb_read32(dev->dev, SSB_TMSLOW) | SSB_TMSLOW_FGC);
+       b43_nphy_bmac_clock_fgc(dev, 1);
        bbcfg = b43_phy_read(dev, B43_NPHY_BBCFG);
-       b43_phy_set(dev, B43_NPHY_BBCFG, B43_NPHY_BBCFG_RSTCCA);
-       b43_phy_write(dev, B43_NPHY_BBCFG,
-                     bbcfg & ~B43_NPHY_BBCFG_RSTCCA);
-       ssb_write32(dev->dev, SSB_TMSLOW,
-                   ssb_read32(dev->dev, SSB_TMSLOW) & ~SSB_TMSLOW_FGC);
+       b43_phy_write(dev, B43_NPHY_BBCFG, bbcfg | B43_NPHY_BBCFG_RSTCCA);
+       udelay(1);
+       b43_phy_write(dev, B43_NPHY_BBCFG, bbcfg & ~B43_NPHY_BBCFG_RSTCCA);
+       b43_nphy_bmac_clock_fgc(dev, 0);
+       /* TODO: N PHY Force RF Seq with argument 2 */
 }
 
 enum b43_nphy_rf_sequence {