Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24728
b: refs/heads/master
c: e9357c0
h: refs/heads/master
v: v3
  • Loading branch information
Michael Buesch authored and John W. Linville committed Mar 27, 2006
1 parent 1af3ec3 commit c1f5ec9
Show file tree
Hide file tree
Showing 14 changed files with 321 additions and 302 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aae3778176ec7a57b1c4f539b7252acfd7d99a1b
refs/heads/master: e9357c056c5e62516f0044e60591d41f00ca7cfa
94 changes: 58 additions & 36 deletions trunk/drivers/net/wireless/bcm43xx/bcm43xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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). */
Expand Down Expand Up @@ -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 */
Expand All @@ -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;

Expand Down Expand Up @@ -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? */
Expand Down
7 changes: 2 additions & 5 deletions trunk/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions trunk/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/net/wireless/bcm43xx/bcm43xx_ilt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/net/wireless/bcm43xx/bcm43xx_leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit c1f5ec9

Please sign in to comment.