Commit 7858e07b authored by Larry Finger's avatar Larry Finger Committed by John W. Linville

b43legacy: Fixes for beaconing

This patch ports the beaconing fixes from commit a82d9922 "b43: Beaconing
fixes" to b43legacy. Basically it prevents the card from triggering the beacon
IRQ over and over again.
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Acked-by: default avatarMichael Buesch <mb@bu3sch.de>
Tested-by: default avatarDavid Ellingsworth <david@identd.dyndns.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 7edfab7a
...@@ -59,7 +59,8 @@ ...@@ -59,7 +59,8 @@
#define B43legacy_MMIO_XMITSTAT_1 0x174 #define B43legacy_MMIO_XMITSTAT_1 0x174
#define B43legacy_MMIO_REV3PLUS_TSF_LOW 0x180 /* core rev >= 3 only */ #define B43legacy_MMIO_REV3PLUS_TSF_LOW 0x180 /* core rev >= 3 only */
#define B43legacy_MMIO_REV3PLUS_TSF_HIGH 0x184 /* core rev >= 3 only */ #define B43legacy_MMIO_REV3PLUS_TSF_HIGH 0x184 /* core rev >= 3 only */
#define B43legacy_MMIO_TSF_CFP_REP 0x188
#define B43legacy_MMIO_TSF_CFP_START 0x18C
/* 32-bit DMA */ /* 32-bit DMA */
#define B43legacy_MMIO_DMA32_BASE0 0x200 #define B43legacy_MMIO_DMA32_BASE0 0x200
#define B43legacy_MMIO_DMA32_BASE1 0x220 #define B43legacy_MMIO_DMA32_BASE1 0x220
...@@ -616,6 +617,7 @@ struct b43legacy_wl { ...@@ -616,6 +617,7 @@ struct b43legacy_wl {
struct sk_buff *current_beacon; struct sk_buff *current_beacon;
bool beacon0_uploaded; bool beacon0_uploaded;
bool beacon1_uploaded; bool beacon1_uploaded;
struct work_struct beacon_update_trigger;
}; };
/* Pointers to the firmware data and meta information about it. */ /* Pointers to the firmware data and meta information about it. */
......
...@@ -1013,7 +1013,8 @@ static void b43legacy_write_beacon_template(struct b43legacy_wldev *dev, ...@@ -1013,7 +1013,8 @@ static void b43legacy_write_beacon_template(struct b43legacy_wldev *dev,
b43legacywarn(dev->wl, "Did not find a valid TIM IE in the " b43legacywarn(dev->wl, "Did not find a valid TIM IE in the "
"beacon template packet. AP or IBSS operation " "beacon template packet. AP or IBSS operation "
"may be broken.\n"); "may be broken.\n");
} } else
b43legacydbg(dev->wl, "Updated beacon template\n");
} }
static void b43legacy_write_probe_resp_plcp(struct b43legacy_wldev *dev, static void b43legacy_write_probe_resp_plcp(struct b43legacy_wldev *dev,
...@@ -1133,6 +1134,27 @@ static void b43legacy_write_probe_resp_template(struct b43legacy_wldev *dev, ...@@ -1133,6 +1134,27 @@ static void b43legacy_write_probe_resp_template(struct b43legacy_wldev *dev,
kfree(probe_resp_data); kfree(probe_resp_data);
} }
static void b43legacy_beacon_update_trigger_work(struct work_struct *work)
{
struct b43legacy_wl *wl = container_of(work, struct b43legacy_wl,
beacon_update_trigger);
struct b43legacy_wldev *dev;
mutex_lock(&wl->mutex);
dev = wl->current_dev;
if (likely(dev && (b43legacy_status(dev) >= B43legacy_STAT_INITIALIZED))) {
/* Force the microcode to trigger the
* beacon update bottom-half IRQ. */
spin_lock_irq(&wl->irq_lock);
b43legacy_write32(dev, B43legacy_MMIO_MACCMD,
b43legacy_read32(dev, B43legacy_MMIO_MACCMD)
| B43legacy_MACCMD_BEACON0_VALID
| B43legacy_MACCMD_BEACON1_VALID);
spin_unlock_irq(&wl->irq_lock);
}
mutex_unlock(&wl->mutex);
}
/* Asynchronously update the packet templates in template RAM. /* Asynchronously update the packet templates in template RAM.
* Locking: Requires wl->irq_lock to be locked. */ * Locking: Requires wl->irq_lock to be locked. */
static void b43legacy_update_templates(struct b43legacy_wl *wl) static void b43legacy_update_templates(struct b43legacy_wl *wl)
...@@ -1156,25 +1178,31 @@ static void b43legacy_update_templates(struct b43legacy_wl *wl) ...@@ -1156,25 +1178,31 @@ static void b43legacy_update_templates(struct b43legacy_wl *wl)
wl->current_beacon = beacon; wl->current_beacon = beacon;
wl->beacon0_uploaded = 0; wl->beacon0_uploaded = 0;
wl->beacon1_uploaded = 0; wl->beacon1_uploaded = 0;
queue_work(wl->hw->workqueue, &wl->beacon_update_trigger);
} }
static void b43legacy_set_beacon_int(struct b43legacy_wldev *dev, static void b43legacy_set_beacon_int(struct b43legacy_wldev *dev,
u16 beacon_int) u16 beacon_int)
{ {
b43legacy_time_lock(dev); b43legacy_time_lock(dev);
if (dev->dev->id.revision >= 3) if (dev->dev->id.revision >= 3) {
b43legacy_write32(dev, 0x188, (beacon_int << 16)); b43legacy_write32(dev, B43legacy_MMIO_TSF_CFP_REP,
else { (beacon_int << 16));
b43legacy_write32(dev, B43legacy_MMIO_TSF_CFP_START,
(beacon_int << 10));
} else {
b43legacy_write16(dev, 0x606, (beacon_int >> 6)); b43legacy_write16(dev, 0x606, (beacon_int >> 6));
b43legacy_write16(dev, 0x610, beacon_int); b43legacy_write16(dev, 0x610, beacon_int);
} }
b43legacy_time_unlock(dev); b43legacy_time_unlock(dev);
b43legacydbg(dev->wl, "Set beacon interval to %u\n", beacon_int);
} }
static void handle_irq_beacon(struct b43legacy_wldev *dev) static void handle_irq_beacon(struct b43legacy_wldev *dev)
{ {
struct b43legacy_wl *wl = dev->wl; struct b43legacy_wl *wl = dev->wl;
u32 cmd; u32 cmd;
u32 beacon0_valid, beacon1_valid;
if (!b43legacy_is_mode(wl, NL80211_IFTYPE_AP)) if (!b43legacy_is_mode(wl, NL80211_IFTYPE_AP))
return; return;
...@@ -1182,7 +1210,11 @@ static void handle_irq_beacon(struct b43legacy_wldev *dev) ...@@ -1182,7 +1210,11 @@ static void handle_irq_beacon(struct b43legacy_wldev *dev)
/* This is the bottom half of the asynchronous beacon update. */ /* This is the bottom half of the asynchronous beacon update. */
cmd = b43legacy_read32(dev, B43legacy_MMIO_MACCMD); cmd = b43legacy_read32(dev, B43legacy_MMIO_MACCMD);
if (!(cmd & B43legacy_MACCMD_BEACON0_VALID)) { beacon0_valid = (cmd & B43legacy_MACCMD_BEACON0_VALID);
beacon1_valid = (cmd & B43legacy_MACCMD_BEACON1_VALID);
cmd &= ~(B43legacy_MACCMD_BEACON0_VALID | B43legacy_MACCMD_BEACON1_VALID);
if (!beacon0_valid) {
if (!wl->beacon0_uploaded) { if (!wl->beacon0_uploaded) {
b43legacy_write_beacon_template(dev, 0x68, b43legacy_write_beacon_template(dev, 0x68,
B43legacy_SHM_SH_BTL0, B43legacy_SHM_SH_BTL0,
...@@ -1193,8 +1225,7 @@ static void handle_irq_beacon(struct b43legacy_wldev *dev) ...@@ -1193,8 +1225,7 @@ static void handle_irq_beacon(struct b43legacy_wldev *dev)
wl->beacon0_uploaded = 1; wl->beacon0_uploaded = 1;
} }
cmd |= B43legacy_MACCMD_BEACON0_VALID; cmd |= B43legacy_MACCMD_BEACON0_VALID;
} } else if (!beacon1_valid) {
if (!(cmd & B43legacy_MACCMD_BEACON1_VALID)) {
if (!wl->beacon1_uploaded) { if (!wl->beacon1_uploaded) {
b43legacy_write_beacon_template(dev, 0x468, b43legacy_write_beacon_template(dev, 0x468,
B43legacy_SHM_SH_BTL1, B43legacy_SHM_SH_BTL1,
...@@ -3435,6 +3466,7 @@ static void b43legacy_op_stop(struct ieee80211_hw *hw) ...@@ -3435,6 +3466,7 @@ static void b43legacy_op_stop(struct ieee80211_hw *hw)
struct b43legacy_wldev *dev = wl->current_dev; struct b43legacy_wldev *dev = wl->current_dev;
b43legacy_rfkill_exit(dev); b43legacy_rfkill_exit(dev);
cancel_work_sync(&(wl->beacon_update_trigger));
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
if (b43legacy_status(dev) >= B43legacy_STAT_STARTED) if (b43legacy_status(dev) >= B43legacy_STAT_STARTED)
...@@ -3766,6 +3798,7 @@ static int b43legacy_wireless_init(struct ssb_device *dev) ...@@ -3766,6 +3798,7 @@ static int b43legacy_wireless_init(struct ssb_device *dev)
spin_lock_init(&wl->leds_lock); spin_lock_init(&wl->leds_lock);
mutex_init(&wl->mutex); mutex_init(&wl->mutex);
INIT_LIST_HEAD(&wl->devlist); INIT_LIST_HEAD(&wl->devlist);
INIT_WORK(&wl->beacon_update_trigger, b43legacy_beacon_update_trigger_work);
ssb_set_devtypedata(dev, wl); ssb_set_devtypedata(dev, wl);
b43legacyinfo(wl, "Broadcom %04X WLAN found\n", dev->bus->chip_id); b43legacyinfo(wl, "Broadcom %04X WLAN found\n", dev->bus->chip_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment