b43: N-PHY: fix logic in band switching
authorRafał Miłecki <zajec5@gmail.com>
Mon, 11 Oct 2010 01:11:03 +0000 (03:11 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 11 Oct 2010 19:04:25 +0000 (15:04 -0400)
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 789d21c5413913e939d947fe303c601ae0dc3d68..19582ba205982a96c8028d7d6389479fb37efcb1 100644 (file)
@@ -3337,17 +3337,18 @@ static void b43_nphy_channel_setup(struct b43_wldev *dev,
        struct b43_phy *phy = &dev->phy;
        struct b43_phy_n *nphy = dev->phy.n;
 
-       u16 tmp;
+       u16 old_band_5ghz;
        u32 tmp32;
 
-       tmp = b43_phy_read(dev, B43_NPHY_BANDCTL) & B43_NPHY_BANDCTL_5GHZ;
-       if (new_channel->band == IEEE80211_BAND_5GHZ && tmp == 0) {
+       old_band_5ghz =
+               b43_phy_read(dev, B43_NPHY_BANDCTL) & B43_NPHY_BANDCTL_5GHZ;
+       if (new_channel->band == IEEE80211_BAND_5GHZ && !old_band_5ghz) {
                tmp32 = b43_read32(dev, B43_MMIO_PSM_PHY_HDR);
                b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32 | 4);
                b43_phy_set(dev, B43_PHY_B_BBCFG, 0xC000);
                b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32);
                b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ);
-       } else if (new_channel->band == IEEE80211_BAND_5GHZ) {
+       } else if (new_channel->band == IEEE80211_BAND_2GHZ && old_band_5ghz) {
                b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ);
                tmp32 = b43_read32(dev, B43_MMIO_PSM_PHY_HDR);
                b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32 | 4);