Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
dma.c File Reference
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <brcmu_utils.h>
#include <aiutils.h>
#include "types.h"
#include "dma.h"
#include "soc.h"

Go to the source code of this file.

Data Structures

struct  dma64desc
 
struct  dma_info
 

Macros

#define pr_fmt(fmt)   KBUILD_MODNAME ": " fmt
 
#define DMA64REGOFFS(field)   offsetof(struct dma64regs, field)
 
#define DMA64TXREGOFFS(di, field)   (di->d64txregbase + DMA64REGOFFS(field))
 
#define DMA64RXREGOFFS(di, field)   (di->d64rxregbase + DMA64REGOFFS(field))
 
#define D64RINGALIGN_BITS   13
 
#define D64MAXRINGSZ   (1 << D64RINGALIGN_BITS)
 
#define D64RINGALIGN   (1 << D64RINGALIGN_BITS)
 
#define D64MAXDD   (D64MAXRINGSZ / sizeof(struct dma64desc))
 
#define D64_XC_XE   0x00000001 /* transmit enable */
 
#define D64_XC_SE   0x00000002 /* transmit suspend request */
 
#define D64_XC_LE   0x00000004 /* loopback enable */
 
#define D64_XC_FL   0x00000010 /* flush request */
 
#define D64_XC_PD   0x00000800 /* parity check disable */
 
#define D64_XC_AE   0x00030000 /* address extension bits */
 
#define D64_XC_AE_SHIFT   16
 
#define D64_XP_LD_MASK   0x00000fff /* last valid descriptor */
 
#define D64_XS0_CD_MASK   0x00001fff /* current descriptor pointer */
 
#define D64_XS0_XS_MASK   0xf0000000 /* transmit state */
 
#define D64_XS0_XS_SHIFT   28
 
#define D64_XS0_XS_DISABLED   0x00000000 /* disabled */
 
#define D64_XS0_XS_ACTIVE   0x10000000 /* active */
 
#define D64_XS0_XS_IDLE   0x20000000 /* idle wait */
 
#define D64_XS0_XS_STOPPED   0x30000000 /* stopped */
 
#define D64_XS0_XS_SUSP   0x40000000 /* suspend pending */
 
#define D64_XS1_AD_MASK   0x00001fff /* active descriptor */
 
#define D64_XS1_XE_MASK   0xf0000000 /* transmit errors */
 
#define D64_XS1_XE_SHIFT   28
 
#define D64_XS1_XE_NOERR   0x00000000 /* no error */
 
#define D64_XS1_XE_DPE   0x10000000 /* descriptor protocol error */
 
#define D64_XS1_XE_DFU   0x20000000 /* data fifo underrun */
 
#define D64_XS1_XE_DTE   0x30000000 /* data transfer error */
 
#define D64_XS1_XE_DESRE   0x40000000 /* descriptor read error */
 
#define D64_XS1_XE_COREE   0x50000000 /* core error */
 
#define D64_RC_RE   0x00000001
 
#define D64_RC_RO_MASK   0x000000fe
 
#define D64_RC_RO_SHIFT   1
 
#define D64_RC_FM   0x00000100
 
#define D64_RC_SH   0x00000200
 
#define D64_RC_OC   0x00000400
 
#define D64_RC_PD   0x00000800
 
#define D64_RC_AE   0x00030000
 
#define D64_RC_AE_SHIFT   16
 
#define DMA_CTRL_PEN   (1 << 0)
 
#define DMA_CTRL_ROC   (1 << 1)
 
#define DMA_CTRL_RXMULTI   (1 << 2)
 
#define DMA_CTRL_UNFRAMED   (1 << 3)
 
#define D64_RP_LD_MASK   0x00000fff /* last valid descriptor */
 
#define D64_RS0_CD_MASK   0x00001fff /* current descriptor pointer */
 
#define D64_RS0_RS_MASK   0xf0000000 /* receive state */
 
#define D64_RS0_RS_SHIFT   28
 
