aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/phy_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/b43/phy_common.c')
-rw-r--r--drivers/net/wireless/b43/phy_common.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index 8f7d7eff2d80..e46b2f4f0920 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -50,7 +50,7 @@ int b43_phy_allocate(struct b43_wldev *dev)
50 phy->ops = &b43_phyops_g; 50 phy->ops = &b43_phyops_g;
51 break; 51 break;
52 case B43_PHYTYPE_N: 52 case B43_PHYTYPE_N:
53#ifdef CONFIG_B43_NPHY 53#ifdef CONFIG_B43_PHY_N
54 phy->ops = &b43_phyops_n; 54 phy->ops = &b43_phyops_n;
55#endif 55#endif
56 break; 56 break;
@@ -168,7 +168,7 @@ void b43_phy_lock(struct b43_wldev *dev)
168 B43_WARN_ON(dev->phy.phy_locked); 168 B43_WARN_ON(dev->phy.phy_locked);
169 dev->phy.phy_locked = 1; 169 dev->phy.phy_locked = 1;
170#endif 170#endif
171 B43_WARN_ON(dev->dev->id.revision < 3); 171 B43_WARN_ON(dev->sdev->id.revision < 3);
172 172
173 if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP)) 173 if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP))
174 b43_power_saving_ctl_bits(dev, B43_PS_AWAKE); 174 b43_power_saving_ctl_bits(dev, B43_PS_AWAKE);
@@ -180,7 +180,7 @@ void b43_phy_unlock(struct b43_wldev *dev)
180 B43_WARN_ON(!dev->phy.phy_locked); 180 B43_WARN_ON(!dev->phy.phy_locked);
181 dev->phy.phy_locked = 0; 181 dev->phy.phy_locked = 0;
182#endif 182#endif
183 B43_WARN_ON(dev->dev->id.revision < 3); 183 B43_WARN_ON(dev->sdev->id.revision < 3);
184 184
185 if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP)) 185 if (!b43_is_mode(dev->wl, NL80211_IFTYPE_AP))
186 b43_power_saving_ctl_bits(dev, 0); 186 b43_power_saving_ctl_bits(dev, 0);
@@ -231,6 +231,7 @@ void b43_radio_maskset(struct b43_wldev *dev, u16 offset, u16 mask, u16 set)
231u16 b43_phy_read(struct b43_wldev *dev, u16 reg) 231u16 b43_phy_read(struct b43_wldev *dev, u16 reg)
232{ 232{
233 assert_mac_suspended(dev); 233 assert_mac_suspended(dev);
234 dev->phy.writes_counter = 0;
234 return dev->phy.ops->phy_read(dev, reg); 235 return dev->phy.ops->phy_read(dev, reg);
235} 236}
236 237
@@ -238,6 +239,10 @@ void b43_phy_write(struct b43_wldev *dev, u16 reg, u16 value)
238{ 239{
239 assert_mac_suspended(dev); 240 assert_mac_suspended(dev);
240 dev->phy.ops->phy_write(dev, reg, value); 241 dev->phy.ops->phy_write(dev, reg, value);
242 if (++dev->phy.writes_counter == B43_MAX_WRITES_IN_ROW) {
243 b43_read16(dev, B43_MMIO_PHY_VER);
244 dev->phy.writes_counter = 0;
245 }
241} 246}
242 247
243void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg) 248void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg)
@@ -294,8 +299,10 @@ int b43_switch_channel(struct b43_wldev *dev, unsigned int new_channel)
294 */ 299 */
295 channelcookie = new_channel; 300 channelcookie = new_channel;
296 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) 301 if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
297 channelcookie |= 0x100; 302 channelcookie |= B43_SHM_SH_CHAN_5GHZ;
298 //FIXME set 40Mhz flag if required 303 /* FIXME: set 40Mhz flag if required */
304 if (0)
305 channelcookie |= B43_SHM_SH_CHAN_40MHZ;
299 savedcookie = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_CHAN); 306 savedcookie = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_CHAN);
300 b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_CHAN, channelcookie); 307 b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_CHAN, channelcookie);
301 308
@@ -361,8 +368,8 @@ void b43_phy_txpower_check(struct b43_wldev *dev, unsigned int flags)
361 /* The next check will be needed in two seconds, or later. */ 368 /* The next check will be needed in two seconds, or later. */
362 phy->next_txpwr_check_time = round_jiffies(now + (HZ * 2)); 369 phy->next_txpwr_check_time = round_jiffies(now + (HZ * 2));
363 370
364 if ((dev->dev->bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM) && 371 if ((dev->sdev->bus->boardinfo.vendor == SSB_BOARDVENDOR_BCM) &&
365 (dev->dev->bus->boardinfo.type == SSB_BOARD_BU4306)) 372 (dev->sdev->bus->boardinfo.type == SSB_BOARD_BU4306))
366 return; /* No software txpower adjustment needed */ 373 return; /* No software txpower adjustment needed */
367 374
368 result = phy->ops->recalc_txpower(dev, !!(flags & B43_TXPWR_IGNORE_TSSI)); 375 result = phy->ops->recalc_txpower(dev, !!(flags & B43_TXPWR_IGNORE_TSSI));
@@ -422,12 +429,21 @@ void b43_phyop_switch_analog_generic(struct b43_wldev *dev, bool on)
422 b43_write16(dev, B43_MMIO_PHY0, on ? 0 : 0xF4); 429 b43_write16(dev, B43_MMIO_PHY0, on ? 0 : 0xF4);
423} 430}
424 431
432
433bool b43_channel_type_is_40mhz(enum nl80211_channel_type channel_type)
434{
435 return (channel_type == NL80211_CHAN_HT40MINUS ||
436 channel_type == NL80211_CHAN_HT40PLUS);
437}
438
425/* http://bcm-v4.sipsolutions.net/802.11/PHY/Cordic */ 439/* http://bcm-v4.sipsolutions.net/802.11/PHY/Cordic */
426struct b43_c32 b43_cordic(int theta) 440struct b43_c32 b43_cordic(int theta)
427{ 441{
428 u32 arctg[] = { 2949120, 1740967, 919879, 466945, 234379, 117304, 442 static const u32 arctg[] = {
429 58666, 29335, 14668, 7334, 3667, 1833, 917, 458, 443 2949120, 1740967, 919879, 466945, 234379, 117304,
430 229, 115, 57, 29, }; 444 58666, 29335, 14668, 7334, 3667, 1833,
445 917, 458, 229, 115, 57, 29,
446 };
431 u8 i; 447 u8 i;
432 s32 tmp; 448 s32 tmp;
433 s8 signx = 1; 449 s8 signx = 1;