diff options
Diffstat (limited to 'drivers/net/wireless/b43')
-rw-r--r-- | drivers/net/wireless/b43/b43.h | 17 | ||||
-rw-r--r-- | drivers/net/wireless/b43/debugfs.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/b43/phy.c | 60 | ||||
-rw-r--r-- | drivers/net/wireless/b43/phy.h | 14 |
5 files changed, 36 insertions, 65 deletions
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index 086a9c6c2b07..5a1a790a105b 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -476,7 +476,6 @@ struct b43_phy { | |||
476 | u16 radio_ver; /* Radio version */ | 476 | u16 radio_ver; /* Radio version */ |
477 | u8 radio_rev; /* Radio revision */ | 477 | u8 radio_rev; /* Radio revision */ |
478 | 478 | ||
479 | bool locked; /* Only used in b43_phy_{un}lock() */ | ||
480 | bool dyn_tssi_tbl; /* tssi2dbm is kmalloc()ed. */ | 479 | bool dyn_tssi_tbl; /* tssi2dbm is kmalloc()ed. */ |
481 | 480 | ||
482 | /* ACI (adjacent channel interference) flags. */ | 481 | /* ACI (adjacent channel interference) flags. */ |
@@ -513,11 +512,6 @@ struct b43_phy { | |||
513 | s16 lna_gain; /* LNA */ | 512 | s16 lna_gain; /* LNA */ |
514 | s16 pga_gain; /* PGA */ | 513 | s16 pga_gain; /* PGA */ |
515 | 514 | ||
516 | /* PHY lock for core.rev < 3 | ||
517 | * This lock is only used by b43_phy_{un}lock() | ||
518 | */ | ||
519 | spinlock_t lock; | ||
520 | |||
521 | /* Desired TX power level (in dBm). | 515 | /* Desired TX power level (in dBm). |
522 | * This is set by the user and adjusted in b43_phy_xmitpower(). */ | 516 | * This is set by the user and adjusted in b43_phy_xmitpower(). */ |
523 | u8 power_level; | 517 | u8 power_level; |
@@ -528,9 +522,7 @@ struct b43_phy { | |||
528 | struct b43_bbatt bbatt; | 522 | struct b43_bbatt bbatt; |
529 | struct b43_rfatt rfatt; | 523 | struct b43_rfatt rfatt; |
530 | u8 tx_control; /* B43_TXCTL_XXX */ | 524 | u8 tx_control; /* B43_TXCTL_XXX */ |
531 | #ifdef CONFIG_B43_DEBUG | 525 | |
532 | bool manual_txpower_control; /* Manual TX-power control enabled? */ | ||
533 | #endif | ||
534 | /* Hardware Power Control enabled? */ | 526 | /* Hardware Power Control enabled? */ |
535 | bool hardware_power_control; | 527 | bool hardware_power_control; |
536 | 528 | ||
@@ -571,6 +563,13 @@ struct b43_phy { | |||
571 | B43_OFDMTAB_DIRECTION_READ, | 563 | B43_OFDMTAB_DIRECTION_READ, |
572 | B43_OFDMTAB_DIRECTION_WRITE, | 564 | B43_OFDMTAB_DIRECTION_WRITE, |
573 | } ofdmtab_addr_direction; | 565 | } ofdmtab_addr_direction; |
566 | |||
567 | #if B43_DEBUG | ||
568 | /* Manual TX-power control enabled? */ | ||
569 | bool manual_txpower_control; | ||
570 | /* PHY registers locked by b43_phy_lock()? */ | ||
571 | bool phy_locked; | ||
572 | #endif /* B43_DEBUG */ | ||
574 | }; | 573 | }; |
575 | 574 | ||
576 | /* Data structures for DMA transmission, per 80211 core. */ | 575 | /* Data structures for DMA transmission, per 80211 core. */ |
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c index 93e5030aa6c3..e38ed0fe72e9 100644 --- a/drivers/net/wireless/b43/debugfs.c +++ b/drivers/net/wireless/b43/debugfs.c | |||
@@ -222,8 +222,6 @@ out: | |||
222 | static int txpower_g_write_file(struct b43_wldev *dev, | 222 | static int txpower_g_write_file(struct b43_wldev *dev, |
223 | const char *buf, size_t count) | 223 | const char *buf, size_t count) |
224 | { | 224 | { |
225 | unsigned long phy_flags; | ||
226 | |||
227 | if (dev->phy.type != B43_PHYTYPE_G) | 225 | if (dev->phy.type != B43_PHYTYPE_G) |
228 | return -ENODEV; | 226 | return -ENODEV; |
229 | if ((count >= 4) && (memcmp(buf, "auto", 4) == 0)) { | 227 | if ((count >= 4) && (memcmp(buf, "auto", 4) == 0)) { |
@@ -247,12 +245,12 @@ static int txpower_g_write_file(struct b43_wldev *dev, | |||
247 | dev->phy.tx_control |= B43_TXCTL_PA2DB; | 245 | dev->phy.tx_control |= B43_TXCTL_PA2DB; |
248 | if (pa3db) | 246 | if (pa3db) |
249 | dev->phy.tx_control |= B43_TXCTL_PA3DB; | 247 | dev->phy.tx_control |= B43_TXCTL_PA3DB; |
250 | b43_phy_lock(dev, phy_flags); | 248 | b43_phy_lock(dev); |
251 | b43_radio_lock(dev); | 249 | b43_radio_lock(dev); |
252 | b43_set_txpower_g(dev, &dev->phy.bbatt, | 250 | b43_set_txpower_g(dev, &dev->phy.bbatt, |
253 | &dev->phy.rfatt, dev->phy.tx_control); | 251 | &dev->phy.rfatt, dev->phy.tx_control); |
254 | b43_radio_unlock(dev); | 252 | b43_radio_unlock(dev); |
255 | b43_phy_unlock(dev, phy_flags); | 253 | b43_phy_unlock(dev); |
256 | } | 254 | } |
257 | 255 | ||
258 | return 0; | 256 | return 0; |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 7125af6f242a..ea63a9928803 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -3146,9 +3146,6 @@ static void setup_struct_phy_for_init(struct b43_wldev *dev, | |||
3146 | memset(phy->minlowsig, 0xFF, sizeof(phy->minlowsig)); | 3146 | memset(phy->minlowsig, 0xFF, sizeof(phy->minlowsig)); |
3147 | memset(phy->minlowsigpos, 0, sizeof(phy->minlowsigpos)); | 3147 | memset(phy->minlowsigpos, 0, sizeof(phy->minlowsigpos)); |
3148 | 3148 | ||
3149 | /* Flags */ | ||
3150 | phy->locked = 0; | ||
3151 | |||
3152 | phy->aci_enable = 0; | 3149 | phy->aci_enable = 0; |
3153 | phy->aci_wlan_automatic = 0; | 3150 | phy->aci_wlan_automatic = 0; |
3154 | phy->aci_hw_rssi = 0; | 3151 | phy->aci_hw_rssi = 0; |
@@ -3175,7 +3172,6 @@ static void setup_struct_phy_for_init(struct b43_wldev *dev, | |||
3175 | phy->lofcal = 0xFFFF; | 3172 | phy->lofcal = 0xFFFF; |
3176 | phy->initval = 0xFFFF; | 3173 | phy->initval = 0xFFFF; |
3177 | 3174 | ||
3178 | spin_lock_init(&phy->lock); | ||
3179 | phy->interfmode = B43_INTERFMODE_NONE; | 3175 | phy->interfmode = B43_INTERFMODE_NONE; |
3180 | phy->channel = 0xFF; | 3176 | phy->channel = 0xFF; |
3181 | 3177 | ||
diff --git a/drivers/net/wireless/b43/phy.c b/drivers/net/wireless/b43/phy.c index 67b8a922b337..2abf125aa2cf 100644 --- a/drivers/net/wireless/b43/phy.c +++ b/drivers/net/wireless/b43/phy.c | |||
@@ -228,42 +228,30 @@ static void b43_shm_clear_tssi(struct b43_wldev *dev) | |||
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
231 | void b43_raw_phy_lock(struct b43_wldev *dev) | 231 | /* Lock the PHY registers against concurrent access from the microcode. |
232 | * This lock is nonrecursive. */ | ||
233 | void b43_phy_lock(struct b43_wldev *dev) | ||
232 | { | 234 | { |
233 | struct b43_phy *phy = &dev->phy; | 235 | #if B43_DEBUG |
234 | 236 | B43_WARN_ON(dev->phy.phy_locked); | |
235 | B43_WARN_ON(!irqs_disabled()); | 237 | dev->phy.phy_locked = 1; |
236 | 238 | #endif | |
237 | /* We had a check for MACCTL==0 here, but I think that doesn't | 239 | B43_WARN_ON(dev->dev->id.revision < 3); |
238 | * make sense, as MACCTL is never 0 when this is called. | ||
239 | * --mb */ | ||
240 | B43_WARN_ON(b43_read32(dev, B43_MMIO_MACCTL) == 0); | ||
241 | 240 | ||
242 | if (dev->dev->id.revision < 3) { | 241 | if (!b43_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) |
243 | b43_mac_suspend(dev); | 242 | b43_power_saving_ctl_bits(dev, B43_PS_AWAKE); |
244 | spin_lock(&phy->lock); | ||
245 | } else { | ||
246 | if (!b43_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) | ||
247 | b43_power_saving_ctl_bits(dev, B43_PS_AWAKE); | ||
248 | } | ||
249 | phy->locked = 1; | ||
250 | } | 243 | } |
251 | 244 | ||
252 | void b43_raw_phy_unlock(struct b43_wldev *dev) | 245 | void b43_phy_unlock(struct b43_wldev *dev) |
253 | { | 246 | { |
254 | struct b43_phy *phy = &dev->phy; | 247 | #if B43_DEBUG |
248 | B43_WARN_ON(!dev->phy.phy_locked); | ||
249 | dev->phy.phy_locked = 0; | ||
250 | #endif | ||
251 | B43_WARN_ON(dev->dev->id.revision < 3); | ||
255 | 252 | ||
256 | B43_WARN_ON(!irqs_disabled()); | 253 | if (!b43_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) |
257 | if (dev->dev->id.revision < 3) { | 254 | b43_power_saving_ctl_bits(dev, 0); |
258 | if (phy->locked) { | ||
259 | spin_unlock(&phy->lock); | ||
260 | b43_mac_enable(dev); | ||
261 | } | ||
262 | } else { | ||
263 | if (!b43_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) | ||
264 | b43_power_saving_ctl_bits(dev, 0); | ||
265 | } | ||
266 | phy->locked = 0; | ||
267 | } | 255 | } |
268 | 256 | ||
269 | /* Different PHYs require different register routing flags. | 257 | /* Different PHYs require different register routing flags. |
@@ -1730,7 +1718,6 @@ void b43_phy_xmitpower(struct b43_wldev *dev) | |||
1730 | int rfatt_delta, bbatt_delta; | 1718 | int rfatt_delta, bbatt_delta; |
1731 | int rfatt, bbatt; | 1719 | int rfatt, bbatt; |
1732 | u8 tx_control; | 1720 | u8 tx_control; |
1733 | unsigned long phylock_flags; | ||
1734 | 1721 | ||
1735 | tmp = b43_shm_read16(dev, B43_SHM_SHARED, 0x0058); | 1722 | tmp = b43_shm_read16(dev, B43_SHM_SHARED, 0x0058); |
1736 | v0 = (s8) (tmp & 0x00FF); | 1723 | v0 = (s8) (tmp & 0x00FF); |
@@ -1861,13 +1848,13 @@ void b43_phy_xmitpower(struct b43_wldev *dev) | |||
1861 | phy->bbatt.att = bbatt; | 1848 | phy->bbatt.att = bbatt; |
1862 | 1849 | ||
1863 | /* Adjust the hardware */ | 1850 | /* Adjust the hardware */ |
1864 | b43_phy_lock(dev, phylock_flags); | 1851 | b43_phy_lock(dev); |
1865 | b43_radio_lock(dev); | 1852 | b43_radio_lock(dev); |
1866 | b43_set_txpower_g(dev, &phy->bbatt, &phy->rfatt, | 1853 | b43_set_txpower_g(dev, &phy->bbatt, &phy->rfatt, |
1867 | phy->tx_control); | 1854 | phy->tx_control); |
1868 | b43_lo_g_ctl_mark_cur_used(dev); | 1855 | b43_lo_g_ctl_mark_cur_used(dev); |
1869 | b43_radio_unlock(dev); | 1856 | b43_radio_unlock(dev); |
1870 | b43_phy_unlock(dev, phylock_flags); | 1857 | b43_phy_unlock(dev); |
1871 | break; | 1858 | break; |
1872 | } | 1859 | } |
1873 | default: | 1860 | default: |
@@ -2158,6 +2145,7 @@ void b43_radio_lock(struct b43_wldev *dev) | |||
2158 | u32 macctl; | 2145 | u32 macctl; |
2159 | 2146 | ||
2160 | macctl = b43_read32(dev, B43_MMIO_MACCTL); | 2147 | macctl = b43_read32(dev, B43_MMIO_MACCTL); |
2148 | B43_WARN_ON(macctl & B43_MACCTL_RADIOLOCK); | ||
2161 | macctl |= B43_MACCTL_RADIOLOCK; | 2149 | macctl |= B43_MACCTL_RADIOLOCK; |
2162 | b43_write32(dev, B43_MMIO_MACCTL, macctl); | 2150 | b43_write32(dev, B43_MMIO_MACCTL, macctl); |
2163 | /* Commit the write and wait for the device | 2151 | /* Commit the write and wait for the device |
@@ -2174,6 +2162,7 @@ void b43_radio_unlock(struct b43_wldev *dev) | |||
2174 | b43_read16(dev, B43_MMIO_PHY_VER); | 2162 | b43_read16(dev, B43_MMIO_PHY_VER); |
2175 | /* unlock */ | 2163 | /* unlock */ |
2176 | macctl = b43_read32(dev, B43_MMIO_MACCTL); | 2164 | macctl = b43_read32(dev, B43_MMIO_MACCTL); |
2165 | B43_WARN_ON(!(macctl & B43_MACCTL_RADIOLOCK)); | ||
2177 | macctl &= ~B43_MACCTL_RADIOLOCK; | 2166 | macctl &= ~B43_MACCTL_RADIOLOCK; |
2178 | b43_write32(dev, B43_MMIO_MACCTL, macctl); | 2167 | b43_write32(dev, B43_MMIO_MACCTL, macctl); |
2179 | } | 2168 | } |
@@ -2355,12 +2344,11 @@ u8 b43_radio_aci_scan(struct b43_wldev * dev) | |||
2355 | u8 ret[13]; | 2344 | u8 ret[13]; |
2356 | unsigned int channel = phy->channel; | 2345 | unsigned int channel = phy->channel; |
2357 | unsigned int i, j, start, end; | 2346 | unsigned int i, j, start, end; |
2358 | unsigned long phylock_flags; | ||
2359 | 2347 | ||
2360 | if (!((phy->type == B43_PHYTYPE_G) && (phy->rev > 0))) | 2348 | if (!((phy->type == B43_PHYTYPE_G) && (phy->rev > 0))) |
2361 | return 0; | 2349 | return 0; |
2362 | 2350 | ||
2363 | b43_phy_lock(dev, phylock_flags); | 2351 | b43_phy_lock(dev); |
2364 | b43_radio_lock(dev); | 2352 | b43_radio_lock(dev); |
2365 | b43_phy_write(dev, 0x0802, b43_phy_read(dev, 0x0802) & 0xFFFC); | 2353 | b43_phy_write(dev, 0x0802, b43_phy_read(dev, 0x0802) & 0xFFFC); |
2366 | b43_phy_write(dev, B43_PHY_G_CRS, | 2354 | b43_phy_write(dev, B43_PHY_G_CRS, |
@@ -2389,7 +2377,7 @@ u8 b43_radio_aci_scan(struct b43_wldev * dev) | |||
2389 | ret[j] = 1; | 2377 | ret[j] = 1; |
2390 | } | 2378 | } |
2391 | b43_radio_unlock(dev); | 2379 | b43_radio_unlock(dev); |
2392 | b43_phy_unlock(dev, phylock_flags); | 2380 | b43_phy_unlock(dev); |
2393 | 2381 | ||
2394 | return ret[channel - 1]; | 2382 | return ret[channel - 1]; |
2395 | } | 2383 | } |
diff --git a/drivers/net/wireless/b43/phy.h b/drivers/net/wireless/b43/phy.h index 4ee01d534ba1..31bd4d87b404 100644 --- a/drivers/net/wireless/b43/phy.h +++ b/drivers/net/wireless/b43/phy.h | |||
@@ -199,18 +199,8 @@ enum { | |||
199 | #define B43_PHYVER_TYPE_SHIFT 8 | 199 | #define B43_PHYVER_TYPE_SHIFT 8 |
200 | #define B43_PHYVER_VERSION 0x00FF | 200 | #define B43_PHYVER_VERSION 0x00FF |
201 | 201 | ||
202 | void b43_raw_phy_lock(struct b43_wldev *dev); | 202 | void b43_phy_lock(struct b43_wldev *dev); |
203 | #define b43_phy_lock(dev, flags) \ | 203 | void b43_phy_unlock(struct b43_wldev *dev); |
204 | do { \ | ||
205 | local_irq_save(flags); \ | ||
206 | b43_raw_phy_lock(dev); \ | ||
207 | } while (0) | ||
208 | void b43_raw_phy_unlock(struct b43_wldev *dev); | ||
209 | #define b43_phy_unlock(dev, flags) \ | ||
210 | do { \ | ||
211 | b43_raw_phy_unlock(dev); \ | ||
212 | local_irq_restore(flags); \ | ||
213 | } while (0) | ||
214 | 204 | ||
215 | u16 b43_phy_read(struct b43_wldev *dev, u16 offset); | 205 | u16 b43_phy_read(struct b43_wldev *dev, u16 offset); |
216 | void b43_phy_write(struct b43_wldev *dev, u16 offset, u16 val); | 206 | void b43_phy_write(struct b43_wldev *dev, u16 offset, u16 val); |