4 #define MAX_NUM_BUFFER_PER_RING 32
7 #define cpu_bits _be_s_bits /* use with le32_to_cpu only */
8 #define pci_bits _be_bits /* may contain swapped bytes,
9 but dont need le32_to_cpu */
12 #ifdef __LITTLE_ENDIAN
13 #define cpu_bits _le_bits
14 #define pci_bits _le_bits
17 #define VENDOR_ID_ZUMA 0x1172
18 #define DEVICE_ID_ZUMA_PBB 0x0004
20 #define RXDBP(chan) (&sip->rx_desc[chan].base) /* ch*8 */
21 #define RXDP(chan) (&sip->rx_desc[chan].current) /* ch*8 + 4 */
22 #define TXDBP(chan) (&sip->tx_desc[chan].base) /* ch*8 + 64 */
23 #define TXDP(chan) (&sip->tx_desc[chan].current) /* ch*8 + 68 */
25 #define PBB_DMA_OWN_BIT 0x80000000
26 #define PBB_DMA_LAST_BIT 0x40000000
28 #define EOF_RX_FLAG 1 /* bit 0 */
29 #define EOB_RX_FLAG 2 /* bit 1 */
30 #define EOF_TX_FLAG 4 /* bit 2 */
31 #define EOB_TX_FLAG 8 /* bit 3 */
33 #define TX_MODE(m) (((m)&7) << 16)
35 #define RX_DESC(i) (cs->rx_desc[i])
36 #define TX_DESC(i) (cs->tx_desc[i])
38 #define RX_CONTROL(i) (RX_DESC(i).control.word)
39 #define RX_CONTROL_SIZE(i) (RX_DESC(i).control.rx.size)
40 #define TX_CONTROL(i) (TX_DESC(i).control.word)
42 #define RX_DATA_P(i) (&RX_DESC(i).ptr)
43 #define TX_DATA_P(i) (&TX_DESC(i).ptr)
45 typedef volatile unsigned char V8;
46 typedef volatile unsigned short V16;
47 typedef volatile unsigned int V32;
49 /* RAM descriptor layout */
50 typedef struct _tag_dma_descriptor {
75 * NOTE: DO NOT USE structure to write non-word values... all registers
76 * MUST be written 4 bytes at a time in SI version 0.
77 * Non-word writes will result in "unaccessed" bytes written as zero.
79 * Byte reads are allowed.
81 * V32 pads are because the registers are spaced every 8 bytes (64 bits)
85 /* NOTE!!! 4 dwords */
86 typedef struct _tag_dma_descriptor_ring {
88 V32 pad1; /* skip high dword */
89 volatile DMA_DESCRIPTOR *current;
90 V32 pad3; /* skip high dword */
91 } DMA_DESCRIPTOR_RING;
94 typedef union _tag_dma_generic {
95 struct { /* byte 3 2 1 0 */
96 V32 chan7:4; /* bits 31-28 */
97 V32 chan6:4; /* bits 27-24 */
98 V32 chan5:4; /* bits 23-20 */
99 V32 chan4:4; /* bits 19-16 */
100 V32 chan3:4; /* bits 15-12 */
101 V32 chan2:4; /* bits 11-8 */
102 V32 chan1:4; /* bits 7-4 */
103 V32 chan0:4; /* bits 3-0 */
105 struct { /* byte 0 1 2 3 */
106 V32 chan1:4; /* bits 7-4 */
107 V32 chan0:4; /* bits 3-0 */
108 V32 chan3:4; /* bits 15-12 */
109 V32 chan2:4; /* bits 11-8 */
110 V32 chan5:4; /* bits 23-20 */
111 V32 chan4:4; /* bits 19-16 */
112 V32 chan7:4; /* bits 31-28 */
113 V32 chan6:4; /* bits 27-24 */
115 struct { /* byte 0 1 2 3 */
116 V32 chan0:4; /* bits 0-3 */
117 V32 chan1:4; /* bits 4-7 */
118 V32 chan2:4; /* bits 8-11 */
119 V32 chan3:4; /* bits 12-15 */
120 V32 chan4:4; /* bits 16-19 */
121 V32 chan5:4; /* bits 20-23 */
122 V32 chan6:4; /* bits 24-27 */
123 V32 chan7:4; /* bits 28-31 */
127 } DMA_RXTX_ENABLE, DMA_RX_DELETE,
128 DMA_INT_STATUS, DMA_INT_MASK,
129 DMA_RX_LEVEL_STATUS, DMA_RX_LEVEL_INT_MASK;
132 typedef union _tag_dma_rx_timer{
134 V32 res0:8; /* bits 32-24 */
135 V32 res1:7; /* bits 23-17 */
136 V32 enable:1; /* bit 16 */
137 V32 value:16; /* bits 15-0 */
140 /* crosses byte boundary. must use swap. */
141 V32 s_value:16; /* bits 7-0,15-8 */
142 V32 enable:1; /* bit 16 */
143 V32 res1:7; /* bits 23-17 */
144 V32 res0:8; /* bits 32-24 */
147 V32 value:16; /* bits 0-15 */
148 V32 enable:1; /* bit 16 */
149 V32 res1:7; /* bits 17-23 */
150 V32 res0:8; /* bits 24-32 */
156 /* NOTE!!!: 2 dwords */
157 typedef struct _tag_dma_desc_level{
160 V32 res1:8; /* bits 31-24 */
161 V32 res0:7; /* bits 23-17 */
162 V32 write:1; /* bit 16 */
163 V32 thresh:8; /* bits 15-8 */
164 V32 level:8; /* bits 7-0 */
167 V32 level:8; /* bits 7-0 */
168 V32 thresh:8; /* bits 15-8 */
169 V32 res0:7; /* bits 30-17 */
170 V32 write:1; /* bit 16 */
171 V32 res1:8; /* bits 31-24 */
174 V32 level:8; /* bits 0-7 */
175 V32 thresh:8; /* bits 8-15 */
176 V32 write:1; /* bit 16 */
177 V32 res0:7; /* bit 17-30 */
178 V32 res1:8; /* bits 24-31 */
186 typedef struct _tag_pbb_dma_reg_map {
187 /* 0-15 (0x000-0x078) */
188 DMA_DESCRIPTOR_RING rx_desc[8]; /* 4 dwords each, 128 bytes tot. */
190 /* 16-31 (0x080-0x0f8) */
191 DMA_DESCRIPTOR_RING tx_desc[8]; /* 4 dwords each, 128 bytes tot. */
193 /* 32/33 (0x100/0x108) */
200 DMA_RXTX_ENABLE rxtx_enable;
204 DMA_RX_DELETE rx_delete;
207 /* 36-38 (0x120-0x130) */
208 DMA_INT_STATUS status;
210 DMA_INT_STATUS last_status;
212 DMA_INT_MASK int_mask;
215 /* 39/40 (0x138/0x140) */
217 /* NOTE!! 4 dwords */
241 } _be_bits, _le_bits;
246 /* 41/42 (0x148/0x150) */
252 /* 43/44 (0x158/0x160) */
253 DMA_RX_LEVEL_STATUS rx_level_status;
255 DMA_RX_LEVEL_INT_MASK rx_level_int_mask;
259 DMA_RX_TIMER rx_timer;
270 /* 48/49 (0x180/0x188) */
280 /* 51/52 (0x198/0x1a0) */
289 V32 rev_major:8; /* bits 31-24 */
290 V32 rev_minor:8; /* bits 23-16 */
291 V32 reserved:16; /* bits 15-0 */
294 V32 s_reserved:16; /* bits 7-0, 15-8 */
295 V32 rev_minor:8; /* bits 23-16 */
296 V32 rev_major:8; /* bits 31-24 */
299 V32 reserved:16; /* bits 0-15 */
300 V32 rev_minor:8; /* bits 16-23 */
301 V32 rev_major:8; /* bits 24-31 */
308 /* 54-59 (0x1b0-0x1d8) */
326 /* 61-63 (0x1e8-0x1f8) */
334 /* 64-71 (0x200 - 0x238) */
335 DMA_DESC_LEVEL rx_desc_level[8]; /* 2 dwords each, 32 bytes tot. */
337 /* 72-98 (0x240 - 0x2f8) */
340 /* 96-127 (0x300 - 0x3f8) */
341 /* mirrors (0x100 - 0x1f8) */
346 #endif /* ZUMA_PBB_H */