#define D64_RS0_RS_DISABLED   0x00000000 /* disabled */
 
#define D64_RS0_RS_ACTIVE   0x10000000 /* active */
 
#define D64_RS0_RS_IDLE   0x20000000 /* idle wait */
 
#define D64_RS0_RS_STOPPED   0x30000000 /* stopped */
 
#define D64_RS0_RS_SUSP   0x40000000 /* suspend pending */
 
#define D64_RS1_AD_MASK   0x0001ffff /* active descriptor */
 
#define D64_RS1_RE_MASK   0xf0000000 /* receive errors */
 
#define D64_RS1_RE_SHIFT   28
 
#define D64_RS1_RE_NOERR   0x00000000 /* no error */
 
#define D64_RS1_RE_DPO   0x10000000 /* descriptor protocol error */
 
#define D64_RS1_RE_DFU   0x20000000 /* data fifo overflow */
 
#define D64_RS1_RE_DTE   0x30000000 /* data transfer error */
 
#define D64_RS1_RE_DESRE   0x40000000 /* descriptor read error */
 
#define D64_RS1_RE_COREE   0x50000000 /* core error */
 
#define D64_FA_OFF_MASK   0xffff /* offset */
 
#define D64_FA_SEL_MASK   0xf0000 /* select */
 
#define D64_FA_SEL_SHIFT   16
 
#define D64_FA_SEL_XDD   0x00000 /* transmit dma data */
 
#define D64_FA_SEL_XDP   0x10000 /* transmit dma pointers */
 
#define D64_FA_SEL_RDD   0x40000 /* receive dma data */
 
#define D64_FA_SEL_RDP   0x50000 /* receive dma pointers */
 
#define D64_FA_SEL_XFD   0x80000 /* transmit fifo data */
 
#define D64_FA_SEL_XFP   0x90000 /* transmit fifo pointers */
 
#define D64_FA_SEL_RFD   0xc0000 /* receive fifo data */
 
#define D64_FA_SEL_RFP   0xd0000 /* receive fifo pointers */
 
#define D64_FA_SEL_RSD   0xe0000 /* receive frame status data */
 
#define D64_FA_SEL_RSP   0xf0000 /* receive frame status pointers */
 
#define D64_CTRL_COREFLAGS   0x0ff00000 /* core specific flags */
 
#define D64_CTRL1_EOT   ((u32)1 << 28) /* end of descriptor table */
 
#define D64_CTRL1_IOC   ((u32)1 << 29) /* interrupt on completion */
 
#define D64_CTRL1_EOF   ((u32)1 << 30) /* end of frame */
 
#define D64_CTRL1_SOF   ((u32)1 << 31) /* start of frame */
 
#define D64_CTRL2_BC_MASK   0x00007fff
 
#define D64_CTRL2_AE   0x00030000
 
#define D64_CTRL2_AE_SHIFT   16
 
#define D64_CTRL2_PARITY   0x00040000
 
#define D64_CTRL_CORE_MASK   0x0ff00000
 
#define D64_RX_FRM_STS_LEN   0x0000ffff /* frame length mask */
 
#define D64_RX_FRM_STS_OVFL   0x00800000 /* RxOverFlow */
 
#define D64_RX_FRM_STS_DSCRCNT   0x0f000000 /* no. of descriptors used - 1 */
 
#define D64_RX_FRM_STS_DATATYPE   0xf0000000 /* core-dependent data type */
 
#define BCMEXTRAHDROOM   172
 
#define DMA_ERROR(fmt,...)   no_printk(fmt, ##__VA_ARGS__)
 
#define DMA_TRACE(fmt,...)   no_printk(fmt, ##__VA_ARGS__)
 
#define DMA_NONE(fmt,...)   no_printk(fmt, ##__VA_ARGS__)
 
#define MAXNAMEL   8 /* 8 char names */
 
#define B2I(bytes, type)   ((bytes) / sizeof(type))
 
#define I2B(index, type)   ((index) * sizeof(type))
 
