Commit 4b2d9cf0 authored by Jeff Garzik's avatar Jeff Garzik

Merge branch 'upstream' of...

Merge branch 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6 into upstream
parents 4c1234ff 89c318ed
...@@ -636,6 +636,17 @@ struct bcm43xx_key { ...@@ -636,6 +636,17 @@ struct bcm43xx_key {
u8 algorithm; u8 algorithm;
}; };
/* Driver initialization status. */
enum {
BCM43xx_STAT_UNINIT, /* Uninitialized. */
BCM43xx_STAT_INITIALIZING, /* init_board() in progress. */
BCM43xx_STAT_INITIALIZED, /* Fully operational. */
BCM43xx_STAT_SHUTTINGDOWN, /* free_board() in progress. */
BCM43xx_STAT_RESTARTING, /* controller_restart() called. */
};
#define bcm43xx_status(bcm) atomic_read(&(bcm)->init_status)
#define bcm43xx_set_status(bcm, stat) atomic_set(&(bcm)->init_status, (stat))
struct bcm43xx_private { struct bcm43xx_private {
struct ieee80211_device *ieee; struct ieee80211_device *ieee;
struct ieee80211softmac_device *softmac; struct ieee80211softmac_device *softmac;
...@@ -646,18 +657,17 @@ struct bcm43xx_private { ...@@ -646,18 +657,17 @@ struct bcm43xx_private {
void __iomem *mmio_addr; void __iomem *mmio_addr;
/* Do not use the lock directly. Use the bcm43xx_lock* helper /* Locking, see "theory of locking" text below. */
* functions, to be MMIO-safe. */ spinlock_t irq_lock;
spinlock_t _lock; struct mutex mutex;
/* Driver initialization status BCM43xx_STAT_*** */
atomic_t init_status;
/* Driver status flags. */ u16 was_initialized:1, /* for PCI suspend/resume. */
u32 initialized:1, /* init_board() succeed */
was_initialized:1, /* for PCI suspend/resume. */
shutting_down:1, /* free_board() in progress */
__using_pio:1, /* Internal, use bcm43xx_using_pio(). */ __using_pio:1, /* Internal, use bcm43xx_using_pio(). */
bad_frames_preempt:1, /* Use "Bad Frames Preemption" (default off) */ bad_frames_preempt:1, /* Use "Bad Frames Preemption" (default off) */
reg124_set_0x4:1, /* Some variable to keep track of IRQ stuff. */ reg124_set_0x4:1, /* Some variable to keep track of IRQ stuff. */
powersaving:1, /* TRUE if we are in PowerSaving mode. FALSE otherwise. */
short_preamble:1, /* TRUE, if short preamble is enabled. */ short_preamble:1, /* TRUE, if short preamble is enabled. */
firmware_norelease:1; /* Do not release the firmware. Used on suspend. */ firmware_norelease:1; /* Do not release the firmware. Used on suspend. */
...@@ -721,7 +731,7 @@ struct bcm43xx_private { ...@@ -721,7 +731,7 @@ struct bcm43xx_private {
struct tasklet_struct isr_tasklet; struct tasklet_struct isr_tasklet;
/* Periodic tasks */ /* Periodic tasks */
struct timer_list periodic_tasks; struct work_struct periodic_work;
unsigned int periodic_state; unsigned int periodic_state;
struct work_struct restart_work; struct work_struct restart_work;
...@@ -746,21 +756,55 @@ struct bcm43xx_private { ...@@ -746,21 +756,55 @@ struct bcm43xx_private {
#endif #endif
}; };
/* bcm43xx_(un)lock() protect struct bcm43xx_private.
* Note that _NO_ MMIO writes are allowed. If you want to /* *** THEORY OF LOCKING ***
* write to the device through MMIO in the critical section, use *
* the *_mmio lock functions. * We have two different locks in the bcm43xx driver.
* MMIO read-access is allowed, though. * => bcm->mutex: General sleeping mutex. Protects struct bcm43xx_private
*/ * and the device registers.
#define bcm43xx_lock(bcm, flags) spin_lock_irqsave(&(bcm)->_lock, flags) * => bcm->irq_lock: IRQ spinlock. Protects against IRQ handler concurrency.
#define bcm43xx_unlock(bcm, flags) spin_unlock_irqrestore(&(bcm)->_lock, flags) *
/* bcm43xx_(un)lock_mmio() protect struct bcm43xx_private and MMIO. * We have three types of helper function pairs to utilize these locks.
* MMIO write-access to the device is allowed. * (Always use the helper functions.)
* All MMIO writes are flushed on unlock, so it is guaranteed to not * 1) bcm43xx_{un}lock_noirq():
* interfere with other threads writing MMIO registers. * Takes bcm->mutex. Does _not_ protect against IRQ concurrency,
* so it is almost always unsafe, if device IRQs are enabled.
* So only use this, if device IRQs are masked.
* Locking may sleep.
* You can sleep within the critical section.
* 2) bcm43xx_{un}lock_irqonly():
* Takes bcm->irq_lock. Does _not_ protect against
* bcm43xx_lock_noirq() critical sections.
* Does only protect against the IRQ handler path and other
* irqonly() critical sections.
* Locking does not sleep.
* You must not sleep within the critical section.
* 3) bcm43xx_{un}lock_irqsafe():
* This is the cummulative lock and takes both, mutex and irq_lock.
* Protects against noirq() and irqonly() critical sections (and
* the IRQ handler path).
* Locking may sleep.
* You must not sleep within the critical section.
*/ */
#define bcm43xx_lock_mmio(bcm, flags) bcm43xx_lock(bcm, flags)
#define bcm43xx_unlock_mmio(bcm, flags) do { mmiowb(); bcm43xx_unlock(bcm, flags); } while (0) /* Lock type 1 */
#define bcm43xx_lock_noirq(bcm) mutex_lock(&(bcm)->mutex)
#define bcm43xx_unlock_noirq(bcm) mutex_unlock(&(bcm)->mutex)
/* Lock type 2 */
#define bcm43xx_lock_irqonly(bcm, flags) \
spin_lock_irqsave(&(bcm)->irq_lock, flags)
#define bcm43xx_unlock_irqonly(bcm, flags) \
spin_unlock_irqrestore(&(bcm)->irq_lock, flags)
/* Lock type 3 */
#define bcm43xx_lock_irqsafe(bcm, flags) do { \
bcm43xx_lock_noirq(bcm); \
bcm43xx_lock_irqonly(bcm, flags); \
} while (0)
#define bcm43xx_unlock_irqsafe(bcm, flags) do { \
bcm43xx_unlock_irqonly(bcm, flags); \
bcm43xx_unlock_noirq(bcm); \
} while (0)
static inline static inline
struct bcm43xx_private * bcm43xx_priv(struct net_device *dev) struct bcm43xx_private * bcm43xx_priv(struct net_device *dev)
...@@ -843,16 +887,6 @@ struct bcm43xx_radioinfo * bcm43xx_current_radio(struct bcm43xx_private *bcm) ...@@ -843,16 +887,6 @@ struct bcm43xx_radioinfo * bcm43xx_current_radio(struct bcm43xx_private *bcm)
return &(bcm->core_80211_ext[bcm->current_80211_core_idx].radio); return &(bcm->core_80211_ext[bcm->current_80211_core_idx].radio);
} }
/* Are we running in init_board() context? */
static inline
int bcm43xx_is_initializing(struct bcm43xx_private *bcm)
{
if (bcm->initialized)
return 0;
if (bcm->shutting_down)
return 0;
return 1;
}
static inline static inline
struct bcm43xx_lopair * bcm43xx_get_lopair(struct bcm43xx_phyinfo *phy, struct bcm43xx_lopair * bcm43xx_get_lopair(struct bcm43xx_phyinfo *phy,
......
...@@ -77,8 +77,8 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf, ...@@ -77,8 +77,8 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf,
down(&big_buffer_sem); down(&big_buffer_sem);
bcm43xx_lock_mmio(bcm, flags); bcm43xx_lock_irqsafe(bcm, flags);
if (!bcm->initialized) { if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
fappend("Board not initialized.\n"); fappend("Board not initialized.\n");
goto out; goto out;
} }
...@@ -121,7 +121,7 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf, ...@@ -121,7 +121,7 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf,
fappend("\n"); fappend("\n");
out: out:
bcm43xx_unlock_mmio(bcm, flags); bcm43xx_unlock_irqsafe(bcm, flags);
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
up(&big_buffer_sem); up(&big_buffer_sem);
return res; return res;
...@@ -159,8 +159,8 @@ static ssize_t spromdump_read_file(struct file *file, char __user *userbuf, ...@@ -159,8 +159,8 @@ static ssize_t spromdump_read_file(struct file *file, char __user *userbuf,
unsigned long flags; unsigned long flags;
down(&big_buffer_sem); down(&big_buffer_sem);
bcm43xx_lock_mmio(bcm, flags); bcm43xx_lock_irqsafe(bcm, flags);
if (!bcm->initialized) { if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
fappend("Board not initialized.\n"); fappend("Board not initialized.\n");
goto out; goto out;
} }
...@@ -169,7 +169,7 @@ static ssize_t spromdump_read_file(struct file *file, char __user *userbuf, ...@@ -169,7 +169,7 @@ static ssize_t spromdump_read_file(struct file *file, char __user *userbuf,
fappend("boardflags: 0x%04x\n", bcm->sprom.boardflags); fappend("boardflags: 0x%04x\n", bcm->sprom.boardflags);
out: out:
bcm43xx_unlock_mmio(bcm, flags); bcm43xx_unlock_irqsafe(bcm, flags);
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
up(&big_buffer_sem); up(&big_buffer_sem);
return res; return res;
...@@ -188,8 +188,8 @@ static ssize_t tsf_read_file(struct file *file, char __user *userbuf, ...@@ -188,8 +188,8 @@ static ssize_t tsf_read_file(struct file *file, char __user *userbuf,
u64 tsf; u64 tsf;
down(&big_buffer_sem); down(&big_buffer_sem);
bcm43xx_lock_mmio(bcm, flags); bcm43xx_lock_irqsafe(bcm, flags);
if (!bcm->initialized) { if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
fappend("Board not initialized.\n"); fappend("Board not initialized.\n");
goto out; goto out;
} }
...@@ -199,7 +199,7 @@ static ssize_t tsf_read_file(struct file *file, char __user *userbuf, ...@@ -199,7 +199,7 @@ static ssize_t tsf_read_file(struct file *file, char __user *userbuf,
(unsigned int)(tsf & 0xFFFFFFFFULL)); (unsigned int)(tsf & 0xFFFFFFFFULL));
out: out:
bcm43xx_unlock_mmio(bcm, flags); bcm43xx_unlock_irqsafe(bcm, flags);
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
up(&big_buffer_sem); up(&big_buffer_sem);
return res; return res;
...@@ -221,8 +221,8 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf, ...@@ -221,8 +221,8 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf,
res = -EFAULT; res = -EFAULT;
goto out_up; goto out_up;
} }
bcm43xx_lock_mmio(bcm, flags); bcm43xx_lock_irqsafe(bcm, flags);
if (!bcm->initialized) { if (bcm43xx_status(bcm) != BCM43xx_STAT_INITIALIZED) {
printk(KERN_INFO PFX "debugfs: Board not initialized.\n"); printk(KERN_INFO PFX "debugfs: Board not initialized.\n");
res = -EFAULT; res = -EFAULT;
goto out_unlock; goto out_unlock;
...@@ -233,10 +233,11 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf, ...@@ -233,10 +233,11 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf,
goto out_unlock; goto out_unlock;
} }
bcm43xx_tsf_write(bcm, tsf); bcm43xx_tsf_write(bcm, tsf);
mmiowb();
res = buf_size; res = buf_size;
out_unlock: out_unlock:
bcm43xx_unlock_mmio(bcm, flags); bcm43xx_unlock_irqsafe(bcm, flags);
out_up: out_up:
up(&big_buffer_sem); up(&big_buffer_sem);
return res; return res;
...@@ -257,7 +258,7 @@ static ssize_t txstat_read_file(struct file *file, char __user *userbuf, ...@@ -257,7 +258,7 @@ static ssize_t txstat_read_file(struct file *file, char __user *userbuf,
int i, cnt, j = 0; int i, cnt, j = 0;
down(&big_buffer_sem); down(&big_buffer_sem);
bcm43xx_lock(bcm, flags); bcm43xx_lock_irqsafe(bcm, flags);
fappend("Last %d logged xmitstatus blobs (Latest first):\n\n", fappend("Last %d logged xmitstatus blobs (Latest first):\n\n",
BCM43xx_NR_LOGGED_XMITSTATUS); BCM43xx_NR_LOGGED_XMITSTATUS);
...@@ -293,14 +294,14 @@ static ssize_t txstat_read_file(struct file *file, char __user *userbuf, ...@@ -293,14 +294,14 @@ static ssize_t txstat_read_file(struct file *file, char __user *userbuf,
i = BCM43xx_NR_LOGGED_XMITSTATUS - 1; i = BCM43xx_NR_LOGGED_XMITSTATUS - 1;
} }
bcm43xx_unlock(bcm, flags); bcm43xx_unlock_irqsafe(bcm, flags);
res = simple_read_from_buffer(userbuf, count, ppos, buf, pos); res = simple_read_from_buffer(userbuf, count, ppos, buf, pos);
bcm43xx_lock(bcm, flags); bcm43xx_lock_irqsafe(bcm, flags);
if (*ppos == pos) { if (*ppos == pos) {
/* Done. Drop the copied data. */ /* Done. Drop the copied data. */
e->xmitstatus_printing = 0; e->xmitstatus_printing = 0;
} }
bcm43xx_unlock(bcm, flags); bcm43xx_unlock_irqsafe(bcm, flags);
up(&big_buffer_sem); up(&big_buffer_sem);
return res; return res;
} }
......
...@@ -51,12 +51,12 @@ static void bcm43xx_led_blink(unsigned long d) ...@@ -51,12 +51,12 @@ static void bcm43xx_led_blink(unsigned long d)
struct bcm43xx_private *bcm = led->bcm; struct bcm43xx_private *bcm = led->bcm;
unsigned long flags; unsigned long flags;
bcm43xx_lock_mmio(bcm, flags); bcm43xx_lock_irqonly(bcm, flags);
if (led->blink_interval) { if (led->blink_interval) {
bcm43xx_led_changestate(led); bcm43xx_led_changestate(led);
mod_timer(&led->blink_timer, jiffies + led->blink_interval); mod_timer(&led->blink_timer, jiffies + led->blink_interval);
} }
bcm43xx_unlock_mmio(bcm, flags); bcm43xx_unlock_irqonly(bcm, flags);
} }
static void bcm43xx_led_blink_start(struct bcm43xx_led *led, static void bcm43xx_led_blink_start(struct bcm43xx_led *led,
......
This diff is collapsed.
...@@ -1410,7 +1410,10 @@ static inline ...@@ -1410,7 +1410,10 @@ static inline
u16 bcm43xx_phy_lo_g_deviation_subval(struct bcm43xx_private *bcm, u16 control) u16 bcm43xx_phy_lo_g_deviation_subval(struct bcm43xx_private *bcm, u16 control)
{ {
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
u16 ret;
unsigned long flags;
local_irq_save(flags);
if (phy->connected) { if (phy->connected) {
bcm43xx_phy_write(bcm, 0x15, 0xE300); bcm43xx_phy_write(bcm, 0x15, 0xE300);
control <<= 8; control <<= 8;
...@@ -1430,8 +1433,10 @@ u16 bcm43xx_phy_lo_g_deviation_subval(struct bcm43xx_private *bcm, u16 control) ...@@ -1430,8 +1433,10 @@ u16 bcm43xx_phy_lo_g_deviation_subval(struct bcm43xx_private *bcm, u16 control)
bcm43xx_phy_write(bcm, 0x0015, control | 0xFFE0); bcm43xx_phy_write(bcm, 0x0015, control | 0xFFE0);
udelay(8); udelay(8);
} }
ret = bcm43xx_phy_read(bcm, 0x002D);
local_irq_restore(flags);
return bcm43xx_phy_read(bcm, 0x002D); return ret;
} }
static u32 bcm43xx_phy_lo_g_singledeviation(struct bcm43xx_private *bcm, u16 control) static u32 bcm43xx_phy_lo_g_singledeviation(struct bcm43xx_private *bcm, u16 control)
...@@ -1648,7 +1653,7 @@ void bcm43xx_phy_set_baseband_attenuation(struct bcm43xx_private *bcm, ...@@ -1648,7 +1653,7 @@ void bcm43xx_phy_set_baseband_attenuation(struct bcm43xx_private *bcm,
void bcm43xx_phy_lo_g_measure(struct bcm43xx_private *bcm) void bcm43xx_phy_lo_g_measure(struct bcm43xx_private *bcm)
{ {
static const u8 pairorder[10] = { 3, 1, 5, 7, 9, 2, 0, 4, 6, 8 }; static const u8 pairorder[10] = { 3, 1, 5, 7, 9, 2, 0, 4, 6, 8 };
const int is_initializing = bcm43xx_is_initializing(bcm); const int is_initializing = (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZING);
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
u16 h, i, oldi = 0, j; u16 h, i, oldi = 0, j;
......
...@@ -262,8 +262,10 @@ static void tx_tasklet(unsigned long d) ...@@ -262,8 +262,10 @@ static void tx_tasklet(unsigned long d)
int err; int err;
u16 txctl; u16 txctl;
bcm43xx_lock_mmio(bcm, flags); bcm43xx_lock_irqonly(bcm, flags);
if (queue->tx_frozen)
goto out_unlock;
txctl = bcm43xx_pio_read(queue, BCM43xx_PIO_TXCTL); txctl = bcm43xx_pio_read(queue, BCM43xx_PIO_TXCTL);
if (txctl & BCM43xx_PIO_TXCTL_SUSPEND) if (txctl & BCM43xx_PIO_TXCTL_SUSPEND)
goto out_unlock; goto out_unlock;
...@@ -298,7 +300,7 @@ static void tx_tasklet(unsigned long d) ...@@ -298,7 +300,7 @@ static void tx_tasklet(unsigned long d)
continue; continue;
} }
out_unlock: out_unlock:
bcm43xx_unlock_mmio(bcm, flags); bcm43xx_unlock_irqonly(bcm, flags);
} }
static void setup_txqueues(struct bcm43xx_pioqueue *queue) static void setup_txqueues(struct bcm43xx_pioqueue *queue)
...@@ -374,7 +376,6 @@ static void cancel_transfers(struct bcm43xx_pioqueue *queue) ...@@ -374,7 +376,6 @@ static void cancel_transfers(struct bcm43xx_pioqueue *queue)
struct bcm43xx_pio_txpacket *packet, *tmp_packet; struct bcm43xx_pio_txpacket *packet, *tmp_packet;
netif_tx_disable(queue->bcm->net_dev); netif_tx_disable(queue->bcm->net_dev);
assert(queue->bcm->shutting_down);
tasklet_disable(&queue->txtask); tasklet_disable(&queue->txtask);
list_for_each_entry_safe(packet, tmp_packet, &queue->txrunning, list) list_for_each_entry_safe(packet, tmp_packet, &queue->txrunning, list)
...@@ -634,5 +635,40 @@ void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue) ...@@ -634,5 +635,40 @@ void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue)
bcm43xx_pio_read(queue, BCM43xx_PIO_TXCTL) bcm43xx_pio_read(queue, BCM43xx_PIO_TXCTL)
& ~BCM43xx_PIO_TXCTL_SUSPEND); & ~BCM43xx_PIO_TXCTL_SUSPEND);
bcm43xx_power_saving_ctl_bits(queue->bcm, -1, -1); bcm43xx_power_saving_ctl_bits(queue->bcm, -1, -1);
if (!list_empty(&queue->txqueue))
tasklet_schedule(&queue->txtask); tasklet_schedule(&queue->txtask);
} }
void bcm43xx_pio_freeze_txqueues(struct bcm43xx_private *bcm)
{
struct bcm43xx_pio *pio;
assert(bcm43xx_using_pio(bcm));
pio = bcm43xx_current_pio(bcm);
pio->queue0->tx_frozen = 1;
pio->queue1->tx_frozen = 1;
pio->queue2->tx_frozen = 1;
pio->queue3->tx_frozen = 1;
}
void bcm43xx_pio_thaw_txqueues(struct bcm43xx_private *bcm)
{
struct bcm43xx_pio *pio;
assert(bcm43xx_using_pio(bcm));
pio = bcm43xx_current_pio(bcm);
pio->queue0->tx_frozen = 0;
pio->queue1->tx_frozen = 0;
pio->queue2->tx_frozen = 0;
pio->queue3->tx_frozen = 0;
if (!list_empty(&pio->queue0->txqueue))
tasklet_schedule(&pio->queue0->txtask);
if (!list_empty(&pio->queue1->txqueue))
tasklet_schedule(&pio->queue1->txtask);
if (!list_empty(&pio->queue2->txqueue))
tasklet_schedule(&pio->queue2->txtask);
if (!list_empty(&pio->queue3->txqueue))
tasklet_schedule(&pio->queue3->txtask);
}
...@@ -54,6 +54,7 @@ struct bcm43xx_pioqueue { ...@@ -54,6 +54,7 @@ struct bcm43xx_pioqueue {
u16 mmio_base; u16 mmio_base;
u8 tx_suspended:1, u8 tx_suspended:1,
tx_frozen:1,
need_workarounds:1; /* Workarounds needed for core.rev < 3 */ need_workarounds:1; /* Workarounds needed for core.rev < 3 */
/* Adjusted size of the device internal TX buffer. */ /* Adjusted size of the device internal TX buffer. */
...@@ -108,8 +109,12 @@ void bcm43xx_pio_handle_xmitstatus(struct bcm43xx_private *bcm, ...@@ -108,8 +109,12 @@ void bcm43xx_pio_handle_xmitstatus(struct bcm43xx_private *bcm,
struct bcm43xx_xmitstatus *status); struct bcm43xx_xmitstatus *status);
void bcm43xx_pio_rx(struct bcm43xx_pioqueue *queue); void bcm43xx_pio_rx(struct bcm43xx_pioqueue *queue);
/* Suspend a TX queue on hardware level. */
void bcm43xx_pio_tx_suspend(struct bcm43xx_pioqueue *queue); void bcm43xx_pio_tx_suspend(struct bcm43xx_pioqueue *queue);
void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue); void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue);
/* Suspend (freeze) the TX tasklet (software level). */
void bcm43xx_pio_freeze_txqueues(struct bcm43xx_private *bcm);
void bcm43xx_pio_thaw_txqueues(struct bcm43xx_private *bcm);
#else /* CONFIG_BCM43XX_PIO */ #else /* CONFIG_BCM43XX_PIO */
...@@ -145,6 +150,14 @@ static inline ...@@ -145,6 +150,14 @@ static inline
void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue) void bcm43xx_pio_tx_resume(struct bcm43xx_pioqueue *queue)
{ {
} }
static inline
void bcm43xx_pio_freeze_txqueues(struct bcm43xx_private *bcm)
{
}
static inline
void bcm43xx_pio_thaw_txqueues(struct bcm43xx_private *bcm)
{
}
#endif /* CONFIG_BCM43XX_PIO */ #endif /* CONFIG_BCM43XX_PIO */
#endif /* BCM43xx_PIO_H_ */ #endif /* BCM43xx_PIO_H_ */
...@@ -120,12 +120,12 @@ static ssize_t bcm43xx_attr_sprom_show(struct device *dev, ...@@ -120,12 +120,12 @@ static ssize_t bcm43xx_attr_sprom_show(struct device *dev,
GFP_KERNEL); GFP_KERNEL);
if (!sprom) if (!sprom)
return -ENOMEM; return -ENOMEM;
bcm43xx_lock_mmio(bcm, flags); bcm43xx_lock_irqsafe(bcm, flags);
assert(bcm->initialized);
err = bcm43xx_sprom_read(bcm, sprom); err = bcm43xx_sprom_read(bcm, sprom);
if (!err) if (!err)
err = sprom2hex(sprom, buf, PAGE_SIZE); err = sprom2hex(sprom, buf, PAGE_SIZE);
bcm43xx_unlock_mmio(bcm, flags); mmiowb();
bcm43xx_unlock_irqsafe(bcm, flags);
kfree(sprom); kfree(sprom);
return err; return err;
...@@ -150,10 +150,10 @@ static ssize_t bcm43xx_attr_sprom_store(struct device *dev, ...@@ -150,10 +150,10 @@ static ssize_t bcm43xx_attr_sprom_store(struct device *dev,
err = hex2sprom(sprom, buf, count); err = hex2sprom(sprom, buf, count);
if (err) if (err)
goto out_kfree; goto out_kfree;
bcm43xx_lock_mmio(bcm, flags); bcm43xx_lock_irqsafe(bcm, flags);
assert(bcm->initialized);
err = bcm43xx_sprom_write(bcm, sprom); err = bcm43xx_sprom_write(bcm, sprom);
bcm43xx_unlock_mmio(bcm, flags); mmiowb();
bcm43xx_unlock_irqsafe(bcm, flags);
out_kfree: out_kfree:
kfree(sprom); kfree(sprom);
...@@ -170,15 +170,13 @@ static ssize_t bcm43xx_attr_interfmode_show(struct device *dev, ...@@ -170,15 +170,13 @@ static ssize_t bcm43xx_attr_interfmode_show(struct device *dev,
char *buf) char *buf)
{ {
struct bcm43xx_private *bcm = dev_to_bcm(dev); struct bcm43xx_private *bcm = dev_to_bcm(dev);
unsigned long flags;
int err; int err;
ssize_t count = 0; ssize_t count = 0;
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
bcm43xx_lock(bcm, flags); bcm43xx_lock_noirq(bcm);
assert(bcm->initialized);
switch (bcm43xx_current_radio(bcm)->interfmode) { switch (bcm43xx_current_radio(bcm)->interfmode) {
case BCM43xx_RADIO_INTERFMODE_NONE: case BCM43xx_RADIO_INTERFMODE_NONE:
...@@ -195,7 +193,7 @@ static ssize_t bcm43xx_attr_interfmode_show(struct device *dev, ...@@ -195,7 +193,7 @@ static ssize_t bcm43xx_attr_interfmode_show(struct device *dev,
} }
err = 0; err = 0;
bcm43xx_unlock(bcm, flags); bcm43xx_unlock_noirq(bcm);
return err ? err : count; return err ? err : count;
...@@ -231,16 +229,15 @@ static ssize_t bcm43xx_attr_interfmode_store(struct device *dev, ...@@ -231,16 +229,15 @@ static ssize_t bcm43xx_attr_interfmode_store(struct device *dev,
return -EINVAL; return -EINVAL;
} }
bcm43xx_lock_mmio(bcm, flags); bcm43xx_lock_irqsafe(bcm, flags);
assert(bcm->initialized);
err = bcm43xx_radio_set_interference_mitigation(bcm, mode); err = bcm43xx_radio_set_interference_mitigation(bcm, mode);
if (err) { if (err) {
printk(KERN_ERR PFX "Interference Mitigation not " printk(KERN_ERR PFX "Interference Mitigation not "
"supported by device\n"); "supported by device\n");
} }
mmiowb();
bcm43xx_unlock_mmio(bcm, flags); bcm43xx_unlock_irqsafe(bcm, flags);
return err ? err : count; return err ? err : count;
} }
...@@ -254,15 +251,13 @@ static ssize_t bcm43xx_attr_preamble_show(struct device *dev, ...@@ -254,15 +251,13 @@ static ssize_t bcm43xx_attr_preamble_show(struct device *dev,
char *buf) char *buf)
{ {
struct bcm43xx_private *bcm = dev_to_bcm(dev); struct bcm43xx_private *bcm = dev_to_bcm(dev);
unsigned long flags;
int err; int err;
ssize_t count; ssize_t count;
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
bcm43xx_lock(bcm, flags); bcm43xx_lock_noirq(bcm);
assert(bcm->initialized);
if (bcm->short_preamble) if (bcm->short_preamble)
count = snprintf(buf, PAGE_SIZE, "1 (Short Preamble enabled)\n"); count = snprintf(buf, PAGE_SIZE, "1 (Short Preamble enabled)\n");
...@@ -270,7 +265,7 @@ static ssize_t bcm43xx_attr_preamble_show(struct device *dev, ...@@ -270,7 +265,7 @@ static ssize_t bcm43xx_attr_preamble_show(struct device *dev,
count = snprintf(buf, PAGE_SIZE, "0 (Short Preamble disabled)\n"); count = snprintf(buf, PAGE_SIZE, "0 (Short Preamble disabled)\n");
err = 0; err = 0;
bcm43xx_unlock(bcm, flags); bcm43xx_unlock_noirq(bcm);
return err ? err : count; return err ? err : count;
} }
...@@ -290,13 +285,12 @@ static ssize_t bcm43xx_attr_preamble_store(struct device *dev, ...@@ -290,13 +285,12 @@ static ssize_t bcm43xx_attr_preamble_store(struct device *dev,
value = get_boolean(buf, count); value = get_boolean(buf, count);
if (value < 0) if (value < 0)
return value; return value;
bcm43xx_lock(bcm, flags); bcm43xx_lock_irqsafe(bcm, flags);
assert(bcm->initialized);
bcm->short_preamble = !!value; bcm->short_preamble = !!value;
err = 0; err = 0;
bcm43xx_unlock(bcm, flags); bcm43xx_unlock_irqsafe(bcm, flags);
return err ? err : count; return err ? err : count;
} }
...@@ -310,7 +304,7 @@ int bcm43xx_sysfs_register(struct bcm43xx_private *bcm) ...@@ -310,7 +304,7 @@ int bcm43xx_sysfs_register(struct bcm43xx_private *bcm)
struct device *dev = &bcm->pci_dev->dev; struct device *dev = &bcm->pci_dev->dev;
int err; int err;
assert(bcm->initialized); assert(bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED);
err = device_create_file(dev, &dev_attr_sprom); err = device_create_file(dev, &dev_attr_sprom);
if (err) if (err)
......
This diff is collapsed.
...@@ -533,7 +533,7 @@ static inline void ipw_clear_bit(struct ipw_priv *priv, u32 reg, u32 mask) ...@@ -533,7 +533,7 @@ static inline void ipw_clear_bit(struct ipw_priv *priv, u32 reg, u32 mask)
ipw_write32(priv, reg, ipw_read32(priv, reg) & ~mask); ipw_write32(priv, reg, ipw_read32(priv, reg) & ~mask);
} }
static inline void ipw_enable_interrupts(struct ipw_priv *priv) static inline void __ipw_enable_interrupts(struct ipw_priv *priv)
{ {
if (priv->status & STATUS_INT_ENABLED) if (priv->status & STATUS_INT_ENABLED)
return; return;
...@@ -541,7 +541,7 @@ static inline void ipw_enable_interrupts(struct ipw_priv *priv) ...@@ -541,7 +541,7 @@ static inline void ipw_enable_interrupts(struct ipw_priv *priv)
ipw_write32(priv, IPW_INTA_MASK_R, IPW_INTA_MASK_ALL); ipw_write32(priv, IPW_INTA_MASK_R, IPW_INTA_MASK_ALL);
} }
static inline void ipw_disable_interrupts(struct ipw_priv *priv) static inline void __ipw_disable_interrupts(struct ipw_priv *priv)
{ {
if (!(priv->status & STATUS_INT_ENABLED)) if (!(priv->status & STATUS_INT_ENABLED))
return; return;
...@@ -549,6 +549,24 @@ static inline void ipw_disable_interrupts(struct ipw_priv *priv) ...@@ -549,6 +549,24 @@ static inline void ipw_disable_interrupts(struct ipw_priv *priv)
ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL); ipw_write32(priv, IPW_INTA_MASK_R, ~IPW_INTA_MASK_ALL);
} }
static inline void ipw_enable_interrupts(struct ipw_priv *priv)
{
unsigned long flags;
spin_lock_irqsave(&priv->irq_lock, flags);
__ipw_enable_interrupts(priv);
spin_unlock_irqrestore(&priv->irq_lock, flags);
}
static inline void ipw_disable_interrupts(struct ipw_priv *priv)
{
unsigned long flags;
spin_lock_irqsave(&priv->irq_lock, flags);
__ipw_disable_interrupts(priv);
spin_unlock_irqrestore(&priv->irq_lock, flags);
}
#ifdef CONFIG_IPW2200_DEBUG #ifdef CONFIG_IPW2200_DEBUG
static char *ipw_error_desc(u32 val) static char *ipw_error_desc(u32 val)
{ {
...@@ -1856,7 +1874,7 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) ...@@ -1856,7 +1874,7 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
unsigned long flags; unsigned long flags;
int rc = 0; int rc = 0;
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->irq_lock, flags);
inta = ipw_read32(priv, IPW_INTA_RW); inta = ipw_read32(priv, IPW_INTA_RW);
inta_mask = ipw_read32(priv, IPW_INTA_MASK_R); inta_mask = ipw_read32(priv, IPW_INTA_MASK_R);
...@@ -1865,6 +1883,10 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) ...@@ -1865,6 +1883,10 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
/* Add any cached INTA values that need to be handled */ /* Add any cached INTA values that need to be handled */
inta |= priv->isr_inta; inta |= priv->isr_inta;
spin_unlock_irqrestore(&priv->irq_lock, flags);
spin_lock_irqsave(&priv->lock, flags);
/* handle all the justifications for the interrupt */ /* handle all the justifications for the interrupt */
if (inta & IPW_INTA_BIT_RX_TRANSFER) { if (inta & IPW_INTA_BIT_RX_TRANSFER) {
ipw_rx(priv); ipw_rx(priv);
...@@ -1993,10 +2015,10 @@ static void ipw_irq_tasklet(struct ipw_priv *priv) ...@@ -1993,10 +2015,10 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
IPW_ERROR("Unhandled INTA bits 0x%08x\n", inta & ~handled); IPW_ERROR("Unhandled INTA bits 0x%08x\n", inta & ~handled);
} }
spin_unlock_irqrestore(&priv->lock, flags);
/* enable all interrupts */ /* enable all interrupts */
ipw_enable_interrupts(priv); ipw_enable_interrupts(priv);
spin_unlock_irqrestore(&priv->lock, flags);
} }
#define IPW_CMD(x) case IPW_CMD_ ## x : return #x #define IPW_CMD(x) case IPW_CMD_ ## x : return #x
...@@ -10460,7 +10482,7 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) ...@@ -10460,7 +10482,7 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs)
if (!priv) if (!priv)
return IRQ_NONE; return IRQ_NONE;
spin_lock(&priv->lock); spin_lock(&priv->irq_lock);
if (!(priv->status & STATUS_INT_ENABLED)) { if (!(priv->status & STATUS_INT_ENABLED)) {
/* Shared IRQ */ /* Shared IRQ */
...@@ -10482,7 +10504,7 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) ...@@ -10482,7 +10504,7 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs)
} }
/* tell the device to stop sending interrupts */ /* tell the device to stop sending interrupts */
ipw_disable_interrupts(priv); __ipw_disable_interrupts(priv);
/* ack current interrupts */ /* ack current interrupts */
inta &= (IPW_INTA_MASK_ALL & inta_mask); inta &= (IPW_INTA_MASK_ALL & inta_mask);
...@@ -10493,11 +10515,11 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs) ...@@ -10493,11 +10515,11 @@ static irqreturn_t ipw_isr(int irq, void *data, struct pt_regs *regs)
tasklet_schedule(&priv->irq_tasklet); tasklet_schedule(&priv->irq_tasklet);
spin_unlock(&priv->lock); spin_unlock(&priv->irq_lock);
return IRQ_HANDLED; return IRQ_HANDLED;
none: none:
spin_unlock(&priv->lock); spin_unlock(&priv->irq_lock);
return IRQ_NONE; return IRQ_NONE;
} }
...@@ -11477,6 +11499,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -11477,6 +11499,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
#ifdef CONFIG_IPW2200_DEBUG #ifdef CONFIG_IPW2200_DEBUG
ipw_debug_level = debug; ipw_debug_level = debug;
#endif #endif
spin_lock_init(&priv->irq_lock);
spin_lock_init(&priv->lock); spin_lock_init(&priv->lock);
for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&priv->ibss_mac_hash[i]); INIT_LIST_HEAD(&priv->ibss_mac_hash[i]);
......
...@@ -1173,6 +1173,7 @@ struct ipw_priv { ...@@ -1173,6 +1173,7 @@ struct ipw_priv {
struct ieee80211_device *ieee; struct ieee80211_device *ieee;
spinlock_t lock; spinlock_t lock;
spinlock_t irq_lock;
struct mutex mutex; struct mutex mutex;
/* basic pci-network driver stuff */ /* basic pci-network driver stuff */
......
...@@ -968,6 +968,7 @@ enum ieee80211_state { ...@@ -968,6 +968,7 @@ enum ieee80211_state {
enum { enum {
IEEE80211_CH_PASSIVE_ONLY = (1 << 0), IEEE80211_CH_PASSIVE_ONLY = (1 << 0),
IEEE80211_CH_80211H_RULES = (1 << 1),
IEEE80211_CH_B_ONLY = (1 << 2), IEEE80211_CH_B_ONLY = (1 << 2),
IEEE80211_CH_NO_IBSS = (1 << 3), IEEE80211_CH_NO_IBSS = (1 << 3),
IEEE80211_CH_UNIFORM_SPREADING = (1 << 4), IEEE80211_CH_UNIFORM_SPREADING = (1 << 4),
...@@ -976,10 +977,10 @@ enum { ...@@ -976,10 +977,10 @@ enum {
}; };
struct ieee80211_channel { struct ieee80211_channel {
u32 freq; u32 freq; /* in MHz */
u8 channel; u8 channel;
u8 flags; u8 flags;
u8 max_power; u8 max_power; /* in dBm */
}; };
struct ieee80211_geo { struct ieee80211_geo {
......
...@@ -388,7 +388,7 @@ ieee80211softmac_wx_set_genie(struct net_device *dev, ...@@ -388,7 +388,7 @@ ieee80211softmac_wx_set_genie(struct net_device *dev,
memcpy(mac->wpa.IE, extra, wrqu->data.length); memcpy(mac->wpa.IE, extra, wrqu->data.length);
dprintk(KERN_INFO PFX "generic IE set to "); dprintk(KERN_INFO PFX "generic IE set to ");
for (i=0;i<wrqu->data.length;i++) for (i=0;i<wrqu->data.length;i++)
dprintk("%.2x", mac->wpa.IE[i]); dprintk("%.2x", (u8)mac->wpa.IE[i]);
dprintk("\n"); dprintk("\n");
mac->wpa.IElen = wrqu->data.length; mac->wpa.IElen = wrqu->data.length;
} else { } else {
......
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