Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278909
b: refs/heads/master
c: 2e81b9b
h: refs/heads/master
i:
  278907: a78d921
v: v3
  • Loading branch information
Arend van Spriel authored and John W. Linville committed Dec 13, 2011
1 parent 6961670 commit 1ad2589
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 31 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: 16d2812e9eaaa47ca952ea81e34b4f400c861dfc
refs/heads/master: 2e81b9b19f20286425fed3b54df9b81189444cee
47 changes: 25 additions & 22 deletions trunk/drivers/net/wireless/brcm80211/brcmsmac/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ struct dma_info {
uint *msg_level; /* message level pointer */
char name[MAXNAMEL]; /* callers name for diag msgs */

struct pci_dev *pbus; /* bus handle */
struct bcma_device *d11core;
struct device *dmadev;

bool dma64; /* this dma engine is operating in 64-bit mode */
bool addrext; /* this dma engine supports DmaExtendedAddrChanges */
Expand Down Expand Up @@ -450,7 +451,7 @@ static bool _dma_descriptor_align(struct dma_info *di)
* Descriptor table must start at the DMA hardware dictated alignment, so
* allocated memory must be large enough to support this requirement.
*/
static void *dma_alloc_consistent(struct pci_dev *pdev, uint size,
static void *dma_alloc_consistent(struct dma_info *di, uint size,
u16 align_bits, uint *alloced,
dma_addr_t *pap)
{
Expand All @@ -460,7 +461,7 @@ static void *dma_alloc_consistent(struct pci_dev *pdev, uint size,
size += align;
*alloced = size;
}
return pci_alloc_consistent(pdev, size, pap);
return dma_alloc_coherent(di->dmadev, size, pap, GFP_ATOMIC);
}

static
Expand All @@ -486,7 +487,7 @@ static void *dma_ringalloc(struct dma_info *di, u32 boundary, uint size,
u32 desc_strtaddr;
u32 alignbytes = 1 << *alignbits;

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

if (NULL == va)
return NULL;
Expand All @@ -495,8 +496,8 @@ static void *dma_ringalloc(struct dma_info *di, u32 boundary, uint size,
if (((desc_strtaddr + size - 1) & boundary) != (desc_strtaddr
& boundary)) {
*alignbits = dma_align_sizetobits(size);
pci_free_consistent(di->pbus, size, va, *descpa);
va = dma_alloc_consistent(di->pbus, size, *alignbits,
dma_free_coherent(di->dmadev, size, va, *descpa);
va = dma_alloc_consistent(di, size, *alignbits,
alloced, descpa);
}
return va;
Expand Down Expand Up @@ -556,10 +557,11 @@ static bool _dma_alloc(struct dma_info *di, uint direction)
}

struct dma_pub *dma_attach(char *name, struct si_pub *sih,
void __iomem *dmaregstx, void __iomem *dmaregsrx,
uint ntxd, uint nrxd,
uint rxbufsize, int rxextheadroom,
uint nrxpost, uint rxoffset, uint *msg_level)
struct bcma_device *d11core,
void __iomem *dmaregstx, void __iomem *dmaregsrx,
uint ntxd, uint nrxd,
uint rxbufsize, int rxextheadroom,
uint nrxpost, uint rxoffset, uint *msg_level)
{
struct dma_info *di;
uint size;
Expand All @@ -575,6 +577,7 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
di->dma64 = ((ai_core_sflags(sih, 0, 0) & SISF_DMA64) == SISF_DMA64);

/* init dma reg pointer */
di->d11core = d11core;
di->d64txregs = (struct dma64regs __iomem *) dmaregstx;
di->d64rxregs = (struct dma64regs __iomem *) dmaregsrx;

Expand All @@ -594,7 +597,7 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
strncpy(di->name, name, MAXNAMEL);
di->name[MAXNAMEL - 1] = '\0';

di->pbus = ((struct si_info *)sih)->pcibus;
di->dmadev = d11core->dma_dev;

/* save tunables */
di->ntxd = (u16) ntxd;
Expand Down Expand Up @@ -749,13 +752,13 @@ void dma_detach(struct dma_pub *pub)

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

/* free packet pointer vectors */
kfree(di->txp);
Expand Down Expand Up @@ -882,7 +885,7 @@ static struct sk_buff *dma64_getnextrxp(struct dma_info *di, bool forceall)
pa = le32_to_cpu(di->rxd64[i].addrlow) - di->dataoffsetlow;

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

di->rxd64[i].addrlow = cpu_to_le32(0xdeadbeef);
di->rxd64[i].addrhigh = cpu_to_le32(0xdeadbeef);
Expand Down Expand Up @@ -1048,8 +1051,8 @@ bool dma_rxfill(struct dma_pub *pub)
*/
*(u32 *) (p->data) = 0;

pa = pci_map_single(di->pbus, p->data,
di->rxbufsize, PCI_DMA_FROMDEVICE);
pa = dma_map_single(di->dmadev, p->data, di->rxbufsize,
DMA_FROM_DEVICE);

/* save the free packet pointer */
di->rxp[rxout] = p;
Expand Down Expand Up @@ -1267,7 +1270,7 @@ int dma_txfast(struct dma_pub *pub, struct sk_buff *p, bool commit)
goto outoftxd;

/* get physical address of buffer start */
pa = pci_map_single(di->pbus, data, len, PCI_DMA_TODEVICE);
pa = dma_map_single(di->dmadev, data, len, DMA_TO_DEVICE);

/* With a DMA segment list, Descriptor table is filled
* using the segment list instead of looping over
Expand Down Expand Up @@ -1376,7 +1379,7 @@ struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range)
txp = di->txp[i];
di->txp[i] = NULL;

pci_unmap_single(di->pbus, pa, size, PCI_DMA_TODEVICE);
dma_unmap_single(di->dmadev, pa, size, DMA_TO_DEVICE);
}

di->txin = i;
Expand Down
10 changes: 6 additions & 4 deletions trunk/drivers/net/wireless/brcm80211/brcmsmac/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ struct dma_pub {
};

extern struct dma_pub *dma_attach(char *name, struct si_pub *sih,
void __iomem *dmaregstx, void __iomem *dmaregsrx,
uint ntxd, uint nrxd,
uint rxbufsize, int rxextheadroom,
uint nrxpost, uint rxoffset, uint *msg_level);
struct bcma_device *d11core,
void __iomem *dmaregstx,
void __iomem *dmaregsrx,
uint ntxd, uint nrxd,
uint rxbufsize, int rxextheadroom,
uint nrxpost, uint rxoffset, uint *msg_level);

void dma_rxinit(struct dma_pub *pub);
int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list);
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/net/wireless/brcm80211/brcmsmac/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)
* TX: TX_AC_BK_FIFO (TX AC Background data packets)
* RX: RX_FIFO (RX data packets)
*/
wlc_hw->di[0] = dma_attach(name, wlc_hw->sih,
wlc_hw->di[0] = dma_attach(name, wlc_hw->sih, wlc_hw->d11core,
(wme ? dmareg(wlc_hw, DMA_TX, 0) :
NULL), dmareg(wlc_hw, DMA_RX, 0),
(wme ? NTXD : 0), NRXD,
Expand All @@ -1112,7 +1112,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)
* (legacy) TX_DATA_FIFO (TX data packets)
* RX: UNUSED
*/
wlc_hw->di[1] = dma_attach(name, wlc_hw->sih,
wlc_hw->di[1] = dma_attach(name, wlc_hw->sih, wlc_hw->d11core,
dmareg(wlc_hw, DMA_TX, 1), NULL,
NTXD, 0, 0, -1, 0, 0,
&brcm_msg_level);
Expand All @@ -1123,7 +1123,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)
* TX: TX_AC_VI_FIFO (TX AC Video data packets)
* RX: UNUSED
*/
wlc_hw->di[2] = dma_attach(name, wlc_hw->sih,
wlc_hw->di[2] = dma_attach(name, wlc_hw->sih, wlc_hw->d11core,
dmareg(wlc_hw, DMA_TX, 2), NULL,
NTXD, 0, 0, -1, 0, 0,
&brcm_msg_level);
Expand All @@ -1133,7 +1133,7 @@ static bool brcms_b_attach_dmapio(struct brcms_c_info *wlc, uint j, bool wme)
* TX: TX_AC_VO_FIFO (TX AC Voice data packets)
* (legacy) TX_CTL_FIFO (TX control & mgmt packets)
*/
wlc_hw->di[3] = dma_attach(name, wlc_hw->sih,
wlc_hw->di[3] = dma_attach(name, wlc_hw->sih, wlc_hw->d11core,
dmareg(wlc_hw, DMA_TX, 3),
NULL, NTXD, 0, 0, -1,
0, 0, &brcm_msg_level);
Expand Down

0 comments on commit 1ad2589

Please sign in to comment.