#define PCI32ADDR_HIGH   0xc0000000 /* address[31:30] */
 
#define PCI32ADDR_HIGH_SHIFT   30 /* address[31:30] */
 
#define PCI64ADDR_HIGH   0x80000000 /* address[63] */
 
#define PCI64ADDR_HIGH_SHIFT   31 /* address[63] */
 

Functions

struct dma_pubdma_attach (char *name, struct si_pub *sih, struct bcma_device *core, uint txregbase, uint rxregbase, uint ntxd, uint nrxd, uint rxbufsize, int rxextheadroom, uint nrxpost, uint rxoffset, uint *msg_level)
 
void dma_detach (struct dma_pub *pub)
 
void dma_rxinit (struct dma_pub *pub)
 
int dma_rx (struct dma_pub *pub, struct sk_buff_head *skb_list)
 
bool dma_rxfill (struct dma_pub *pub)
 
void dma_rxreclaim (struct dma_pub *pub)
 
void dma_counterreset (struct dma_pub *pub)
 
unsigned long dma_getvar (struct dma_pub *pub, const char *name)
 
void dma_txinit (struct dma_pub *pub)
 
void dma_txsuspend (struct dma_pub *pub)
 
void dma_txresume (struct dma_pub *pub)
 
bool dma_txsuspended (struct dma_pub *pub)
 
void dma_txreclaim (struct dma_pub *pub, enum txd_range range)
 
bool dma_txreset (struct dma_pub *pub)
 
bool dma_rxreset (struct dma_pub *pub)
 
int dma_txfast (struct dma_pub *pub, struct sk_buff *p, bool commit)
 
struct sk_buffdma_getnexttxp (struct dma_pub *pub, enum txd_range range)
 
void dma_walk_packets (struct dma_pub *dmah, void(*callback_fnc)(void *pkt, void *arg_a), void *arg_a)
 

Macro Definition Documentation

#define B2I (   bytes,
  type 
)    ((bytes) / sizeof(type))

Definition at line 204 of file dma.c.

#define BCMEXTRAHDROOM   172

Definition at line 177 of file dma.c.

#define D64_CTRL1_EOF   ((u32)1 << 30) /* end of frame */

Definition at line 148 of file dma.c.

#define D64_CTRL1_EOT   ((u32)1 << 28) /* end of descriptor table */

Definition at line 146 of file dma.c.

#define D64_CTRL1_IOC   ((u32)1 << 29) /* interrupt on completion */

Definition at line 147 of file dma.c.

#define D64_CTRL1_SOF   ((u32)1 << 31) /* start of frame */

Definition at line 149 of file dma.c.

#define D64_CTRL2_AE   0x00030000

Definition at line 155 of file dma.c.

#define D64_CTRL2_AE_SHIFT   16

Definition at line 156 of file dma.c.

#define D64_CTRL2_BC_MASK   0x00007fff

Definition at line 153 of file dma.c.

#define D64_CTRL2_PARITY   0x00040000

Definition at line 158 of file dma.c.

#define D64_CTRL_CORE_MASK   0x0ff00000

Definition at line 161 of file dma.c.

#define D64_CTRL_COREFLAGS   0x0ff00000 /* core specific flags */

Definition at line 145 of file dma.c.

#define D64_FA_OFF_MASK   0xffff /* offset */

Definition at line 130 of file dma.c.

#define D64_FA_SEL_MASK   0xf0000 /* select */

Definition at line 131 of file dma.c.

#define D64_FA_SEL_RDD   0x40000 /* receive dma data */

Definition at line 135 of file dma.c.

#define D64_FA_SEL_RDP   0x50000 /* receive dma pointers */

Definition at line 136 of file dma.c.

#define D64_FA_SEL_RFD   0xc0000 /* receive fifo data */

Definition at line 139 of file dma.c.

#define D64_FA_SEL_RFP   0xd0000 /* receive fifo pointers */

Definition at line 140 of file dma.c.

#define D64_FA_SEL_RSD   0xe0000 /* receive frame status data */

