aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2014-05-17 17:24:54 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-05-19 16:42:14 -0400
commitb60c3c2fdf524e9fb3cbe6b12c2c4c6d8f4febf4 (patch)
tree3b7150651149a33035e9fd67df574f016c044d44 /drivers
parent0f68423f63446e7db46487e99c2c2e2382485218 (diff)
b43: move PHY reset code into PHY specific file
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/b43/main.c35
-rw-r--r--drivers/net/wireless/b43/phy_common.c33
-rw-r--r--drivers/net/wireless/b43/phy_common.h2
3 files changed, 36 insertions, 34 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index d670c878725b..43fbb8848595 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3706,39 +3706,6 @@ static void b43_op_set_tsf(struct ieee80211_hw *hw,
3706 mutex_unlock(&wl->mutex); 3706 mutex_unlock(&wl->mutex);
3707} 3707}
3708 3708
3709static void b43_put_phy_into_reset(struct b43_wldev *dev)
3710{
3711#ifdef CONFIG_B43_SSB
3712 u32 tmp;
3713#endif
3714
3715 switch (dev->dev->bus_type) {
3716#ifdef CONFIG_B43_BCMA
3717 case B43_BUS_BCMA:
3718 b43err(dev->wl,
3719 "Putting PHY into reset not supported on BCMA\n");
3720 break;
3721#endif
3722#ifdef CONFIG_B43_SSB
3723 case B43_BUS_SSB:
3724 tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW);
3725 tmp &= ~B43_TMSLOW_GMODE;
3726 tmp |= B43_TMSLOW_PHYRESET;
3727 tmp |= SSB_TMSLOW_FGC;
3728 ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp);
3729 msleep(1);
3730
3731 tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW);
3732 tmp &= ~SSB_TMSLOW_FGC;
3733 tmp |= B43_TMSLOW_PHYRESET;
3734 ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp);
3735 msleep(1);
3736
3737 break;
3738#endif
3739 }
3740}
3741
3742static const char *band_to_string(enum ieee80211_band band) 3709static const char *band_to_string(enum ieee80211_band band)
3743{ 3710{
3744 switch (band) { 3711 switch (band) {
@@ -3804,7 +3771,7 @@ static int b43_switch_band(struct b43_wl *wl, struct ieee80211_channel *chan)
3804 if (down_dev != up_dev) { 3771 if (down_dev != up_dev) {
3805 /* We switch to a different core, so we put PHY into 3772 /* We switch to a different core, so we put PHY into
3806 * RESET on the old core. */ 3773 * RESET on the old core. */
3807 b43_put_phy_into_reset(down_dev); 3774 b43_phy_put_into_reset(down_dev);
3808 } 3775 }
3809 3776
3810 /* Now start the new core. */ 3777 /* Now start the new core. */
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index 3e45989f418d..85773a443499 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -312,6 +312,39 @@ void b43_phy_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set)
312 } 312 }
313} 313}
314 314
315void b43_phy_put_into_reset(struct b43_wldev *dev)
316{
317#ifdef CONFIG_B43_SSB
318 u32 tmp;
319#endif
320
321 switch (dev->dev->bus_type) {
322#ifdef CONFIG_B43_BCMA
323 case B43_BUS_BCMA:
324 b43err(dev->wl,
325 "Putting PHY into reset not supported on BCMA\n");
326 break;
327#endif
328#ifdef CONFIG_B43_SSB
329 case B43_BUS_SSB:
330 tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW);
331 tmp &= ~B43_TMSLOW_GMODE;
332 tmp |= B43_TMSLOW_PHYRESET;
333 tmp |= SSB_TMSLOW_FGC;
334 ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp);
335 msleep(1);
336
337 tmp = ssb_read32(dev->dev->sdev, SSB_TMSLOW);
338 tmp &= ~SSB_TMSLOW_FGC;
339 tmp |= B43_TMSLOW_PHYRESET;
340 ssb_write32(dev->dev->sdev, SSB_TMSLOW, tmp);
341 msleep(1);
342
343 break;
344#endif
345 }
346}
347
315int b43_switch_channel(struct b43_wldev *dev, unsigned int new_channel) 348int b43_switch_channel(struct b43_wldev *dev, unsigned int new_channel)
316{ 349{
317 struct b43_phy *phy = &(dev->phy); 350 struct b43_phy *phy = &(dev->phy);
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
index f1b999349876..4f0fcec5b033 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -390,6 +390,8 @@ void b43_phy_lock(struct b43_wldev *dev);
390 */ 390 */
391void b43_phy_unlock(struct b43_wldev *dev); 391void b43_phy_unlock(struct b43_wldev *dev);
392 392
393void b43_phy_put_into_reset(struct b43_wldev *dev);
394
393/** 395/**
394 * b43_switch_channel - Switch to another channel 396 * b43_switch_channel - Switch to another channel
395 */ 397 */