[PATCH] bcm43xx: reduce the size of bcm43xx_private by removing unneeded members.
Signed-off-by: Michael Buesch <mbuesch@freenet.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
aae3778176
commit
e9357c056c
|
@ -556,33 +556,37 @@ struct bcm43xx_pio {
|
|||
|
||||
#define BCM43xx_MAX_80211_CORES 2
|
||||
|
||||
#define BCM43xx_COREFLAG_AVAILABLE (1 << 0)
|
||||
#define BCM43xx_COREFLAG_ENABLED (1 << 1)
|
||||
#define BCM43xx_COREFLAG_INITIALIZED (1 << 2)
|
||||
|
||||
#ifdef CONFIG_BCM947XX
|
||||
#define core_offset(bcm) (bcm)->current_core_offset
|
||||
#else
|
||||
#define core_offset(bcm) 0
|
||||
#endif
|
||||
|
||||
/* Generic information about a core. */
|
||||
struct bcm43xx_coreinfo {
|
||||
/** Driver internal flags. See BCM43xx_COREFLAG_* */
|
||||
u32 flags;
|
||||
u8 available:1,
|
||||
enabled:1,
|
||||
initialized:1;
|
||||
/** core_id ID number */
|
||||
u16 id;
|
||||
/** core_rev revision number */
|
||||
u8 rev;
|
||||
/** Index number for _switch_core() */
|
||||
u8 index;
|
||||
/* Pointer to the PHYinfo, which belongs to this core (if 80211 core) */
|
||||
struct bcm43xx_phyinfo *phy;
|
||||
/* Pointer to the RadioInfo, which belongs to this core (if 80211 core) */
|
||||
struct bcm43xx_radioinfo *radio;
|
||||
/* Pointer to the DMA rings, which belong to this core (if 80211 core) */
|
||||
struct bcm43xx_dma *dma;
|
||||
/* Pointer to the PIO queues, which belong to this core (if 80211 core) */
|
||||
struct bcm43xx_pio *pio;
|
||||
};
|
||||
|
||||
/* Additional information for each 80211 core. */
|
||||
struct bcm43xx_coreinfo_80211 {
|
||||
/* PHY device. */
|
||||
struct bcm43xx_phyinfo phy;
|
||||
/* Radio device. */
|
||||
struct bcm43xx_radioinfo radio;
|
||||
union {
|
||||
/* DMA context. */
|
||||
struct bcm43xx_dma dma;
|
||||
/* PIO context. */
|
||||
struct bcm43xx_pio pio;
|
||||
};
|
||||
};
|
||||
|
||||
/* Context information for a noise calculation (Link Quality). */
|
||||
|
@ -652,7 +656,7 @@ struct bcm43xx_private {
|
|||
#define BCM43xx_NR_LEDS 4
|
||||
struct bcm43xx_led leds[BCM43xx_NR_LEDS];
|
||||
|
||||
/* The currently active core. NULL if not initialized, yet. */
|
||||
/* The currently active core. */
|
||||
struct bcm43xx_coreinfo *current_core;
|
||||
#ifdef CONFIG_BCM947XX
|
||||
/** current core memory offset */
|
||||
|
@ -665,18 +669,15 @@ struct bcm43xx_private {
|
|||
*/
|
||||
struct bcm43xx_coreinfo core_chipcommon;
|
||||
struct bcm43xx_coreinfo core_pci;
|
||||
struct bcm43xx_coreinfo core_v90;
|
||||
struct bcm43xx_coreinfo core_pcmcia;
|
||||
struct bcm43xx_coreinfo core_ethernet;
|
||||
struct bcm43xx_coreinfo core_80211[ BCM43xx_MAX_80211_CORES ];
|
||||
/* Info about the PHY for each 80211 core. */
|
||||
struct bcm43xx_phyinfo phy[ BCM43xx_MAX_80211_CORES ];
|
||||
/* Info about the Radio for each 80211 core. */
|
||||
struct bcm43xx_radioinfo radio[ BCM43xx_MAX_80211_CORES ];
|
||||
/* DMA */
|
||||
struct bcm43xx_dma dma[ BCM43xx_MAX_80211_CORES ];
|
||||
/* PIO */
|
||||
struct bcm43xx_pio pio[ BCM43xx_MAX_80211_CORES ];
|
||||
/* Additional information, specific to the 80211 cores. */
|
||||
struct bcm43xx_coreinfo_80211 core_80211_ext[ BCM43xx_MAX_80211_CORES ];
|
||||
/* Index of the current 80211 core. If current_core is not
|
||||
* an 80211 core, this is -1.
|
||||
*/
|
||||
int current_80211_core_idx;
|
||||
/* Number of available 80211 cores. */
|
||||
int nr_80211_available;
|
||||
|
||||
u32 chipcommon_capabilities;
|
||||
|
||||
|
@ -769,18 +770,39 @@ int bcm43xx_using_pio(struct bcm43xx_private *bcm)
|
|||
# error "Using neither DMA nor PIO? Confused..."
|
||||
#endif
|
||||
|
||||
|
||||
/* Helper functions to access data structures private to the 80211 cores.
|
||||
* Note that we _must_ have an 80211 core mapped when calling
|
||||
* any of these functions.
|
||||
*/
|
||||
static inline
|
||||
int bcm43xx_num_80211_cores(struct bcm43xx_private *bcm)
|
||||
struct bcm43xx_pio * bcm43xx_current_pio(struct bcm43xx_private *bcm)
|
||||
{
|
||||
int i, cnt = 0;
|
||||
|
||||
for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) {
|
||||
if (bcm->core_80211[i].flags & BCM43xx_COREFLAG_AVAILABLE)
|
||||
cnt++;
|
||||
}
|
||||
|
||||
return cnt;
|
||||
assert(bcm43xx_using_pio(bcm));
|
||||
assert(bcm->current_80211_core_idx >= 0);
|
||||
assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
|
||||
return &(bcm->core_80211_ext[bcm->current_80211_core_idx].pio);
|
||||
}
|
||||
static inline
|
||||
struct bcm43xx_dma * bcm43xx_current_dma(struct bcm43xx_private *bcm)
|
||||
{
|
||||
assert(!bcm43xx_using_pio(bcm));
|
||||
assert(bcm->current_80211_core_idx >= 0);
|
||||
assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
|
||||
return &(bcm->core_80211_ext[bcm->current_80211_core_idx].dma);
|
||||
}
|
||||
static inline
|
||||
struct bcm43xx_phyinfo * bcm43xx_current_phy(struct bcm43xx_private *bcm)
|
||||
{
|
||||
assert(bcm->current_80211_core_idx >= 0);
|
||||
assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
|
||||
return &(bcm->core_80211_ext[bcm->current_80211_core_idx].phy);
|
||||
}
|
||||
static inline
|
||||
struct bcm43xx_radioinfo * bcm43xx_current_radio(struct bcm43xx_private *bcm)
|
||||
{
|
||||
assert(bcm->current_80211_core_idx >= 0);
|
||||
assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES);
|
||||
return &(bcm->core_80211_ext[bcm->current_80211_core_idx].radio);
|
||||
}
|
||||
|
||||
/* Are we running in init_board() context? */
|
||||
|
|
|
@ -104,16 +104,13 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf,
|
|||
fappend("\nCores:\n");
|
||||
#define fappend_core(name, info) fappend("core \"" name "\" %s, %s, id: 0x%04x, " \
|
||||
"rev: 0x%02x, index: 0x%02x\n", \
|
||||
(info).flags & BCM43xx_COREFLAG_AVAILABLE \
|
||||
(info).available \
|
||||
? "available" : "nonavailable", \
|
||||
(info).flags & BCM43xx_COREFLAG_ENABLED \
|
||||
(info).enabled \
|
||||
? "enabled" : "disabled", \
|
||||
(info).id, (info).rev, (info).index)
|
||||
fappend_core("CHIPCOMMON", bcm->core_chipcommon);
|
||||
fappend_core("PCI", bcm->core_pci);
|
||||
fappend_core("V90", bcm->core_v90);
|
||||
fappend_core("PCMCIA", bcm->core_pcmcia);
|
||||
fappend_core("ETHERNET", bcm->core_ethernet);
|
||||
fappend_core("first 80211", bcm->core_80211[0]);
|
||||
fappend_core("second 80211", bcm->core_80211[1]);
|
||||
#undef fappend_core
|
||||
|
|
|
@ -531,7 +531,7 @@ static void bcm43xx_destroy_dmaring(struct bcm43xx_dmaring *ring)
|
|||
|
||||
void bcm43xx_dma_free(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_dma *dma = bcm->current_core->dma;
|
||||
struct bcm43xx_dma *dma = bcm43xx_current_dma(bcm);
|
||||
|
||||
bcm43xx_destroy_dmaring(dma->rx_ring1);
|
||||
dma->rx_ring1 = NULL;
|
||||
|
@ -549,7 +549,7 @@ void bcm43xx_dma_free(struct bcm43xx_private *bcm)
|
|||
|
||||
int bcm43xx_dma_init(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_dma *dma = bcm->current_core->dma;
|
||||
struct bcm43xx_dma *dma = bcm43xx_current_dma(bcm);
|
||||
struct bcm43xx_dmaring *ring;
|
||||
int err = -ENOMEM;
|
||||
|
||||
|
@ -652,7 +652,7 @@ static
|
|||
struct bcm43xx_dmaring * parse_cookie(struct bcm43xx_private *bcm,
|
||||
u16 cookie, int *slot)
|
||||
{
|
||||
struct bcm43xx_dma *dma = bcm->current_core->dma;
|
||||
struct bcm43xx_dma *dma = bcm43xx_current_dma(bcm);
|
||||
struct bcm43xx_dmaring *ring = NULL;
|
||||
|
||||
switch (cookie & 0xF000) {
|
||||
|
@ -755,7 +755,7 @@ int bcm43xx_dma_tx(struct bcm43xx_private *bcm,
|
|||
* the device to send the stuff.
|
||||
* Note that this is called from atomic context.
|
||||
*/
|
||||
struct bcm43xx_dmaring *ring = bcm->current_core->dma->tx_ring1;
|
||||
struct bcm43xx_dmaring *ring = bcm43xx_current_dma(bcm)->tx_ring1;
|
||||
u8 i;
|
||||
struct sk_buff *skb;
|
||||
|
||||
|
@ -784,6 +784,7 @@ int bcm43xx_dma_tx(struct bcm43xx_private *bcm,
|
|||
void bcm43xx_dma_handle_xmitstatus(struct bcm43xx_private *bcm,
|
||||
struct bcm43xx_xmitstatus *status)
|
||||
{
|
||||
struct bcm43xx_dma *dma = bcm43xx_current_dma(bcm);
|
||||
struct bcm43xx_dmaring *ring;
|
||||
struct bcm43xx_dmadesc *desc;
|
||||
struct bcm43xx_dmadesc_meta *meta;
|
||||
|
|
|
@ -314,7 +314,7 @@ const u16 bcm43xx_ilt_sigmasqr2[BCM43xx_ILT_SIGMASQR_SIZE] = {
|
|||
|
||||
void bcm43xx_ilt_write(struct bcm43xx_private *bcm, u16 offset, u16 val)
|
||||
{
|
||||
if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A) {
|
||||
if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A) {
|
||||
bcm43xx_phy_write(bcm, BCM43xx_PHY_ILT_A_CTRL, offset);
|
||||
mmiowb();
|
||||
bcm43xx_phy_write(bcm, BCM43xx_PHY_ILT_A_DATA1, val);
|
||||
|
@ -327,7 +327,7 @@ void bcm43xx_ilt_write(struct bcm43xx_private *bcm, u16 offset, u16 val)
|
|||
|
||||
u16 bcm43xx_ilt_read(struct bcm43xx_private *bcm, u16 offset)
|
||||
{
|
||||
if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A) {
|
||||
if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A) {
|
||||
bcm43xx_phy_write(bcm, BCM43xx_PHY_ILT_A_CTRL, offset);
|
||||
return bcm43xx_phy_read(bcm, BCM43xx_PHY_ILT_A_DATA1);
|
||||
} else {
|
||||
|
|
|
@ -171,8 +171,8 @@ void bcm43xx_leds_exit(struct bcm43xx_private *bcm)
|
|||
void bcm43xx_leds_update(struct bcm43xx_private *bcm, int activity)
|
||||
{
|
||||
struct bcm43xx_led *led;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
const int transferring = (jiffies - bcm->stats.last_tx) < BCM43xx_LED_XFER_THRES;
|
||||
int i, turn_on;
|
||||
unsigned long interval = 0;
|
||||
|
|
|
@ -406,7 +406,7 @@ static void bcm43xx_write_mac_bssid_templates(struct bcm43xx_private *bcm)
|
|||
static void bcm43xx_set_slot_time(struct bcm43xx_private *bcm, u16 slot_time)
|
||||
{
|
||||
/* slot_time is in usec. */
|
||||
if (bcm->current_core->phy->type != BCM43xx_PHYTYPE_G)
|
||||
if (bcm43xx_current_phy(bcm)->type != BCM43xx_PHYTYPE_G)
|
||||
return;
|
||||
bcm43xx_write16(bcm, 0x684, 510 + slot_time);
|
||||
bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x0010, slot_time);
|
||||
|
@ -443,7 +443,7 @@ static void bcm43xx_disassociate(struct bcm43xx_private *bcm)
|
|||
|
||||
bcm43xx_shm_write32(bcm, BCM43xx_SHM_WIRELESS, 0x0004, 0x000003ff);
|
||||
|
||||
if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_G &&
|
||||
if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_G &&
|
||||
ieee80211_is_ofdm_rate(bcm->softmac->txrates.default_rate))
|
||||
bcm43xx_short_slot_timing_enable(bcm);
|
||||
|
||||
|
@ -510,8 +510,8 @@ static int bcm43xx_disable_interrupts_sync(struct bcm43xx_private *bcm, u32 *old
|
|||
|
||||
static int bcm43xx_read_radioinfo(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
u32 radio_id;
|
||||
u16 manufact;
|
||||
u16 version;
|
||||
|
@ -566,10 +566,10 @@ static int bcm43xx_read_radioinfo(struct bcm43xx_private *bcm)
|
|||
radio->txpower[2] = 3;
|
||||
else
|
||||
radio->txpower[2] = 0;
|
||||
if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A)
|
||||
if (phy->type == BCM43xx_PHYTYPE_A)
|
||||
radio->txpower_desired = bcm->sprom.maxpower_aphy;
|
||||
else
|
||||
bcm->current_core->radio->txpower_desired = bcm->sprom.maxpower_bgphy;
|
||||
radio->txpower_desired = bcm->sprom.maxpower_bgphy;
|
||||
|
||||
/* Initialize the in-memory nrssi Lookup Table. */
|
||||
for (i = 0; i < 64; i++)
|
||||
|
@ -929,15 +929,14 @@ static void bcm43xx_geo_init(struct bcm43xx_private *bcm)
|
|||
struct ieee80211_geo geo;
|
||||
struct ieee80211_channel *chan;
|
||||
int have_a = 0, have_bg = 0;
|
||||
int i, num80211;
|
||||
int i;
|
||||
u8 channel;
|
||||
struct bcm43xx_phyinfo *phy;
|
||||
const char *iso_country;
|
||||
|
||||
memset(&geo, 0, sizeof(geo));
|
||||
num80211 = bcm43xx_num_80211_cores(bcm);
|
||||
for (i = 0; i < num80211; i++) {
|
||||
phy = bcm->phy + i;
|
||||
for (i = 0; i < bcm->nr_80211_available; i++) {
|
||||
phy = &(bcm->core_80211_ext[i].phy);
|
||||
switch (phy->type) {
|
||||
case BCM43xx_PHYTYPE_B:
|
||||
case BCM43xx_PHYTYPE_G:
|
||||
|
@ -985,8 +984,8 @@ static void bcm43xx_geo_init(struct bcm43xx_private *bcm)
|
|||
*/
|
||||
void bcm43xx_dummy_transmission(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
unsigned int i, max_loop;
|
||||
u16 value = 0;
|
||||
u32 buffer[5] = {
|
||||
|
@ -1213,14 +1212,20 @@ int bcm43xx_switch_core(struct bcm43xx_private *bcm, struct bcm43xx_coreinfo *ne
|
|||
|
||||
if (unlikely(!new_core))
|
||||
return 0;
|
||||
if (!(new_core->flags & BCM43xx_COREFLAG_AVAILABLE))
|
||||
if (!new_core->available)
|
||||
return -ENODEV;
|
||||
if (bcm->current_core == new_core)
|
||||
return 0;
|
||||
err = _switch_core(bcm, new_core->index);
|
||||
if (likely(!err))
|
||||
bcm->current_core = new_core;
|
||||
if (unlikely(err))
|
||||
goto out;
|
||||
|
||||
bcm->current_core = new_core;
|
||||
bcm->current_80211_core_idx = -1;
|
||||
if (new_core->id == BCM43xx_COREID_80211)
|
||||
bcm->current_80211_core_idx = (int)(new_core - &(bcm->core_80211[0]));
|
||||
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -1295,7 +1300,8 @@ static int bcm43xx_core_disable(struct bcm43xx_private *bcm, u32 core_flags)
|
|||
bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow);
|
||||
|
||||
out:
|
||||
bcm->current_core->flags &= ~ BCM43xx_COREFLAG_ENABLED;
|
||||
bcm->current_core->enabled = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1340,7 +1346,7 @@ static int bcm43xx_core_enable(struct bcm43xx_private *bcm, u32 core_flags)
|
|||
bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow);
|
||||
udelay(1);
|
||||
|
||||
bcm->current_core->flags |= BCM43xx_COREFLAG_ENABLED;
|
||||
bcm->current_core->enabled = 1;
|
||||
assert(err == 0);
|
||||
out:
|
||||
return err;
|
||||
|
@ -1411,7 +1417,7 @@ static int bcm43xx_wireless_core_mark_inactive(struct bcm43xx_private *bcm,
|
|||
bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow);
|
||||
udelay(1);
|
||||
|
||||
if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_G) {
|
||||
if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_G) {
|
||||
old_core = bcm->current_core;
|
||||
err = bcm43xx_switch_core(bcm, active_80211_core);
|
||||
if (err)
|
||||
|
@ -1433,9 +1439,6 @@ static void handle_irq_transmit_status(struct bcm43xx_private *bcm)
|
|||
u16 tmp;
|
||||
struct bcm43xx_xmitstatus stat;
|
||||
|
||||
assert(bcm->current_core->id == BCM43xx_COREID_80211);
|
||||
assert(bcm->current_core->rev >= 5);
|
||||
|
||||
while (1) {
|
||||
v0 = bcm43xx_read32(bcm, BCM43xx_MMIO_XMITSTAT_0);
|
||||
if (!v0)
|
||||
|
@ -1473,7 +1476,7 @@ static void bcm43xx_generate_noise_sample(struct bcm43xx_private *bcm)
|
|||
bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS2_BITFIELD,
|
||||
bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS2_BITFIELD) | (1 << 4));
|
||||
assert(bcm->noisecalc.core_at_start == bcm->current_core);
|
||||
assert(bcm->noisecalc.channel_at_start == bcm->current_core->radio->channel);
|
||||
assert(bcm->noisecalc.channel_at_start == bcm43xx_current_radio(bcm)->channel);
|
||||
}
|
||||
|
||||
static void bcm43xx_calculate_link_quality(struct bcm43xx_private *bcm)
|
||||
|
@ -1483,7 +1486,7 @@ static void bcm43xx_calculate_link_quality(struct bcm43xx_private *bcm)
|
|||
if (bcm->noisecalc.calculation_running)
|
||||
return;
|
||||
bcm->noisecalc.core_at_start = bcm->current_core;
|
||||
bcm->noisecalc.channel_at_start = bcm->current_core->radio->channel;
|
||||
bcm->noisecalc.channel_at_start = bcm43xx_current_radio(bcm)->channel;
|
||||
bcm->noisecalc.calculation_running = 1;
|
||||
bcm->noisecalc.nr_samples = 0;
|
||||
|
||||
|
@ -1492,7 +1495,7 @@ static void bcm43xx_calculate_link_quality(struct bcm43xx_private *bcm)
|
|||
|
||||
static void handle_irq_noise(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u16 tmp;
|
||||
u8 noise[4];
|
||||
u8 i, j;
|
||||
|
@ -1759,16 +1762,16 @@ static void bcm43xx_interrupt_tasklet(struct bcm43xx_private *bcm)
|
|||
assert(!(dma_reason[2] & BCM43xx_DMAIRQ_RX_DONE));
|
||||
if (dma_reason[0] & BCM43xx_DMAIRQ_RX_DONE) {
|
||||
if (bcm43xx_using_pio(bcm))
|
||||
bcm43xx_pio_rx(bcm->current_core->pio->queue0);
|
||||
bcm43xx_pio_rx(bcm43xx_current_pio(bcm)->queue0);
|
||||
else
|
||||
bcm43xx_dma_rx(bcm->current_core->dma->rx_ring0);
|
||||
bcm43xx_dma_rx(bcm43xx_current_dma(bcm)->rx_ring0);
|
||||
/* We intentionally don't set "activity" to 1, here. */
|
||||
}
|
||||
if (dma_reason[3] & BCM43xx_DMAIRQ_RX_DONE) {
|
||||
if (bcm43xx_using_pio(bcm))
|
||||
bcm43xx_pio_rx(bcm->current_core->pio->queue3);
|
||||
bcm43xx_pio_rx(bcm43xx_current_pio(bcm)->queue3);
|
||||
else
|
||||
bcm43xx_dma_rx(bcm->current_core->dma->rx_ring1);
|
||||
bcm43xx_dma_rx(bcm43xx_current_dma(bcm)->rx_ring1);
|
||||
activity = 1;
|
||||
}
|
||||
bcmirq_handled(BCM43xx_IRQ_RX);
|
||||
|
@ -1911,7 +1914,7 @@ static void bcm43xx_release_firmware(struct bcm43xx_private *bcm, int force)
|
|||
|
||||
static int bcm43xx_request_firmware(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
u8 rev = bcm->current_core->rev;
|
||||
int err = 0;
|
||||
int nr;
|
||||
|
@ -2349,6 +2352,8 @@ static void bcm43xx_chip_cleanup(struct bcm43xx_private *bcm)
|
|||
*/
|
||||
static int bcm43xx_chip_init(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
int err;
|
||||
int iw_mode = bcm->ieee->iw_mode;
|
||||
int tmp;
|
||||
|
@ -2388,13 +2393,13 @@ static int bcm43xx_chip_init(struct bcm43xx_private *bcm)
|
|||
goto err_radio_off;
|
||||
|
||||
/* Select initial Interference Mitigation. */
|
||||
tmp = bcm->current_core->radio->interfmode;
|
||||
bcm->current_core->radio->interfmode = BCM43xx_RADIO_INTERFMODE_NONE;
|
||||
tmp = radio->interfmode;
|
||||
radio->interfmode = BCM43xx_RADIO_INTERFMODE_NONE;
|
||||
bcm43xx_radio_set_interference_mitigation(bcm, tmp);
|
||||
|
||||
bcm43xx_phy_set_antenna_diversity(bcm);
|
||||
bcm43xx_radio_set_txantenna(bcm, BCM43xx_RADIO_TXANTENNA_DEFAULT);
|
||||
if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_B) {
|
||||
if (phy->type == BCM43xx_PHYTYPE_B) {
|
||||
value16 = bcm43xx_read16(bcm, 0x005E);
|
||||
value16 |= 0x0004;
|
||||
bcm43xx_write16(bcm, 0x005E, value16);
|
||||
|
@ -2512,6 +2517,32 @@ error:
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
void bcm43xx_init_struct_phyinfo(struct bcm43xx_phyinfo *phy)
|
||||
{
|
||||
/* Initialize a "phyinfo" structure. The structure is already
|
||||
* zeroed out.
|
||||
*/
|
||||
phy->antenna_diversity = 0xFFFF;
|
||||
phy->savedpctlreg = 0xFFFF;
|
||||
phy->minlowsig[0] = 0xFFFF;
|
||||
phy->minlowsig[1] = 0xFFFF;
|
||||
spin_lock_init(&phy->lock);
|
||||
}
|
||||
|
||||
void bcm43xx_init_struct_radioinfo(struct bcm43xx_radioinfo *radio)
|
||||
{
|
||||
/* Initialize a "radioinfo" structure. The structure is already
|
||||
* zeroed out.
|
||||
*/
|
||||
radio->interfmode = BCM43xx_RADIO_INTERFMODE_NONE;
|
||||
radio->channel = 0xFF;
|
||||
radio->initial_channel = 0xFF;
|
||||
radio->lofcal = 0xFFFF;
|
||||
radio->initval = 0xFFFF;
|
||||
radio->nrssi[0] = -1000;
|
||||
radio->nrssi[1] = -1000;
|
||||
}
|
||||
|
||||
static int bcm43xx_probe_cores(struct bcm43xx_private *bcm)
|
||||
{
|
||||
int err, i;
|
||||
|
@ -2523,15 +2554,14 @@ static int bcm43xx_probe_cores(struct bcm43xx_private *bcm)
|
|||
|
||||
memset(&bcm->core_chipcommon, 0, sizeof(struct bcm43xx_coreinfo));
|
||||
memset(&bcm->core_pci, 0, sizeof(struct bcm43xx_coreinfo));
|
||||
memset(&bcm->core_v90, 0, sizeof(struct bcm43xx_coreinfo));
|
||||
memset(&bcm->core_pcmcia, 0, sizeof(struct bcm43xx_coreinfo));
|
||||
memset(&bcm->core_80211, 0, sizeof(struct bcm43xx_coreinfo)
|
||||
* BCM43xx_MAX_80211_CORES);
|
||||
|
||||
memset(&bcm->phy, 0, sizeof(struct bcm43xx_phyinfo)
|
||||
* BCM43xx_MAX_80211_CORES);
|
||||
memset(&bcm->radio, 0, sizeof(struct bcm43xx_radioinfo)
|
||||
* BCM43xx_MAX_80211_CORES);
|
||||
memset(&bcm->core_80211_ext, 0, sizeof(struct bcm43xx_coreinfo_80211)
|
||||
* BCM43xx_MAX_80211_CORES);
|
||||
bcm->current_80211_core_idx = -1;
|
||||
bcm->nr_80211_available = 0;
|
||||
bcm->current_core = NULL;
|
||||
bcm->active_80211_core = NULL;
|
||||
|
||||
/* map core 0 */
|
||||
err = _switch_core(bcm, 0);
|
||||
|
@ -2549,7 +2579,7 @@ static int bcm43xx_probe_cores(struct bcm43xx_private *bcm)
|
|||
if (core_id == BCM43xx_COREID_CHIPCOMMON) {
|
||||
chip_id_32 = bcm43xx_read32(bcm, 0);
|
||||
chip_id_16 = chip_id_32 & 0xFFFF;
|
||||
bcm->core_chipcommon.flags |= BCM43xx_COREFLAG_AVAILABLE;
|
||||
bcm->core_chipcommon.available = 1;
|
||||
bcm->core_chipcommon.id = core_id;
|
||||
bcm->core_chipcommon.rev = core_rev;
|
||||
bcm->core_chipcommon.index = 0;
|
||||
|
@ -2618,18 +2648,19 @@ static int bcm43xx_probe_cores(struct bcm43xx_private *bcm)
|
|||
dprintk(KERN_INFO PFX "Chip ID 0x%x, rev 0x%x\n",
|
||||
bcm->chip_id, bcm->chip_rev);
|
||||
dprintk(KERN_INFO PFX "Number of cores: %d\n", core_count);
|
||||
if (bcm->core_chipcommon.flags & BCM43xx_COREFLAG_AVAILABLE) {
|
||||
if (bcm->core_chipcommon.available) {
|
||||
dprintk(KERN_INFO PFX "Core 0: ID 0x%x, rev 0x%x, vendor 0x%x, %s\n",
|
||||
core_id, core_rev, core_vendor,
|
||||
bcm43xx_core_enabled(bcm) ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
if (bcm->core_chipcommon.flags & BCM43xx_COREFLAG_AVAILABLE)
|
||||
if (bcm->core_chipcommon.available)
|
||||
current_core = 1;
|
||||
else
|
||||
current_core = 0;
|
||||
for ( ; current_core < core_count; current_core++) {
|
||||
struct bcm43xx_coreinfo *core;
|
||||
struct bcm43xx_coreinfo_80211 *ext_80211;
|
||||
|
||||
err = _switch_core(bcm, current_core);
|
||||
if (err)
|
||||
|
@ -2651,36 +2682,16 @@ static int bcm43xx_probe_cores(struct bcm43xx_private *bcm)
|
|||
switch (core_id) {
|
||||
case BCM43xx_COREID_PCI:
|
||||
core = &bcm->core_pci;
|
||||
if (core->flags & BCM43xx_COREFLAG_AVAILABLE) {
|
||||
if (core->available) {
|
||||
printk(KERN_WARNING PFX "Multiple PCI cores found.\n");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case BCM43xx_COREID_V90:
|
||||
core = &bcm->core_v90;
|
||||
if (core->flags & BCM43xx_COREFLAG_AVAILABLE) {
|
||||
printk(KERN_WARNING PFX "Multiple V90 cores found.\n");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case BCM43xx_COREID_PCMCIA:
|
||||
core = &bcm->core_pcmcia;
|
||||
if (core->flags & BCM43xx_COREFLAG_AVAILABLE) {
|
||||
printk(KERN_WARNING PFX "Multiple PCMCIA cores found.\n");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case BCM43xx_COREID_ETHERNET:
|
||||
core = &bcm->core_ethernet;
|
||||
if (core->flags & BCM43xx_COREFLAG_AVAILABLE) {
|
||||
printk(KERN_WARNING PFX "Multiple Ethernet cores found.\n");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case BCM43xx_COREID_80211:
|
||||
for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) {
|
||||
core = &(bcm->core_80211[i]);
|
||||
if (!(core->flags & BCM43xx_COREFLAG_AVAILABLE))
|
||||
ext_80211 = &(bcm->core_80211_ext[i]);
|
||||
if (!core->available)
|
||||
break;
|
||||
core = NULL;
|
||||
}
|
||||
|
@ -2715,40 +2726,23 @@ static int bcm43xx_probe_cores(struct bcm43xx_private *bcm)
|
|||
err = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
core->phy = &bcm->phy[i];
|
||||
core->phy->antenna_diversity = 0xffff;
|
||||
core->phy->savedpctlreg = 0xFFFF;
|
||||
core->phy->minlowsig[0] = 0xFFFF;
|
||||
core->phy->minlowsig[1] = 0xFFFF;
|
||||
core->phy->minlowsigpos[0] = 0;
|
||||
core->phy->minlowsigpos[1] = 0;
|
||||
spin_lock_init(&core->phy->lock);
|
||||
core->radio = &bcm->radio[i];
|
||||
core->radio->interfmode = BCM43xx_RADIO_INTERFMODE_NONE;
|
||||
core->radio->channel = 0xFF;
|
||||
core->radio->initial_channel = 0xFF;
|
||||
core->radio->lofcal = 0xFFFF;
|
||||
core->radio->initval = 0xFFFF;
|
||||
core->radio->nrssi[0] = -1000;
|
||||
core->radio->nrssi[1] = -1000;
|
||||
core->dma = &bcm->dma[i];
|
||||
core->pio = &bcm->pio[i];
|
||||
bcm->nr_80211_available++;
|
||||
bcm43xx_init_struct_phyinfo(&ext_80211->phy);
|
||||
bcm43xx_init_struct_radioinfo(&ext_80211->radio);
|
||||
break;
|
||||
case BCM43xx_COREID_CHIPCOMMON:
|
||||
printk(KERN_WARNING PFX "Multiple CHIPCOMMON cores found.\n");
|
||||
break;
|
||||
default:
|
||||
printk(KERN_WARNING PFX "Unknown core found (ID 0x%x)\n", core_id);
|
||||
}
|
||||
if (core) {
|
||||
core->flags |= BCM43xx_COREFLAG_AVAILABLE;
|
||||
core->available = 1;
|
||||
core->id = core_id;
|
||||
core->rev = core_rev;
|
||||
core->index = current_core;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(bcm->core_80211[0].flags & BCM43xx_COREFLAG_AVAILABLE)) {
|
||||
if (!bcm->core_80211[0].available) {
|
||||
printk(KERN_ERR PFX "Error: No 80211 core found!\n");
|
||||
err = -ENODEV;
|
||||
goto out;
|
||||
|
@ -2802,7 +2796,7 @@ static void bcm43xx_rate_memory_write(struct bcm43xx_private *bcm,
|
|||
|
||||
static void bcm43xx_rate_memory_init(struct bcm43xx_private *bcm)
|
||||
{
|
||||
switch (bcm->current_core->phy->type) {
|
||||
switch (bcm43xx_current_phy(bcm)->type) {
|
||||
case BCM43xx_PHYTYPE_A:
|
||||
case BCM43xx_PHYTYPE_G:
|
||||
bcm43xx_rate_memory_write(bcm, IEEE80211_OFDM_RATE_6MB, 1);
|
||||
|
@ -2829,12 +2823,14 @@ static void bcm43xx_wireless_core_cleanup(struct bcm43xx_private *bcm)
|
|||
bcm43xx_pio_free(bcm);
|
||||
bcm43xx_dma_free(bcm);
|
||||
|
||||
bcm->current_core->flags &= ~ BCM43xx_COREFLAG_INITIALIZED;
|
||||
bcm->current_core->initialized = 0;
|
||||
}
|
||||
|
||||
/* http://bcm-specs.sipsolutions.net/80211Init */
|
||||
static int bcm43xx_wireless_core_init(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u32 ucodeflags;
|
||||
int err;
|
||||
u32 sbimconfiglow;
|
||||
|
@ -2867,16 +2863,15 @@ static int bcm43xx_wireless_core_init(struct bcm43xx_private *bcm)
|
|||
/* HW decryption needs to be set now */
|
||||
ucodeflags |= 0x40000000;
|
||||
|
||||
if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_G) {
|
||||
if (phy->type == BCM43xx_PHYTYPE_G) {
|
||||
ucodeflags |= BCM43xx_UCODEFLAG_UNKBGPHY;
|
||||
if (bcm->current_core->phy->rev == 1)
|
||||
if (phy->rev == 1)
|
||||
ucodeflags |= BCM43xx_UCODEFLAG_UNKGPHY;
|
||||
if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL)
|
||||
ucodeflags |= BCM43xx_UCODEFLAG_UNKPACTRL;
|
||||
} else if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_B) {
|
||||
} else if (phy->type == BCM43xx_PHYTYPE_B) {
|
||||
ucodeflags |= BCM43xx_UCODEFLAG_UNKBGPHY;
|
||||
if ((bcm->current_core->phy->rev >= 2) &&
|
||||
(bcm->current_core->radio->version == 0x2050))
|
||||
if (phy->rev >= 2 && radio->version == 0x2050)
|
||||
ucodeflags &= ~BCM43xx_UCODEFLAG_UNKGPHY;
|
||||
}
|
||||
|
||||
|
@ -2901,7 +2896,7 @@ static int bcm43xx_wireless_core_init(struct bcm43xx_private *bcm)
|
|||
bcm43xx_rate_memory_init(bcm);
|
||||
|
||||
/* Minimum Contention Window */
|
||||
if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_B)
|
||||
if (phy->type == BCM43xx_PHYTYPE_B)
|
||||
bcm43xx_shm_write32(bcm, BCM43xx_SHM_WIRELESS, 0x0003, 0x0000001f);
|
||||
else
|
||||
bcm43xx_shm_write32(bcm, BCM43xx_SHM_WIRELESS, 0x0003, 0x0000000f);
|
||||
|
@ -2927,7 +2922,7 @@ static int bcm43xx_wireless_core_init(struct bcm43xx_private *bcm)
|
|||
bcm43xx_mac_enable(bcm);
|
||||
bcm43xx_interrupt_enable(bcm, bcm->irq_savedstate);
|
||||
|
||||
bcm->current_core->flags |= BCM43xx_COREFLAG_INITIALIZED;
|
||||
bcm->current_core->initialized = 1;
|
||||
out:
|
||||
return err;
|
||||
|
||||
|
@ -3048,7 +3043,7 @@ static void bcm43xx_softmac_init(struct bcm43xx_private *bcm)
|
|||
|
||||
static void bcm43xx_periodic_every120sec(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
|
||||
if (phy->type != BCM43xx_PHYTYPE_G || phy->rev < 2)
|
||||
return;
|
||||
|
@ -3076,8 +3071,8 @@ static void bcm43xx_periodic_every30sec(struct bcm43xx_private *bcm)
|
|||
|
||||
static void bcm43xx_periodic_every15sec(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
|
||||
if (phy->type == BCM43xx_PHYTYPE_G) {
|
||||
//TODO: update_aci_moving_average
|
||||
|
@ -3170,9 +3165,9 @@ static void bcm43xx_free_board(struct bcm43xx_private *bcm)
|
|||
bcm43xx_unlock(bcm, flags);
|
||||
|
||||
for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) {
|
||||
if (!(bcm->core_80211[i].flags & BCM43xx_COREFLAG_AVAILABLE))
|
||||
if (!bcm->core_80211[i].available)
|
||||
continue;
|
||||
if (!(bcm->core_80211[i].flags & BCM43xx_COREFLAG_INITIALIZED))
|
||||
if (!bcm->core_80211[i].initialized)
|
||||
continue;
|
||||
|
||||
err = bcm43xx_switch_core(bcm, &bcm->core_80211[i]);
|
||||
|
@ -3190,7 +3185,6 @@ static void bcm43xx_free_board(struct bcm43xx_private *bcm)
|
|||
static int bcm43xx_init_board(struct bcm43xx_private *bcm)
|
||||
{
|
||||
int i, err;
|
||||
int num_80211_cores;
|
||||
int connect_phy;
|
||||
unsigned long flags;
|
||||
|
||||
|
@ -3212,8 +3206,7 @@ static int bcm43xx_init_board(struct bcm43xx_private *bcm)
|
|||
goto err_crystal_off;
|
||||
|
||||
tasklet_enable(&bcm->isr_tasklet);
|
||||
num_80211_cores = bcm43xx_num_80211_cores(bcm);
|
||||
for (i = 0; i < num_80211_cores; i++) {
|
||||
for (i = 0; i < bcm->nr_80211_available; i++) {
|
||||
err = bcm43xx_switch_core(bcm, &bcm->core_80211[i]);
|
||||
assert(err != -ENODEV);
|
||||
if (err)
|
||||
|
@ -3223,8 +3216,8 @@ static int bcm43xx_init_board(struct bcm43xx_private *bcm)
|
|||
* Connect PHY only on the first core.
|
||||
*/
|
||||
if (!bcm43xx_core_enabled(bcm)) {
|
||||
if (num_80211_cores == 1) {
|
||||
connect_phy = bcm->current_core->phy->connected;
|
||||
if (bcm->nr_80211_available == 1) {
|
||||
connect_phy = bcm43xx_current_phy(bcm)->connected;
|
||||
} else {
|
||||
if (i == 0)
|
||||
connect_phy = 1;
|
||||
|
@ -3248,7 +3241,7 @@ static int bcm43xx_init_board(struct bcm43xx_private *bcm)
|
|||
}
|
||||
}
|
||||
bcm->active_80211_core = &bcm->core_80211[0];
|
||||
if (num_80211_cores >= 2) {
|
||||
if (bcm->nr_80211_available >= 2) {
|
||||
bcm43xx_switch_core(bcm, &bcm->core_80211[0]);
|
||||
bcm43xx_mac_enable(bcm);
|
||||
}
|
||||
|
@ -3260,9 +3253,9 @@ static int bcm43xx_init_board(struct bcm43xx_private *bcm)
|
|||
|
||||
bcm43xx_pctl_set_clock(bcm, BCM43xx_PCTL_CLK_DYNAMIC);
|
||||
|
||||
if (bcm->current_core->radio->initial_channel != 0xFF) {
|
||||
if (bcm43xx_current_radio(bcm)->initial_channel != 0xFF) {
|
||||
bcm43xx_mac_suspend(bcm);
|
||||
bcm43xx_radio_selectchannel(bcm, bcm->current_core->radio->initial_channel, 0);
|
||||
bcm43xx_radio_selectchannel(bcm, bcm43xx_current_radio(bcm)->initial_channel, 0);
|
||||
bcm43xx_mac_enable(bcm);
|
||||
}
|
||||
|
||||
|
@ -3282,8 +3275,8 @@ out:
|
|||
err_80211_unwind:
|
||||
tasklet_disable(&bcm->isr_tasklet);
|
||||
/* unwind all 80211 initialization */
|
||||
for (i = 0; i < num_80211_cores; i++) {
|
||||
if (!(bcm->core_80211[i].flags & BCM43xx_COREFLAG_INITIALIZED))
|
||||
for (i = 0; i < bcm->nr_80211_available; i++) {
|
||||
if (!bcm->core_80211[i].initialized)
|
||||
continue;
|
||||
bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL);
|
||||
bcm43xx_wireless_core_cleanup(bcm);
|
||||
|
@ -3307,15 +3300,15 @@ static void bcm43xx_detach_board(struct bcm43xx_private *bcm)
|
|||
|
||||
/* Free allocated structures/fields */
|
||||
for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) {
|
||||
kfree(bcm->phy[i]._lo_pairs);
|
||||
if (bcm->phy[i].dyn_tssi_tbl)
|
||||
kfree(bcm->phy[i].tssi2dbm);
|
||||
kfree(bcm->core_80211_ext[i].phy._lo_pairs);
|
||||
if (bcm->core_80211_ext[i].phy.dyn_tssi_tbl)
|
||||
kfree(bcm->core_80211_ext[i].phy.tssi2dbm);
|
||||
}
|
||||
}
|
||||
|
||||
static int bcm43xx_read_phyinfo(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
u16 value;
|
||||
u8 phy_version;
|
||||
u8 phy_type;
|
||||
|
@ -3393,7 +3386,6 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm)
|
|||
int i;
|
||||
void __iomem *ioaddr;
|
||||
unsigned long mmio_start, mmio_end, mmio_flags, mmio_len;
|
||||
int num_80211_cores;
|
||||
u32 coremask;
|
||||
|
||||
err = pci_enable_device(pci_dev);
|
||||
|
@ -3467,11 +3459,9 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm)
|
|||
if (err)
|
||||
goto err_chipset_detach;
|
||||
|
||||
num_80211_cores = bcm43xx_num_80211_cores(bcm);
|
||||
|
||||
/* Attach all IO cores to the backplane. */
|
||||
coremask = 0;
|
||||
for (i = 0; i < num_80211_cores; i++)
|
||||
for (i = 0; i < bcm->nr_80211_available; i++)
|
||||
coremask |= (1 << bcm->core_80211[i].index);
|
||||
//FIXME: Also attach some non80211 cores?
|
||||
err = bcm43xx_setup_backplane_pci_connection(bcm, coremask);
|
||||
|
@ -3487,7 +3477,7 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm)
|
|||
if (err)
|
||||
goto err_chipset_detach;
|
||||
|
||||
for (i = 0; i < num_80211_cores; i++) {
|
||||
for (i = 0; i < bcm->nr_80211_available; i++) {
|
||||
err = bcm43xx_switch_core(bcm, &bcm->core_80211[i]);
|
||||
assert(err != -ENODEV);
|
||||
if (err)
|
||||
|
@ -3519,7 +3509,7 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm)
|
|||
bcm43xx_pctl_set_crystal(bcm, 0);
|
||||
|
||||
/* Set the MAC address in the networking subsystem */
|
||||
if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A)
|
||||
if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A)
|
||||
memcpy(bcm->net_dev->dev_addr, bcm->sprom.et1macaddr, 6);
|
||||
else
|
||||
memcpy(bcm->net_dev->dev_addr, bcm->sprom.il0macaddr, 6);
|
||||
|
@ -3535,9 +3525,9 @@ out:
|
|||
|
||||
err_80211_unwind:
|
||||
for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) {
|
||||
kfree(bcm->phy[i]._lo_pairs);
|
||||
if (bcm->phy[i].dyn_tssi_tbl)
|
||||
kfree(bcm->phy[i].tssi2dbm);
|
||||
kfree(bcm->core_80211_ext[i].phy._lo_pairs);
|
||||
if (bcm->core_80211_ext[i].phy.dyn_tssi_tbl)
|
||||
kfree(bcm->core_80211_ext[i].phy.tssi2dbm);
|
||||
}
|
||||
err_chipset_detach:
|
||||
bcm43xx_chipset_detach(bcm);
|
||||
|
|
|
@ -80,7 +80,7 @@ static inline
|
|||
u8 bcm43xx_freq_to_channel(struct bcm43xx_private *bcm,
|
||||
int freq)
|
||||
{
|
||||
if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A)
|
||||
if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A)
|
||||
return bcm43xx_freq_to_channel_a(freq);
|
||||
return bcm43xx_freq_to_channel_bg(freq);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ static inline
|
|||
int bcm43xx_channel_to_freq(struct bcm43xx_private *bcm,
|
||||
u8 channel)
|
||||
{
|
||||
if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A)
|
||||
if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A)
|
||||
return bcm43xx_channel_to_freq_a(channel);
|
||||
return bcm43xx_channel_to_freq_bg(channel);
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ static inline
|
|||
int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm,
|
||||
u8 channel)
|
||||
{
|
||||
if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A)
|
||||
if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A)
|
||||
return bcm43xx_is_valid_channel_a(channel);
|
||||
return bcm43xx_is_valid_channel_bg(channel);
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm);
|
|||
|
||||
void bcm43xx_raw_phy_lock(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
|
||||
assert(irqs_disabled());
|
||||
if (bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD) == 0x00000000) {
|
||||
|
@ -102,7 +102,7 @@ void bcm43xx_raw_phy_lock(struct bcm43xx_private *bcm)
|
|||
|
||||
void bcm43xx_raw_phy_unlock(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
|
||||
assert(irqs_disabled());
|
||||
if (bcm->current_core->rev < 3) {
|
||||
|
@ -132,7 +132,7 @@ void bcm43xx_phy_write(struct bcm43xx_private *bcm, u16 offset, u16 val)
|
|||
|
||||
void bcm43xx_phy_calibrate(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
unsigned long flags;
|
||||
|
||||
bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD); /* Dummy read. */
|
||||
|
@ -158,39 +158,32 @@ void bcm43xx_phy_calibrate(struct bcm43xx_private *bcm)
|
|||
*/
|
||||
int bcm43xx_phy_connect(struct bcm43xx_private *bcm, int connect)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
u32 flags;
|
||||
|
||||
if (bcm->current_core->rev < 5) {
|
||||
if (connect) {
|
||||
bcm->current_core->phy->connected = 1;
|
||||
dprintk(KERN_INFO PFX "PHY connected\n");
|
||||
} else {
|
||||
bcm->current_core->phy->connected = 0;
|
||||
dprintk(KERN_INFO PFX "PHY disconnected\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (bcm->current_core->rev < 5)
|
||||
goto out;
|
||||
|
||||
flags = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATEHIGH);
|
||||
if (connect) {
|
||||
if (!(flags & 0x00010000))
|
||||
return -ENODEV;
|
||||
bcm->current_core->phy->connected = 1;
|
||||
|
||||
flags = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATELOW);
|
||||
flags |= (0x800 << 18);
|
||||
bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, flags);
|
||||
dprintk(KERN_INFO PFX "PHY connected\n");
|
||||
} else {
|
||||
if (!(flags & 0x00020000))
|
||||
return -ENODEV;
|
||||
bcm->current_core->phy->connected = 0;
|
||||
|
||||
flags = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATELOW);
|
||||
flags &= ~(0x800 << 18);
|
||||
bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, flags);
|
||||
dprintk(KERN_INFO PFX "PHY disconnected\n");
|
||||
}
|
||||
out:
|
||||
phy->connected = connect;
|
||||
if (connect)
|
||||
dprintk(KERN_INFO PFX "PHY connected\n");
|
||||
else
|
||||
dprintk(KERN_INFO PFX "PHY disconnected\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -200,8 +193,8 @@ int bcm43xx_phy_connect(struct bcm43xx_private *bcm, int connect)
|
|||
*/
|
||||
static void bcm43xx_phy_init_pctl(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u16 saved_batt = 0, saved_ratt = 0, saved_txctl1 = 0;
|
||||
int must_reset_txpower = 0;
|
||||
|
||||
|
@ -250,7 +243,7 @@ static void bcm43xx_phy_init_pctl(struct bcm43xx_private *bcm)
|
|||
|
||||
static void bcm43xx_phy_agcsetup(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
u16 offset = 0x0000;
|
||||
|
||||
if (phy->rev == 1)
|
||||
|
@ -326,7 +319,7 @@ static void bcm43xx_phy_agcsetup(struct bcm43xx_private *bcm)
|
|||
|
||||
static void bcm43xx_phy_setupg(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
u16 i;
|
||||
|
||||
assert(phy->type == BCM43xx_PHYTYPE_G);
|
||||
|
@ -420,7 +413,7 @@ static void bcm43xx_phy_setupg(struct bcm43xx_private *bcm)
|
|||
/* Initialize the noisescaletable for APHY */
|
||||
static void bcm43xx_phy_init_noisescaletbl(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
int i;
|
||||
|
||||
bcm43xx_phy_write(bcm, BCM43xx_PHY_ILT_A_CTRL, 0x1400);
|
||||
|
@ -448,10 +441,11 @@ static void bcm43xx_phy_init_noisescaletbl(struct bcm43xx_private *bcm)
|
|||
|
||||
static void bcm43xx_phy_setupa(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
u16 i;
|
||||
|
||||
assert(bcm->current_core->phy->type == BCM43xx_PHYTYPE_A);
|
||||
switch (bcm->current_core->phy->rev) {
|
||||
assert(phy->type == BCM43xx_PHYTYPE_A);
|
||||
switch (phy->rev) {
|
||||
case 2:
|
||||
bcm43xx_phy_write(bcm, 0x008E, 0x3800);
|
||||
bcm43xx_phy_write(bcm, 0x0035, 0x03FF);
|
||||
|
@ -563,7 +557,8 @@ static void bcm43xx_phy_setupa(struct bcm43xx_private *bcm)
|
|||
/* Initialize APHY. This is also called for the GPHY in some cases. */
|
||||
static void bcm43xx_phy_inita(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u16 tval;
|
||||
|
||||
if (phy->type == BCM43xx_PHYTYPE_A) {
|
||||
|
@ -586,11 +581,11 @@ static void bcm43xx_phy_inita(struct bcm43xx_private *bcm)
|
|||
|
||||
if ((bcm->board_vendor == PCI_VENDOR_ID_BROADCOM)
|
||||
&& ((bcm->board_type == 0x0416) || (bcm->board_type == 0x040A))) {
|
||||
if (bcm->current_core->radio->lofcal == 0xFFFF) {
|
||||
if (radio->lofcal == 0xFFFF) {
|
||||
TODO();//TODO: LOF Cal
|
||||
bcm43xx_radio_set_tx_iq(bcm);
|
||||
} else
|
||||
bcm43xx_radio_write16(bcm, 0x001E, bcm->current_core->radio->lofcal);
|
||||
bcm43xx_radio_write16(bcm, 0x001E, radio->lofcal);
|
||||
}
|
||||
|
||||
bcm43xx_phy_write(bcm, 0x007A, 0xF111);
|
||||
|
@ -620,7 +615,7 @@ static void bcm43xx_phy_inita(struct bcm43xx_private *bcm)
|
|||
|
||||
static void bcm43xx_phy_initb2(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u16 offset, val;
|
||||
|
||||
bcm43xx_write16(bcm, 0x03EC, 0x3F22);
|
||||
|
@ -671,7 +666,7 @@ static void bcm43xx_phy_initb2(struct bcm43xx_private *bcm)
|
|||
|
||||
static void bcm43xx_phy_initb4(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u16 offset, val;
|
||||
|
||||
bcm43xx_write16(bcm, 0x03EC, 0x3F22);
|
||||
|
@ -729,8 +724,8 @@ static void bcm43xx_phy_initb4(struct bcm43xx_private *bcm)
|
|||
|
||||
static void bcm43xx_phy_initb5(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u16 offset;
|
||||
|
||||
if (phy->version == 1 &&
|
||||
|
@ -835,8 +830,8 @@ static void bcm43xx_phy_initb5(struct bcm43xx_private *bcm)
|
|||
|
||||
static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u16 offset, val;
|
||||
|
||||
bcm43xx_phy_write(bcm, 0x003E, 0x817A);
|
||||
|
@ -946,9 +941,9 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm)
|
|||
udelay(40);
|
||||
bcm43xx_radio_write16(bcm, 0x007C, (bcm43xx_radio_read16(bcm, 0x007C) | 0x0002));
|
||||
bcm43xx_radio_write16(bcm, 0x0050, 0x0020);
|
||||
if ((bcm->current_core->radio->manufact == 0x17F) &&
|
||||
(bcm->current_core->radio->version == 0x2050) &&
|
||||
(bcm->current_core->radio->revision <= 2)) {
|
||||
if (radio->manufact == 0x17F &&
|
||||
radio->version == 0x2050 &&
|
||||
radio->revision <= 2) {
|
||||
bcm43xx_radio_write16(bcm, 0x0050, 0x0020);
|
||||
bcm43xx_radio_write16(bcm, 0x005A, 0x0070);
|
||||
bcm43xx_radio_write16(bcm, 0x005B, 0x007B);
|
||||
|
@ -1001,8 +996,8 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm)
|
|||
|
||||
static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u16 tmp;
|
||||
|
||||
if (phy->rev == 1)
|
||||
|
@ -1096,8 +1091,8 @@ static u16 bcm43xx_phy_lo_b_r15_loop(struct bcm43xx_private *bcm)
|
|||
|
||||
void bcm43xx_phy_lo_b_measure(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
u16 regstack[12] = { 0 };
|
||||
u16 mls;
|
||||
u16 fval;
|
||||
|
@ -1190,7 +1185,9 @@ void bcm43xx_phy_lo_b_measure(struct bcm43xx_private *bcm)
|
|||
static inline
|
||||
u16 bcm43xx_phy_lo_g_deviation_subval(struct bcm43xx_private *bcm, u16 control)
|
||||
{
|
||||
if (bcm->current_core->phy->connected) {
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
|
||||
if (phy->connected) {
|
||||
bcm43xx_phy_write(bcm, 0x15, 0xE300);
|
||||
control <<= 8;
|
||||
bcm43xx_phy_write(bcm, 0x0812, control | 0x00B0);
|
||||
|
@ -1242,7 +1239,7 @@ void bcm43xx_lo_write(struct bcm43xx_private *bcm,
|
|||
"WARNING: Writing invalid LOpair "
|
||||
"(low: %d, high: %d, index: %lu)\n",
|
||||
pair->low, pair->high,
|
||||
(unsigned long)(pair - bcm->current_core->phy->_lo_pairs));
|
||||
(unsigned long)(pair - bcm43xx_current_phy(bcm)->_lo_pairs));
|
||||
dump_stack();
|
||||
}
|
||||
#endif
|
||||
|
@ -1257,7 +1254,7 @@ struct bcm43xx_lopair * bcm43xx_find_lopair(struct bcm43xx_private *bcm,
|
|||
u16 tx)
|
||||
{
|
||||
static const u8 dict[10] = { 11, 10, 11, 12, 13, 12, 13, 12, 13, 12 };
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
|
||||
if (baseband_attenuation > 6)
|
||||
baseband_attenuation = 6;
|
||||
|
@ -1275,10 +1272,12 @@ struct bcm43xx_lopair * bcm43xx_find_lopair(struct bcm43xx_private *bcm,
|
|||
static inline
|
||||
struct bcm43xx_lopair * bcm43xx_current_lopair(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
|
||||
return bcm43xx_find_lopair(bcm,
|
||||
bcm->current_core->radio->txpower[0],
|
||||
bcm->current_core->radio->txpower[1],
|
||||
bcm->current_core->radio->txpower[2]);
|
||||
radio->txpower[0],
|
||||
radio->txpower[1],
|
||||
radio->txpower[2]);
|
||||
}
|
||||
|
||||
/* Adjust B/G LO */
|
||||
|
@ -1294,9 +1293,9 @@ void bcm43xx_phy_lo_adjust(struct bcm43xx_private *bcm, int fixed)
|
|||
bcm43xx_lo_write(bcm, pair);
|
||||
}
|
||||
|
||||
static inline
|
||||
void bcm43xx_phy_lo_g_measure_txctl2(struct bcm43xx_private *bcm)
|
||||
static void bcm43xx_phy_lo_g_measure_txctl2(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u16 txctl2 = 0, i;
|
||||
u32 smallest, tmp;
|
||||
|
||||
|
@ -1312,7 +1311,7 @@ void bcm43xx_phy_lo_g_measure_txctl2(struct bcm43xx_private *bcm)
|
|||
txctl2 = i;
|
||||
}
|
||||
}
|
||||
bcm->current_core->radio->txpower[3] = txctl2;
|
||||
radio->txpower[3] = txctl2;
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -1402,16 +1401,17 @@ void bcm43xx_phy_lo_g_state(struct bcm43xx_private *bcm,
|
|||
void bcm43xx_phy_set_baseband_attenuation(struct bcm43xx_private *bcm,
|
||||
u16 baseband_attenuation)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
u16 value;
|
||||
|
||||
if (bcm->current_core->phy->version == 0) {
|
||||
if (phy->version == 0) {
|
||||
value = (bcm43xx_read16(bcm, 0x03E6) & 0xFFF0);
|
||||
value |= (baseband_attenuation & 0x000F);
|
||||
bcm43xx_write16(bcm, 0x03E6, value);
|
||||
return;
|
||||
}
|
||||
|
||||
if (bcm->current_core->phy->version > 1) {
|
||||
if (phy->version > 1) {
|
||||
value = bcm43xx_phy_read(bcm, 0x0060) & ~0x003C;
|
||||
value |= (baseband_attenuation << 2) & 0x003C;
|
||||
} else {
|
||||
|
@ -1426,8 +1426,8 @@ 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 };
|
||||
const int is_initializing = bcm43xx_is_initializing(bcm);
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u16 h, i, oldi = 0, j;
|
||||
struct bcm43xx_lopair control;
|
||||
struct bcm43xx_lopair *tmp_control;
|
||||
|
@ -1653,7 +1653,7 @@ void bcm43xx_phy_lo_mark_current_used(struct bcm43xx_private *bcm)
|
|||
|
||||
void bcm43xx_phy_lo_mark_all_unused(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_lopair *pair;
|
||||
int i;
|
||||
|
||||
|
@ -1668,7 +1668,7 @@ void bcm43xx_phy_lo_mark_all_unused(struct bcm43xx_private *bcm)
|
|||
*/
|
||||
static s8 bcm43xx_phy_estimate_power_out(struct bcm43xx_private *bcm, s8 tssi)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
s8 dbm = 0;
|
||||
s32 tmp;
|
||||
|
||||
|
@ -1698,8 +1698,8 @@ static s8 bcm43xx_phy_estimate_power_out(struct bcm43xx_private *bcm, s8 tssi)
|
|||
/* http://bcm-specs.sipsolutions.net/RecalculateTransmissionPower */
|
||||
void bcm43xx_phy_xmitpower(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
|
||||
if (phy->savedpctlreg == 0xFFFF)
|
||||
return;
|
||||
|
@ -1880,8 +1880,8 @@ s8 bcm43xx_tssi2dbm_entry(s8 entry [], u8 index, s16 pab0, s16 pab1, s16 pab2)
|
|||
/* http://bcm-specs.sipsolutions.net/TSSI_to_DBM_Table */
|
||||
int bcm43xx_phy_init_tssi2dbm_table(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
s16 pab0, pab1, pab2;
|
||||
u8 idx;
|
||||
s8 *dyn_tssi2dbm;
|
||||
|
@ -1958,7 +1958,7 @@ int bcm43xx_phy_init_tssi2dbm_table(struct bcm43xx_private *bcm)
|
|||
|
||||
int bcm43xx_phy_init(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
int err = -ENODEV;
|
||||
unsigned long flags;
|
||||
|
||||
|
@ -2008,7 +2008,7 @@ int bcm43xx_phy_init(struct bcm43xx_private *bcm)
|
|||
|
||||
void bcm43xx_phy_set_antenna_diversity(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
u16 antennadiv;
|
||||
u16 offset;
|
||||
u16 value;
|
||||
|
|
|
@ -146,7 +146,7 @@ struct bcm43xx_pioqueue * parse_cookie(struct bcm43xx_private *bcm,
|
|||
u16 cookie,
|
||||
struct bcm43xx_pio_txpacket **packet)
|
||||
{
|
||||
struct bcm43xx_pio *pio = bcm->current_core->pio;
|
||||
struct bcm43xx_pio *pio = bcm43xx_current_pio(bcm);
|
||||
struct bcm43xx_pioqueue *queue = NULL;
|
||||
int packetindex;
|
||||
|
||||
|
@ -377,7 +377,7 @@ static void bcm43xx_destroy_pioqueue(struct bcm43xx_pioqueue *queue)
|
|||
|
||||
void bcm43xx_pio_free(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_pio *pio = bcm->current_core->pio;
|
||||
struct bcm43xx_pio *pio = bcm43xx_current_pio(bcm);
|
||||
|
||||
bcm43xx_destroy_pioqueue(pio->queue3);
|
||||
pio->queue3 = NULL;
|
||||
|
@ -391,7 +391,7 @@ void bcm43xx_pio_free(struct bcm43xx_private *bcm)
|
|||
|
||||
int bcm43xx_pio_init(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_pio *pio = bcm->current_core->pio;
|
||||
struct bcm43xx_pio *pio = bcm43xx_current_pio(bcm);
|
||||
struct bcm43xx_pioqueue *queue;
|
||||
int err = -ENOMEM;
|
||||
|
||||
|
@ -438,7 +438,7 @@ err_destroy0:
|
|||
int bcm43xx_pio_tx(struct bcm43xx_private *bcm,
|
||||
struct ieee80211_txb *txb)
|
||||
{
|
||||
struct bcm43xx_pioqueue *queue = bcm->current_core->pio->queue1;
|
||||
struct bcm43xx_pioqueue *queue = bcm43xx_current_pio(bcm)->queue1;
|
||||
struct bcm43xx_pio_txpacket *packet;
|
||||
u16 tmp;
|
||||
|
||||
|
|
|
@ -114,8 +114,8 @@ void bcm43xx_radio_unlock(struct bcm43xx_private *bcm)
|
|||
|
||||
u16 bcm43xx_radio_read16(struct bcm43xx_private *bcm, u16 offset)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
|
||||
switch (phy->type) {
|
||||
case BCM43xx_PHYTYPE_A:
|
||||
|
@ -151,7 +151,7 @@ void bcm43xx_radio_write16(struct bcm43xx_private *bcm, u16 offset, u16 val)
|
|||
static void bcm43xx_set_all_gains(struct bcm43xx_private *bcm,
|
||||
s16 first, s16 second, s16 third)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
u16 i;
|
||||
u16 start = 0x08, end = 0x18;
|
||||
u16 offset = 0x0400;
|
||||
|
@ -183,7 +183,7 @@ static void bcm43xx_set_all_gains(struct bcm43xx_private *bcm,
|
|||
|
||||
static void bcm43xx_set_original_gains(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
u16 i, tmp;
|
||||
u16 offset = 0x0400;
|
||||
u16 start = 0x0008, end = 0x0018;
|
||||
|
@ -217,7 +217,7 @@ static void bcm43xx_set_original_gains(struct bcm43xx_private *bcm)
|
|||
/* Synthetic PU workaround */
|
||||
static void bcm43xx_synth_pu_workaround(struct bcm43xx_private *bcm, u8 channel)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
|
||||
if (radio->version != 0x2050 || radio->revision >= 6) {
|
||||
/* We do not need the workaround. */
|
||||
|
@ -238,7 +238,7 @@ static void bcm43xx_synth_pu_workaround(struct bcm43xx_private *bcm, u8 channel)
|
|||
|
||||
u8 bcm43xx_radio_aci_detect(struct bcm43xx_private *bcm, u8 channel)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u8 ret = 0;
|
||||
u16 saved, rssi, temp;
|
||||
int i, j = 0;
|
||||
|
@ -269,8 +269,8 @@ u8 bcm43xx_radio_aci_detect(struct bcm43xx_private *bcm, u8 channel)
|
|||
|
||||
u8 bcm43xx_radio_aci_scan(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u8 ret[13];
|
||||
unsigned int channel = radio->channel;
|
||||
unsigned int i, j, start, end;
|
||||
|
@ -351,22 +351,23 @@ void bcm43xx_nrssi_hw_update(struct bcm43xx_private *bcm, u16 val)
|
|||
/* http://bcm-specs.sipsolutions.net/NRSSILookupTable */
|
||||
void bcm43xx_nrssi_mem_update(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
s16 i, delta;
|
||||
s32 tmp;
|
||||
|
||||
delta = 0x1F - bcm->current_core->radio->nrssi[0];
|
||||
delta = 0x1F - radio->nrssi[0];
|
||||
for (i = 0; i < 64; i++) {
|
||||
tmp = (i - delta) * bcm->current_core->radio->nrssislope;
|
||||
tmp = (i - delta) * radio->nrssislope;
|
||||
tmp /= 0x10000;
|
||||
tmp += 0x3A;
|
||||
tmp = limit_value(tmp, 0, 0x3F);
|
||||
bcm->current_core->radio->nrssi_lt[i] = tmp;
|
||||
radio->nrssi_lt[i] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
static void bcm43xx_calc_nrssi_offset(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
u16 backup[20] = { 0 };
|
||||
s16 v47F;
|
||||
u16 i;
|
||||
|
@ -531,8 +532,8 @@ static void bcm43xx_calc_nrssi_offset(struct bcm43xx_private *bcm)
|
|||
|
||||
void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u16 backup[18] = { 0 };
|
||||
u16 tmp;
|
||||
s16 nrssi0, nrssi1;
|
||||
|
@ -779,8 +780,8 @@ void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm)
|
|||
|
||||
void bcm43xx_calc_nrssi_threshold(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
s16 threshold;
|
||||
s32 a, b;
|
||||
int tmp;
|
||||
|
@ -804,7 +805,7 @@ void bcm43xx_calc_nrssi_threshold(struct bcm43xx_private *bcm)
|
|||
radiotype = 1;
|
||||
|
||||
if (radiotype == 1) {
|
||||
threshold = bcm->current_core->radio->nrssi[1] - 5;
|
||||
threshold = radio->nrssi[1] - 5;
|
||||
} else {
|
||||
threshold = 40 * radio->nrssi[0];
|
||||
threshold += 33 * (radio->nrssi[1] - radio->nrssi[0]);
|
||||
|
@ -901,8 +902,8 @@ static void
|
|||
bcm43xx_radio_interference_mitigation_enable(struct bcm43xx_private *bcm,
|
||||
int mode)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
int i = 0;
|
||||
u16 *stack = radio->interfstack;
|
||||
u16 tmp, flipped;
|
||||
|
@ -1052,8 +1053,8 @@ static void
|
|||
bcm43xx_radio_interference_mitigation_disable(struct bcm43xx_private *bcm,
|
||||
int mode)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
int i = 0;
|
||||
u16 *stack = radio->interfstack;
|
||||
u16 tmp, flipped;
|
||||
|
@ -1142,8 +1143,8 @@ bcm43xx_radio_interference_mitigation_disable(struct bcm43xx_private *bcm,
|
|||
int bcm43xx_radio_set_interference_mitigation(struct bcm43xx_private *bcm,
|
||||
int mode)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
int currentmode;
|
||||
|
||||
if ((phy->type != BCM43xx_PHYTYPE_G) ||
|
||||
|
@ -1199,8 +1200,8 @@ u16 bcm43xx_radio_calibrationvalue(struct bcm43xx_private *bcm)
|
|||
|
||||
u16 bcm43xx_radio_init2050(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u16 backup[19] = { 0 };
|
||||
u16 ret;
|
||||
u16 i, j;
|
||||
|
@ -1444,7 +1445,7 @@ int bcm43xx_radio_selectchannel(struct bcm43xx_private *bcm,
|
|||
u8 channel,
|
||||
int synthetic_pu_workaround)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u16 r8, tmp;
|
||||
u16 freq;
|
||||
|
||||
|
@ -1628,6 +1629,7 @@ static u16 bcm43xx_get_txgain_dac(u16 txpower)
|
|||
|
||||
void bcm43xx_radio_set_txpower_a(struct bcm43xx_private *bcm, u16 txpower)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
u16 pamp, base, dac, ilt;
|
||||
|
||||
txpower = limit_value(txpower, 0, 63);
|
||||
|
@ -1650,7 +1652,7 @@ void bcm43xx_radio_set_txpower_a(struct bcm43xx_private *bcm, u16 txpower)
|
|||
|
||||
bcm43xx_ilt_write(bcm, 0x3001, dac);
|
||||
|
||||
bcm->current_core->radio->txpower[0] = txpower;
|
||||
radio->txpower[0] = txpower;
|
||||
|
||||
TODO();
|
||||
//TODO: FuncPlaceholder (Adjust BB loft cancel)
|
||||
|
@ -1660,8 +1662,8 @@ void bcm43xx_radio_set_txpower_bg(struct bcm43xx_private *bcm,
|
|||
u16 baseband_attenuation, u16 radio_attenuation,
|
||||
u16 txpower)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
|
||||
if (baseband_attenuation == 0xFFFF)
|
||||
baseband_attenuation = radio->txpower[0];
|
||||
|
@ -1698,8 +1700,8 @@ void bcm43xx_radio_set_txpower_bg(struct bcm43xx_private *bcm,
|
|||
|
||||
void bcm43xx_radio_turn_on(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
int err;
|
||||
|
||||
if (radio->enabled)
|
||||
|
@ -1730,8 +1732,8 @@ void bcm43xx_radio_turn_on(struct bcm43xx_private *bcm)
|
|||
|
||||
void bcm43xx_radio_turn_off(struct bcm43xx_private *bcm)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
|
||||
if (phy->type == BCM43xx_PHYTYPE_A) {
|
||||
bcm43xx_radio_write16(bcm, 0x0004, 0x00FF);
|
||||
|
@ -1750,7 +1752,9 @@ void bcm43xx_radio_turn_off(struct bcm43xx_private *bcm)
|
|||
|
||||
void bcm43xx_radio_clear_tssi(struct bcm43xx_private *bcm)
|
||||
{
|
||||
switch (bcm->current_core->phy->type) {
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
|
||||
switch (phy->type) {
|
||||
case BCM43xx_PHYTYPE_A:
|
||||
bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x0068, 0x7F7F);
|
||||
bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x006a, 0x7F7F);
|
||||
|
|
|
@ -150,7 +150,7 @@ static ssize_t bcm43xx_attr_interfmode_show(struct device *dev,
|
|||
bcm43xx_lock(bcm, flags);
|
||||
assert(bcm->initialized);
|
||||
|
||||
switch (bcm->current_core->radio->interfmode) {
|
||||
switch (bcm43xx_current_radio(bcm)->interfmode) {
|
||||
case BCM43xx_RADIO_INTERFMODE_NONE:
|
||||
count = snprintf(buf, PAGE_SIZE, "0 (No Interference Mitigation)\n");
|
||||
break;
|
||||
|
|
|
@ -56,15 +56,14 @@ static int bcm43xx_wx_get_name(struct net_device *net_dev,
|
|||
{
|
||||
struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
|
||||
unsigned long flags;
|
||||
int i, nr_80211;
|
||||
int i;
|
||||
struct bcm43xx_phyinfo *phy;
|
||||
char suffix[7] = { 0 };
|
||||
int have_a = 0, have_b = 0, have_g = 0;
|
||||
|
||||
bcm43xx_lock(bcm, flags);
|
||||
nr_80211 = bcm43xx_num_80211_cores(bcm);
|
||||
for (i = 0; i < nr_80211; i++) {
|
||||
phy = bcm->phy + i;
|
||||
for (i = 0; i < bcm->nr_80211_available; i++) {
|
||||
phy = &(bcm->core_80211_ext[i].phy);
|
||||
switch (phy->type) {
|
||||
case BCM43xx_PHYTYPE_A:
|
||||
have_a = 1;
|
||||
|
@ -129,7 +128,7 @@ static int bcm43xx_wx_set_channelfreq(struct net_device *net_dev,
|
|||
err = bcm43xx_radio_selectchannel(bcm, channel, 0);
|
||||
bcm43xx_mac_enable(bcm);
|
||||
} else {
|
||||
bcm->current_core->radio->initial_channel = channel;
|
||||
bcm43xx_current_radio(bcm)->initial_channel = channel;
|
||||
err = 0;
|
||||
}
|
||||
out_unlock:
|
||||
|
@ -144,15 +143,17 @@ static int bcm43xx_wx_get_channelfreq(struct net_device *net_dev,
|
|||
char *extra)
|
||||
{
|
||||
struct bcm43xx_private *bcm = bcm43xx_priv(net_dev);
|
||||
struct bcm43xx_radioinfo *radio;
|
||||
unsigned long flags;
|
||||
int err = -ENODEV;
|
||||
u16 channel;
|
||||
|
||||
bcm43xx_lock(bcm, flags);
|
||||
channel = bcm->current_core->radio->channel;
|
||||
radio = bcm43xx_current_radio(bcm);
|
||||
channel = radio->channel;
|
||||
if (channel == 0xFF) {
|
||||
assert(!bcm->initialized);
|
||||
channel = bcm->current_core->radio->initial_channel;
|
||||
channel = radio->initial_channel;
|
||||
if (channel == 0xFF)
|
||||
goto out_unlock;
|
||||
}
|
||||
|
@ -232,6 +233,7 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,
|
|||
const struct ieee80211_geo *geo;
|
||||
unsigned long flags;
|
||||
int i, j;
|
||||
struct bcm43xx_phyinfo *phy;
|
||||
|
||||
data->data.length = sizeof(*range);
|
||||
memset(range, 0, sizeof(*range));
|
||||
|
@ -270,11 +272,12 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,
|
|||
IW_ENC_CAPA_CIPHER_CCMP;
|
||||
|
||||
bcm43xx_lock(bcm, flags);
|
||||
phy = bcm43xx_current_phy(bcm);
|
||||
|
||||
range->num_bitrates = 0;
|
||||
i = 0;
|
||||
if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A ||
|
||||
bcm->current_core->phy->type == BCM43xx_PHYTYPE_G) {
|
||||
if (phy->type == BCM43xx_PHYTYPE_A ||
|
||||
phy->type == BCM43xx_PHYTYPE_G) {
|
||||
range->num_bitrates = 8;
|
||||
range->bitrate[i++] = IEEE80211_OFDM_RATE_6MB;
|
||||
range->bitrate[i++] = IEEE80211_OFDM_RATE_9MB;
|
||||
|
@ -285,8 +288,8 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev,
|
|||
range->bitrate[i++] = IEEE80211_OFDM_RATE_48MB;
|
||||
range->bitrate[i++] = IEEE80211_OFDM_RATE_54MB;
|
||||
}
|
||||
if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_B ||
|
||||
bcm->current_core->phy->type == BCM43xx_PHYTYPE_G) {
|
||||
if (phy->type == BCM43xx_PHYTYPE_B ||
|
||||
phy->type == BCM43xx_PHYTYPE_G) {
|
||||
range->num_bitrates += 4;
|
||||
range->bitrate[i++] = IEEE80211_CCK_RATE_1MB;
|
||||
range->bitrate[i++] = IEEE80211_CCK_RATE_2MB;
|
||||
|
@ -461,8 +464,8 @@ static int bcm43xx_wx_set_xmitpower(struct net_device *net_dev,
|
|||
bcm43xx_lock_mmio(bcm, flags);
|
||||
if (!bcm->initialized)
|
||||
goto out_unlock;
|
||||
radio = bcm->current_core->radio;
|
||||
phy = bcm->current_core->phy;
|
||||
radio = bcm43xx_current_radio(bcm);
|
||||
phy = bcm43xx_current_phy(bcm);
|
||||
if (data->txpower.disabled != (!(radio->enabled))) {
|
||||
if (data->txpower.disabled)
|
||||
bcm43xx_radio_turn_off(bcm);
|
||||
|
@ -500,7 +503,7 @@ static int bcm43xx_wx_get_xmitpower(struct net_device *net_dev,
|
|||
bcm43xx_lock(bcm, flags);
|
||||
if (!bcm->initialized)
|
||||
goto out_unlock;
|
||||
radio = bcm->current_core->radio;
|
||||
radio = bcm43xx_current_radio(bcm);
|
||||
/* desired dBm value is in Q5.2 */
|
||||
data->txpower.value = radio->txpower_desired >> 2;
|
||||
data->txpower.fixed = 1;
|
||||
|
@ -645,7 +648,7 @@ static int bcm43xx_wx_set_interfmode(struct net_device *net_dev,
|
|||
"not supported while the interface is down.\n");
|
||||
err = -ENODEV;
|
||||
} else
|
||||
bcm->current_core->radio->interfmode = mode;
|
||||
bcm43xx_current_radio(bcm)->interfmode = mode;
|
||||
}
|
||||
bcm43xx_unlock_mmio(bcm, flags);
|
||||
|
||||
|
@ -662,7 +665,7 @@ static int bcm43xx_wx_get_interfmode(struct net_device *net_dev,
|
|||
int mode;
|
||||
|
||||
bcm43xx_lock(bcm, flags);
|
||||
mode = bcm->current_core->radio->interfmode;
|
||||
mode = bcm43xx_current_radio(bcm)->interfmode;
|
||||
bcm43xx_unlock(bcm, flags);
|
||||
|
||||
switch (mode) {
|
||||
|
|
|
@ -284,7 +284,7 @@ void bcm43xx_generate_txhdr(struct bcm43xx_private *bcm,
|
|||
const int is_first_fragment,
|
||||
const u16 cookie)
|
||||
{
|
||||
const struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
const struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
const struct ieee80211_hdr_4addr *wireless_header = (const struct ieee80211_hdr_4addr *)fragment_data;
|
||||
const struct ieee80211_security *secinfo = &bcm->ieee->sec;
|
||||
u8 bitrate;
|
||||
|
@ -382,8 +382,8 @@ static s8 bcm43xx_rssi_postprocess(struct bcm43xx_private *bcm,
|
|||
u8 in_rssi, int ofdm,
|
||||
int adjust_2053, int adjust_2050)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm->current_core->radio;
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
s32 tmp;
|
||||
|
||||
switch (radio->version) {
|
||||
|
@ -442,7 +442,7 @@ static s8 bcm43xx_rssi_postprocess(struct bcm43xx_private *bcm,
|
|||
static s8 bcm43xx_rssinoise_postprocess(struct bcm43xx_private *bcm,
|
||||
u8 in_rssi)
|
||||
{
|
||||
struct bcm43xx_phyinfo *phy = bcm->current_core->phy;
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
s8 ret;
|
||||
|
||||
if (phy->type == BCM43xx_PHYTYPE_A) {
|
||||
|
@ -458,6 +458,8 @@ int bcm43xx_rx(struct bcm43xx_private *bcm,
|
|||
struct sk_buff *skb,
|
||||
struct bcm43xx_rxhdr *rxhdr)
|
||||
{
|
||||
struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
|
||||
struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
|
||||
struct bcm43xx_plcp_hdr4 *plcp;
|
||||
struct ieee80211_rx_stats stats;
|
||||
struct ieee80211_hdr_4addr *wlhdr;
|
||||
|
@ -494,13 +496,13 @@ int bcm43xx_rx(struct bcm43xx_private *bcm,
|
|||
else
|
||||
stats.rate = bcm43xx_plcp_get_bitrate_cck(plcp);
|
||||
//printk("RX ofdm %d, rate == %u\n", is_ofdm, stats.rate);
|
||||
stats.received_channel = bcm->current_core->radio->channel;
|
||||
stats.received_channel = radio->channel;
|
||||
//TODO stats.control =
|
||||
stats.mask = IEEE80211_STATMASK_SIGNAL |
|
||||
//TODO IEEE80211_STATMASK_NOISE |
|
||||
IEEE80211_STATMASK_RATE |
|
||||
IEEE80211_STATMASK_RSSI;
|
||||
if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A)
|
||||
if (phy->type == BCM43xx_PHYTYPE_A)
|
||||
stats.freq = IEEE80211_52GHZ_BAND;
|
||||
else
|
||||
stats.freq = IEEE80211_24GHZ_BAND;
|
||||
|
|
Loading…
Reference in a new issue