Definition at line 141 of file dma.c.

#define D64_FA_SEL_RSP   0xf0000 /* receive frame status pointers */

Definition at line 142 of file dma.c.

#define D64_FA_SEL_SHIFT   16

Definition at line 132 of file dma.c.

#define D64_FA_SEL_XDD   0x00000 /* transmit dma data */

Definition at line 133 of file dma.c.

#define D64_FA_SEL_XDP   0x10000 /* transmit dma pointers */

Definition at line 134 of file dma.c.

#define D64_FA_SEL_XFD   0x80000 /* transmit fifo data */

Definition at line 137 of file dma.c.

#define D64_FA_SEL_XFP   0x90000 /* transmit fifo pointers */

Definition at line 138 of file dma.c.

#define D64_RC_AE   0x00030000

Definition at line 93 of file dma.c.

#define D64_RC_AE_SHIFT   16

Definition at line 94 of file dma.c.

#define D64_RC_FM   0x00000100

Definition at line 85 of file dma.c.

#define D64_RC_OC   0x00000400

Definition at line 89 of file dma.c.

#define D64_RC_PD   0x00000800

Definition at line 91 of file dma.c.

#define D64_RC_RE   0x00000001

Definition at line 80 of file dma.c.

#define D64_RC_RO_MASK   0x000000fe

Definition at line 82 of file dma.c.

#define D64_RC_RO_SHIFT   1

Definition at line 83 of file dma.c.

#define D64_RC_SH   0x00000200

Definition at line 87 of file dma.c.

#define D64_RP_LD_MASK   0x00000fff /* last valid descriptor */

Definition at line 107 of file dma.c.

#define D64_RS0_CD_MASK   0x00001fff /* current descriptor pointer */

Definition at line 110 of file dma.c.

#define D64_RS0_RS_ACTIVE   0x10000000 /* active */

Definition at line 114 of file dma.c.

#define D64_RS0_RS_DISABLED   0x00000000 /* disabled */

Definition at line 113 of file dma.c.

#define D64_RS0_RS_IDLE   0x20000000 /* idle wait */

Definition at line 115 of file dma.c.

#define D64_RS0_RS_MASK   0xf0000000 /* receive state */

Definition at line 111 of file dma.c.

#define D64_RS0_RS_SHIFT   28

Definition at line 112 of file dma.c.

#define D64_RS0_RS_STOPPED   0x30000000 /* stopped */

Definition at line 116 of file dma.c.

#define D64_RS0_RS_SUSP   0x40000000 /* suspend pending */

Definition at line 117 of file dma.c.

#define D64_RS1_AD_MASK   0x0001ffff /* active descriptor */

Definition at line 119 of file dma.c.

#define D64_RS1_RE_COREE   0x50000000 /* core error */

Definition at line 127 of file dma.c.

#define D64_RS1_RE_DESRE   0x40000000 /* descriptor read error */

Definition at line 126 of file dma.c.

#define D64_RS1_RE_DFU   0x20000000 /* data fifo overflow */

Definition at line 124 of file dma.c.

#define D64_RS1_RE_DPO   0x10000000 /* descriptor protocol error */

Definition at line 123 of file dma.c.

#define D64_RS1_RE_DTE   0x30000000 /* data transfer error */

Definition at line 125 of file dma.c.

#define D64_RS1_RE_MASK   0xf0000000 /* receive errors */

Definition at line 120 of file dma.c.

#define D64_RS1_RE_NOERR   0x00000000 /* no error */

Definition at line 122 of file dma.c.

#define D64_RS1_RE_SHIFT   28

Definition at line 121 of file dma.c.

#define D64_RX_FRM_STS_DATATYPE   0xf0000000 /* core-dependent data type */

Definition at line 166 of file dma.c.

#define D64_RX_FRM_STS_DSCRCNT   0x0f000000 /* no. of descriptors used - 1 */

Definition at line 165 of file dma.c.

