Skip to content

Commit

Permalink
staging: brcm80211: move dma specific macros from osl to dma code
Browse files Browse the repository at this point in the history
Signed-off-by: Brett Rudley <brudley@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Brett Rudley authored and Greg Kroah-Hartman committed Dec 7, 2010
1 parent 411ee44 commit 8968af1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 28 deletions.
8 changes: 8 additions & 0 deletions drivers/staging/brcm80211/include/bcmutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,14 @@ extern struct sk_buff *pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out);
#define CEIL(x, y) (((x) + ((y)-1)) / (y))
#define ISPOWEROF2(x) ((((x)-1)&(x)) == 0)

/* map physical to virtual I/O */
#if !defined(CONFIG_MMC_MSM7X00A)
#define REG_MAP(pa, size) ioremap_nocache((unsigned long)(pa), \
(unsigned long)(size))
#else
#define REG_MAP(pa, size) (void *)(0)
#endif

/* bit map related macros */
#ifndef setbit
#ifndef NBBY /* the BSD family defines NBBY */
Expand Down
23 changes: 0 additions & 23 deletions drivers/staging/brcm80211/include/osl.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,29 +219,6 @@ extern void osl_dma_unmap(struct osl_info *osh, uint pa, uint size,

#define bcopy(src, dst, len) memcpy((dst), (src), (len))

/* uncached/cached virtual address */
#ifdef __mips__
#include <asm/addrspace.h>
#define OSL_UNCACHED(va) ((void *)KSEG1ADDR((va)))
#define OSL_CACHED(va) ((void *)KSEG0ADDR((va)))
#else
#define OSL_UNCACHED(va) ((void *)va)
#define OSL_CACHED(va) ((void *)va)
#endif /* mips */

/* map/unmap physical to virtual I/O */
#if !defined(CONFIG_MMC_MSM7X00A)
#define REG_MAP(pa, size) ioremap_nocache((unsigned long)(pa), \
(unsigned long)(size))
#else
#define REG_MAP(pa, size) (void *)(0)
#endif /* !defined(CONFIG_MMC_MSM7X00A */
#define REG_UNMAP(va) iounmap((va))

#define R_SM(r) (*(r))
#define W_SM(r, v) (*(r) = (v))
#define BZERO_SM(r, len) memset((r), '\0', (len))

/* packet primitives */
#define PKTGET(osh, len, send) osl_pktget((osh), (len))
#define PKTFREE(osh, skb, send) osl_pktfree((osh), (skb), (send))
Expand Down
16 changes: 12 additions & 4 deletions drivers/staging/brcm80211/util/hnddma.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
#include <sbhnddma.h>
#include <hnddma.h>

#if defined(__mips__)
#include <asm/addrspace.h>
#endif

/* debug/trace */
#ifdef BCMDBG
#define DMA_ERROR(args) \
Expand Down Expand Up @@ -69,6 +73,9 @@ static uint dma_msg_level;

#define DI_INFO(dmah) ((dma_info_t *)dmah)

#define R_SM(r) (*(r))
#define W_SM(r, v) (*(r) = (v))

/* dma engine software state */
typedef struct dma_info {
struct hnddma_pub hnddma; /* exported structure, don't use hnddma_t,
Expand Down Expand Up @@ -903,7 +910,7 @@ static void _dma_rxinit(dma_info_t *di)

/* clear rx descriptor ring */
if (DMA64_ENAB(di) && DMA64_MODE(di)) {
BZERO_SM((void *)di->rxd64,
memset((void *)di->rxd64, '\0',
(di->nrxd * sizeof(dma64dd_t)));

/* DMA engine with out alignment requirement requires table to be inited
Expand All @@ -917,7 +924,7 @@ static void _dma_rxinit(dma_info_t *di)
if (di->aligndesc_4k)
_dma_ddtable_init(di, DMA_RX, di->rxdpa);
} else if (DMA32_ENAB(di)) {
BZERO_SM((void *)di->rxd32,
memset((void *)di->rxd32, '\0',
(di->nrxd * sizeof(dma32dd_t)));
_dma_rxenable(di);
_dma_ddtable_init(di, DMA_RX, di->rxdpa);
Expand Down Expand Up @@ -993,6 +1000,7 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di)
DMA_TRACE(("%s: dma_rx len %d\n", di->name, len));

#if defined(__mips__)
#define OSL_UNCACHED(va) ((void *)KSEG1ADDR((va)))
if (!len) {
while (!(len = *(u16 *) OSL_UNCACHED(head->data)))
udelay(1);
Expand Down Expand Up @@ -1436,7 +1444,7 @@ static void dma32_txinit(dma_info_t *di)
di->hnddma.txavail = di->ntxd - 1;

/* clear tx descriptor ring */
BZERO_SM((void *)di->txd32, (di->ntxd * sizeof(dma32dd_t)));
memset((void *)di->txd32, '\0', (di->ntxd * sizeof(dma32dd_t)));

if ((di->hnddma.dmactrlflags & DMA_CTRL_PEN) == 0)
control |= XC_PD;
Expand Down Expand Up @@ -1992,7 +2000,7 @@ static void dma64_txinit(dma_info_t *di)
di->hnddma.txavail = di->ntxd - 1;

/* clear tx descriptor ring */
BZERO_SM((void *)di->txd64, (di->ntxd * sizeof(dma64dd_t)));
memset((void *)di->txd64, '\0', (di->ntxd * sizeof(dma64dd_t)));

/* DMA engine with out alignment requirement requires table to be inited
* before enabling the engine
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/brcm80211/util/siutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ void si_detach(si_t *sih)
if (sih->bustype == SI_BUS)
for (idx = 0; idx < SI_MAXCORES; idx++)
if (sii->regs[idx]) {
REG_UNMAP(sii->regs[idx]);
iounmap(sii->regs[idx]);
sii->regs[idx] = NULL;
}

Expand Down

0 comments on commit 8968af1

Please sign in to comment.