Commit e9357c05 authored by Michael Buesch's avatar Michael Buesch Committed by John W. Linville

[PATCH] bcm43xx: reduce the size of bcm43xx_private by removing unneeded members.

Signed-off-by: default avatarMichael Buesch <mbuesch@freenet.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent aae37781
......@@ -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;
......
This diff is collapsed.
......@@ -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);
}
......
This diff is collapsed.
......@@ -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 @@ int bcm43xx_pio_init(struct bcm43xx_private *bcm)
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;
......
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