#define D64_RX_FRM_STS_LEN   0x0000ffff /* frame length mask */

Definition at line 163 of file dma.c.

#define D64_RX_FRM_STS_OVFL   0x00800000 /* RxOverFlow */

Definition at line 164 of file dma.c.

#define D64_XC_AE   0x00030000 /* address extension bits */

Definition at line 52 of file dma.c.

#define D64_XC_AE_SHIFT   16

Definition at line 53 of file dma.c.

#define D64_XC_FL   0x00000010 /* flush request */

Definition at line 50 of file dma.c.

#define D64_XC_LE   0x00000004 /* loopback enable */

Definition at line 49 of file dma.c.

#define D64_XC_PD   0x00000800 /* parity check disable */

Definition at line 51 of file dma.c.

#define D64_XC_SE   0x00000002 /* transmit suspend request */

Definition at line 48 of file dma.c.

#define D64_XC_XE   0x00000001 /* transmit enable */

Definition at line 47 of file dma.c.

#define D64_XP_LD_MASK   0x00000fff /* last valid descriptor */

Definition at line 56 of file dma.c.

#define D64_XS0_CD_MASK   0x00001fff /* current descriptor pointer */

Definition at line 59 of file dma.c.

#define D64_XS0_XS_ACTIVE   0x10000000 /* active */

Definition at line 63 of file dma.c.

#define D64_XS0_XS_DISABLED   0x00000000 /* disabled */

Definition at line 62 of file dma.c.

#define D64_XS0_XS_IDLE   0x20000000 /* idle wait */

Definition at line 64 of file dma.c.

#define D64_XS0_XS_MASK   0xf0000000 /* transmit state */

Definition at line 60 of file dma.c.

#define D64_XS0_XS_SHIFT   28

Definition at line 61 of file dma.c.

#define D64_XS0_XS_STOPPED   0x30000000 /* stopped */

Definition at line 65 of file dma.c.

#define D64_XS0_XS_SUSP   0x40000000 /* suspend pending */

Definition at line 66 of file dma.c.

#define D64_XS1_AD_MASK   0x00001fff /* active descriptor */

Definition at line 68 of file dma.c.

#define D64_XS1_XE_COREE   0x50000000 /* core error */

Definition at line 76 of file dma.c.

#define D64_XS1_XE_DESRE   0x40000000 /* descriptor read error */

Definition at line 75 of file dma.c.

#define D64_XS1_XE_DFU   0x20000000 /* data fifo underrun */

Definition at line 73 of file dma.c.

#define D64_XS1_XE_DPE   0x10000000 /* descriptor protocol error */

Definition at line 72 of file dma.c.

#define D64_XS1_XE_DTE   0x30000000 /* data transfer error */

Definition at line 74 of file dma.c.

#define D64_XS1_XE_MASK   0xf0000000 /* transmit errors */

Definition at line 69 of file dma.c.

#define D64_XS1_XE_NOERR   0x00000000 /* no error */

Definition at line 71 of file dma.c.

#define D64_XS1_XE_SHIFT   28

Definition at line 70 of file dma.c.

#define D64MAXDD   (D64MAXRINGSZ / sizeof(struct dma64desc))

Definition at line 44 of file dma.c.

#define D64MAXRINGSZ   (1 << D64RINGALIGN_BITS)

Definition at line 41 of file dma.c.

#define D64RINGALIGN   (1 << D64RINGALIGN_BITS)

Definition at line 42 of file dma.c.

#define D64RINGALIGN_BITS   13

Definition at line 40 of file dma.c.

#define DMA64REGOFFS (   field)    offsetof(struct dma64regs, field)

Definition at line 32 of file dma.c.

#define DMA64RXREGOFFS (   di,
  field 
)    (di->d64rxregbase + DMA64REGOFFS(field))

Definition at line 34 of file dma.c.

#define DMA64TXREGOFFS (   di,
  field 
)    (di->d64txregbase + DMA64REGOFFS(field))

Definition at line 33 of file dma.c.

