b43: Implement PHY PLL reset
authorRafał Miłecki <zajec5@gmail.com>
Fri, 12 Sep 2014 16:37:26 +0000 (18:37 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 15 Sep 2014 19:00:53 +0000 (15:00 -0400)
We should reset PLL after changing MAC frequency.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43/main.c
drivers/net/wireless/b43/main.h
drivers/net/wireless/b43/phy_ht.c
drivers/net/wireless/b43/phy_n.c

index 165dbc35eba231bb784d9059c60e55b8d0635250..3adc13f6ffef08c809865382681352fe6c5a5ee7 100644 (file)
@@ -1204,6 +1204,36 @@ void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags)
        }
 }
 
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacCorePllReset */
+void b43_wireless_core_phy_pll_reset(struct b43_wldev *dev)
+{
+       struct bcma_drv_cc *bcma_cc __maybe_unused;
+       struct ssb_chipcommon *ssb_cc __maybe_unused;
+
+       switch (dev->dev->bus_type) {
+#ifdef CONFIG_B43_BCMA
+       case B43_BUS_BCMA:
+               bcma_cc = &dev->dev->bdev->bus->drv_cc;
+
+               bcma_cc_write32(bcma_cc, BCMA_CC_CHIPCTL_ADDR, 0);
+               bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
+               bcma_cc_set32(bcma_cc, BCMA_CC_CHIPCTL_DATA, 0x4);
+               bcma_cc_mask32(bcma_cc, BCMA_CC_CHIPCTL_DATA, ~0x4);
+               break;
+#endif
+#ifdef CONFIG_B43_SSB
+       case B43_BUS_SSB:
+               ssb_cc = &dev->dev->sdev->bus->chipco;
+
+               chipco_write32(ssb_cc, SSB_CHIPCO_CHIPCTL_ADDR, 0);
+               chipco_mask32(ssb_cc, SSB_CHIPCO_CHIPCTL_DATA, ~0x4);
+               chipco_set32(ssb_cc, SSB_CHIPCO_CHIPCTL_DATA, 0x4);
+               chipco_mask32(ssb_cc, SSB_CHIPCO_CHIPCTL_DATA, ~0x4);
+               break;
+#endif
+       }
+}
+
 #ifdef CONFIG_B43_BCMA
 static void b43_bcma_phy_reset(struct b43_wldev *dev)
 {
index 9f22e4b4c13297207c309d7ea6a1fd884d061655..c46430cc725c168cec55bcc32eb8a9c26ed2f8f6 100644 (file)
@@ -96,6 +96,8 @@ void b43_controller_restart(struct b43_wldev *dev, const char *reason);
 #define B43_PS_ASLEEP  (1 << 3)        /* Force device asleep */
 void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags);
 
+void b43_wireless_core_phy_pll_reset(struct b43_wldev *dev);
+
 void b43_mac_suspend(struct b43_wldev *dev);
 void b43_mac_enable(struct b43_wldev *dev);
 void b43_mac_phy_clock_set(struct b43_wldev *dev, bool on);
index 6a0140a7ea2380523bec93395d187ef54bc41b7c..bd68945965d6967ba75f2a4a25d5328d3d649d12 100644 (file)
@@ -762,7 +762,7 @@ static void b43_phy_ht_spur_avoid(struct b43_wldev *dev,
 
        b43_mac_switch_freq(dev, spuravoid);
 
-       /* TODO: reset PLL */
+       b43_wireless_core_phy_pll_reset(dev);
 
        if (spuravoid)
                b43_phy_set(dev, B43_PHY_HT_BBCFG, B43_PHY_HT_BBCFG_RSTRX);
index cf625d8732a7cdf3402b71494d6d53e3668bf4ab..9f0bcf3b8414c7cb11713158f4f0fc485df07618 100644 (file)
@@ -6369,7 +6369,7 @@ static void b43_nphy_channel_setup(struct b43_wldev *dev,
                b43_mac_switch_freq(dev, spuravoid);
 
                if (dev->phy.rev == 3 || dev->phy.rev == 4)
-                       ; /* TODO: reset PLL */
+                       b43_wireless_core_phy_pll_reset(dev);
 
                if (spuravoid)
                        b43_phy_set(dev, B43_NPHY_BBCFG, B43_NPHY_BBCFG_RSTRX);