0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _BRCM_DMA_H_
0018 #define _BRCM_DMA_H_
0019
0020 #include <linux/delay.h>
0021 #include <linux/skbuff.h>
0022 #include "types.h" /* forward structure declarations */
0023
0024
0025 #define DMA_TX 1
0026 #define DMA_RX 2
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 struct dma32diag {
0037 u32 fifoaddr;
0038 u32 fifodatalow;
0039 u32 fifodatahigh;
0040 u32 pad;
0041 };
0042
0043
0044
0045
0046 struct dma64regs {
0047 u32 control;
0048 u32 ptr;
0049 u32 addrlow;
0050 u32 addrhigh;
0051 u32 status0;
0052 u32 status1;
0053 };
0054
0055
0056 enum txd_range {
0057 DMA_RANGE_ALL = 1,
0058 DMA_RANGE_TRANSMITTED,
0059 DMA_RANGE_TRANSFERED
0060 };
0061
0062
0063
0064
0065
0066 struct dma_pub {
0067 uint txavail;
0068 uint dmactrlflags;
0069
0070
0071 uint rxgiants;
0072 uint rxnobuf;
0073
0074 uint txnobuf;
0075 };
0076
0077 extern struct dma_pub *dma_attach(char *name, struct brcms_c_info *wlc,
0078 uint txregbase, uint rxregbase,
0079 uint ntxd, uint nrxd,
0080 uint rxbufsize, int rxextheadroom,
0081 uint nrxpost, uint rxoffset);
0082
0083 void dma_rxinit(struct dma_pub *pub);
0084 int dma_rx(struct dma_pub *pub, struct sk_buff_head *skb_list);
0085 bool dma_rxfill(struct dma_pub *pub);
0086 bool dma_rxreset(struct dma_pub *pub);
0087 bool dma_txreset(struct dma_pub *pub);
0088 void dma_txinit(struct dma_pub *pub);
0089 int dma_txfast(struct brcms_c_info *wlc, struct dma_pub *pub,
0090 struct sk_buff *p0);
0091 void dma_txflush(struct dma_pub *pub);
0092 int dma_txpending(struct dma_pub *pub);
0093 void dma_kick_tx(struct dma_pub *pub);
0094 void dma_txsuspend(struct dma_pub *pub);
0095 bool dma_txsuspended(struct dma_pub *pub);
0096 void dma_txresume(struct dma_pub *pub);
0097 void dma_txreclaim(struct dma_pub *pub, enum txd_range range);
0098 void dma_rxreclaim(struct dma_pub *pub);
0099 void dma_detach(struct dma_pub *pub);
0100 unsigned long dma_getvar(struct dma_pub *pub, const char *name);
0101 struct sk_buff *dma_getnexttxp(struct dma_pub *pub, enum txd_range range);
0102 void dma_counterreset(struct dma_pub *pub);
0103
0104 void dma_walk_packets(struct dma_pub *dmah, void (*callback_fnc)
0105 (void *pkt, void *arg_a), void *arg_a);
0106
0107
0108
0109
0110
0111
0112
0113 static inline void dma_spin_for_len(uint len, struct sk_buff *head)
0114 {
0115 #if defined(CONFIG_BCM47XX)
0116 if (!len) {
0117 while (!(len = *(u16 *) KSEG1ADDR(head->data)))
0118 udelay(1);
0119
0120 *(u16 *) (head->data) = cpu_to_le16((u16) len);
0121 }
0122 #endif
0123 }
0124
0125 #endif