#define DMA_CTRL_PEN   (1 << 0)

Definition at line 98 of file dma.c.

#define DMA_CTRL_ROC   (1 << 1)

Definition at line 100 of file dma.c.

#define DMA_CTRL_RXMULTI   (1 << 2)

Definition at line 102 of file dma.c.

#define DMA_CTRL_UNFRAMED   (1 << 3)

Definition at line 104 of file dma.c.

#define DMA_ERROR (   fmt,
  ... 
)    no_printk(fmt, ##__VA_ARGS__)

Definition at line 192 of file dma.c.

#define DMA_NONE (   fmt,
  ... 
)    no_printk(fmt, ##__VA_ARGS__)

Definition at line 198 of file dma.c.

#define DMA_TRACE (   fmt,
  ... 
)    no_printk(fmt, ##__VA_ARGS__)

Definition at line 194 of file dma.c.

#define I2B (   index,
  type 
)    ((index) * sizeof(type))

Definition at line 205 of file dma.c.

#define MAXNAMEL   8 /* 8 char names */

Definition at line 201 of file dma.c.

#define PCI32ADDR_HIGH   0xc0000000 /* address[31:30] */

Definition at line 207 of file dma.c.

#define PCI32ADDR_HIGH_SHIFT   30 /* address[31:30] */

Definition at line 208 of file dma.c.

#define PCI64ADDR_HIGH   0x80000000 /* address[63] */

Definition at line 210 of file dma.c.

#define PCI64ADDR_HIGH_SHIFT   31 /* address[63] */

Definition at line 211 of file dma.c.

#define pr_fmt (   fmt)    KBUILD_MODNAME ": " fmt

Definition at line 17 of file dma.c.

Function Documentation

struct dma_pub* dma_attach ( char name,
struct si_pub sih,
struct bcma_device core,
uint  txregbase,
uint  rxregbase,
uint  ntxd,
uint  nrxd,
uint  rxbufsize,
int  rxextheadroom,
uint  nrxpost,
uint  rxoffset,
uint msg_level 
)
read

Definition at line 567 of file dma.c.

void dma_counterreset ( struct dma_pub pub)

Definition at line 1116 of file dma.c.

void dma_detach ( struct dma_pub pub)

Definition at line 762 of file dma.c.

struct sk_buff* dma_getnexttxp ( struct dma_pub pub,
enum txd_range  range 
)
read

Definition at line 1350 of file dma.c.

unsigned long dma_getvar ( struct dma_pub pub,
const char name 
)

Definition at line 1125 of file dma.c.

int dma_rx ( struct dma_pub pub,
struct sk_buff_head skb_list 
)

Definition at line 940 of file dma.c.

bool dma_rxfill ( struct dma_pub pub)

Definition at line 1025 of file dma.c.

void dma_rxinit ( struct dma_pub pub)

Definition at line 858 of file dma.c.

void dma_rxreclaim ( struct dma_pub pub)

Definition at line 1105 of file dma.c.

bool dma_rxreset ( struct dma_pub pub)

Definition at line 1251 of file dma.c.

int dma_txfast ( struct dma_pub pub,
struct sk_buff p,
bool  commit 
)

Definition at line 1273 of file dma.c.

void dma_txinit ( struct dma_pub pub)

Definition at line 1136 of file dma.c.

void dma_txreclaim ( struct dma_pub pub,
enum txd_range  range 
)

Definition at line 1203 of file dma.c.

bool dma_txreset ( struct dma_pub pub)

Definition at line 1224 of file dma.c.

void dma_txresume ( struct dma_pub pub)

Definition at line 1181 of file dma.c.

void dma_txsuspend ( struct dma_pub pub)

Definition at line 1169 of file dma.c.

bool dma_txsuspended ( struct dma_pub pub)

Definition at line 1193 of file dma.c.

void dma_walk_packets ( struct dma_pub dmah,
void(*)(void *pkt, void *arg_a)  callback_fnc,
void arg_a 
)

Definition at line 1431 of file dma.c.