Commit 75388acd authored by Larry Finger's avatar Larry Finger Committed by David S. Miller

[B43LEGACY]: add mac80211-based driver for legacy BCM43xx devices

Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e4d6b795
......@@ -804,6 +804,13 @@ L: linux-wireless@vger.kernel.org
W: http://bcm43xx.berlios.de/
S: Maintained
B43LEGACY WIRELESS DRIVER
P: Larry Finger
M: Larry.Finger@lwfinger.net
L: linux-wireless@vger.kernel.org
W: http://bcm43xx.berlios.de/
S: Maintained
BCM43XX WIRELESS DRIVER (SOFTMAC BASED VERSION)
P: Larry Finger
M: Larry.Finger@lwfinger.net
......
......@@ -580,6 +580,7 @@ config ADM8211
source "drivers/net/wireless/hostap/Kconfig"
source "drivers/net/wireless/bcm43xx/Kconfig"
source "drivers/net/wireless/b43/Kconfig"
source "drivers/net/wireless/b43legacy/Kconfig"
source "drivers/net/wireless/zd1211rw/Kconfig"
endmenu
......@@ -37,6 +37,7 @@ obj-$(CONFIG_PRISM54) += prism54/
obj-$(CONFIG_HOSTAP) += hostap/
obj-$(CONFIG_BCM43XX) += bcm43xx/
obj-$(CONFIG_B43) += b43/
obj-$(CONFIG_B43LEGACY) += b43legacy/
obj-$(CONFIG_ZD1211RW) += zd1211rw/
# 16-bit wireless PCMCIA client drivers
......
config B43LEGACY
tristate "Broadcom 43xx-legacy wireless support (mac80211 stack)"
depends on SSB_POSSIBLE && MAC80211 && WLAN_80211
select SSB
select FW_LOADER
select HW_RANDOM
---help---
b43legacy is a driver for 802.11b devices from Broadcom (BCM4301 and
BCM4303) and early model 802.11g chips (BCM4306 Ver. 2) used in the
Linksys WPC54G V1 PCMCIA devices.
Newer 802.11g and 802.11a devices need b43.
It is safe to include both b43 and b43legacy as the underlying glue
layer will automatically load the correct version for your device.
This driver uses V3 firmware, which must be installed separately using
b43-fwcutter.
This driver can be built as a module (recommended) that will be
called "b43legacy". If unsure, say M.
# Auto-select SSB PCI-HOST support, if possible
config B43LEGACY_PCI_AUTOSELECT
bool
depends on B43LEGACY && SSB_PCIHOST_POSSIBLE
select SSB_PCIHOST
default y
# Auto-select SSB PCICORE driver, if possible
config B43LEGACY_PCICORE_AUTOSELECT
bool
depends on B43LEGACY && SSB_DRIVER_PCICORE_POSSIBLE
select SSB_DRIVER_PCICORE
default y
config B43LEGACY_DEBUG
bool "Broadcom 43xx-legacy debugging"
depends on B43LEGACY
default y
---help---
Say Y, because this information will help you get the driver running.
This option generates a minimum of log output.
config B43LEGACY_DMA
bool
depends on B43LEGACY
config B43LEGACY_PIO
bool
depends on B43LEGACY
choice
prompt "Broadcom 43xx-legacy data transfer mode"
depends on B43LEGACY
default B43LEGACY_DMA_AND_PIO_MODE
config B43LEGACY_DMA_AND_PIO_MODE
bool "DMA + PIO"
select B43LEGACY_DMA
select B43LEGACY_PIO
---help---
Include both, Direct Memory Access (DMA) and Programmed I/O (PIO)
data transfer modes. The mode actually used is selectable through
the module parameter "pio". With pio=0 as a module parameter, the
default DMA is used, otherwise PIO is used.
If unsure, choose this option.
config B43LEGACY_DMA_MODE
bool "DMA (Direct Memory Access) only"
select B43LEGACY_DMA
---help---
Only include Direct Memory Access (DMA).
This reduces the size of the driver module, by omitting the PIO code.
config B43LEGACY_PIO_MODE
bool "PIO (Programmed I/O) only"
select B43LEGACY_PIO
---help---
Only include Programmed I/O (PIO).
This reduces the size of the driver module, by omitting the DMA code.
Please note that PIO transfers are slow (compared to DMA).
Also note that not all devices of the b43legacy series support PIO.
You should use PIO only if DMA does not work for you.
endchoice
obj-$(CONFIG_B43LEGACY) += b43legacy.o
b43legacy-obj-$(CONFIG_B43LEGACY_DEBUG) += debugfs.o
b43legacy-obj-$(CONFIG_B43LEGACY_DMA) += dma.o
b43legacy-obj-$(CONFIG_B43LEGACY_PIO) += pio.o
b43legacy-objs := main.o \
ilt.o \
leds.o \
phy.o \
radio.o \
sysfs.o \
xmit.o \
$(b43legacy-obj-y)
This diff is collapsed.
This diff is collapsed.
#ifndef B43legacy_DEBUGFS_H_
#define B43legacy_DEBUGFS_H_
struct b43legacy_wldev;
struct b43legacy_txstatus;
enum b43legacy_dyndbg { /* Dynamic debugging features */
B43legacy_DBG_XMITPOWER,
B43legacy_DBG_DMAOVERFLOW,
B43legacy_DBG_DMAVERBOSE,
B43legacy_DBG_PWORK_FAST,
B43legacy_DBG_PWORK_STOP,
__B43legacy_NR_DYNDBG,
};
#ifdef CONFIG_B43LEGACY_DEBUG
struct dentry;
#define B43legacy_NR_LOGGED_TXSTATUS 100
struct b43legacy_txstatus_log {
struct b43legacy_txstatus *log;
int end;
spinlock_t lock; /* lock for debugging */
};
struct b43legacy_dfs_file {
struct dentry *dentry;
char *buffer;
size_t data_len;
};
struct b43legacy_dfsentry {
struct b43legacy_wldev *dev;
struct dentry *subdir;
struct b43legacy_dfs_file file_tsf;
struct b43legacy_dfs_file file_ucode_regs;
struct b43legacy_dfs_file file_shm;
struct b43legacy_dfs_file file_txstat;
struct b43legacy_dfs_file file_txpower_g;
struct b43legacy_dfs_file file_restart;
struct b43legacy_dfs_file file_loctls;
struct b43legacy_txstatus_log txstatlog;
/* Enabled/Disabled list for the dynamic debugging features. */
u32 dyn_debug[__B43legacy_NR_DYNDBG];
/* Dentries for the dynamic debugging entries. */
struct dentry *dyn_debug_dentries[__B43legacy_NR_DYNDBG];
};
int b43legacy_debug(struct b43legacy_wldev *dev,
enum b43legacy_dyndbg feature);
void b43legacy_debugfs_init(void);
void b43legacy_debugfs_exit(void);
void b43legacy_debugfs_add_device(struct b43legacy_wldev *dev);
void b43legacy_debugfs_remove_device(struct b43legacy_wldev *dev);
void b43legacy_debugfs_log_txstat(struct b43legacy_wldev *dev,
const struct b43legacy_txstatus *status);
#else /* CONFIG_B43LEGACY_DEBUG*/
static inline
int b43legacy_debug(struct b43legacy_wldev *dev,
enum b43legacy_dyndbg feature)
{
return 0;
}
static inline
void b43legacy_debugfs_init(void) { }
static inline
void b43legacy_debugfs_exit(void) { }
static inline
void b43legacy_debugfs_add_device(struct b43legacy_wldev *dev) { }
static inline
void b43legacy_debugfs_remove_device(struct b43legacy_wldev *dev) { }
static inline
void b43legacy_debugfs_log_txstat(struct b43legacy_wldev *dev,
const struct b43legacy_txstatus *status)
{ }
#endif /* CONFIG_B43LEGACY_DEBUG*/
#endif /* B43legacy_DEBUGFS_H_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef B43legacy_ILT_H_
#define B43legacy_ILT_H_
#define B43legacy_ILT_ROTOR_SIZE 53
extern const u32 b43legacy_ilt_rotor[B43legacy_ILT_ROTOR_SIZE];
#define B43legacy_ILT_RETARD_SIZE 53
extern const u32 b43legacy_ilt_retard[B43legacy_ILT_RETARD_SIZE];
#define B43legacy_ILT_FINEFREQA_SIZE 256
extern const u16 b43legacy_ilt_finefreqa[B43legacy_ILT_FINEFREQA_SIZE];
#define B43legacy_ILT_FINEFREQG_SIZE 256
extern const u16 b43legacy_ilt_finefreqg[B43legacy_ILT_FINEFREQG_SIZE];
#define B43legacy_ILT_NOISEA2_SIZE 8
extern const u16 b43legacy_ilt_noisea2[B43legacy_ILT_NOISEA2_SIZE];
#define B43legacy_ILT_NOISEA3_SIZE 8
extern const u16 b43legacy_ilt_noisea3[B43legacy_ILT_NOISEA3_SIZE];
#define B43legacy_ILT_NOISEG1_SIZE 8
extern const u16 b43legacy_ilt_noiseg1[B43legacy_ILT_NOISEG1_SIZE];
#define B43legacy_ILT_NOISEG2_SIZE 8
extern const u16 b43legacy_ilt_noiseg2[B43legacy_ILT_NOISEG2_SIZE];
#define B43legacy_ILT_NOISESCALEG_SIZE 27
extern const u16 b43legacy_ilt_noisescaleg1[B43legacy_ILT_NOISESCALEG_SIZE];
extern const u16 b43legacy_ilt_noisescaleg2[B43legacy_ILT_NOISESCALEG_SIZE];
extern const u16 b43legacy_ilt_noisescaleg3[B43legacy_ILT_NOISESCALEG_SIZE];
#define B43legacy_ILT_SIGMASQR_SIZE 53
extern const u16 b43legacy_ilt_sigmasqr1[B43legacy_ILT_SIGMASQR_SIZE];
extern const u16 b43legacy_ilt_sigmasqr2[B43legacy_ILT_SIGMASQR_SIZE];
void b43legacy_ilt_write(struct b43legacy_wldev *dev, u16 offset, u16 val);
void b43legacy_ilt_write32(struct b43legacy_wldev *dev, u16 offset,
u32 val);
u16 b43legacy_ilt_read(struct b43legacy_wldev *dev, u16 offset);
#endif /* B43legacy_ILT_H_ */
/*
Broadcom B43legacy wireless driver
Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
Stefano Brivio <st3@riseup.net>
Michael Buesch <mb@bu3sch.de>
Danny van Dyk <kugelfang@gentoo.org>
Andreas Jaggi <andreas.jaggi@waterwave.ch>
Copyright (c) 2007 Larry Finger <Larry.Finger@lwfinger.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "leds.h"
#include "b43legacy.h"
#include "main.h"
static void b43legacy_led_changestate(struct b43legacy_led *led)
{
struct b43legacy_wldev *dev = led->dev;
const int index = led->index;
u16 ledctl;
B43legacy_WARN_ON(!(index >= 0 && index < B43legacy_NR_LEDS));
B43legacy_WARN_ON(!led->blink_interval);
ledctl = b43legacy_read16(dev, B43legacy_MMIO_GPIO_CONTROL);
ledctl ^= (1 << index);
b43legacy_write16(dev, B43legacy_MMIO_GPIO_CONTROL, ledctl);
}
static void b43legacy_led_blink(unsigned long d)
{
struct b43legacy_led *led = (struct b43legacy_led *)d;
struct b43legacy_wldev *dev = led->dev;
unsigned long flags;
spin_lock_irqsave(&dev->wl->leds_lock, flags);
if (led->blink_interval) {
b43legacy_led_changestate(led);
mod_timer(&led->blink_timer, jiffies + led->blink_interval);
}
spin_unlock_irqrestore(&dev->wl->leds_lock, flags);
}
static void b43legacy_led_blink_start(struct b43legacy_led *led,
unsigned long interval)
{
if (led->blink_interval)
return;
led->blink_interval = interval;
b43legacy_led_changestate(led);
led->blink_timer.expires = jiffies + interval;
add_timer(&led->blink_timer);
}
static void b43legacy_led_blink_stop(struct b43legacy_led *led, int sync)
{
struct b43legacy_wldev *dev = led->dev;
const int index = led->index;
u16 ledctl;
if (!led->blink_interval)
return;
if (unlikely(sync))
del_timer_sync(&led->blink_timer);
else
del_timer(&led->blink_timer);
led->blink_interval = 0;
/* Make sure the LED is turned off. */
B43legacy_WARN_ON(!(index >= 0 && index < B43legacy_NR_LEDS));
ledctl = b43legacy_read16(dev, B43legacy_MMIO_GPIO_CONTROL);
if (led->activelow)
ledctl |= (1 << index);
else
ledctl &= ~(1 << index);
b43legacy_write16(dev, B43legacy_MMIO_GPIO_CONTROL, ledctl);
}
static void b43legacy_led_init_hardcoded(struct b43legacy_wldev *dev,
struct b43legacy_led *led,
int led_index)
{
struct ssb_bus *bus = dev->dev->bus;
/* This function is called, if the behaviour (and activelow)
* information for a LED is missing in the SPROM.
* We hardcode the behaviour values for various devices here.
* Note that the B43legacy_LED_TEST_XXX behaviour values can
* be used to figure out which led is mapped to which index.
*/
switch (led_index) {
case 0:
led->behaviour = B43legacy_LED_ACTIVITY;
led->activelow = 1;
if (bus->boardinfo.vendor == PCI_VENDOR_ID_COMPAQ)
led->behaviour = B43legacy_LED_RADIO_ALL;
break;
case 1:
led->behaviour = B43legacy_LED_RADIO_B;
if (bus->boardinfo.vendor == PCI_VENDOR_ID_ASUSTEK)
led->behaviour = B43legacy_LED_ASSOC;
break;
case 2:
led->behaviour = B43legacy_LED_RADIO_A;
break;
case 3:
led->behaviour = B43legacy_LED_OFF;
break;
default:
B43legacy_BUG_ON(1);
}
}
int b43legacy_leds_init(struct b43legacy_wldev *dev)
{
struct b43legacy_led *led;
u8 sprom[4];
int i;
sprom[0] = dev->dev->bus->sprom.r1.gpio0;
sprom[1] = dev->dev->bus->sprom.r1.gpio1;
sprom[2] = dev->dev->bus->sprom.r1.gpio2;
sprom[3] = dev->dev->bus->sprom.r1.gpio3;
for (i = 0; i < B43legacy_NR_LEDS; i++) {
led = &(dev->leds[i]);
led->index = i;
led->dev = dev;
setup_timer(&led->blink_timer,
b43legacy_led_blink,
(unsigned long)led);
if (sprom[i] == 0xFF)
b43legacy_led_init_hardcoded(dev, led, i);
else {
led->behaviour = sprom[i] & B43legacy_LED_BEHAVIOUR;
led->activelow = !!(sprom[i] &
B43legacy_LED_ACTIVELOW);
}
}
return 0;
}
void b43legacy_leds_exit(struct b43legacy_wldev *dev)
{
struct b43legacy_led *led;
int i;
for (i = 0; i < B43legacy_NR_LEDS; i++) {
led = &(dev->leds[i]);
b43legacy_led_blink_stop(led, 1);
}
b43legacy_leds_switch_all(dev, 0);
}
void b43legacy_leds_update(struct b43legacy_wldev *dev, int activity)
{
struct b43legacy_led *led;
struct b43legacy_phy *phy = &dev->phy;
const int transferring = (jiffies - dev->stats.last_tx)
< B43legacy_LED_XFER_THRES;
int i;
int turn_on;
unsigned long interval = 0;
u16 ledctl;
unsigned long flags;
spin_lock_irqsave(&dev->wl->leds_lock, flags);
ledctl = b43legacy_read16(dev, B43legacy_MMIO_GPIO_CONTROL);
for (i = 0; i < B43legacy_NR_LEDS; i++) {
led = &(dev->leds[i]);
turn_on = 0;
switch (led->behaviour) {
case B43legacy_LED_INACTIVE:
continue;
case B43legacy_LED_OFF:
break;
case B43legacy_LED_ON:
turn_on = 1;
break;
case B43legacy_LED_ACTIVITY:
turn_on = activity;
break;
case B43legacy_LED_RADIO_ALL:
turn_on = phy->radio_on &&
b43legacy_is_hw_radio_enabled(dev);
break;
case B43legacy_LED_RADIO_A:
break;
case B43legacy_LED_RADIO_B:
turn_on = (phy->radio_on &&
b43legacy_is_hw_radio_enabled(dev) &&
(phy->type == B43legacy_PHYTYPE_B ||
phy->type == B43legacy_PHYTYPE_G));
break;
case B43legacy_LED_MODE_BG:
if (phy->type == B43legacy_PHYTYPE_G &&
b43legacy_is_hw_radio_enabled(dev))
turn_on = 1;
break;
case B43legacy_LED_TRANSFER:
if (transferring)
b43legacy_led_blink_start(led,
B43legacy_LEDBLINK_MEDIUM);
else
b43legacy_led_blink_stop(led, 0);
continue;
case B43legacy_LED_APTRANSFER:
if (b43legacy_is_mode(dev->wl,
IEEE80211_IF_TYPE_AP)) {
if (transferring) {
interval = B43legacy_LEDBLINK_FAST;
turn_on = 1;
}
} else {
turn_on = 1;
if (transferring)
interval = B43legacy_LEDBLINK_FAST;
else
turn_on = 0;
}
if (turn_on)
b43legacy_led_blink_start(led, interval);
else
b43legacy_led_blink_stop(led, 0);
continue;
case B43legacy_LED_WEIRD:
break;
case B43legacy_LED_ASSOC:
turn_on = 1;
#ifdef CONFIG_B43LEGACY_DEBUG
case B43legacy_LED_TEST_BLINKSLOW:
b43legacy_led_blink_start(led, B43legacy_LEDBLINK_SLOW);
continue;
case B43legacy_LED_TEST_BLINKMEDIUM:
b43legacy_led_blink_start(led,
B43legacy_LEDBLINK_MEDIUM);
continue;
case B43legacy_LED_TEST_BLINKFAST:
b43legacy_led_blink_start(led, B43legacy_LEDBLINK_FAST);
continue;
#endif /* CONFIG_B43LEGACY_DEBUG */
default:
B43legacy_BUG_ON(1);
};
if (led->activelow)
turn_on = !turn_on;
if (turn_on)
ledctl |= (1 << i);
else
ledctl &= ~(1 << i);
}
b43legacy_write16(dev, B43legacy_MMIO_GPIO_CONTROL, ledctl);
spin_unlock_irqrestore(&dev->wl->leds_lock, flags);
}
void b43legacy_leds_switch_all(struct b43legacy_wldev *dev, int on)
{
struct b43legacy_led *led;
u16 ledctl;
int i;
int bit_on;
unsigned long flags;
spin_lock_irqsave(&dev->wl->leds_lock, flags);
ledctl = b43legacy_read16(dev, B43legacy_MMIO_GPIO_CONTROL);
for (i = 0; i < B43legacy_NR_LEDS; i++) {
led = &(dev->leds[i]);
if (led->behaviour == B43legacy_LED_INACTIVE)
continue;
if (on)
bit_on = led->activelow ? 0 : 1;
else
bit_on = led->activelow ? 1 : 0;
if (bit_on)
ledctl |= (1 << i);
else
ledctl &= ~(1 << i);
}
b43legacy_write16(dev, B43legacy_MMIO_GPIO_CONTROL, ledctl);
spin_unlock_irqrestore(&dev->wl->leds_lock, flags);
}
#ifndef B43legacy_LEDS_H_
#define B43legacy_LEDS_H_
#include <linux/types.h>
#include <linux/timer.h>
struct b43legacy_led {
u8 behaviour;
bool activelow;
/* Index in the "leds" array in b43legacy_wldev */
u8 index;
struct b43legacy_wldev *dev;
struct timer_list blink_timer;
unsigned long blink_interval;
};
/* Delay between state changes when blinking in jiffies */
#define B43legacy_LEDBLINK_SLOW (HZ / 1)
#define B43legacy_LEDBLINK_MEDIUM (HZ / 4)
#define B43legacy_LEDBLINK_FAST (HZ / 8)
#define B43legacy_LED_XFER_THRES (HZ / 100)
#define B43legacy_LED_BEHAVIOUR 0x7F
#define B43legacy_LED_ACTIVELOW 0x80
enum { /* LED behaviour values */
B43legacy_LED_OFF,
B43legacy_LED_ON,
B43legacy_LED_ACTIVITY,
B43legacy_LED_RADIO_ALL,
B43legacy_LED_RADIO_A,
B43legacy_LED_RADIO_B,
B43legacy_LED_MODE_BG,
B43legacy_LED_TRANSFER,
B43legacy_LED_APTRANSFER,
B43legacy_LED_WEIRD,
B43legacy_LED_ASSOC,
B43legacy_LED_INACTIVE,
/* Behaviour values for testing.
* With these values it is easier to figure out
* the real behaviour of leds, in case the SPROM
* is missing information.
*/
B43legacy_LED_TEST_BLINKSLOW,
B43legacy_LED_TEST_BLINKMEDIUM,
B43legacy_LED_TEST_BLINKFAST,
};
int b43legacy_leds_init(struct b43legacy_wldev *dev);
void b43legacy_leds_exit(struct b43legacy_wldev *dev);
void b43legacy_leds_update(struct b43legacy_wldev *dev, int activity);
void b43legacy_leds_switch_all(struct b43legacy_wldev *dev, int on);
#endif /* B43legacy_LEDS_H_ */
This diff is collapsed.
/*
Broadcom B43legacy wireless driver
Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
Copyright (c) 2005 Stefano Brivio <st3@riseup.net>
Copyright (c) 2005, 2006 Michael Buesch <mb@bu3sch.de>
Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
Copyright (c) 2007 Larry Finger <Larry.Finger@lwfinger.net>
Some parts of the code in this file are derived from the ipw2200
driver Copyright(c) 2003 - 2004 Intel Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef B43legacy_MAIN_H_
#define B43legacy_MAIN_H_
#include "b43legacy.h"
#define P4D_BYT3S(magic, nr_bytes) u8 __p4dding##magic[nr_bytes]
#define P4D_BYTES(line, nr_bytes) P4D_BYT3S(line, nr_bytes)
/* Magic helper macro to pad structures. Ignore those above. It's magic. */
#define PAD_BYTES(nr_bytes) P4D_BYTES(__LINE__ , (nr_bytes))
/* Lightweight function to convert a frequency (in Mhz) to a channel number. */
static inline
u8 b43legacy_freq_to_channel_bg(int freq)
{
u8 channel;
if (freq == 2484)
channel = 14;
else
channel = (freq - 2407) / 5;
return channel;
}
static inline
u8 b43legacy_freq_to_channel(struct b43legacy_wldev *dev,
int freq)
{
return b43legacy_freq_to_channel_bg(freq);
}
/* Lightweight function to convert a channel number to a frequency (in Mhz). */
static inline
int b43legacy_channel_to_freq_bg(u8 channel)
{
int freq;
if (channel == 14)
freq = 2484;
else
freq = 2407 + (5 * channel);
return freq;
}
static inline
int b43legacy_channel_to_freq(struct b43legacy_wldev *dev,
u8 channel)
{
return b43legacy_channel_to_freq_bg(channel);
}
static inline
int b43legacy_is_cck_rate(int rate)
{
return (rate == B43legacy_CCK_RATE_1MB ||
rate == B43legacy_CCK_RATE_2MB ||
rate == B43legacy_CCK_RATE_5MB ||
rate == B43legacy_CCK_RATE_11MB);
}
static inline
int b43legacy_is_ofdm_rate(int rate)
{
return !b43legacy_is_cck_rate(rate);
}
static inline
int b43legacy_is_hw_radio_enabled(struct b43legacy_wldev *dev)
{
/* function to return state of hardware enable of radio
* returns 0 if radio disabled, 1 if radio enabled
*/
struct b43legacy_phy *phy = &dev->phy;
if (phy->rev >= 3)
return ((b43legacy_read32(dev,
B43legacy_MMIO_RADIO_HWENABLED_HI)
& B43legacy_MMIO_RADIO_HWENABLED_HI_MASK)
== 0) ? 1 : 0;
else
return ((b43legacy_read16(dev,
B43legacy_MMIO_RADIO_HWENABLED_LO)
& B43legacy_MMIO_RADIO_HWENABLED_LO_MASK)
== 0) ? 0 : 1;
}
void b43legacy_tsf_read(struct b43legacy_wldev *dev, u64 *tsf);
void b43legacy_tsf_write(struct b43legacy_wldev *dev, u64 tsf);
u32 b43legacy_shm_read32(struct b43legacy_wldev *dev,
u16 routing, u16 offset);
u16 b43legacy_shm_read16(struct b43legacy_wldev *dev,
u16 routing, u16 offset);
void b43legacy_shm_write32(struct b43legacy_wldev *dev,
u16 routing, u16 offset,
u32 value);
void b43legacy_shm_write16(struct b43legacy_wldev *dev,
u16 routing, u16 offset,
u16 value);
u32 b43legacy_hf_read(struct b43legacy_wldev *dev);
void b43legacy_hf_write(struct b43legacy_wldev *dev, u32 value);
void b43legacy_dummy_transmission(struct b43legacy_wldev *dev);
void b43legacy_wireless_core_reset(struct b43legacy_wldev *dev, u32 flags);
void b43legacy_mac_suspend(struct b43legacy_wldev *dev);
void b43legacy_mac_enable(struct b43legacy_wldev *dev);
void b43legacy_controller_restart(struct b43legacy_wldev *dev,
const char *reason);
#endif /* B43legacy_MAIN_H_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef B43legacy_PIO_H_
#define B43legacy_PIO_H_
#include "b43legacy.h"
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/skbuff.h>
#define B43legacy_PIO_TXCTL 0x00
#define B43legacy_PIO_TXDATA 0x02
#define B43legacy_PIO_TXQBUFSIZE 0x04
#define B43legacy_PIO_RXCTL 0x08
#define B43legacy_PIO_RXDATA 0x0A
#define B43legacy_PIO_TXCTL_WRITELO (1 << 0)
#define B43legacy_PIO_TXCTL_WRITEHI (1 << 1)
#define B43legacy_PIO_TXCTL_COMPLETE (1 << 2)
#define B43legacy_PIO_TXCTL_INIT (1 << 3)
#define B43legacy_PIO_TXCTL_SUSPEND (1 << 7)
#define B43legacy_PIO_RXCTL_DATAAVAILABLE (1 << 0)
#define B43legacy_PIO_RXCTL_READY (1 << 1)
/* PIO constants */
#define B43legacy_PIO_MAXTXDEVQPACKETS 31
#define B43legacy_PIO_TXQADJUST 80
/* PIO tuning knobs */
#define B43legacy_PIO_MAXTXPACKETS 256
#ifdef CONFIG_B43LEGACY_PIO
struct b43legacy_pioqueue;
struct b43legacy_xmitstatus;
struct b43legacy_pio_txpacket {
struct b43legacy_pioqueue *queue;
struct sk_buff *skb;
struct ieee80211_tx_status txstat;
struct list_head list;
};
#define pio_txpacket_getindex(packet) ((int)((packet) - \
(packet)->queue->tx_packets_cache))
struct b43legacy_pioqueue {
struct b43legacy_wldev *dev;
u16 mmio_base;
bool tx_suspended;
bool tx_frozen;
bool need_workarounds; /* Workarounds needed for core.rev < 3 */
/* Adjusted size of the device internal TX buffer. */
u16 tx_devq_size;
/* Used octets of the device internal TX buffer. */
u16 tx_devq_used;
/* Used packet slots in the device internal TX buffer. */
u8 tx_devq_packets;
/* Packets from the txfree list can
* be taken on incoming TX requests.
*/
struct list_head txfree;
unsigned int nr_txfree;
/* Packets on the txqueue are queued,
* but not completely written to the chip, yet.
*/
struct list_head txqueue;
/* Packets on the txrunning queue are completely
* posted to the device. We are waiting for the txstatus.
*/
struct list_head txrunning;
/* Total number or packets sent.
* (This counter can obviously wrap).
*/
unsigned int nr_tx_packets;
struct tasklet_struct txtask;
struct b43legacy_pio_txpacket
tx_packets_cache[B43legacy_PIO_MAXTXPACKETS];
};
static inline
u16 b43legacy_pio_read(struct b43legacy_pioqueue *queue,
u16 offset)
{
return b43legacy_read16(queue->dev, queue->mmio_base + offset);
}
static inline
void b43legacy_pio_write(struct b43legacy_pioqueue *queue,
u16 offset, u16 value)
{
b43legacy_write16(queue->dev, queue->mmio_base + offset, value);
mmiowb();
}
int b43legacy_pio_init(struct b43legacy_wldev *dev);
void b43legacy_pio_free(struct b43legacy_wldev *dev);
int b43legacy_pio_tx(struct b43legacy_wldev *dev,
struct sk_buff *skb,
struct ieee80211_tx_control *ctl);
void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev,
const struct b43legacy_txstatus *status);
void b43legacy_pio_get_tx_stats(struct b43legacy_wldev *dev,
struct ieee80211_tx_queue_stats *stats);
void b43legacy_pio_rx(struct b43legacy_pioqueue *queue);
/* Suspend TX queue in hardware. */
void b43legacy_pio_tx_suspend(struct b43legacy_pioqueue *queue);
void b43legacy_pio_tx_resume(struct b43legacy_pioqueue *queue);
/* Suspend (freeze) the TX tasklet (software level). */
void b43legacy_pio_freeze_txqueues(struct b43legacy_wldev *dev);
void b43legacy_pio_thaw_txqueues(struct b43legacy_wldev *dev);
#else /* CONFIG_B43LEGACY_PIO */
static inline
int b43legacy_pio_init(struct b43legacy_wldev *dev)
{
return 0;
}
static inline
void b43legacy_pio_free(struct b43legacy_wldev *dev)
{
}
static inline
int b43legacy_pio_tx(struct b43legacy_wldev *dev,
struct sk_buff *skb,
struct ieee80211_tx_control *ctl)
{
return 0;
}
static inline
void b43legacy_pio_handle_txstatus(struct b43legacy_wldev *dev,
const struct b43legacy_txstatus *status)
{
}
static inline
void b43legacy_pio_get_tx_stats(struct b43legacy_wldev *dev,
struct ieee80211_tx_queue_stats *stats)
{
}
static inline
void b43legacy_pio_rx(struct b43legacy_pioqueue *queue)
{
}
static inline
void b43legacy_pio_tx_suspend(struct b43legacy_pioqueue *queue)
{
}
static inline
void b43legacy_pio_tx_resume(struct b43legacy_pioqueue *queue)
{
}
static inline
void b43legacy_pio_freeze_txqueues(struct b43legacy_wldev *dev)
{
}
static inline
void b43legacy_pio_thaw_txqueues(struct b43legacy_wldev *dev)
{
}
#endif /* CONFIG_B43LEGACY_PIO */
#endif /* B43legacy_PIO_H_ */
This diff is collapsed.
/*
Broadcom B43legacy wireless driver
Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
Stefano Brivio <st3@riseup.net>
Michael Buesch <mbuesch@freenet.de>
Danny van Dyk <kugelfang@gentoo.org>
Andreas Jaggi <andreas.jaggi@waterwave.ch>
Some parts of the code in this file are derived from the ipw2200
driver Copyright(c) 2003 - 2004 Intel Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef B43legacy_RADIO_H_
#define B43legacy_RADIO_H_
#include "b43legacy.h"
#define B43legacy_RADIO_DEFAULT_CHANNEL_BG 6
/* Force antenna 0. */
#define B43legacy_RADIO_TXANTENNA_0 0
/* Force antenna 1. */
#define B43legacy_RADIO_TXANTENNA_1 1
/* Use the RX antenna, that was selected for the most recently
* received good PLCP header.
*/
#define B43legacy_RADIO_TXANTENNA_LASTPLCP 3
#define B43legacy_RADIO_TXANTENNA_DEFAULT B43legacy_RADIO_TXANTENNA_LASTPLCP
#define B43legacy_RADIO_INTERFMODE_NONE 0
#define B43legacy_RADIO_INTERFMODE_NONWLAN 1
#define B43legacy_RADIO_INTERFMODE_MANUALWLAN 2
#define B43legacy_RADIO_INTERFMODE_AUTOWLAN 3
void b43legacy_radio_lock(struct b43legacy_wldev *dev);
void b43legacy_radio_unlock(struct b43legacy_wldev *dev);
u16 b43legacy_radio_read16(struct b43legacy_wldev *dev, u16 offset);
void b43legacy_radio_write16(struct b43legacy_wldev *dev, u16 offset, u16 val);
u16 b43legacy_radio_init2050(struct b43legacy_wldev *dev);
void b43legacy_radio_turn_on(struct b43legacy_wldev *dev);
void b43legacy_radio_turn_off(struct b43legacy_wldev *dev);
int b43legacy_radio_selectchannel(struct b43legacy_wldev *dev, u8 channel,
int synthetic_pu_workaround);
void b43legacy_radio_set_txpower_a(struct b43legacy_wldev *dev, u16 txpower);
void b43legacy_radio_set_txpower_bg(struct b43legacy_wldev *dev,
u16 baseband_attenuation, u16 attenuation,
u16 txpower);
u16 b43legacy_default_baseband_attenuation(struct b43legacy_wldev *dev);
u16 b43legacy_default_radio_attenuation(struct b43legacy_wldev *dev);
u16 b43legacy_default_txctl1(struct b43legacy_wldev *dev);
void b43legacy_radio_set_txantenna(struct b43legacy_wldev *dev, u32 val);
void b43legacy_radio_clear_tssi(struct b43legacy_wldev *dev);
u8 b43legacy_radio_aci_detect(struct b43legacy_wldev *dev, u8 channel);
u8 b43legacy_radio_aci_scan(struct b43legacy_wldev *dev);
int b43legacy_radio_set_interference_mitigation(struct b43legacy_wldev *dev,
int mode);
void b43legacy_calc_nrssi_slope(struct b43legacy_wldev *dev);
void b43legacy_calc_nrssi_threshold(struct b43legacy_wldev *dev);
s16 b43legacy_nrssi_hw_read(struct b43legacy_wldev *dev, u16 offset);
void b43legacy_nrssi_hw_write(struct b43legacy_wldev *dev, u16 offset, s16 val);
void b43legacy_nrssi_hw_update(struct b43legacy_wldev *dev, u16 val);
void b43legacy_nrssi_mem_update(struct b43legacy_wldev *dev);
void b43legacy_radio_set_tx_iq(struct b43legacy_wldev *dev);
u16 b43legacy_radio_calibrationvalue(struct b43legacy_wldev *dev);
#endif /* B43legacy_RADIO_H_ */
This diff is collapsed.
#ifndef B43legacy_SYSFS_H_
#define B43legacy_SYSFS_H_
struct b43legacy_wldev;
int b43legacy_sysfs_register(struct b43legacy_wldev *dev);
void b43legacy_sysfs_unregister(struct b43legacy_wldev *dev);
#endif /* B43legacy_SYSFS_H_ */
This diff is collapsed.
This diff is collapsed.
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