Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 236184
b: refs/heads/master
c: 06d278c
h: refs/heads/master
v: v3
  • Loading branch information
Arend van Spriel authored and Greg Kroah-Hartman committed Mar 1, 2011
1 parent 9b29e45 commit a7cf702
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 91 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: 7c0e45d7fb4ca3f9505b316598f4c2d748f3e8d0
refs/heads/master: 06d278c51a072a655d7da23e3acc53f676967375
2 changes: 1 addition & 1 deletion trunk/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_cmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ void write_phy_reg(phy_info_t *pi, u16 addr, u16 val)
if (addr == 0x72)
(void)R_REG(osh, &regs->phyregdata);
#else
W_REG(osh, (volatile u32 *)(&regs->phyregaddr),
W_REG(osh, (u32 *)(&regs->phyregaddr),
addr | (val << 16));
if (pi->sh->bustype == PCI_BUS) {
if (++pi->phy_wreg >= pi->phy_wreg_limit) {
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/staging/brcm80211/include/nicpci.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#else
struct sbpcieregs;

extern u8 pcicore_find_pci_capability(struct osl_info *osh, u8 req_cap_id,
extern u8 pcicore_find_pci_capability(void *dev, u8 req_cap_id,
unsigned char *buf, u32 *buflen);
extern uint pcie_readreg(struct osl_info *osh, struct sbpcieregs *pcieregs,
uint addrtype, uint offset);
Expand All @@ -70,7 +70,7 @@ extern u32 pcicore_pcieserdesreg(void *pch, u32 mdioslave, u32 offset,
extern u32 pcicore_pciereg(void *pch, u32 offset, u32 mask,
u32 val, uint type);

extern bool pcicore_pmecap_fast(struct osl_info *osh);
extern bool pcicore_pmecap_fast(void *pch);
extern void pcicore_pmeen(void *pch);
extern void pcicore_pmeclr(void *pch);
extern bool pcicore_pmestat(void *pch);
Expand Down
21 changes: 9 additions & 12 deletions trunk/drivers/staging/brcm80211/include/osl.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,11 @@ extern uint osl_pci_slot(struct osl_info *osh);
#endif

#if defined(BCMSDIO)
#define SELECT_BUS_WRITE(osh, mmap_op, bus_op) \
if ((osh)->mmbus) \
mmap_op else bus_op
#define SELECT_BUS_READ(osh, mmap_op, bus_op) \
((osh)->mmbus) ? mmap_op : bus_op
#define SELECT_BUS_WRITE(mmap_op, bus_op) bus_op
#define SELECT_BUS_READ(mmap_op, bus_op) bus_op
#else
#define SELECT_BUS_WRITE(osh, mmap_op, bus_op) mmap_op
#define SELECT_BUS_READ(osh, mmap_op, bus_op) mmap_op
#define SELECT_BUS_WRITE(mmap_op, bus_op) mmap_op
#define SELECT_BUS_READ(mmap_op, bus_op) mmap_op
#endif

/* the largest reasonable packet buffer driver uses for ethernet MTU in bytes */
Expand All @@ -89,14 +86,14 @@ extern uint osl_pci_slot(struct osl_info *osh);
#ifndef IL_BIGENDIAN
#ifndef __mips__
#define R_REG(osh, r) (\
SELECT_BUS_READ(osh, sizeof(*(r)) == sizeof(u8) ? \
SELECT_BUS_READ(sizeof(*(r)) == sizeof(u8) ? \
readb((volatile u8*)(r)) : \
sizeof(*(r)) == sizeof(u16) ? readw((volatile u16*)(r)) : \
readl((volatile u32*)(r)), OSL_READ_REG(osh, r)) \
)
#else /* __mips__ */
#define R_REG(osh, r) (\
SELECT_BUS_READ(osh, \
SELECT_BUS_READ( \
({ \
__typeof(*(r)) __osl_v; \
__asm__ __volatile__("sync"); \
Expand Down Expand Up @@ -126,7 +123,7 @@ extern uint osl_pci_slot(struct osl_info *osh);
#endif /* __mips__ */

#define W_REG(osh, r, v) do { \
SELECT_BUS_WRITE(osh, \
SELECT_BUS_WRITE( \
switch (sizeof(*(r))) { \
case sizeof(u8): \
writeb((u8)(v), (volatile u8*)(r)); break; \
Expand All @@ -139,7 +136,7 @@ extern uint osl_pci_slot(struct osl_info *osh);
} while (0)
#else /* IL_BIGENDIAN */
#define R_REG(osh, r) (\
SELECT_BUS_READ(osh, \
SELECT_BUS_READ( \
({ \
__typeof(*(r)) __osl_v; \
switch (sizeof(*(r))) { \
Expand All @@ -160,7 +157,7 @@ extern uint osl_pci_slot(struct osl_info *osh);
OSL_READ_REG(osh, r)) \
)
#define W_REG(osh, r, v) do { \
SELECT_BUS_WRITE(osh, \
SELECT_BUS_WRITE( \
switch (sizeof(*(r))) { \
case sizeof(u8): \
writeb((u8)(v), \
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/staging/brcm80211/include/siutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ typedef struct gpioh_item {

/* misc si info needed by some of the routines */
typedef struct si_info {
struct si_pub pub; /* back plane public state (must be first field) */
struct si_pub pub; /* back plane public state (must be first) */
struct osl_info *osh; /* osl os handle */
void *sdh; /* bcmsdh handle */
void *pbus; /* handle to bus (pci/sdio/..) */
uint dev_coreid; /* the core provides driver functions */
void *intr_arg; /* interrupt callback function arg */
si_intrsoff_t intrsoff_fn; /* turns chip interrupts off */
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/staging/brcm80211/util/aiutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void ai_scan(si_t *sih, void *regs, uint devid)
sii->curwrap = (void *)((unsigned long)regs + SI_CORE_SIZE);

/* Now point the window at the erom */
pci_write_config_dword(sii->osh->pdev, PCI_BAR0_WIN, erombase);
pci_write_config_dword(sii->pbus, PCI_BAR0_WIN, erombase);
eromptr = regs;
break;

Expand Down Expand Up @@ -347,10 +347,10 @@ void *ai_setcoreidx(si_t *sih, uint coreidx)

case PCI_BUS:
/* point bar0 window */
pci_write_config_dword(sii->osh->pdev, PCI_BAR0_WIN, addr);
pci_write_config_dword(sii->pbus, PCI_BAR0_WIN, addr);
regs = sii->curmap;
/* point bar0 2nd 4KB window */
pci_write_config_dword(sii->osh->pdev, PCI_BAR0_WIN2, wrap);
pci_write_config_dword(sii->pbus, PCI_BAR0_WIN2, wrap);
break;

case SPI_BUS:
Expand Down
34 changes: 18 additions & 16 deletions trunk/drivers/staging/brcm80211/util/hnddma.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ typedef struct dma_info {
char name[MAXNAMEL]; /* callers name for diag msgs */

struct osl_info *osh; /* os handle */
void *pbus; /* bus handle */
si_t *sih; /* sb handle */

bool dma64; /* this dma engine is operating in 64-bit mode */
Expand Down Expand Up @@ -201,7 +202,7 @@ static void _dma_counterreset(dma_info_t *di);
static void _dma_fifoloopbackenable(dma_info_t *di);
static uint _dma_ctrlflags(dma_info_t *di, uint mask, uint flags);
static u8 dma_align_sizetobits(uint size);
static void *dma_ringalloc(struct osl_info *osh, u32 boundary, uint size,
static void *dma_ringalloc(dma_info_t *di, u32 boundary, uint size,
u16 *alignbits, uint *alloced,
dmaaddr_t *descpa, osldma_t **dmah);

Expand Down Expand Up @@ -338,6 +339,7 @@ struct hnddma_pub *dma_attach(struct osl_info *osh, char *name, si_t *sih,

di->osh = osh;
di->sih = sih;
di->pbus = osh->pdev;

/* save tunables */
di->ntxd = (u16) ntxd;
Expand Down Expand Up @@ -531,7 +533,7 @@ static bool _dma_alloc(dma_info_t *di, uint direction)
return dma64_alloc(di, direction);
}

void *dma_alloc_consistent(struct osl_info *osh, uint size, u16 align_bits,
void *dma_alloc_consistent(struct pci_dev *pdev, uint size, u16 align_bits,
uint *alloced, unsigned long *pap)
{
if (align_bits) {
Expand All @@ -540,7 +542,7 @@ void *dma_alloc_consistent(struct osl_info *osh, uint size, u16 align_bits,
size += align;
*alloced = size;
}
return pci_alloc_consistent(osh->pdev, size, (dma_addr_t *) pap);
return pci_alloc_consistent(pdev, size, (dma_addr_t *) pap);
}

/* !! may be called with core in reset */
Expand All @@ -555,11 +557,11 @@ static void _dma_detach(dma_info_t *di)

/* free dma descriptor rings */
if (di->txd64)
pci_free_consistent(di->osh->pdev, di->txdalloc,
pci_free_consistent(di->pbus, di->txdalloc,
((s8 *)di->txd64 - di->txdalign),
(di->txdpaorig));
if (di->rxd64)
pci_free_consistent(di->osh->pdev, di->rxdalloc,
pci_free_consistent(di->pbus, di->rxdalloc,
((s8 *)di->rxd64 - di->rxdalign),
(di->rxdpaorig));

Expand Down Expand Up @@ -880,7 +882,7 @@ static bool BCMFASTPATH _dma_rxfill(dma_info_t *di)
memset(&di->rxp_dmah[rxout], 0,
sizeof(hnddma_seg_map_t));

pa = pci_map_single(di->osh->pdev, p->data,
pa = pci_map_single(di->pbus, p->data,
di->rxbufsize, PCI_DMA_FROMDEVICE);

ASSERT(IS_ALIGNED(PHYSADDRLO(pa), 4));
Expand Down Expand Up @@ -1086,15 +1088,15 @@ u8 dma_align_sizetobits(uint size)
* descriptor ring size aligned location. This will ensure that the ring will
* not cross page boundary
*/
static void *dma_ringalloc(struct osl_info *osh, u32 boundary, uint size,
static void *dma_ringalloc(dma_info_t *di, u32 boundary, uint size,
u16 *alignbits, uint *alloced,
dmaaddr_t *descpa, osldma_t **dmah)
{
void *va;
u32 desc_strtaddr;
u32 alignbytes = 1 << *alignbits;

va = dma_alloc_consistent(osh, size, *alignbits, alloced, descpa);
va = dma_alloc_consistent(di->pbus, size, *alignbits, alloced, descpa);

if (NULL == va)
return NULL;
Expand All @@ -1103,8 +1105,8 @@ static void *dma_ringalloc(struct osl_info *osh, u32 boundary, uint size,
if (((desc_strtaddr + size - 1) & boundary) != (desc_strtaddr
& boundary)) {
*alignbits = dma_align_sizetobits(size);
pci_free_consistent(osh->pdev, size, va, *descpa);
va = dma_alloc_consistent(osh, size, *alignbits,
pci_free_consistent(di->pbus, size, va, *descpa);
va = dma_alloc_consistent(di->pbus, size, *alignbits,
alloced, descpa);
}
return va;
Expand Down Expand Up @@ -1228,7 +1230,7 @@ static bool dma64_alloc(dma_info_t *di, uint direction)
align = (1 << align_bits);

if (direction == DMA_TX) {
va = dma_ringalloc(di->osh, D64RINGALIGN, size, &align_bits,
va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits,
&alloced, &di->txdpaorig, &di->tx_dmah);
if (va == NULL) {
DMA_ERROR(("%s: dma64_alloc: DMA_ALLOC_CONSISTENT(ntxd) failed\n", di->name));
Expand All @@ -1246,7 +1248,7 @@ static bool dma64_alloc(dma_info_t *di, uint direction)
di->txdalloc = alloced;
ASSERT(IS_ALIGNED((unsigned long)di->txd64, align));
} else {
va = dma_ringalloc(di->osh, D64RINGALIGN, size, &align_bits,
va = dma_ringalloc(di, D64RINGALIGN, size, &align_bits,
&alloced, &di->rxdpaorig, &di->rx_dmah);
if (va == NULL) {
DMA_ERROR(("%s: dma64_alloc: DMA_ALLOC_CONSISTENT(nrxd) failed\n", di->name));
Expand Down Expand Up @@ -1397,7 +1399,7 @@ static int dma64_txunframed(dma_info_t *di, void *buf, uint len, bool commit)
if (len == 0)
return 0;

pa = pci_map_single(di->osh->pdev, buf, len, PCI_DMA_TODEVICE);
pa = pci_map_single(di->pbus, buf, len, PCI_DMA_TODEVICE);

flags = (D64_CTRL1_SOF | D64_CTRL1_IOC | D64_CTRL1_EOF);

Expand Down Expand Up @@ -1477,7 +1479,7 @@ static int BCMFASTPATH dma64_txfast(dma_info_t *di, struct sk_buff *p0,
memset(&di->txp_dmah[txout], 0,
sizeof(hnddma_seg_map_t));

pa = pci_map_single(di->osh->pdev, data, len, PCI_DMA_TODEVICE);
pa = pci_map_single(di->pbus, data, len, PCI_DMA_TODEVICE);

if (DMASGLIST_ENAB) {
map = &di->txp_dmah[txout];
Expand Down Expand Up @@ -1639,7 +1641,7 @@ static void *BCMFASTPATH dma64_getnexttxp(dma_info_t *di, txd_range_t range)
i = NEXTTXD(i);
}

pci_unmap_single(di->osh->pdev, pa, size, PCI_DMA_TODEVICE);
pci_unmap_single(di->pbus, pa, size, PCI_DMA_TODEVICE);
}

di->txin = i;
Expand Down Expand Up @@ -1690,7 +1692,7 @@ static void *BCMFASTPATH dma64_getnextrxp(dma_info_t *di, bool forceall)
di->dataoffsethigh));

/* clear this packet from the descriptor ring */
pci_unmap_single(di->osh->pdev, pa, di->rxbufsize, PCI_DMA_FROMDEVICE);
pci_unmap_single(di->pbus, pa, di->rxbufsize, PCI_DMA_FROMDEVICE);

W_SM(&di->rxd64[i].addrlow, 0xdeadbeef);
W_SM(&di->rxd64[i].addrhigh, 0xdeadbeef);
Expand Down
Loading

0 comments on commit a7cf702

Please sign in to comment.