1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #include <linux/compiler.h>
19 #include <linux/if_fddi.h>
20 #include <linux/spinlock.h>
21 #include <linux/timer.h>
22 #include <linux/types.h>
23
24
25 #define FZA_REG_BASE 0x100000
26 #define FZA_REG_RESET 0x100200
27 #define FZA_REG_INT_EVENT 0x100400
28 #define FZA_REG_STATUS 0x100402
29 #define FZA_REG_INT_MASK 0x100404
30 #define FZA_REG_CONTROL_A 0x100500
31 #define FZA_REG_CONTROL_B 0x100502
32
33
34 #define FZA_RESET_DLU 0x0002
35 #define FZA_RESET_INIT 0x0001
36 #define FZA_RESET_CLR 0x0000
37
38
39 #define FZA_EVENT_DLU_DONE 0x0800
40 #define FZA_EVENT_FLUSH_TX 0x0400
41 #define FZA_EVENT_PM_PARITY_ERR 0x0200
42 #define FZA_EVENT_HB_PARITY_ERR 0x0100
43 #define FZA_EVENT_NXM_ERR 0x0080
44
45
46
47 #define FZA_EVENT_LINK_ST_CHG 0x0040
48 #define FZA_EVENT_STATE_CHG 0x0020
49 #define FZA_EVENT_UNS_POLL 0x0010
50 #define FZA_EVENT_CMD_DONE 0x0008
51 #define FZA_EVENT_SMT_TX_POLL 0x0004
52 #define FZA_EVENT_RX_POLL 0x0002
53 #define FZA_EVENT_TX_DONE 0x0001
54
55
56 #define FZA_STATUS_DLU_SHIFT 0xc
57 #define FZA_STATUS_DLU_MASK 0x03
58 #define FZA_STATUS_LINK_SHIFT 0xb
59 #define FZA_STATUS_LINK_MASK 0x01
60 #define FZA_STATUS_STATE_SHIFT 0x8
61 #define FZA_STATUS_STATE_MASK 0x07
62 #define FZA_STATUS_HALT_SHIFT 0x0
63 #define FZA_STATUS_HALT_MASK 0xff
64 #define FZA_STATUS_TEST_SHIFT 0x0
65 #define FZA_STATUS_TEST_MASK 0xff
66
67 #define FZA_STATUS_GET_DLU(x) (((x) >> FZA_STATUS_DLU_SHIFT) & \
68 FZA_STATUS_DLU_MASK)
69 #define FZA_STATUS_GET_LINK(x) (((x) >> FZA_STATUS_LINK_SHIFT) & \
70 FZA_STATUS_LINK_MASK)
71 #define FZA_STATUS_GET_STATE(x) (((x) >> FZA_STATUS_STATE_SHIFT) & \
72 FZA_STATUS_STATE_MASK)
73 #define FZA_STATUS_GET_HALT(x) (((x) >> FZA_STATUS_HALT_SHIFT) & \
74 FZA_STATUS_HALT_MASK)
75 #define FZA_STATUS_GET_TEST(x) (((x) >> FZA_STATUS_TEST_SHIFT) & \
76 FZA_STATUS_TEST_MASK)
77
78 #define FZA_DLU_FAILURE 0x0
79 #define FZA_DLU_ERROR 0x1
80 #define FZA_DLU_SUCCESS 0x2
81
82 #define FZA_LINK_OFF 0x0
83 #define FZA_LINK_ON 0x1
84
85 #define FZA_STATE_RESET 0x0
86 #define FZA_STATE_UNINITIALIZED 0x1
87 #define FZA_STATE_INITIALIZED 0x2
88 #define FZA_STATE_RUNNING 0x3
89 #define FZA_STATE_MAINTENANCE 0x4
90 #define FZA_STATE_HALTED 0x5
91
92 #define FZA_HALT_UNKNOWN 0x00
93 #define FZA_HALT_HOST 0x01
94 #define FZA_HALT_HB_PARITY 0x02
95 #define FZA_HALT_NXM 0x03
96 #define FZA_HALT_SW 0x04
97 #define FZA_HALT_HW 0x05
98 #define FZA_HALT_PC_TRACE 0x06
99 #define FZA_HALT_DLSW 0x07
100 #define FZA_HALT_DLHW 0x08
101
102 #define FZA_TEST_FATAL 0x00
103 #define FZA_TEST_68K 0x01
104 #define FZA_TEST_SRAM_BWADDR 0x02
105 #define FZA_TEST_SRAM_DBUS 0x03
106 #define FZA_TEST_SRAM_STUCK1 0x04
107 #define FZA_TEST_SRAM_STUCK2 0x05
108 #define FZA_TEST_SRAM_COUPL1 0x06
109 #define FZA_TEST_SRAM_COUPL2 0x07
110 #define FZA_TEST_FLASH_CRC 0x08
111 #define FZA_TEST_ROM 0x09
112 #define FZA_TEST_PHY_CSR 0x0a
113 #define FZA_TEST_MAC_BIST 0x0b
114 #define FZA_TEST_MAC_CSR 0x0c
115 #define FZA_TEST_MAC_ADDR_UNIQ 0x0d
116 #define FZA_TEST_ELM_BIST 0x0e
117 #define FZA_TEST_ELM_CSR 0x0f
118 #define FZA_TEST_ELM_ADDR_UNIQ 0x10
119 #define FZA_TEST_CAM 0x11
120 #define FZA_TEST_NIROM 0x12
121 #define FZA_TEST_SC_LOOP 0x13
122 #define FZA_TEST_LM_LOOP 0x14
123 #define FZA_TEST_EB_LOOP 0x15
124 #define FZA_TEST_SC_LOOP_BYPS 0x16
125 #define FZA_TEST_LM_LOOP_LOCAL 0x17
126 #define FZA_TEST_EB_LOOP_LOCAL 0x18
127 #define FZA_TEST_CDC_LOOP 0x19
128 #define FZA_TEST_FIBER_LOOP 0x1A
129 #define FZA_TEST_CAM_MATCH_LOOP 0x1B
130 #define FZA_TEST_68K_IRQ_STUCK 0x1C
131 #define FZA_TEST_IRQ_PRESENT 0x1D
132 #define FZA_TEST_RMC_BIST 0x1E
133 #define FZA_TEST_RMC_CSR 0x1F
134 #define FZA_TEST_RMC_ADDR_UNIQ 0x20
135 #define FZA_TEST_PM_DPATH 0x21
136 #define FZA_TEST_PM_ADDR 0x22
137 #define FZA_TEST_RES_23 0x23
138 #define FZA_TEST_PM_DESC 0x24
139 #define FZA_TEST_PM_OWN 0x25
140 #define FZA_TEST_PM_PARITY 0x26
141 #define FZA_TEST_PM_BSWAP 0x27
142 #define FZA_TEST_PM_WSWAP 0x28
143 #define FZA_TEST_PM_REF 0x29
144 #define FZA_TEST_PM_CSR 0x2A
145 #define FZA_TEST_PORT_STATUS 0x2B
146 #define FZA_TEST_HOST_IRQMASK 0x2C
147 #define FZA_TEST_TIMER_IRQ1 0x2D
148 #define FZA_TEST_FORCE_IRQ1 0x2E
149 #define FZA_TEST_TIMER_IRQ5 0x2F
150 #define FZA_TEST_FORCE_IRQ5 0x30
151 #define FZA_TEST_RES_31 0x31
152 #define FZA_TEST_IC_PRIO 0x32
153 #define FZA_TEST_PM_FULL 0x33
154 #define FZA_TEST_PMI_DMA 0x34
155
156
157 #define FZA_MASK_RESERVED 0xf000
158 #define FZA_MASK_DLU_DONE 0x0800
159 #define FZA_MASK_FLUSH_TX 0x0400
160 #define FZA_MASK_PM_PARITY_ERR 0x0200
161
162 #define FZA_MASK_HB_PARITY_ERR 0x0100
163 #define FZA_MASK_NXM_ERR 0x0080
164
165
166 #define FZA_MASK_LINK_ST_CHG 0x0040
167 #define FZA_MASK_STATE_CHG 0x0020
168 #define FZA_MASK_UNS_POLL 0x0010
169 #define FZA_MASK_CMD_DONE 0x0008
170 #define FZA_MASK_SMT_TX_POLL 0x0004
171 #define FZA_MASK_RCV_POLL 0x0002
172
173 #define FZA_MASK_TX_DONE 0x0001
174
175
176 #define FZA_MASK_NONE 0x0000
177 #define FZA_MASK_NORMAL \
178 ((~(FZA_MASK_RESERVED | FZA_MASK_DLU_DONE | \
179 FZA_MASK_PM_PARITY_ERR | FZA_MASK_HB_PARITY_ERR | \
180 FZA_MASK_NXM_ERR)) & 0xffff)
181
182
183 #define FZA_CONTROL_A_HB_PARITY_ERR 0x8000
184 #define FZA_CONTROL_A_NXM_ERR 0x4000
185
186
187 #define FZA_CONTROL_A_SMT_RX_OVFL 0x0040
188 #define FZA_CONTROL_A_FLUSH_DONE 0x0020
189 #define FZA_CONTROL_A_SHUT 0x0010
190 #define FZA_CONTROL_A_HALT 0x0008
191 #define FZA_CONTROL_A_CMD_POLL 0x0004
192 #define FZA_CONTROL_A_SMT_RX_POLL 0x0002
193 #define FZA_CONTROL_A_TX_POLL 0x0001
194
195
196
197
198
199
200
201 #define FZA_CONTROL_B_CONSOLE 0x0002
202
203
204 #define FZA_CONTROL_B_DRIVER 0x0001
205 #define FZA_CONTROL_B_IDLE 0x0000
206
207 #define FZA_RESET_PAD \
208 (FZA_REG_RESET - FZA_REG_BASE)
209 #define FZA_INT_EVENT_PAD \
210 (FZA_REG_INT_EVENT - FZA_REG_RESET - sizeof(u16))
211 #define FZA_CONTROL_A_PAD \
212 (FZA_REG_CONTROL_A - FZA_REG_INT_MASK - sizeof(u16))
213
214
215 struct fza_regs {
216 u8 pad0[FZA_RESET_PAD];
217 u16 reset;
218 u8 pad1[FZA_INT_EVENT_PAD];
219 u16 int_event;
220 u16 status;
221 u16 int_mask;
222 u8 pad2[FZA_CONTROL_A_PAD];
223 u16 control_a;
224 u16 control_b;
225 };
226
227
228 struct fza_ring_cmd {
229 u32 cmd_own;
230 u32 stat;
231 u32 buffer;
232 u32 pad0;
233 };
234
235 #define FZA_RING_CMD 0x200400
236 #define FZA_RING_CMD_SIZE 0x40
237
238
239
240 #define FZA_RING_CMD_MASK 0x7fffffff
241 #define FZA_RING_CMD_NOP 0x00000000
242 #define FZA_RING_CMD_INIT 0x00000001
243 #define FZA_RING_CMD_MODCAM 0x00000002
244 #define FZA_RING_CMD_PARAM 0x00000003
245 #define FZA_RING_CMD_MODPROM 0x00000004
246 #define FZA_RING_CMD_SETCHAR 0x00000005
247 #define FZA_RING_CMD_RDCNTR 0x00000006
248 #define FZA_RING_CMD_STATUS 0x00000007
249 #define FZA_RING_CMD_RDCAM 0x00000008
250
251
252 #define FZA_RING_STAT_SUCCESS 0x00000000
253
254
255 struct fza_ring_uns {
256 u32 own;
257 u32 id;
258 u32 buffer;
259 u32 pad0;
260 };
261
262 #define FZA_RING_UNS 0x200800
263 #define FZA_RING_UNS_SIZE 0x40
264
265
266
267 #define FZA_RING_UNS_UND 0x00000000
268 #define FZA_RING_UNS_INIT_IN 0x00000001
269 #define FZA_RING_UNS_INIT_RX 0x00000002
270 #define FZA_RING_UNS_BEAC_IN 0x00000003
271 #define FZA_RING_UNS_DUP_ADDR 0x00000004
272 #define FZA_RING_UNS_DUP_TOK 0x00000005
273 #define FZA_RING_UNS_PURG_ERR 0x00000006
274 #define FZA_RING_UNS_STRIP_ERR 0x00000007
275 #define FZA_RING_UNS_OP_OSC 0x00000008
276 #define FZA_RING_UNS_BEAC_RX 0x00000009
277 #define FZA_RING_UNS_PCT_IN 0x0000000a
278 #define FZA_RING_UNS_PCT_RX 0x0000000b
279 #define FZA_RING_UNS_TX_UNDER 0x0000000c
280 #define FZA_RING_UNS_TX_FAIL 0x0000000d
281 #define FZA_RING_UNS_RX_OVER 0x0000000e
282
283
284 struct fza_ring_rmc_tx {
285 u32 rmc;
286 u32 avl;
287 u32 own;
288 u32 pad0;
289 };
290
291 #define FZA_TX_BUFFER_ADDR(x) (0x200000 | (((x) & 0xffff) << 5))
292 #define FZA_TX_BUFFER_SIZE 512
293 struct fza_buffer_tx {
294 u32 data[FZA_TX_BUFFER_SIZE / sizeof(u32)];
295 };
296
297
298 #define FZA_RING_TX_SOP 0x80000000
299 #define FZA_RING_TX_EOP 0x40000000
300 #define FZA_RING_TX_DTP 0x20000000
301 #define FZA_RING_TX_VBC 0x10000000
302 #define FZA_RING_TX_DCC_MASK 0x0f000000
303 #define FZA_RING_TX_DCC_SUCCESS 0x01000000
304 #define FZA_RING_TX_DCC_DTP_SOP 0x02000000
305 #define FZA_RING_TX_DCC_DTP 0x04000000
306 #define FZA_RING_TX_DCC_ABORT 0x05000000
307 #define FZA_RING_TX_DCC_PARITY 0x06000000
308 #define FZA_RING_TX_DCC_UNDRRUN 0x07000000
309 #define FZA_RING_TX_XPO_MASK 0x003fe000
310
311
312 struct fza_ring_hst_rx {
313 u32 buf0_own;
314
315
316
317 u32 buffer1;
318
319
320
321 u32 rmc;
322 u32 pad0;
323 };
324
325 #define FZA_RX_BUFFER_SIZE (4096 + 512)
326
327
328 #define FZA_RING_RX_SOP 0x80000000
329 #define FZA_RING_RX_EOP 0x40000000
330 #define FZA_RING_RX_FSC_MASK 0x38000000
331 #define FZA_RING_RX_FSB_MASK 0x07c00000
332 #define FZA_RING_RX_FSB_ERR 0x04000000
333 #define FZA_RING_RX_FSB_ADDR 0x02000000
334 #define FZA_RING_RX_FSB_COP 0x01000000
335 #define FZA_RING_RX_FSB_F0 0x00800000
336 #define FZA_RING_RX_FSB_F1 0x00400000
337 #define FZA_RING_RX_BAD 0x00200000
338 #define FZA_RING_RX_CRC 0x00100000
339 #define FZA_RING_RX_RRR_MASK 0x000e0000
340 #define FZA_RING_RX_RRR_OK 0x00000000
341 #define FZA_RING_RX_RRR_SADDR 0x00020000
342 #define FZA_RING_RX_RRR_DADDR 0x00040000
343 #define FZA_RING_RX_RRR_ABORT 0x00060000
344 #define FZA_RING_RX_RRR_LENGTH 0x00080000
345 #define FZA_RING_RX_RRR_FRAG 0x000a0000
346 #define FZA_RING_RX_RRR_FORMAT 0x000c0000
347 #define FZA_RING_RX_RRR_RESET 0x000e0000
348 #define FZA_RING_RX_DA_MASK 0x00018000
349 #define FZA_RING_RX_DA_NONE 0x00000000
350 #define FZA_RING_RX_DA_PROM 0x00008000
351 #define FZA_RING_RX_DA_CAM 0x00010000
352 #define FZA_RING_RX_DA_LOCAL 0x00018000
353 #define FZA_RING_RX_SA_MASK 0x00006000
354 #define FZA_RING_RX_SA_NONE 0x00000000
355 #define FZA_RING_RX_SA_ALIAS 0x00002000
356 #define FZA_RING_RX_SA_CAM 0x00004000
357 #define FZA_RING_RX_SA_LOCAL 0x00006000
358
359
360 struct fza_ring_smt {
361 u32 own;
362 u32 rmc;
363 u32 buffer;
364 u32 pad0;
365 };
366
367
368
369
370
371
372 #define FZA_RING_OWN_MASK 0x80000000
373 #define FZA_RING_OWN_FZA 0x00000000
374 #define FZA_RING_OWN_HOST 0x80000000
375 #define FZA_RING_TX_OWN_RMC 0x80000000
376 #define FZA_RING_TX_OWN_HOST 0x00000000
377
378
379 #define FZA_RING_PBC_MASK 0x00001fff
380
381
382
383 struct fza_counter {
384 u32 msw;
385 u32 lsw;
386 };
387
388 struct fza_counters {
389 struct fza_counter sys_buf;
390 struct fza_counter tx_under;
391 struct fza_counter tx_fail;
392 struct fza_counter rx_over;
393 struct fza_counter frame_cnt;
394 struct fza_counter error_cnt;
395 struct fza_counter lost_cnt;
396 struct fza_counter rinit_in;
397 struct fza_counter rinit_rx;
398 struct fza_counter beac_in;
399 struct fza_counter dup_addr;
400 struct fza_counter dup_tok;
401 struct fza_counter purg_err;
402 struct fza_counter strip_err;
403 struct fza_counter pct_in;
404 struct fza_counter pct_rx;
405 struct fza_counter lem_rej;
406 struct fza_counter tne_rej;
407 struct fza_counter lem_event;
408 struct fza_counter lct_rej;
409 struct fza_counter conn_cmpl;
410 struct fza_counter el_buf;
411 };
412
413
414
415
416
417
418
419
420 struct fza_cmd_init {
421 u32 tx_mode;
422 u32 hst_rx_size;
423
424 struct fza_counters counters;
425
426 u8 rmc_rev[4];
427 u8 rom_rev[4];
428 u8 fw_rev[4];
429
430 u32 mop_type;
431
432 u32 hst_rx;
433 u32 rmc_tx;
434 u32 rmc_tx_size;
435 u32 smt_tx;
436 u32 smt_tx_size;
437 u32 smt_rx;
438 u32 smt_rx_size;
439
440 u32 hw_addr[2];
441
442 u32 def_t_req;
443
444
445 u32 def_tvx;
446
447
448 u32 def_t_max;
449
450
451 u32 lem_threshold;
452 u32 def_station_id[2];
453
454 u32 pmd_type_alt;
455
456 u32 smt_ver;
457
458 u32 rtoken_timeout;
459
460
461 u32 ring_purger;
462
463
464
465 u32 smt_ver_max;
466 u32 smt_ver_min;
467 u32 pmd_type;
468 };
469
470
471 #define FZA_PMD_TYPE_MMF 0
472 #define FZA_PMD_TYPE_TW 101
473 #define FZA_PMD_TYPE_STP 102
474
475
476 #define FZA_CMD_CAM_SIZE 64
477 struct fza_cmd_cam {
478 u32 hw_addr[FZA_CMD_CAM_SIZE][2];
479 };
480
481
482
483
484
485
486
487 struct fza_cmd_param {
488 u32 loop_mode;
489 u32 t_max;
490
491
492
493 u32 t_req;
494
495
496
497 u32 tvx;
498
499
500
501 u32 lem_threshold;
502 u32 station_id[2];
503 u32 rtoken_timeout;
504
505
506
507 u32 ring_purger;
508 };
509
510
511 #define FZA_LOOP_NORMAL 0
512 #define FZA_LOOP_INTERN 1
513 #define FZA_LOOP_EXTERN 2
514
515
516 struct fza_cmd_modprom {
517 u32 llc_prom;
518 u32 smt_prom;
519 u32 llc_multi;
520 u32 llc_bcast;
521 };
522
523
524
525
526
527 struct fza_cmd_setchar {
528 u32 t_max;
529 u32 t_req;
530 u32 tvx;
531 u32 lem_threshold;
532 u32 rtoken_timeout;
533 u32 ring_purger;
534 };
535
536
537 struct fza_cmd_rdcntr {
538 struct fza_counters counters;
539 };
540
541
542 struct fza_cmd_status {
543 u32 led_state;
544 u32 rmt_state;
545 u32 link_state;
546 u32 dup_addr;
547 u32 ring_purger;
548 u32 t_neg;
549 u32 una[2];
550 u32 una_timeout;
551 u32 strip_mode;
552 u32 yield_mode;
553 u32 phy_state;
554 u32 neigh_phy;
555 u32 reject;
556 u32 phy_lee;
557 u32 una_old[2];
558 u32 rmt_mac;
559 u32 ring_err;
560 u32 beac_rx[2];
561 u32 un_dup_addr;
562 u32 dna[2];
563 u32 dna_old[2];
564 };
565
566
567 union fza_cmd_buf {
568 struct fza_cmd_init init;
569 struct fza_cmd_cam cam;
570 struct fza_cmd_param param;
571 struct fza_cmd_modprom modprom;
572 struct fza_cmd_setchar setchar;
573 struct fza_cmd_rdcntr rdcntr;
574 struct fza_cmd_status status;
575 };
576
577
578
579
580 #define FZA_PRH0_FMT_TYPE_MASK 0xc0
581 #define FZA_PRH0_TOK_TYPE_MASK 0x30
582
583
584 #define FZA_PRH0_TKN_TYPE_ANY 0x30
585 #define FZA_PRH0_TKN_TYPE_UNR 0x20
586 #define FZA_PRH0_TKN_TYPE_RST 0x10
587 #define FZA_PRH0_TKN_TYPE_IMM 0x00
588
589 #define FZA_PRH0_FRAME_MASK 0x08
590 #define FZA_PRH0_FRAME_SYNC 0x08
591 #define FZA_PRH0_FRAME_ASYNC 0x00
592 #define FZA_PRH0_MODE_MASK 0x04
593 #define FZA_PRH0_MODE_IMMED 0x04
594
595
596 #define FZA_PRH0_MODE_NORMAL 0x00
597
598
599 #define FZA_PRH0_SF_MASK 0x02
600 #define FZA_PRH0_SF_FIRST 0x02
601
602
603 #define FZA_PRH0_SF_NORMAL 0x00
604 #define FZA_PRH0_BCN_MASK 0x01
605 #define FZA_PRH0_BCN_BEACON 0x01
606
607
608 #define FZA_PRH0_BCN_DATA 0x01
609
610
611
612
613 #define FZA_PRH1_SL_MASK 0x40
614 #define FZA_PRH1_SL_LAST 0x40
615
616
617 #define FZA_PRH1_SL_NORMAL 0x00
618 #define FZA_PRH1_CRC_MASK 0x20
619 #define FZA_PRH1_CRC_NORMAL 0x20
620
621
622 #define FZA_PRH1_CRC_SKIP 0x00
623 #define FZA_PRH1_TKN_SEND_MASK 0x18
624
625
626 #define FZA_PRH1_TKN_SEND_ORIG 0x18
627
628
629 #define FZA_PRH1_TKN_SEND_RST 0x10
630 #define FZA_PRH1_TKN_SEND_UNR 0x08
631 #define FZA_PRH1_TKN_SEND_NONE 0x00
632 #define FZA_PRH1_EXTRA_FS_MASK 0x07
633
634 #define FZA_PRH1_EXTRA_FS_ST 0x07
635 #define FZA_PRH1_EXTRA_FS_SS 0x06
636 #define FZA_PRH1_EXTRA_FS_SR 0x05
637 #define FZA_PRH1_EXTRA_FS_NONE1 0x04
638 #define FZA_PRH1_EXTRA_FS_RT 0x03
639 #define FZA_PRH1_EXTRA_FS_RS 0x02
640 #define FZA_PRH1_EXTRA_FS_RR 0x01
641 #define FZA_PRH1_EXTRA_FS_NONE 0x00
642
643 #define FZA_PRH2_NORMAL 0x00
644
645
646 #define FZA_PRH0_LLC (FZA_PRH0_TKN_TYPE_UNR)
647 #define FZA_PRH1_LLC (FZA_PRH1_CRC_NORMAL | FZA_PRH1_TKN_SEND_UNR)
648 #define FZA_PRH2_LLC (FZA_PRH2_NORMAL)
649
650
651 #define FZA_PRH0_SMT (FZA_PRH0_TKN_TYPE_UNR)
652 #define FZA_PRH1_SMT (FZA_PRH1_CRC_NORMAL | FZA_PRH1_TKN_SEND_UNR)
653 #define FZA_PRH2_SMT (FZA_PRH2_NORMAL)
654
655 #if ((FZA_RING_RX_SIZE) < 2) || ((FZA_RING_RX_SIZE) > 256)
656 # error FZA_RING_RX_SIZE has to be from 2 up to 256
657 #endif
658 #if ((FZA_RING_TX_MODE) != 0) && ((FZA_RING_TX_MODE) != 1)
659 # error FZA_RING_TX_MODE has to be either 0 or 1
660 #endif
661
662 #define FZA_RING_TX_SIZE (512 << (FZA_RING_TX_MODE))
663
664 struct fza_private {
665 struct device *bdev;
666 const char *name;
667 void __iomem *mmio;
668 struct fza_regs __iomem *regs;
669
670 struct sk_buff *rx_skbuff[FZA_RING_RX_SIZE];
671
672
673
674 dma_addr_t rx_dma[FZA_RING_RX_SIZE];
675
676
677 struct fza_ring_cmd __iomem *ring_cmd;
678
679
680
681 int ring_cmd_index;
682
683
684 struct fza_ring_uns __iomem *ring_uns;
685
686
687
688 int ring_uns_index;
689
690
691
692 struct fza_ring_rmc_tx __iomem *ring_rmc_tx;
693
694
695
696
697 int ring_rmc_tx_size;
698
699
700
701 int ring_rmc_tx_index;
702
703
704 int ring_rmc_txd_index;
705
706
707
708
709 struct fza_ring_hst_rx __iomem *ring_hst_rx;
710
711
712
713
714 int ring_hst_rx_size;
715
716
717
718 int ring_hst_rx_index;
719
720
721
722 struct fza_ring_smt __iomem *ring_smt_tx;
723
724
725
726
727 int ring_smt_tx_size;
728
729
730
731 int ring_smt_tx_index;
732
733
734
735 struct fza_ring_smt __iomem *ring_smt_rx;
736
737
738
739
740 int ring_smt_rx_size;
741
742
743
744 int ring_smt_rx_index;
745
746
747
748 struct fza_buffer_tx __iomem *buffer_tx;
749
750
751
752 uint state;
753
754 spinlock_t lock;
755 uint int_mask;
756
757 int cmd_done_flag;
758 wait_queue_head_t cmd_done_wait;
759
760 int state_chg_flag;
761 wait_queue_head_t state_chg_wait;
762
763 struct timer_list reset_timer;
764 int timer_state;
765
766 int queue_active;
767
768 struct net_device_stats stats;
769
770 uint irq_count_flush_tx;
771 uint irq_count_uns_poll;
772 uint irq_count_smt_tx_poll;
773 uint irq_count_rx_poll;
774 uint irq_count_tx_done;
775 uint irq_count_cmd_done;
776 uint irq_count_state_chg;
777 uint irq_count_link_st_chg;
778
779 uint t_max;
780 uint t_req;
781 uint tvx;
782 uint lem_threshold;
783 uint station_id[2];
784 uint rtoken_timeout;
785 uint ring_purger;
786 };
787
788 struct fza_fddihdr {
789 u8 pa[2];
790 u8 sd;
791 struct fddihdr hdr;
792 } __packed;