This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / drivers / net / gianfar.h
1 /* 
2  * drivers/net/gianfar.h
3  *
4  * Gianfar Ethernet Driver
5  * Driver for FEC on MPC8540 and TSEC on MPC8540/MPC8560
6  * Based on 8260_io/fcc_enet.c
7  *
8  * Author: Andy Fleming
9  * Maintainer: Kumar Gala (kumar.gala@freescale.com)
10  *
11  * Copyright 2004 Freescale Semiconductor, Inc
12  *
13  * This program is free software; you can redistribute  it and/or modify it
14  * under  the terms of  the GNU General  Public License as published by the
15  * Free Software Foundation;  either version 2 of the  License, or (at your
16  * option) any later version.
17  *
18  *  Still left to do:
19  *      -Add support for module parameters
20  */
21 #ifndef __GIANFAR_H
22 #define __GIANFAR_H
23
24 #include <linux/config.h>
25 #include <linux/kernel.h>
26 #include <linux/sched.h>
27 #include <linux/string.h>
28 #include <linux/errno.h>
29 #include <linux/slab.h>
30 #include <linux/interrupt.h>
31 #include <linux/init.h>
32 #include <linux/delay.h>
33 #include <linux/netdevice.h>
34 #include <linux/etherdevice.h>
35 #include <linux/skbuff.h>
36 #include <linux/spinlock.h>
37 #include <linux/mm.h>
38
39 #include <asm/io.h>
40 #include <asm/irq.h>
41 #include <asm/uaccess.h>
42 #include <linux/module.h>
43 #include <linux/version.h>
44 #include <linux/crc32.h>
45
46 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)
47 #include <linux/workqueue.h>
48 #else
49 #include <linux/tqueue.h>
50 #define work_struct tq_struct
51 #define schedule_work schedule_task
52 #endif
53
54 #include <linux/ethtool.h>
55 #include <linux/netdevice.h>
56 #include <asm/ocp.h>
57 #include "gianfar_phy.h"
58
59 /* The maximum number of packets to be handled in one call of gfar_poll */
60 #define GFAR_DEV_WEIGHT 64
61
62 /* Number of bytes to align the rx bufs to */
63 #define RXBUF_ALIGNMENT 64
64
65 /* The number of bytes which composes a unit for the purpose of
66  * allocating data buffers.  ie-for any given MTU, the data buffer
67  * will be the next highest multiple of 512 bytes. */
68 #define INCREMENTAL_BUFFER_SIZE 512
69
70
71 #define MAC_ADDR_LEN 6
72
73 extern char gfar_driver_name[];
74 extern char gfar_driver_version[];
75
76 /* These need to be powers of 2 for this driver */
77 #ifdef CONFIG_GFAR_NAPI
78 #define DEFAULT_TX_RING_SIZE    256
79 #define DEFAULT_RX_RING_SIZE    256
80 #else
81 #define DEFAULT_TX_RING_SIZE    64
82 #define DEFAULT_RX_RING_SIZE    64
83 #endif
84
85 #define GFAR_RX_MAX_RING_SIZE   256
86 #define GFAR_TX_MAX_RING_SIZE   256
87
88 #define DEFAULT_RX_BUFFER_SIZE  1536
89 #define TX_RING_MOD_MASK(size) (size-1)
90 #define RX_RING_MOD_MASK(size) (size-1)
91 #define JUMBO_BUFFER_SIZE 9728
92 #define JUMBO_FRAME_SIZE 9600
93
94 /* Latency of interface clock in nanoseconds */
95 /* Interface clock latency , in this case, means the 
96  * time described by a value of 1 in the interrupt
97  * coalescing registers' time fields.  Since those fields
98  * refer to the time it takes for 64 clocks to pass, the
99  * latencies are as such:
100  * GBIT = 125MHz => 8ns/clock => 8*64 ns / tick
101  * 100 = 25 MHz => 40ns/clock => 40*64 ns / tick
102  * 10 = 2.5 MHz => 400ns/clock => 400*64 ns / tick
103  */
104 #define GFAR_GBIT_TIME  512
105 #define GFAR_100_TIME   2560
106 #define GFAR_10_TIME    25600
107
108 #define DEFAULT_TXCOUNT 16
109 #define DEFAULT_TXTIME  32768
110
111 #define DEFAULT_RXCOUNT 16
112 #define DEFAULT_RXTIME  32768
113
114 #define TBIPA_VALUE             0x1f
115 #define MIIMCFG_INIT_VALUE      0x00000007
116 #define MIIMCFG_RESET           0x80000000
117 #define MIIMIND_BUSY            0x00000001
118
119 /* MAC register bits */
120 #define MACCFG1_SOFT_RESET      0x80000000
121 #define MACCFG1_RESET_RX_MC     0x00080000
122 #define MACCFG1_RESET_TX_MC     0x00040000
123 #define MACCFG1_RESET_RX_FUN    0x00020000
124 #define MACCFG1_RESET_TX_FUN    0x00010000
125 #define MACCFG1_LOOPBACK        0x00000100
126 #define MACCFG1_RX_FLOW         0x00000020
127 #define MACCFG1_TX_FLOW         0x00000010
128 #define MACCFG1_SYNCD_RX_EN     0x00000008
129 #define MACCFG1_RX_EN           0x00000004
130 #define MACCFG1_SYNCD_TX_EN     0x00000002
131 #define MACCFG1_TX_EN           0x00000001
132
133 #define MACCFG2_INIT_SETTINGS   0x00007205
134 #define MACCFG2_FULL_DUPLEX     0x00000001
135 #define MACCFG2_IF              0x00000300
136 #define MACCFG2_MII             0x00000100
137 #define MACCFG2_GMII            0x00000200
138 #define MACCFG2_HUGEFRAME       0x00000020
139 #define MACCFG2_LENGTHCHECK     0x00000010
140
141 #define ECNTRL_INIT_SETTINGS    0x00001000
142 #define ECNTRL_TBI_MODE         0x00000020
143
144 #define MRBLR_INIT_SETTINGS     DEFAULT_RX_BUFFER_SIZE
145
146 #define MINFLR_INIT_SETTINGS    0x00000040
147
148 /* Init to do tx snooping for buffers and descriptors */
149 #define DMACTRL_INIT_SETTINGS   0x000000c3
150 #define DMACTRL_GRS             0x00000010
151 #define DMACTRL_GTS             0x00000008
152
153 #define TSTAT_CLEAR_THALT       0x80000000
154
155 /* Interrupt coalescing macros */
156 #define IC_ICEN                 0x80000000
157 #define IC_ICFT_MASK            0x1fe00000
158 #define IC_ICFT_SHIFT           21
159 #define mk_ic_icft(x)           \
160         (((unsigned int)x << IC_ICFT_SHIFT)&IC_ICFT_MASK)
161 #define IC_ICTT_MASK            0x0000ffff
162 #define mk_ic_ictt(x)           (x&IC_ICTT_MASK)
163
164 #define mk_ic_value(count, time) (IC_ICEN | \
165                                 mk_ic_icft(count) | \
166                                 mk_ic_ictt(time))
167
168 #define RCTRL_PROM              0x00000008
169 #define RSTAT_CLEAR_RHALT       0x00800000
170
171 #define IEVENT_INIT_CLEAR       0xffffffff
172 #define IEVENT_BABR             0x80000000
173 #define IEVENT_RXC              0x40000000
174 #define IEVENT_BSY              0x20000000
175 #define IEVENT_EBERR            0x10000000
176 #define IEVENT_MSRO             0x04000000
177 #define IEVENT_GTSC             0x02000000
178 #define IEVENT_BABT             0x01000000
179 #define IEVENT_TXC              0x00800000
180 #define IEVENT_TXE              0x00400000
181 #define IEVENT_TXB              0x00200000
182 #define IEVENT_TXF              0x00100000
183 #define IEVENT_LC               0x00040000
184 #define IEVENT_CRL              0x00020000
185 #define IEVENT_XFUN             0x00010000
186 #define IEVENT_RXB0             0x00008000
187 #define IEVENT_GRSC             0x00000100
188 #define IEVENT_RXF0             0x00000080
189 #define IEVENT_RX_MASK          (IEVENT_RXB0 | IEVENT_RXF0)
190 #define IEVENT_TX_MASK          (IEVENT_TXB | IEVENT_TXF)
191 #define IEVENT_ERR_MASK         \
192 (IEVENT_RXC | IEVENT_BSY | IEVENT_EBERR | IEVENT_MSRO | \
193  IEVENT_BABT | IEVENT_TXC | IEVENT_TXE | IEVENT_LC \
194  | IEVENT_CRL | IEVENT_XFUN)
195
196 #define IMASK_INIT_CLEAR        0x00000000
197 #define IMASK_BABR              0x80000000
198 #define IMASK_RXC               0x40000000
199 #define IMASK_BSY               0x20000000
200 #define IMASK_EBERR             0x10000000
201 #define IMASK_MSRO              0x04000000
202 #define IMASK_GRSC              0x02000000
203 #define IMASK_BABT              0x01000000
204 #define IMASK_TXC               0x00800000
205 #define IMASK_TXEEN             0x00400000
206 #define IMASK_TXBEN             0x00200000
207 #define IMASK_TXFEN             0x00100000
208 #define IMASK_LC                0x00040000
209 #define IMASK_CRL               0x00020000
210 #define IMASK_XFUN              0x00010000
211 #define IMASK_RXB0              0x00008000
212 #define IMASK_GTSC              0x00000100
213 #define IMASK_RXFEN0            0x00000080
214 #define IMASK_RX_DISABLED ~(IMASK_RXFEN0 | IMASK_BSY)
215 #define IMASK_DEFAULT  (IMASK_TXEEN | IMASK_TXFEN | IMASK_TXBEN | \
216                 IMASK_RXFEN0 | IMASK_BSY | IMASK_EBERR | IMASK_BABR | \
217                 IMASK_XFUN | IMASK_RXC | IMASK_BABT)
218
219
220 /* Attribute fields */
221
222 /* This enables rx snooping for buffers and descriptors */
223 #ifdef CONFIG_GFAR_BDSTASH
224 #define ATTR_BDSTASH            0x00000800
225 #else
226 #define ATTR_BDSTASH            0x00000000
227 #endif
228
229 #ifdef CONFIG_GFAR_BUFSTASH
230 #define ATTR_BUFSTASH           0x00004000
231 #define STASH_LENGTH            64
232 #else
233 #define ATTR_BUFSTASH           0x00000000
234 #endif
235
236 #define ATTR_SNOOPING           0x000000c0
237 #define ATTR_INIT_SETTINGS      (ATTR_SNOOPING \
238                 | ATTR_BDSTASH | ATTR_BUFSTASH)
239
240 #define ATTRELI_INIT_SETTINGS   0x0
241
242
243 /* TxBD status field bits */
244 #define TXBD_READY              0x8000
245 #define TXBD_PADCRC             0x4000
246 #define TXBD_WRAP               0x2000
247 #define TXBD_INTERRUPT          0x1000
248 #define TXBD_LAST               0x0800
249 #define TXBD_CRC                0x0400
250 #define TXBD_DEF                0x0200
251 #define TXBD_HUGEFRAME          0x0080
252 #define TXBD_LATECOLLISION      0x0080
253 #define TXBD_RETRYLIMIT         0x0040
254 #define TXBD_RETRYCOUNTMASK     0x003c
255 #define TXBD_UNDERRUN           0x0002
256
257 /* RxBD status field bits */
258 #define RXBD_EMPTY              0x8000
259 #define RXBD_RO1                0x4000
260 #define RXBD_WRAP               0x2000
261 #define RXBD_INTERRUPT          0x1000
262 #define RXBD_LAST               0x0800
263 #define RXBD_FIRST              0x0400
264 #define RXBD_MISS               0x0100
265 #define RXBD_BROADCAST          0x0080
266 #define RXBD_MULTICAST          0x0040
267 #define RXBD_LARGE              0x0020
268 #define RXBD_NONOCTET           0x0010
269 #define RXBD_SHORT              0x0008
270 #define RXBD_CRCERR             0x0004
271 #define RXBD_OVERRUN            0x0002
272 #define RXBD_TRUNCATED          0x0001
273 #define RXBD_STATS              0x01ff
274
275 struct txbd8
276 {
277         u16     status; /* Status Fields */
278         u16     length; /* Buffer length */
279         u32     bufPtr; /* Buffer Pointer */
280 };
281
282 struct rxbd8
283 {
284         u16     status; /* Status Fields */
285         u16     length; /* Buffer Length */
286         u32     bufPtr; /* Buffer Pointer */
287 };
288
289 struct rmon_mib
290 {
291         u32     tr64;   /* 0x.680 - Transmit and Receive 64-byte Frame Counter */
292         u32     tr127;  /* 0x.684 - Transmit and Receive 65-127 byte Frame Counter */
293         u32     tr255;  /* 0x.688 - Transmit and Receive 128-255 byte Frame Counter */
294         u32     tr511;  /* 0x.68c - Transmit and Receive 256-511 byte Frame Counter */
295         u32     tr1k;   /* 0x.690 - Transmit and Receive 512-1023 byte Frame Counter */
296         u32     trmax;  /* 0x.694 - Transmit and Receive 1024-1518 byte Frame Counter */
297         u32     trmgv;  /* 0x.698 - Transmit and Receive 1519-1522 byte Good VLAN Frame */
298         u32     rbyt;   /* 0x.69c - Receive Byte Counter */
299         u32     rpkt;   /* 0x.6a0 - Receive Packet Counter */
300         u32     rfcs;   /* 0x.6a4 - Receive FCS Error Counter */
301         u32     rmca;   /* 0x.6a8 - Receive Multicast Packet Counter */
302         u32     rbca;   /* 0x.6ac - Receive Broadcast Packet Counter */
303         u32     rxcf;   /* 0x.6b0 - Receive Control Frame Packet Counter */
304         u32     rxpf;   /* 0x.6b4 - Receive Pause Frame Packet Counter */
305         u32     rxuo;   /* 0x.6b8 - Receive Unknown OP Code Counter */
306         u32     raln;   /* 0x.6bc - Receive Alignment Error Counter */
307         u32     rflr;   /* 0x.6c0 - Receive Frame Length Error Counter */
308         u32     rcde;   /* 0x.6c4 - Receive Code Error Counter */
309         u32     rcse;   /* 0x.6c8 - Receive Carrier Sense Error Counter */
310         u32     rund;   /* 0x.6cc - Receive Undersize Packet Counter */
311         u32     rovr;   /* 0x.6d0 - Receive Oversize Packet Counter */
312         u32     rfrg;   /* 0x.6d4 - Receive Fragments Counter */
313         u32     rjbr;   /* 0x.6d8 - Receive Jabber Counter */
314         u32     rdrp;   /* 0x.6dc - Receive Drop Counter */
315         u32     tbyt;   /* 0x.6e0 - Transmit Byte Counter Counter */
316         u32     tpkt;   /* 0x.6e4 - Transmit Packet Counter */
317         u32     tmca;   /* 0x.6e8 - Transmit Multicast Packet Counter */
318         u32     tbca;   /* 0x.6ec - Transmit Broadcast Packet Counter */
319         u32     txpf;   /* 0x.6f0 - Transmit Pause Control Frame Counter */
320         u32     tdfr;   /* 0x.6f4 - Transmit Deferral Packet Counter */
321         u32     tedf;   /* 0x.6f8 - Transmit Excessive Deferral Packet Counter */
322         u32     tscl;   /* 0x.6fc - Transmit Single Collision Packet Counter */
323         u32     tmcl;   /* 0x.700 - Transmit Multiple Collision Packet Counter */
324         u32     tlcl;   /* 0x.704 - Transmit Late Collision Packet Counter */
325         u32     txcl;   /* 0x.708 - Transmit Excessive Collision Packet Counter */
326         u32     tncl;   /* 0x.70c - Transmit Total Collision Counter */
327         u8      res1[4];
328         u32     tdrp;   /* 0x.714 - Transmit Drop Frame Counter */
329         u32     tjbr;   /* 0x.718 - Transmit Jabber Frame Counter */
330         u32     tfcs;   /* 0x.71c - Transmit FCS Error Counter */
331         u32     txcf;   /* 0x.720 - Transmit Control Frame Counter */
332         u32     tovr;   /* 0x.724 - Transmit Oversize Frame Counter */
333         u32     tund;   /* 0x.728 - Transmit Undersize Frame Counter */
334         u32     tfrg;   /* 0x.72c - Transmit Fragments Frame Counter */
335         u32     car1;   /* 0x.730 - Carry Register One */
336         u32     car2;   /* 0x.734 - Carry Register Two */
337         u32     cam1;   /* 0x.738 - Carry Mask Register One */
338         u32     cam2;   /* 0x.73c - Carry Mask Register Two */
339 };
340
341 struct gfar_extra_stats {
342         u64 kernel_dropped;
343         u64 rx_large;
344         u64 rx_short;
345         u64 rx_nonoctet;
346         u64 rx_crcerr;
347         u64 rx_overrun;
348         u64 rx_bsy;
349         u64 rx_babr;
350         u64 rx_trunc;
351         u64 eberr;
352         u64 tx_babt;
353         u64 tx_underrun;
354         u64 rx_skbmissing;
355         u64 tx_timeout;
356 };
357
358 #define GFAR_RMON_LEN ((sizeof(struct rmon_mib) - 16)/sizeof(u32))
359 #define GFAR_EXTRA_STATS_LEN (sizeof(struct gfar_extra_stats)/sizeof(u64))
360
361 /* Number of stats in the stats structure (ignore car and cam regs)*/
362 #define GFAR_STATS_LEN (GFAR_RMON_LEN + GFAR_EXTRA_STATS_LEN)
363
364 #define GFAR_INFOSTR_LEN 32
365
366 struct gfar_stats {
367         u64 extra[GFAR_EXTRA_STATS_LEN];
368         u64 rmon[GFAR_RMON_LEN];
369 };
370
371
372 struct gfar {
373         u8      res1[16];
374         u32     ievent;                 /* 0x.010 - Interrupt Event Register */
375         u32     imask;                  /* 0x.014 - Interrupt Mask Register */
376         u32     edis;                   /* 0x.018 - Error Disabled Register */
377         u8      res2[4];
378         u32     ecntrl;                 /* 0x.020 - Ethernet Control Register */
379         u32     minflr;                 /* 0x.024 - Minimum Frame Length Register */
380         u32     ptv;                    /* 0x.028 - Pause Time Value Register */
381         u32     dmactrl;                /* 0x.02c - DMA Control Register */
382         u32     tbipa;                  /* 0x.030 - TBI PHY Address Register */
383         u8      res3[88];
384         u32     fifo_tx_thr;            /* 0x.08c - FIFO transmit threshold register */
385         u8      res4[8];
386         u32     fifo_tx_starve;         /* 0x.098 - FIFO transmit starve register */
387         u32     fifo_tx_starve_shutoff; /* 0x.09c - FIFO transmit starve shutoff register */
388         u8      res5[96];
389         u32     tctrl;                  /* 0x.100 - Transmit Control Register */
390         u32     tstat;                  /* 0x.104 - Transmit Status Register */
391         u8      res6[4];
392         u32     tbdlen;                 /* 0x.10c - Transmit Buffer Descriptor Data Length Register */
393         u32     txic;                   /* 0x.110 - Transmit Interrupt Coalescing Configuration Register */
394         u8      res7[16];
395         u32     ctbptr;                 /* 0x.124 - Current Transmit Buffer Descriptor Pointer Register */
396         u8      res8[92];
397         u32     tbptr;                  /* 0x.184 - Transmit Buffer Descriptor Pointer Low Register */
398         u8      res9[124];
399         u32     tbase;                  /* 0x.204 - Transmit Descriptor Base Address Register */
400         u8      res10[168];
401         u32     ostbd;                  /* 0x.2b0 - Out-of-Sequence Transmit Buffer Descriptor Register */
402         u32     ostbdp;                 /* 0x.2b4 - Out-of-Sequence Transmit Data Buffer Pointer Register */
403         u8      res11[72];
404         u32     rctrl;                  /* 0x.300 - Receive Control Register */
405         u32     rstat;                  /* 0x.304 - Receive Status Register */
406         u8      res12[4];
407         u32     rbdlen;                 /* 0x.30c - RxBD Data Length Register */
408         u32     rxic;                   /* 0x.310 - Receive Interrupt Coalescing Configuration Register */
409         u8      res13[16];
410         u32     crbptr;                 /* 0x.324 - Current Receive Buffer Descriptor Pointer */
411         u8      res14[24];
412         u32     mrblr;                  /* 0x.340 - Maximum Receive Buffer Length Register */
413         u8      res15[64];
414         u32     rbptr;                  /* 0x.384 - Receive Buffer Descriptor Pointer */
415         u8      res16[124];
416         u32     rbase;                  /* 0x.404 - Receive Descriptor Base Address */
417         u8      res17[248];
418         u32     maccfg1;                /* 0x.500 - MAC Configuration 1 Register */
419         u32     maccfg2;                /* 0x.504 - MAC Configuration 2 Register */
420         u32     ipgifg;                 /* 0x.508 - Inter Packet Gap/Inter Frame Gap Register */
421         u32     hafdup;                 /* 0x.50c - Half Duplex Register */
422         u32     maxfrm;                 /* 0x.510 - Maximum Frame Length Register */
423         u8      res18[12];
424         u32     miimcfg;                /* 0x.520 - MII Management Configuration Register */
425         u32     miimcom;                /* 0x.524 - MII Management Command Register */
426         u32     miimadd;                /* 0x.528 - MII Management Address Register */
427         u32     miimcon;                /* 0x.52c - MII Management Control Register */
428         u32     miimstat;               /* 0x.530 - MII Management Status Register */
429         u32     miimind;                /* 0x.534 - MII Management Indicator Register */
430         u8      res19[4];
431         u32     ifstat;                 /* 0x.53c - Interface Status Register */
432         u32     macstnaddr1;            /* 0x.540 - Station Address Part 1 Register */
433         u32     macstnaddr2;            /* 0x.544 - Station Address Part 2 Register */
434         u8      res20[312];
435         struct rmon_mib rmon;
436         u8      res21[192];
437         u32     iaddr0;                 /* 0x.800 - Indivdual address register 0 */
438         u32     iaddr1;                 /* 0x.804 - Indivdual address register 1 */
439         u32     iaddr2;                 /* 0x.808 - Indivdual address register 2 */
440         u32     iaddr3;                 /* 0x.80c - Indivdual address register 3 */
441         u32     iaddr4;                 /* 0x.810 - Indivdual address register 4 */
442         u32     iaddr5;                 /* 0x.814 - Indivdual address register 5 */
443         u32     iaddr6;                 /* 0x.818 - Indivdual address register 6 */
444         u32     iaddr7;                 /* 0x.81c - Indivdual address register 7 */
445         u8      res22[96];
446         u32     gaddr0;                 /* 0x.880 - Global address register 0 */
447         u32     gaddr1;                 /* 0x.884 - Global address register 1 */
448         u32     gaddr2;                 /* 0x.888 - Global address register 2 */
449         u32     gaddr3;                 /* 0x.88c - Global address register 3 */
450         u32     gaddr4;                 /* 0x.890 - Global address register 4 */
451         u32     gaddr5;                 /* 0x.894 - Global address register 5 */
452         u32     gaddr6;                 /* 0x.898 - Global address register 6 */
453         u32     gaddr7;                 /* 0x.89c - Global address register 7 */
454         u8      res23[856];
455         u32     attr;                   /* 0x.bf8 - Attributes Register */
456         u32     attreli;                /* 0x.bfc - Attributes Extract Length and Extract Index Register */
457         u8      res24[1024];
458
459 };
460
461 /* Struct stolen almost completely (and shamelessly) from the FCC enet source
462  * (Ok, that's not so true anymore, but there is a family resemblence)
463  * The GFAR buffer descriptors track the ring buffers.  The rx_bd_base
464  * and tx_bd_base always point to the currently available buffer.
465  * The dirty_tx tracks the current buffer that is being sent by the
466  * controller.  The cur_tx and dirty_tx are equal under both completely
467  * empty and completely full conditions.  The empty/ready indicator in
468  * the buffer descriptor determines the actual condition.
469  */
470 struct gfar_private
471 {
472         /* pointers to arrays of skbuffs for tx and rx */
473         struct sk_buff ** tx_skbuff;
474         struct sk_buff ** rx_skbuff;
475
476         /* indices pointing to the next free sbk in skb arrays */
477         u16 skb_curtx;
478         u16 skb_currx;
479
480         /* index of the first skb which hasn't been transmitted
481          * yet. */
482         u16 skb_dirtytx;
483
484         /* Configuration info for the coalescing features */
485         unsigned char txcoalescing;
486         unsigned short txcount;
487         unsigned short txtime;
488         unsigned char rxcoalescing;
489         unsigned short rxcount;
490         unsigned short rxtime;
491
492         /* GFAR addresses */
493         struct rxbd8 *rx_bd_base;       /* Base addresses of Rx and Tx Buffers */
494         struct txbd8 *tx_bd_base;
495         struct rxbd8 *cur_rx;           /* Next free rx ring entry */
496         struct txbd8 *cur_tx;           /* Next free ring entry */
497         struct txbd8 *dirty_tx;         /* The Ring entry to be freed. */
498         struct gfar *regs;      /* Pointer to the GFAR memory mapped Registers */
499         struct phy_info *phyinfo;
500         struct gfar *phyregs;
501         struct work_struct tq;
502         struct timer_list phy_info_timer;
503         struct net_device_stats stats; /* linux network statistics */
504         struct gfar_extra_stats extra_stats;
505         spinlock_t lock;
506         unsigned int rx_buffer_size;
507         unsigned int rx_stash_size;
508         unsigned int tx_ring_size;
509         unsigned int rx_ring_size;
510         wait_queue_head_t rxcleanupq;
511         unsigned int rxclean;
512         int link;       /* current link state */
513         int oldlink;
514         int duplexity; /* Indicates negotiated duplex state */
515         int olddplx;
516         int speed;      /* Indicates negotiated speed */
517         int oldspeed;
518         
519         /* Info structure initialized by board setup code */
520         struct ocp_gfar_data *einfo;
521 };
522
523 extern inline u32 gfar_read(volatile unsigned *addr)
524 {
525         u32 val;
526         val = in_be32(addr);
527         return val;
528 }
529
530 extern inline void gfar_write(volatile unsigned *addr, u32 val)
531 {
532         out_be32(addr, val);
533 }
534
535
536
537 #endif /* __GIANFAR_H */