aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43legacy
diff options
context:
space:
mode:
authorStefano Brivio <stefano.brivio@polimi.it>2008-04-13 18:57:03 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-16 15:59:57 -0400
commit3e2c40ef09f397b0123fc0233d5d0531c217dc39 (patch)
treed245bb9e7ce830b53f270993a9703fe907a4e4dc /drivers/net/wireless/b43legacy
parent245cbe7a65f3e17999de276ea1c84538f3a7451e (diff)
b43legacy: fix TBTT and PU timings
This fixes some timings for pre-TBTT and synthetic PU. The patch by Michael Buesch has been ported to b43legacy. Signed-off-by: Stefano Brivio <stefano.brivio@polimi.it> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43legacy')
-rw-r--r--drivers/net/wireless/b43legacy/b43legacy.h3
-rw-r--r--drivers/net/wireless/b43legacy/main.c34
2 files changed, 34 insertions, 3 deletions
diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h
index 242b8ad4e33c..ded3cd31b3df 100644
--- a/drivers/net/wireless/b43legacy/b43legacy.h
+++ b/drivers/net/wireless/b43legacy/b43legacy.h
@@ -97,6 +97,7 @@
97#define B43legacy_MMIO_RADIO_HWENABLED_LO 0x49A 97#define B43legacy_MMIO_RADIO_HWENABLED_LO 0x49A
98#define B43legacy_MMIO_GPIO_CONTROL 0x49C 98#define B43legacy_MMIO_GPIO_CONTROL 0x49C
99#define B43legacy_MMIO_GPIO_MASK 0x49E 99#define B43legacy_MMIO_GPIO_MASK 0x49E
100#define B43legacy_MMIO_TSF_CFP_PRETBTT 0x612
100#define B43legacy_MMIO_TSF_0 0x632 /* core rev < 3 only */ 101#define B43legacy_MMIO_TSF_0 0x632 /* core rev < 3 only */
101#define B43legacy_MMIO_TSF_1 0x634 /* core rev < 3 only */ 102#define B43legacy_MMIO_TSF_1 0x634 /* core rev < 3 only */
102#define B43legacy_MMIO_TSF_2 0x636 /* core rev < 3 only */ 103#define B43legacy_MMIO_TSF_2 0x636 /* core rev < 3 only */
@@ -149,6 +150,8 @@
149#define B43legacy_SHM_SH_UCODEPATCH 0x0002 /* Microcode patchlevel */ 150#define B43legacy_SHM_SH_UCODEPATCH 0x0002 /* Microcode patchlevel */
150#define B43legacy_SHM_SH_UCODEDATE 0x0004 /* Microcode date */ 151#define B43legacy_SHM_SH_UCODEDATE 0x0004 /* Microcode date */
151#define B43legacy_SHM_SH_UCODETIME 0x0006 /* Microcode time */ 152#define B43legacy_SHM_SH_UCODETIME 0x0006 /* Microcode time */
153#define B43legacy_SHM_SH_SPUWKUP 0x0094 /* pre-wakeup for synth PU in us */
154#define B43legacy_SHM_SH_PRETBTT 0x0096 /* pre-TBTT in us */
152 155
153#define B43legacy_UCODEFLAGS_OFFSET 0x005E 156#define B43legacy_UCODEFLAGS_OFFSET 0x005E
154 157
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index f518e796bdec..2422a5dab1d2 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -3005,6 +3005,34 @@ static void b43legacy_set_retry_limits(struct b43legacy_wldev *dev,
3005 b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0007, long_retry); 3005 b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0007, long_retry);
3006} 3006}
3007 3007
3008static void b43legacy_set_synth_pu_delay(struct b43legacy_wldev *dev,
3009 bool idle) {
3010 u16 pu_delay = 1050;
3011
3012 if (b43legacy_is_mode(dev->wl, IEEE80211_IF_TYPE_IBSS) || idle)
3013 pu_delay = 500;
3014 if ((dev->phy.radio_ver == 0x2050) && (dev->phy.radio_rev == 8))
3015 pu_delay = max(pu_delay, (u16)2400);
3016
3017 b43legacy_shm_write16(dev, B43legacy_SHM_SHARED,
3018 B43legacy_SHM_SH_SPUWKUP, pu_delay);
3019}
3020
3021/* Set the TSF CFP pre-TargetBeaconTransmissionTime. */
3022static void b43legacy_set_pretbtt(struct b43legacy_wldev *dev)
3023{
3024 u16 pretbtt;
3025
3026 /* The time value is in microseconds. */
3027 if (b43legacy_is_mode(dev->wl, IEEE80211_IF_TYPE_IBSS))
3028 pretbtt = 2;
3029 else
3030 pretbtt = 250;
3031 b43legacy_shm_write16(dev, B43legacy_SHM_SHARED,
3032 B43legacy_SHM_SH_PRETBTT, pretbtt);
3033 b43legacy_write16(dev, B43legacy_MMIO_TSF_CFP_PRETBTT, pretbtt);
3034}
3035
3008/* Shutdown a wireless core */ 3036/* Shutdown a wireless core */
3009/* Locking: wl->mutex */ 3037/* Locking: wl->mutex */
3010static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev) 3038static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev)
@@ -3191,9 +3219,7 @@ static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev)
3191 if (err) 3219 if (err)
3192 goto err_chip_exit; 3220 goto err_chip_exit;
3193 3221
3194 b43legacy_write16(dev, 0x0612, 0x0050); 3222 b43legacy_set_synth_pu_delay(dev, 1);
3195 b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x0416, 0x0050);
3196 b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x0414, 0x01F4);
3197 3223
3198 ssb_bus_powerup(bus, 1); /* Enable dynamic PCTL */ 3224 ssb_bus_powerup(bus, 1); /* Enable dynamic PCTL */
3199 b43legacy_upload_card_macaddress(dev); 3225 b43legacy_upload_card_macaddress(dev);
@@ -3249,6 +3275,8 @@ static int b43legacy_op_add_interface(struct ieee80211_hw *hw,
3249 3275
3250 spin_lock_irqsave(&wl->irq_lock, flags); 3276 spin_lock_irqsave(&wl->irq_lock, flags);
3251 b43legacy_adjust_opmode(dev); 3277 b43legacy_adjust_opmode(dev);
3278 b43legacy_set_pretbtt(dev);
3279 b43legacy_set_synth_pu_delay(dev, 0);
3252 b43legacy_upload_card_macaddress(dev); 3280 b43legacy_upload_card_macaddress(dev);
3253 spin_unlock_irqrestore(&wl->irq_lock, flags); 3281 spin_unlock_irqrestore(&wl->irq_lock, flags);
3254 3282