Blame view

drivers/net/ucc_geth.h 45.2 KB
ce973b141   Li Yang   [PATCH] Freescale...
1
  /*
047584ce9   Haiying Wang   net/ucc_geth: Add...
2
   * Copyright (C) Freescale Semicondutor, Inc. 2006-2009. All rights reserved.
ce973b141   Li Yang   [PATCH] Freescale...
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
   *
   * Author: Shlomi Gridish <gridish@freescale.com>
   *
   * Description:
   * Internal header file for UCC Gigabit Ethernet unit routines.
   *
   * Changelog:
   * Jun 28, 2006 Li Yang <LeoLi@freescale.com>
   * - Rearrange code and style fixes
   *
   * This program is free software; you can redistribute  it and/or modify it
   * under  the terms of  the GNU General  Public License as published by the
   * Free Software Foundation;  either version 2 of the  License, or (at your
   * option) any later version.
   */
  #ifndef __UCC_GETH_H__
  #define __UCC_GETH_H__
  
  #include <linux/kernel.h>
  #include <linux/list.h>
ce973b141   Li Yang   [PATCH] Freescale...
23
24
25
26
27
28
  
  #include <asm/immap_qe.h>
  #include <asm/qe.h>
  
  #include <asm/ucc.h>
  #include <asm/ucc_fast.h>
ac421852b   Li Yang   ucc_geth: add eth...
29
30
31
  #define DRV_DESC "QE UCC Gigabit Ethernet Controller"
  #define DRV_NAME "ucc_geth"
  #define DRV_VERSION "1.1"
ce973b141   Li Yang   [PATCH] Freescale...
32
33
34
35
36
37
38
  #define NUM_TX_QUEUES                   8
  #define NUM_RX_QUEUES                   8
  #define NUM_BDS_IN_PREFETCHED_BDS       4
  #define TX_IP_OFFSET_ENTRY_MAX          8
  #define NUM_OF_PADDRS                   4
  #define ENET_INIT_PARAM_MAX_ENTRIES_RX  9
  #define ENET_INIT_PARAM_MAX_ENTRIES_TX  8
18a8e8649   Li Yang   [PATCH] ucc_geth:...
39
40
  struct ucc_geth {
  	struct ucc_fast uccf;
6b0b594bb   Timur Tabi   [POWERPC] qe: mis...
41
  	u8 res0[0x100 - sizeof(struct ucc_fast)];
ce973b141   Li Yang   [PATCH] Freescale...
42
43
44
45
46
47
  
  	u32 maccfg1;		/* mac configuration reg. 1 */
  	u32 maccfg2;		/* mac configuration reg. 2 */
  	u32 ipgifg;		/* interframe gap reg.  */
  	u32 hafdup;		/* half-duplex reg.  */
  	u8 res1[0x10];
728de4c92   Kim Phillips   ucc_geth: migrate...
48
  	u8 miimng[0x18];	/* MII management structure moved to _mii.h */
ce973b141   Li Yang   [PATCH] Freescale...
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
  	u32 ifctl;		/* interface control reg */
  	u32 ifstat;		/* interface statux reg */
  	u32 macstnaddr1;	/* mac station address part 1 reg */
  	u32 macstnaddr2;	/* mac station address part 2 reg */
  	u8 res2[0x8];
  	u32 uempr;		/* UCC Ethernet Mac parameter reg */
  	u32 utbipar;		/* UCC tbi address reg */
  	u16 uescr;		/* UCC Ethernet statistics control reg */
  	u8 res3[0x180 - 0x15A];
  	u32 tx64;		/* Total number of frames (including bad
  				   frames) transmitted that were exactly of the
  				   minimal length (64 for un tagged, 68 for
  				   tagged, or with length exactly equal to the
  				   parameter MINLength */
  	u32 tx127;		/* Total number of frames (including bad
  				   frames) transmitted that were between
  				   MINLength (Including FCS length==4) and 127
  				   octets */
  	u32 tx255;		/* Total number of frames (including bad
  				   frames) transmitted that were between 128
  				   (Including FCS length==4) and 255 octets */
  	u32 rx64;		/* Total number of frames received including
  				   bad frames that were exactly of the mninimal
  				   length (64 bytes) */
  	u32 rx127;		/* Total number of frames (including bad
  				   frames) received that were between MINLength
  				   (Including FCS length==4) and 127 octets */
  	u32 rx255;		/* Total number of frames (including bad
  				   frames) received that were between 128
  				   (Including FCS length==4) and 255 octets */
  	u32 txok;		/* Total number of octets residing in frames
af901ca18   André Goddard Rosa   tree-wide: fix as...
80
  				   that where involved in successfull
ce973b141   Li Yang   [PATCH] Freescale...
81
82
83
84
85
  				   transmission */
  	u16 txcf;		/* Total number of PAUSE control frames
  				   transmitted by this MAC */
  	u8 res4[0x2];
  	u32 tmca;		/* Total number of frames that were transmitted
af901ca18   André Goddard Rosa   tree-wide: fix as...
86
  				   successfully with the group address bit set
ce973b141   Li Yang   [PATCH] Freescale...
87
88
  				   that are not broadcast frames */
  	u32 tbca;		/* Total number of frames transmitted
af901ca18   André Goddard Rosa   tree-wide: fix as...
89
  				   successfully that had destination address
ce973b141   Li Yang   [PATCH] Freescale...
90
91
92
93
94
95
96
97
  				   field equal to the broadcast address */
  	u32 rxfok;		/* Total number of frames received OK */
  	u32 rxbok;		/* Total number of octets received OK */
  	u32 rbyt;		/* Total number of octets received including
  				   octets in bad frames. Must be implemented in
  				   HW because it includes octets in frames that
  				   never even reach the UCC */
  	u32 rmca;		/* Total number of frames that were received
af901ca18   André Goddard Rosa   tree-wide: fix as...
98
  				   successfully with the group address bit set
ce973b141   Li Yang   [PATCH] Freescale...
99
  				   that are not broadcast frames */
af901ca18   André Goddard Rosa   tree-wide: fix as...
100
  	u32 rbca;		/* Total number of frames received successfully
ce973b141   Li Yang   [PATCH] Freescale...
101
102
103
104
105
  				   that had destination address equal to the
  				   broadcast address */
  	u32 scar;		/* Statistics carry register */
  	u32 scam;		/* Statistics caryy mask register */
  	u8 res5[0x200 - 0x1c4];
18a8e8649   Li Yang   [PATCH] ucc_geth:...
106
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
  
  /* UCC GETH TEMODR Register */
  #define TEMODER_TX_RMON_STATISTICS_ENABLE       0x0100	/* enable Tx statistics
  							 */
  #define TEMODER_SCHEDULER_ENABLE                0x2000	/* enable scheduler */
  #define TEMODER_IP_CHECKSUM_GENERATE            0x0400	/* generate IPv4
  							   checksums */
  #define TEMODER_PERFORMANCE_OPTIMIZATION_MODE1  0x0200	/* enable performance
  							   optimization
  							   enhancement (mode1) */
  #define TEMODER_RMON_STATISTICS                 0x0100	/* enable tx statistics
  							 */
  #define TEMODER_NUM_OF_QUEUES_SHIFT             (15-15)	/* Number of queues <<
  							   shift */
  
  /* UCC GETH TEMODR Register */
  #define REMODER_RX_RMON_STATISTICS_ENABLE       0x00001000	/* enable Rx
  								   statistics */
  #define REMODER_RX_EXTENDED_FEATURES            0x80000000	/* enable
  								   extended
  								   features */
  #define REMODER_VLAN_OPERATION_TAGGED_SHIFT     (31-9 )	/* vlan operation
  							   tagged << shift */
  #define REMODER_VLAN_OPERATION_NON_TAGGED_SHIFT (31-10)	/* vlan operation non
  							   tagged << shift */
  #define REMODER_RX_QOS_MODE_SHIFT               (31-15)	/* rx QoS mode << shift
  							 */
  #define REMODER_RMON_STATISTICS                 0x00001000	/* enable rx
  								   statistics */
  #define REMODER_RX_EXTENDED_FILTERING           0x00000800	/* extended
  								   filtering
  								   vs.
  								   mpc82xx-like
  								   filtering */
  #define REMODER_NUM_OF_QUEUES_SHIFT             (31-23)	/* Number of queues <<
  							   shift */
  #define REMODER_DYNAMIC_MAX_FRAME_LENGTH        0x00000008	/* enable
  								   dynamic max
  								   frame length
  								 */
  #define REMODER_DYNAMIC_MIN_FRAME_LENGTH        0x00000004	/* enable
  								   dynamic min
  								   frame length
  								 */
  #define REMODER_IP_CHECKSUM_CHECK               0x00000002	/* check IPv4
  								   checksums */
  #define REMODER_IP_ADDRESS_ALIGNMENT            0x00000001	/* align ip
  								   address to
  								   4-byte
  								   boundary */
  
  /* UCC GETH Event Register */
3bc53427e   Timur Tabi   ucc_geth: use cor...
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
  #define UCCE_TXB   (UCC_GETH_UCCE_TXB7 | UCC_GETH_UCCE_TXB6 | \
  		    UCC_GETH_UCCE_TXB5 | UCC_GETH_UCCE_TXB4 | \
  		    UCC_GETH_UCCE_TXB3 | UCC_GETH_UCCE_TXB2 | \
  		    UCC_GETH_UCCE_TXB1 | UCC_GETH_UCCE_TXB0)
  
  #define UCCE_RXB   (UCC_GETH_UCCE_RXB7 | UCC_GETH_UCCE_RXB6 | \
  		    UCC_GETH_UCCE_RXB5 | UCC_GETH_UCCE_RXB4 | \
  		    UCC_GETH_UCCE_RXB3 | UCC_GETH_UCCE_RXB2 | \
  		    UCC_GETH_UCCE_RXB1 | UCC_GETH_UCCE_RXB0)
  
  #define UCCE_RXF   (UCC_GETH_UCCE_RXF7 | UCC_GETH_UCCE_RXF6 | \
  		    UCC_GETH_UCCE_RXF5 | UCC_GETH_UCCE_RXF4 | \
  		    UCC_GETH_UCCE_RXF3 | UCC_GETH_UCCE_RXF2 | \
  		    UCC_GETH_UCCE_RXF1 | UCC_GETH_UCCE_RXF0)
  
  #define UCCE_OTHER (UCC_GETH_UCCE_SCAR | UCC_GETH_UCCE_GRA | \
  		    UCC_GETH_UCCE_CBPR | UCC_GETH_UCCE_BSY | \
  		    UCC_GETH_UCCE_RXC  | UCC_GETH_UCCE_TXC | UCC_GETH_UCCE_TXE)
  
  #define UCCE_RX_EVENTS  (UCCE_RXF | UCC_GETH_UCCE_BSY)
  #define UCCE_TX_EVENTS	(UCCE_TXB | UCC_GETH_UCCE_TXE)
ce973b141   Li Yang   [PATCH] Freescale...
180

1577ecef7   Andy Fleming   netdev: Merge UCC...
181
182
183
184
185
186
187
188
189
190
191
  /* TBI defines */
  #define	ENET_TBI_MII_CR		0x00	/* Control */
  #define	ENET_TBI_MII_SR		0x01	/* Status */
  #define	ENET_TBI_MII_ANA	0x04	/* AN advertisement */
  #define	ENET_TBI_MII_ANLPBPA	0x05	/* AN link partner base page ability */
  #define	ENET_TBI_MII_ANEX	0x06	/* AN expansion */
  #define	ENET_TBI_MII_ANNPT	0x07	/* AN next page transmit */
  #define	ENET_TBI_MII_ANLPANP	0x08	/* AN link partner ability next page */
  #define	ENET_TBI_MII_EXST	0x0F	/* Extended status */
  #define	ENET_TBI_MII_JD		0x10	/* Jitter diagnostics */
  #define	ENET_TBI_MII_TBICON	0x11	/* TBI control */
047584ce9   Haiying Wang   net/ucc_geth: Add...
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
  /* TBI MDIO register bit fields*/
  #define TBISR_LSTATUS          0x0004
  #define TBICON_CLK_SELECT       0x0020
  #define TBIANA_ASYMMETRIC_PAUSE 0x0100
  #define TBIANA_SYMMETRIC_PAUSE  0x0080
  #define TBIANA_HALF_DUPLEX      0x0040
  #define TBIANA_FULL_DUPLEX      0x0020
  #define TBICR_PHY_RESET         0x8000
  #define TBICR_ANEG_ENABLE       0x1000
  #define TBICR_RESTART_ANEG      0x0200
  #define TBICR_FULL_DUPLEX       0x0100
  #define TBICR_SPEED1_SET        0x0040
  
  #define TBIANA_SETTINGS ( \
  		TBIANA_ASYMMETRIC_PAUSE \
  		| TBIANA_SYMMETRIC_PAUSE \
  		| TBIANA_FULL_DUPLEX \
  		)
  #define TBICR_SETTINGS ( \
  		TBICR_PHY_RESET \
  		| TBICR_ANEG_ENABLE \
  		| TBICR_FULL_DUPLEX \
  		| TBICR_SPEED1_SET \
  		)
ce973b141   Li Yang   [PATCH] Freescale...
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
  /* UCC GETH MACCFG1 (MAC Configuration 1 Register) */
  #define MACCFG1_FLOW_RX                         0x00000020	/* Flow Control
  								   Rx */
  #define MACCFG1_FLOW_TX                         0x00000010	/* Flow Control
  								   Tx */
  #define MACCFG1_ENABLE_SYNCHED_RX               0x00000008	/* Rx Enable
  								   synchronized
  								   to Rx stream
  								 */
  #define MACCFG1_ENABLE_RX                       0x00000004	/* Enable Rx */
  #define MACCFG1_ENABLE_SYNCHED_TX               0x00000002	/* Tx Enable
  								   synchronized
  								   to Tx stream
  								 */
  #define MACCFG1_ENABLE_TX                       0x00000001	/* Enable Tx */
  
  /* UCC GETH MACCFG2 (MAC Configuration 2 Register) */
  #define MACCFG2_PREL_SHIFT                      (31 - 19)	/* Preamble
  								   Length <<
  								   shift */
  #define MACCFG2_PREL_MASK                       0x0000f000	/* Preamble
  								   Length mask */
  #define MACCFG2_SRP                             0x00000080	/* Soft Receive
  								   Preamble */
  #define MACCFG2_STP                             0x00000040	/* Soft
  								   Transmit
  								   Preamble */
  #define MACCFG2_RESERVED_1                      0x00000020	/* Reserved -
  								   must be set
  								   to 1 */
  #define MACCFG2_LC                              0x00000010	/* Length Check
  								 */
  #define MACCFG2_MPE                             0x00000008	/* Magic packet
  								   detect */
  #define MACCFG2_FDX                             0x00000001	/* Full Duplex */
  #define MACCFG2_FDX_MASK                        0x00000001	/* Full Duplex
  								   mask */
  #define MACCFG2_PAD_CRC                         0x00000004
  #define MACCFG2_CRC_EN                          0x00000002
  #define MACCFG2_PAD_AND_CRC_MODE_NONE           0x00000000	/* Neither
  								   Padding
  								   short frames
  								   nor CRC */
  #define MACCFG2_PAD_AND_CRC_MODE_CRC_ONLY       0x00000002	/* Append CRC
  								   only */
  #define MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC    0x00000004
  #define MACCFG2_INTERFACE_MODE_NIBBLE           0x00000100	/* nibble mode
  								   (MII/RMII/RGMII
  								   10/100bps) */
  #define MACCFG2_INTERFACE_MODE_BYTE             0x00000200	/* byte mode
  								   (GMII/TBI/RTB/RGMII
  								   1000bps ) */
  #define MACCFG2_INTERFACE_MODE_MASK             0x00000300	/* mask
  								   covering all
  								   relevant
  								   bits */
  
  /* UCC GETH IPGIFG (Inter-frame Gap / Inter-Frame Gap Register) */
  #define IPGIFG_NON_BACK_TO_BACK_IFG_PART1_SHIFT (31 -  7)	/* Non
  								   back-to-back
  								   inter frame
  								   gap part 1.
  								   << shift */
  #define IPGIFG_NON_BACK_TO_BACK_IFG_PART2_SHIFT (31 - 15)	/* Non
  								   back-to-back
  								   inter frame
  								   gap part 2.
  								   << shift */
  #define IPGIFG_MINIMUM_IFG_ENFORCEMENT_SHIFT    (31 - 23)	/* Mimimum IFG
  								   Enforcement
  								   << shift */
  #define IPGIFG_BACK_TO_BACK_IFG_SHIFT           (31 - 31)	/* back-to-back
  								   inter frame
  								   gap << shift
  								 */
  #define IPGIFG_NON_BACK_TO_BACK_IFG_PART1_MAX   127	/* Non back-to-back
  							   inter frame gap part
  							   1. max val */
  #define IPGIFG_NON_BACK_TO_BACK_IFG_PART2_MAX   127	/* Non back-to-back
  							   inter frame gap part
  							   2. max val */
  #define IPGIFG_MINIMUM_IFG_ENFORCEMENT_MAX      255	/* Mimimum IFG
  							   Enforcement max val */
  #define IPGIFG_BACK_TO_BACK_IFG_MAX             127	/* back-to-back inter
  							   frame gap max val */
  #define IPGIFG_NBTB_CS_IPG_MASK                 0x7F000000
  #define IPGIFG_NBTB_IPG_MASK                    0x007F0000
  #define IPGIFG_MIN_IFG_MASK                     0x0000FF00
  #define IPGIFG_BTB_IPG_MASK                     0x0000007F
  
  /* UCC GETH HAFDUP (Half Duplex Register) */
  #define HALFDUP_ALT_BEB_TRUNCATION_SHIFT        (31 - 11)	/* Alternate
  								   Binary
  								   Exponential
  								   Backoff
  								   Truncation
  								   << shift */
  #define HALFDUP_ALT_BEB_TRUNCATION_MAX          0xf	/* Alternate Binary
  							   Exponential Backoff
  							   Truncation max val */
  #define HALFDUP_ALT_BEB                         0x00080000	/* Alternate
  								   Binary
  								   Exponential
  								   Backoff */
  #define HALFDUP_BACK_PRESSURE_NO_BACKOFF        0x00040000	/* Back
  								   pressure no
  								   backoff */
  #define HALFDUP_NO_BACKOFF                      0x00020000	/* No Backoff */
  #define HALFDUP_EXCESSIVE_DEFER                 0x00010000	/* Excessive
  								   Defer */
  #define HALFDUP_MAX_RETRANSMISSION_SHIFT        (31 - 19)	/* Maximum
  								   Retransmission
  								   << shift */
  #define HALFDUP_MAX_RETRANSMISSION_MAX          0xf	/* Maximum
  							   Retransmission max
  							   val */
  #define HALFDUP_COLLISION_WINDOW_SHIFT          (31 - 31)	/* Collision
  								   Window <<
  								   shift */
  #define HALFDUP_COLLISION_WINDOW_MAX            0x3f	/* Collision Window max
  							   val */
  #define HALFDUP_ALT_BEB_TR_MASK                 0x00F00000
  #define HALFDUP_RETRANS_MASK                    0x0000F000
  #define HALFDUP_COL_WINDOW_MASK                 0x0000003F
  
  /* UCC GETH UCCS (Ethernet Status Register) */
  #define UCCS_BPR                                0x02	/* Back pressure (in
  							   half duplex mode) */
  #define UCCS_PAU                                0x02	/* Pause state (in full
  							   duplex mode) */
  #define UCCS_MPD                                0x01	/* Magic Packet
  							   Detected */
ce973b141   Li Yang   [PATCH] Freescale...
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
  /* UCC GETH IFSTAT (Interface Status Register) */
  #define IFSTAT_EXCESS_DEFER                     0x00000200	/* Excessive
  								   transmission
  								   defer */
  
  /* UCC GETH MACSTNADDR1 (Station Address Part 1 Register) */
  #define MACSTNADDR1_OCTET_6_SHIFT               (31 -  7)	/* Station
  								   address 6th
  								   octet <<
  								   shift */
  #define MACSTNADDR1_OCTET_5_SHIFT               (31 - 15)	/* Station
  								   address 5th
  								   octet <<
  								   shift */
  #define MACSTNADDR1_OCTET_4_SHIFT               (31 - 23)	/* Station
  								   address 4th
  								   octet <<
  								   shift */
  #define MACSTNADDR1_OCTET_3_SHIFT               (31 - 31)	/* Station
  								   address 3rd
  								   octet <<
  								   shift */
  
  /* UCC GETH MACSTNADDR2 (Station Address Part 2 Register) */
  #define MACSTNADDR2_OCTET_2_SHIFT               (31 -  7)	/* Station
  								   address 2nd
  								   octet <<
  								   shift */
  #define MACSTNADDR2_OCTET_1_SHIFT               (31 - 15)	/* Station
  								   address 1st
  								   octet <<
  								   shift */
  
  /* UCC GETH UEMPR (Ethernet Mac Parameter Register) */
  #define UEMPR_PAUSE_TIME_VALUE_SHIFT            (31 - 15)	/* Pause time
  								   value <<
  								   shift */
  #define UEMPR_EXTENDED_PAUSE_TIME_VALUE_SHIFT   (31 - 31)	/* Extended
  								   pause time
  								   value <<
  								   shift */
  
  /* UCC GETH UTBIPAR (Ten Bit Interface Physical Address Register) */
  #define UTBIPAR_PHY_ADDRESS_SHIFT               (31 - 31)	/* Phy address
  								   << shift */
  #define UTBIPAR_PHY_ADDRESS_MASK                0x0000001f	/* Phy address
  								   mask */
  
  /* UCC GETH UESCR (Ethernet Statistics Control Register) */
  #define UESCR_AUTOZ                             0x8000	/* Automatically zero
  							   addressed
  							   statistical counter
  							   values */
  #define UESCR_CLRCNT                            0x4000	/* Clear all statistics
  							   counters */
  #define UESCR_MAXCOV_SHIFT                      (15 -  7)	/* Max
  								   Coalescing
  								   Value <<
  								   shift */
  #define UESCR_SCOV_SHIFT                        (15 - 15)	/* Status
  								   Coalescing
  								   Value <<
  								   shift */
  
  /* UCC GETH UDSR (Data Synchronization Register) */
  #define UDSR_MAGIC                              0x067E
18a8e8649   Li Yang   [PATCH] ucc_geth:...
414
  struct ucc_geth_thread_data_tx {
ce973b141   Li Yang   [PATCH] Freescale...
415
  	u8 res0[104];
18a8e8649   Li Yang   [PATCH] ucc_geth:...
416
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
417

18a8e8649   Li Yang   [PATCH] ucc_geth:...
418
  struct ucc_geth_thread_data_rx {
ce973b141   Li Yang   [PATCH] Freescale...
419
  	u8 res0[40];
18a8e8649   Li Yang   [PATCH] ucc_geth:...
420
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
421
422
  
  /* Send Queue Queue-Descriptor */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
423
  struct ucc_geth_send_queue_qd {
ce973b141   Li Yang   [PATCH] Freescale...
424
425
426
427
  	u32 bd_ring_base;	/* pointer to BD ring base address */
  	u8 res0[0x8];
  	u32 last_bd_completed_address;/* initialize to last entry in BD ring */
  	u8 res1[0x30];
18a8e8649   Li Yang   [PATCH] ucc_geth:...
428
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
429

18a8e8649   Li Yang   [PATCH] ucc_geth:...
430
431
432
  struct ucc_geth_send_queue_mem_region {
  	struct ucc_geth_send_queue_qd sqqd[NUM_TX_QUEUES];
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
433

18a8e8649   Li Yang   [PATCH] ucc_geth:...
434
  struct ucc_geth_thread_tx_pram {
ce973b141   Li Yang   [PATCH] Freescale...
435
  	u8 res0[64];
18a8e8649   Li Yang   [PATCH] ucc_geth:...
436
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
437

18a8e8649   Li Yang   [PATCH] ucc_geth:...
438
  struct ucc_geth_thread_rx_pram {
ce973b141   Li Yang   [PATCH] Freescale...
439
  	u8 res0[128];
18a8e8649   Li Yang   [PATCH] ucc_geth:...
440
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
441
442
443
444
  
  #define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING        64
  #define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_8      64
  #define THREAD_RX_PRAM_ADDITIONAL_FOR_EXTENDED_FILTERING_16     96
18a8e8649   Li Yang   [PATCH] ucc_geth:...
445
  struct ucc_geth_scheduler {
ce973b141   Li Yang   [PATCH] Freescale...
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
  	u16 cpucount0;		/* CPU packet counter */
  	u16 cpucount1;		/* CPU packet counter */
  	u16 cecount0;		/* QE packet counter */
  	u16 cecount1;		/* QE packet counter */
  	u16 cpucount2;		/* CPU packet counter */
  	u16 cpucount3;		/* CPU packet counter */
  	u16 cecount2;		/* QE packet counter */
  	u16 cecount3;		/* QE packet counter */
  	u16 cpucount4;		/* CPU packet counter */
  	u16 cpucount5;		/* CPU packet counter */
  	u16 cecount4;		/* QE packet counter */
  	u16 cecount5;		/* QE packet counter */
  	u16 cpucount6;		/* CPU packet counter */
  	u16 cpucount7;		/* CPU packet counter */
  	u16 cecount6;		/* QE packet counter */
  	u16 cecount7;		/* QE packet counter */
  	u32 weightstatus[NUM_TX_QUEUES];	/* accumulated weight factor */
  	u32 rtsrshadow;		/* temporary variable handled by QE */
  	u32 time;		/* temporary variable handled by QE */
  	u32 ttl;		/* temporary variable handled by QE */
  	u32 mblinterval;	/* max burst length interval */
  	u16 nortsrbytetime;	/* normalized value of byte time in tsr units */
  	u8 fracsiz;		/* radix 2 log value of denom. of
  				   NorTSRByteTime */
  	u8 res0[1];
  	u8 strictpriorityq;	/* Strict Priority Mask register */
  	u8 txasap;		/* Transmit ASAP register */
  	u8 extrabw;		/* Extra BandWidth register */
  	u8 oldwfqmask;		/* temporary variable handled by QE */
  	u8 weightfactor[NUM_TX_QUEUES];
  				      /**< weight factor for queues   */
  	u32 minw;		/* temporary variable handled by QE */
  	u8 res1[0x70 - 0x64];
18a8e8649   Li Yang   [PATCH] ucc_geth:...
479
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
480

18a8e8649   Li Yang   [PATCH] ucc_geth:...
481
  struct ucc_geth_tx_firmware_statistics_pram {
ce973b141   Li Yang   [PATCH] Freescale...
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
  	u32 sicoltx;		/* single collision */
  	u32 mulcoltx;		/* multiple collision */
  	u32 latecoltxfr;	/* late collision */
  	u32 frabortduecol;	/* frames aborted due to transmit collision */
  	u32 frlostinmactxer;	/* frames lost due to internal MAC error
  				   transmission that are not counted on any
  				   other counter */
  	u32 carriersenseertx;	/* carrier sense error */
  	u32 frtxok;		/* frames transmitted OK */
  	u32 txfrexcessivedefer;	/* frames with defferal time greater than
  				   specified threshold */
  	u32 txpkts256;		/* total packets (including bad) between 256
  				   and 511 octets */
  	u32 txpkts512;		/* total packets (including bad) between 512
  				   and 1023 octets */
  	u32 txpkts1024;		/* total packets (including bad) between 1024
  				   and 1518 octets */
  	u32 txpktsjumbo;	/* total packets (including bad) between 1024
  				   and MAXLength octets */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
501
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
502

18a8e8649   Li Yang   [PATCH] ucc_geth:...
503
  struct ucc_geth_rx_firmware_statistics_pram {
ce973b141   Li Yang   [PATCH] Freescale...
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
  	u32 frrxfcser;		/* frames with crc error */
  	u32 fraligner;		/* frames with alignment error */
  	u32 inrangelenrxer;	/* in range length error */
  	u32 outrangelenrxer;	/* out of range length error */
  	u32 frtoolong;		/* frame too long */
  	u32 runt;		/* runt */
  	u32 verylongevent;	/* very long event */
  	u32 symbolerror;	/* symbol error */
  	u32 dropbsy;		/* drop because of BD not ready */
  	u8 res0[0x8];
  	u32 mismatchdrop;	/* drop because of MAC filtering (e.g. address
  				   or type mismatch) */
  	u32 underpkts;		/* total frames less than 64 octets */
  	u32 pkts256;		/* total frames (including bad) between 256 and
  				   511 octets */
  	u32 pkts512;		/* total frames (including bad) between 512 and
  				   1023 octets */
  	u32 pkts1024;		/* total frames (including bad) between 1024
  				   and 1518 octets */
  	u32 pktsjumbo;		/* total frames (including bad) between 1024
  				   and MAXLength octets */
  	u32 frlossinmacer;	/* frames lost because of internal MAC error
  				   that is not counted in any other counter */
  	u32 pausefr;		/* pause frames */
  	u8 res1[0x4];
  	u32 removevlan;		/* total frames that had their VLAN tag removed
  				 */
  	u32 replacevlan;	/* total frames that had their VLAN tag
  				   replaced */
  	u32 insertvlan;		/* total frames that had their VLAN tag
  				   inserted */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
535
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
536

18a8e8649   Li Yang   [PATCH] ucc_geth:...
537
  struct ucc_geth_rx_interrupt_coalescing_entry {
ce973b141   Li Yang   [PATCH] Freescale...
538
539
540
541
542
  	u32 interruptcoalescingmaxvalue;	/* interrupt coalescing max
  						   value */
  	u32 interruptcoalescingcounter;	/* interrupt coalescing counter,
  					   initialize to
  					   interruptcoalescingmaxvalue */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
543
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
544

18a8e8649   Li Yang   [PATCH] ucc_geth:...
545
546
  struct ucc_geth_rx_interrupt_coalescing_table {
  	struct ucc_geth_rx_interrupt_coalescing_entry coalescingentry[NUM_RX_QUEUES];
ce973b141   Li Yang   [PATCH] Freescale...
547
  				       /**< interrupt coalescing entry */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
548
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
549

18a8e8649   Li Yang   [PATCH] ucc_geth:...
550
551
552
  struct ucc_geth_rx_prefetched_bds {
  	struct qe_bd bd[NUM_BDS_IN_PREFETCHED_BDS];	/* prefetched bd */
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
553

18a8e8649   Li Yang   [PATCH] ucc_geth:...
554
  struct ucc_geth_rx_bd_queues_entry {
ce973b141   Li Yang   [PATCH] Freescale...
555
556
557
558
  	u32 bdbaseptr;		/* BD base pointer */
  	u32 bdptr;		/* BD pointer */
  	u32 externalbdbaseptr;	/* external BD base pointer */
  	u32 externalbdptr;	/* external BD pointer */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
559
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
560

18a8e8649   Li Yang   [PATCH] ucc_geth:...
561
  struct ucc_geth_tx_global_pram {
ce973b141   Li Yang   [PATCH] Freescale...
562
563
564
565
566
567
568
569
570
571
572
573
574
  	u16 temoder;
  	u8 res0[0x38 - 0x02];
  	u32 sqptr;		/* a base pointer to send queue memory region */
  	u32 schedulerbasepointer;	/* a base pointer to scheduler memory
  					   region */
  	u32 txrmonbaseptr;	/* base pointer to Tx RMON statistics counter */
  	u32 tstate;		/* tx internal state. High byte contains
  				   function code */
  	u8 iphoffset[TX_IP_OFFSET_ENTRY_MAX];
  	u32 vtagtable[0x8];	/* 8 4-byte VLAN tags */
  	u32 tqptr;		/* a base pointer to the Tx Queues Memory
  				   Region */
  	u8 res2[0x80 - 0x74];
18a8e8649   Li Yang   [PATCH] ucc_geth:...
575
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
576
577
  
  /* structure representing Extended Filtering Global Parameters in PRAM */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
578
  struct ucc_geth_exf_global_pram {
ce973b141   Li Yang   [PATCH] Freescale...
579
580
  	u32 l2pcdptr;		/* individual address filter, high */
  	u8 res0[0x10 - 0x04];
18a8e8649   Li Yang   [PATCH] ucc_geth:...
581
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
582

18a8e8649   Li Yang   [PATCH] ucc_geth:...
583
  struct ucc_geth_rx_global_pram {
ce973b141   Li Yang   [PATCH] Freescale...
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
  	u32 remoder;		/* ethernet mode reg. */
  	u32 rqptr;		/* base pointer to the Rx Queues Memory Region*/
  	u32 res0[0x1];
  	u8 res1[0x20 - 0xC];
  	u16 typeorlen;		/* cutoff point less than which, type/len field
  				   is considered length */
  	u8 res2[0x1];
  	u8 rxgstpack;		/* acknowledgement on GRACEFUL STOP RX command*/
  	u32 rxrmonbaseptr;	/* base pointer to Rx RMON statistics counter */
  	u8 res3[0x30 - 0x28];
  	u32 intcoalescingptr;	/* Interrupt coalescing table pointer */
  	u8 res4[0x36 - 0x34];
  	u8 rstate;		/* rx internal state. High byte contains
  				   function code */
  	u8 res5[0x46 - 0x37];
  	u16 mrblr;		/* max receive buffer length reg. */
  	u32 rbdqptr;		/* base pointer to RxBD parameter table
  				   description */
  	u16 mflr;		/* max frame length reg. */
  	u16 minflr;		/* min frame length reg. */
  	u16 maxd1;		/* max dma1 length reg. */
  	u16 maxd2;		/* max dma2 length reg. */
  	u32 ecamptr;		/* external CAM address */
  	u32 l2qt;		/* VLAN priority mapping table. */
  	u32 l3qt[0x8];		/* IP priority mapping table. */
  	u16 vlantype;		/* vlan type */
  	u16 vlantci;		/* default vlan tci */
  	u8 addressfiltering[64];	/* address filtering data structure */
  	u32 exfGlobalParam;	/* base address for extended filtering global
  				   parameters */
  	u8 res6[0x100 - 0xC4];	/* Initialize to zero */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
615
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
616
617
618
619
  
  #define GRACEFUL_STOP_ACKNOWLEDGE_RX            0x01
  
  /* structure representing InitEnet command */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
620
  struct ucc_geth_init_pram {
ce973b141   Li Yang   [PATCH] Freescale...
621
622
623
624
625
626
627
628
629
630
631
632
633
  	u8 resinit1;
  	u8 resinit2;
  	u8 resinit3;
  	u8 resinit4;
  	u16 resinit5;
  	u8 res1[0x1];
  	u8 largestexternallookupkeysize;
  	u32 rgftgfrxglobal;
  	u32 rxthread[ENET_INIT_PARAM_MAX_ENTRIES_RX];	/* rx threads */
  	u8 res2[0x38 - 0x30];
  	u32 txglobal;		/* tx global */
  	u32 txthread[ENET_INIT_PARAM_MAX_ENTRIES_TX];	/* tx threads */
  	u8 res3[0x1];
18a8e8649   Li Yang   [PATCH] ucc_geth:...
634
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
  
  #define ENET_INIT_PARAM_RGF_SHIFT               (32 - 4)
  #define ENET_INIT_PARAM_TGF_SHIFT               (32 - 8)
  
  #define ENET_INIT_PARAM_RISC_MASK               0x0000003f
  #define ENET_INIT_PARAM_PTR_MASK                0x00ffffc0
  #define ENET_INIT_PARAM_SNUM_MASK               0xff000000
  #define ENET_INIT_PARAM_SNUM_SHIFT              24
  
  #define ENET_INIT_PARAM_MAGIC_RES_INIT1         0x06
  #define ENET_INIT_PARAM_MAGIC_RES_INIT2         0x30
  #define ENET_INIT_PARAM_MAGIC_RES_INIT3         0xff
  #define ENET_INIT_PARAM_MAGIC_RES_INIT4         0x00
  #define ENET_INIT_PARAM_MAGIC_RES_INIT5         0x0400
  
  /* structure representing 82xx Address Filtering Enet Address in PRAM */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
651
  struct ucc_geth_82xx_enet_address {
ce973b141   Li Yang   [PATCH] Freescale...
652
653
654
655
  	u8 res1[0x2];
  	u16 h;			/* address (MSB) */
  	u16 m;			/* address */
  	u16 l;			/* address (LSB) */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
656
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
657
658
  
  /* structure representing 82xx Address Filtering PRAM */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
659
  struct ucc_geth_82xx_address_filtering_pram {
ce973b141   Li Yang   [PATCH] Freescale...
660
661
662
663
  	u32 iaddr_h;		/* individual address filter, high */
  	u32 iaddr_l;		/* individual address filter, low */
  	u32 gaddr_h;		/* group address filter, high */
  	u32 gaddr_l;		/* group address filter, low */
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
664
665
  	struct ucc_geth_82xx_enet_address __iomem taddr;
  	struct ucc_geth_82xx_enet_address __iomem paddr[NUM_OF_PADDRS];
ce973b141   Li Yang   [PATCH] Freescale...
666
  	u8 res0[0x40 - 0x38];
18a8e8649   Li Yang   [PATCH] ucc_geth:...
667
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
668
669
670
  
  /* GETH Tx firmware statistics structure, used when calling
     UCC_GETH_GetStatistics. */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
671
  struct ucc_geth_tx_firmware_statistics {
ce973b141   Li Yang   [PATCH] Freescale...
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
  	u32 sicoltx;		/* single collision */
  	u32 mulcoltx;		/* multiple collision */
  	u32 latecoltxfr;	/* late collision */
  	u32 frabortduecol;	/* frames aborted due to transmit collision */
  	u32 frlostinmactxer;	/* frames lost due to internal MAC error
  				   transmission that are not counted on any
  				   other counter */
  	u32 carriersenseertx;	/* carrier sense error */
  	u32 frtxok;		/* frames transmitted OK */
  	u32 txfrexcessivedefer;	/* frames with defferal time greater than
  				   specified threshold */
  	u32 txpkts256;		/* total packets (including bad) between 256
  				   and 511 octets */
  	u32 txpkts512;		/* total packets (including bad) between 512
  				   and 1023 octets */
  	u32 txpkts1024;		/* total packets (including bad) between 1024
  				   and 1518 octets */
  	u32 txpktsjumbo;	/* total packets (including bad) between 1024
  				   and MAXLength octets */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
691
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
692
693
694
  
  /* GETH Rx firmware statistics structure, used when calling
     UCC_GETH_GetStatistics. */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
695
  struct ucc_geth_rx_firmware_statistics {
ce973b141   Li Yang   [PATCH] Freescale...
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
  	u32 frrxfcser;		/* frames with crc error */
  	u32 fraligner;		/* frames with alignment error */
  	u32 inrangelenrxer;	/* in range length error */
  	u32 outrangelenrxer;	/* out of range length error */
  	u32 frtoolong;		/* frame too long */
  	u32 runt;		/* runt */
  	u32 verylongevent;	/* very long event */
  	u32 symbolerror;	/* symbol error */
  	u32 dropbsy;		/* drop because of BD not ready */
  	u8 res0[0x8];
  	u32 mismatchdrop;	/* drop because of MAC filtering (e.g. address
  				   or type mismatch) */
  	u32 underpkts;		/* total frames less than 64 octets */
  	u32 pkts256;		/* total frames (including bad) between 256 and
  				   511 octets */
  	u32 pkts512;		/* total frames (including bad) between 512 and
  				   1023 octets */
  	u32 pkts1024;		/* total frames (including bad) between 1024
  				   and 1518 octets */
  	u32 pktsjumbo;		/* total frames (including bad) between 1024
  				   and MAXLength octets */
  	u32 frlossinmacer;	/* frames lost because of internal MAC error
  				   that is not counted in any other counter */
  	u32 pausefr;		/* pause frames */
  	u8 res1[0x4];
  	u32 removevlan;		/* total frames that had their VLAN tag removed
  				 */
  	u32 replacevlan;	/* total frames that had their VLAN tag
  				   replaced */
  	u32 insertvlan;		/* total frames that had their VLAN tag
  				   inserted */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
727
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
728
729
730
  
  /* GETH hardware statistics structure, used when calling
     UCC_GETH_GetStatistics. */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
731
  struct ucc_geth_hardware_statistics {
ce973b141   Li Yang   [PATCH] Freescale...
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
  	u32 tx64;		/* Total number of frames (including bad
  				   frames) transmitted that were exactly of the
  				   minimal length (64 for un tagged, 68 for
  				   tagged, or with length exactly equal to the
  				   parameter MINLength */
  	u32 tx127;		/* Total number of frames (including bad
  				   frames) transmitted that were between
  				   MINLength (Including FCS length==4) and 127
  				   octets */
  	u32 tx255;		/* Total number of frames (including bad
  				   frames) transmitted that were between 128
  				   (Including FCS length==4) and 255 octets */
  	u32 rx64;		/* Total number of frames received including
  				   bad frames that were exactly of the mninimal
  				   length (64 bytes) */
  	u32 rx127;		/* Total number of frames (including bad
  				   frames) received that were between MINLength
  				   (Including FCS length==4) and 127 octets */
  	u32 rx255;		/* Total number of frames (including bad
  				   frames) received that were between 128
  				   (Including FCS length==4) and 255 octets */
  	u32 txok;		/* Total number of octets residing in frames
af901ca18   André Goddard Rosa   tree-wide: fix as...
754
  				   that where involved in successfull
ce973b141   Li Yang   [PATCH] Freescale...
755
756
757
758
  				   transmission */
  	u16 txcf;		/* Total number of PAUSE control frames
  				   transmitted by this MAC */
  	u32 tmca;		/* Total number of frames that were transmitted
af901ca18   André Goddard Rosa   tree-wide: fix as...
759
  				   successfully with the group address bit set
ce973b141   Li Yang   [PATCH] Freescale...
760
761
  				   that are not broadcast frames */
  	u32 tbca;		/* Total number of frames transmitted
af901ca18   André Goddard Rosa   tree-wide: fix as...
762
  				   successfully that had destination address
ce973b141   Li Yang   [PATCH] Freescale...
763
764
765
766
767
768
769
770
  				   field equal to the broadcast address */
  	u32 rxfok;		/* Total number of frames received OK */
  	u32 rxbok;		/* Total number of octets received OK */
  	u32 rbyt;		/* Total number of octets received including
  				   octets in bad frames. Must be implemented in
  				   HW because it includes octets in frames that
  				   never even reach the UCC */
  	u32 rmca;		/* Total number of frames that were received
af901ca18   André Goddard Rosa   tree-wide: fix as...
771
  				   successfully with the group address bit set
ce973b141   Li Yang   [PATCH] Freescale...
772
  				   that are not broadcast frames */
af901ca18   André Goddard Rosa   tree-wide: fix as...
773
  	u32 rbca;		/* Total number of frames received successfully
ce973b141   Li Yang   [PATCH] Freescale...
774
775
  				   that had destination address equal to the
  				   broadcast address */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
776
  } __attribute__ ((packed));
ce973b141   Li Yang   [PATCH] Freescale...
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
  
  /* UCC GETH Tx errors returned via TxConf callback */
  #define TX_ERRORS_DEF      0x0200
  #define TX_ERRORS_EXDEF    0x0100
  #define TX_ERRORS_LC       0x0080
  #define TX_ERRORS_RL       0x0040
  #define TX_ERRORS_RC_MASK  0x003C
  #define TX_ERRORS_RC_SHIFT 2
  #define TX_ERRORS_UN       0x0002
  #define TX_ERRORS_CSL      0x0001
  
  /* UCC GETH Rx errors returned via RxStore callback */
  #define RX_ERRORS_CMR      0x0200
  #define RX_ERRORS_M        0x0100
  #define RX_ERRORS_BC       0x0080
  #define RX_ERRORS_MC       0x0040
  
  /* Transmit BD. These are in addition to values defined in uccf. */
  #define T_VID      0x003c0000	/* insert VLAN id index mask. */
  #define T_DEF      (((u32) TX_ERRORS_DEF     ) << 16)
  #define T_EXDEF    (((u32) TX_ERRORS_EXDEF   ) << 16)
  #define T_LC       (((u32) TX_ERRORS_LC      ) << 16)
  #define T_RL       (((u32) TX_ERRORS_RL      ) << 16)
  #define T_RC_MASK  (((u32) TX_ERRORS_RC_MASK ) << 16)
  #define T_UN       (((u32) TX_ERRORS_UN      ) << 16)
  #define T_CSL      (((u32) TX_ERRORS_CSL     ) << 16)
  #define T_ERRORS_REPORT  (T_DEF | T_EXDEF | T_LC | T_RL | T_RC_MASK \
  		| T_UN | T_CSL)	/* transmit errors to report */
  
  /* Receive BD. These are in addition to values defined in uccf. */
  #define R_LG    0x00200000	/* Frame length violation.  */
  #define R_NO    0x00100000	/* Non-octet aligned frame.  */
  #define R_SH    0x00080000	/* Short frame.  */
  #define R_CR    0x00040000	/* CRC error.  */
  #define R_OV    0x00020000	/* Overrun.  */
  #define R_IPCH  0x00010000	/* IP checksum check failed. */
  #define R_CMR   (((u32) RX_ERRORS_CMR  ) << 16)
  #define R_M     (((u32) RX_ERRORS_M    ) << 16)
  #define R_BC    (((u32) RX_ERRORS_BC   ) << 16)
  #define R_MC    (((u32) RX_ERRORS_MC   ) << 16)
  #define R_ERRORS_REPORT (R_CMR | R_M | R_BC | R_MC)	/* receive errors to
  							   report */
  #define R_ERRORS_FATAL  (R_LG  | R_NO | R_SH | R_CR | \
  		R_OV | R_IPCH)	/* receive errors to discard */
  
  /* Alignments */
  #define UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT	256
  #define UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT       128
  #define UCC_GETH_THREAD_RX_PRAM_ALIGNMENT       128
  #define UCC_GETH_THREAD_TX_PRAM_ALIGNMENT       64
  #define UCC_GETH_THREAD_DATA_ALIGNMENT          256	/* spec gives values
  							   based on num of
  							   threads, but always
  							   using the maximum is
  							   easier */
  #define UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT	32
58933c643   Dave Liu   ucc_geth: Fix the...
833
  #define UCC_GETH_SCHEDULER_ALIGNMENT		8	/* This is a guess */
ce973b141   Li Yang   [PATCH] Freescale...
834
835
  #define UCC_GETH_TX_STATISTICS_ALIGNMENT	4	/* This is a guess */
  #define UCC_GETH_RX_STATISTICS_ALIGNMENT	4	/* This is a guess */
7563907eb   Michael Barkowski   ucc_geth: Fix int...
836
  #define UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT	64
ce973b141   Li Yang   [PATCH] Freescale...
837
838
  #define UCC_GETH_RX_BD_QUEUES_ALIGNMENT		8	/* This is a guess */
  #define UCC_GETH_RX_PREFETCHED_BDS_ALIGNMENT	128	/* This is a guess */
58933c643   Dave Liu   ucc_geth: Fix the...
839
  #define UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT 8	/* This
ce973b141   Li Yang   [PATCH] Freescale...
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
  									   is a
  									   guess
  									 */
  #define UCC_GETH_RX_BD_RING_ALIGNMENT		32
  #define UCC_GETH_TX_BD_RING_ALIGNMENT		32
  #define UCC_GETH_MRBLR_ALIGNMENT		128
  #define UCC_GETH_RX_BD_RING_SIZE_ALIGNMENT	4
  #define UCC_GETH_TX_BD_RING_SIZE_MEMORY_ALIGNMENT	32
  #define UCC_GETH_RX_DATA_BUF_ALIGNMENT		64
  
  #define UCC_GETH_TAD_EF                         0x80
  #define UCC_GETH_TAD_V                          0x40
  #define UCC_GETH_TAD_REJ                        0x20
  #define UCC_GETH_TAD_VTAG_OP_RIGHT_SHIFT        2
  #define UCC_GETH_TAD_VTAG_OP_SHIFT              6
  #define UCC_GETH_TAD_V_NON_VTAG_OP              0x20
  #define UCC_GETH_TAD_RQOS_SHIFT                 0
  #define UCC_GETH_TAD_V_PRIORITY_SHIFT           5
  #define UCC_GETH_TAD_CFI                        0x10
  
  #define UCC_GETH_VLAN_PRIORITY_MAX              8
  #define UCC_GETH_IP_PRIORITY_MAX                64
  #define UCC_GETH_TX_VTAG_TABLE_ENTRY_MAX        8
  #define UCC_GETH_RX_BD_RING_SIZE_MIN            8
  #define UCC_GETH_TX_BD_RING_SIZE_MIN            2
ac421852b   Li Yang   ucc_geth: add eth...
865
  #define UCC_GETH_BD_RING_SIZE_MAX		0xffff
ce973b141   Li Yang   [PATCH] Freescale...
866
867
868
869
870
871
  
  #define UCC_GETH_SIZE_OF_BD                     QE_SIZEOF_BD
  
  /* Driver definitions */
  #define TX_BD_RING_LEN                          0x10
  #define RX_BD_RING_LEN                          0x10
ce973b141   Li Yang   [PATCH] Freescale...
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
  
  #define TX_RING_MOD_MASK(size)                  (size-1)
  #define RX_RING_MOD_MASK(size)                  (size-1)
  
  #define ENET_NUM_OCTETS_PER_ADDRESS             6
  #define ENET_GROUP_ADDR                         0x01	/* Group address mask
  							   for ethernet
  							   addresses */
  
  #define TX_TIMEOUT                              (1*HZ)
  #define SKB_ALLOC_TIMEOUT                       100000
  #define PHY_INIT_TIMEOUT                        100000
  #define PHY_CHANGE_TIME                         2
  
  /* Fast Ethernet (10/100 Mbps) */
  #define UCC_GETH_URFS_INIT                      512	/* Rx virtual FIFO size
  							 */
  #define UCC_GETH_URFET_INIT                     256	/* 1/2 urfs */
  #define UCC_GETH_URFSET_INIT                    384	/* 3/4 urfs */
  #define UCC_GETH_UTFS_INIT                      512	/* Tx virtual FIFO size
  							 */
  #define UCC_GETH_UTFET_INIT                     256	/* 1/2 utfs */
58933c643   Dave Liu   ucc_geth: Fix the...
894
  #define UCC_GETH_UTFTT_INIT                     512
ce973b141   Li Yang   [PATCH] Freescale...
895
896
897
898
899
  /* Gigabit Ethernet (1000 Mbps) */
  #define UCC_GETH_URFS_GIGA_INIT                 4096/*2048*/	/* Rx virtual
  								   FIFO size */
  #define UCC_GETH_URFET_GIGA_INIT                2048/*1024*/	/* 1/2 urfs */
  #define UCC_GETH_URFSET_GIGA_INIT               3072/*1536*/	/* 3/4 urfs */
58933c643   Dave Liu   ucc_geth: Fix the...
900
901
902
903
  #define UCC_GETH_UTFS_GIGA_INIT                 4096/*2048*/	/* Tx virtual
  								   FIFO size */
  #define UCC_GETH_UTFET_GIGA_INIT                2048/*1024*/	/* 1/2 utfs */
  #define UCC_GETH_UTFTT_GIGA_INIT                4096/*0x40*/	/* Tx virtual
ce973b141   Li Yang   [PATCH] Freescale...
904
  								   FIFO size */
ce973b141   Li Yang   [PATCH] Freescale...
905
906
907
908
  
  #define UCC_GETH_REMODER_INIT                   0	/* bits that must be
  							   set */
  #define UCC_GETH_TEMODER_INIT                   0xC000	/* bits that must */
3bc53427e   Timur Tabi   ucc_geth: use cor...
909
910
911
  
  /* Initial value for UPSMR */
  #define UCC_GETH_UPSMR_INIT                     UCC_GETH_UPSMR_RES1
ce973b141   Li Yang   [PATCH] Freescale...
912
913
  #define UCC_GETH_MACCFG1_INIT                   0
  #define UCC_GETH_MACCFG2_INIT                   (MACCFG2_RESERVED_1)
ce973b141   Li Yang   [PATCH] Freescale...
914
915
  
  /* Ethernet Address Type. */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
916
  enum enet_addr_type {
ce973b141   Li Yang   [PATCH] Freescale...
917
918
919
  	ENET_ADDR_TYPE_INDIVIDUAL,
  	ENET_ADDR_TYPE_GROUP,
  	ENET_ADDR_TYPE_BROADCAST
18a8e8649   Li Yang   [PATCH] ucc_geth:...
920
  };
ce973b141   Li Yang   [PATCH] Freescale...
921

ce973b141   Li Yang   [PATCH] Freescale...
922
  /* UCC GETH 82xx Ethernet Address Recognition Location */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
923
  enum ucc_geth_enet_address_recognition_location {
ce973b141   Li Yang   [PATCH] Freescale...
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
  	UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_STATION_ADDRESS,/* station
  								      address */
  	UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR_FIRST,	/* additional
  								   station
  								   address
  								   paddr1 */
  	UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR2,	/* additional
  								   station
  								   address
  								   paddr2 */
  	UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR3,	/* additional
  								   station
  								   address
  								   paddr3 */
  	UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_PADDR_LAST,	/* additional
  								   station
  								   address
  								   paddr4 */
  	UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_GROUP_HASH,	/* group hash */
  	UCC_GETH_ENET_ADDRESS_RECOGNITION_LOCATION_INDIVIDUAL_HASH /* individual
  								      hash */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
945
  };
ce973b141   Li Yang   [PATCH] Freescale...
946
947
  
  /* UCC GETH vlan operation tagged */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
948
  enum ucc_geth_vlan_operation_tagged {
ce973b141   Li Yang   [PATCH] Freescale...
949
950
951
952
953
954
955
  	UCC_GETH_VLAN_OPERATION_TAGGED_NOP = 0x0,	/* Tagged - nop */
  	UCC_GETH_VLAN_OPERATION_TAGGED_REPLACE_VID_PORTION_OF_Q_TAG
  		= 0x1,	/* Tagged - replace vid portion of q tag */
  	UCC_GETH_VLAN_OPERATION_TAGGED_IF_VID0_REPLACE_VID_WITH_DEFAULT_VALUE
  		= 0x2,	/* Tagged - if vid0 replace vid with default value  */
  	UCC_GETH_VLAN_OPERATION_TAGGED_EXTRACT_Q_TAG_FROM_FRAME
  		= 0x3	/* Tagged - extract q tag from frame */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
956
  };
ce973b141   Li Yang   [PATCH] Freescale...
957
958
  
  /* UCC GETH vlan operation non-tagged */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
959
  enum ucc_geth_vlan_operation_non_tagged {
ce973b141   Li Yang   [PATCH] Freescale...
960
961
962
963
  	UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP = 0x0,	/* Non tagged - nop */
  	UCC_GETH_VLAN_OPERATION_NON_TAGGED_Q_TAG_INSERT = 0x1	/* Non tagged -
  								   q tag insert
  								 */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
964
  };
ce973b141   Li Yang   [PATCH] Freescale...
965
966
  
  /* UCC GETH Rx Quality of Service Mode */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
967
  enum ucc_geth_qos_mode {
ce973b141   Li Yang   [PATCH] Freescale...
968
969
970
971
972
973
974
975
976
  	UCC_GETH_QOS_MODE_DEFAULT = 0x0,	/* default queue */
  	UCC_GETH_QOS_MODE_QUEUE_NUM_FROM_L2_CRITERIA = 0x1,	/* queue
  								   determined
  								   by L2
  								   criteria */
  	UCC_GETH_QOS_MODE_QUEUE_NUM_FROM_L3_CRITERIA = 0x2	/* queue
  								   determined
  								   by L3
  								   criteria */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
977
  };
ce973b141   Li Yang   [PATCH] Freescale...
978
979
980
  
  /* UCC GETH Statistics Gathering Mode - These are bit flags, 'or' them together
     for combined functionality */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
981
  enum ucc_geth_statistics_gathering_mode {
ce973b141   Li Yang   [PATCH] Freescale...
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
  	UCC_GETH_STATISTICS_GATHERING_MODE_NONE = 0x00000000,	/* No
  								   statistics
  								   gathering */
  	UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE = 0x00000001,/* Enable
  								    hardware
  								    statistics
  								    gathering
  								  */
  	UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX = 0x00000004,/*Enable
  								      firmware
  								      tx
  								      statistics
  								      gathering
  								     */
  	UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX = 0x00000008/* Enable
  								      firmware
  								      rx
  								      statistics
  								      gathering
  								    */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1002
  };
ce973b141   Li Yang   [PATCH] Freescale...
1003
1004
  
  /* UCC GETH Pad and CRC Mode - Note, Padding without CRC is not possible */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1005
  enum ucc_geth_maccfg2_pad_and_crc_mode {
ce973b141   Li Yang   [PATCH] Freescale...
1006
1007
1008
1009
1010
1011
1012
1013
1014
  	UCC_GETH_PAD_AND_CRC_MODE_NONE
  		= MACCFG2_PAD_AND_CRC_MODE_NONE,	/* Neither Padding
  							   short frames
  							   nor CRC */
  	UCC_GETH_PAD_AND_CRC_MODE_CRC_ONLY
  		= MACCFG2_PAD_AND_CRC_MODE_CRC_ONLY,	/* Append
  							   CRC only */
  	UCC_GETH_PAD_AND_CRC_MODE_PAD_AND_CRC =
  	    MACCFG2_PAD_AND_CRC_MODE_PAD_AND_CRC
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1015
  };
ce973b141   Li Yang   [PATCH] Freescale...
1016
1017
  
  /* UCC GETH upsmr Flow Control Mode */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1018
  enum ucc_geth_flow_control_mode {
ce973b141   Li Yang   [PATCH] Freescale...
1019
1020
1021
1022
1023
1024
  	UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_NONE = 0x00000000,	/* No automatic
  								   flow control
  								 */
  	UPSMR_AUTOMATIC_FLOW_CONTROL_MODE_PAUSE_WHEN_EMERGENCY
  		= 0x00004000	/* Send pause frame when RxFIFO reaches its
  				   emergency threshold */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1025
  };
ce973b141   Li Yang   [PATCH] Freescale...
1026
1027
  
  /* UCC GETH number of threads */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1028
  enum ucc_geth_num_of_threads {
ce973b141   Li Yang   [PATCH] Freescale...
1029
1030
1031
1032
1033
  	UCC_GETH_NUM_OF_THREADS_1 = 0x1,	/* 1 */
  	UCC_GETH_NUM_OF_THREADS_2 = 0x2,	/* 2 */
  	UCC_GETH_NUM_OF_THREADS_4 = 0x0,	/* 4 */
  	UCC_GETH_NUM_OF_THREADS_6 = 0x3,	/* 6 */
  	UCC_GETH_NUM_OF_THREADS_8 = 0x4	/* 8 */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1034
  };
ce973b141   Li Yang   [PATCH] Freescale...
1035
1036
  
  /* UCC GETH number of station addresses */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1037
  enum ucc_geth_num_of_station_addresses {
ce973b141   Li Yang   [PATCH] Freescale...
1038
1039
  	UCC_GETH_NUM_OF_STATION_ADDRESSES_1,	/* 1 */
  	UCC_GETH_NUM_OF_STATION_ADDRESSES_5	/* 5 */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1040
  };
ce973b141   Li Yang   [PATCH] Freescale...
1041
1042
  
  /* UCC GETH 82xx Ethernet Address Container */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1043
1044
1045
  struct enet_addr_container {
  	u8 address[ENET_NUM_OCTETS_PER_ADDRESS];	/* ethernet address */
  	enum ucc_geth_enet_address_recognition_location location;	/* location in
ce973b141   Li Yang   [PATCH] Freescale...
1046
1047
1048
1049
  								   82xx address
  								   recognition
  								   hardware */
  	struct list_head node;
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1050
  };
ce973b141   Li Yang   [PATCH] Freescale...
1051

18a8e8649   Li Yang   [PATCH] ucc_geth:...
1052
  #define ENET_ADDR_CONT_ENTRY(ptr) list_entry(ptr, struct enet_addr_container, node)
ce973b141   Li Yang   [PATCH] Freescale...
1053
1054
  
  /* UCC GETH Termination Action Descriptor (TAD) structure. */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1055
  struct ucc_geth_tad_params {
ce973b141   Li Yang   [PATCH] Freescale...
1056
1057
  	int rx_non_dynamic_extended_features_mode;
  	int reject_frame;
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1058
1059
1060
  	enum ucc_geth_vlan_operation_tagged vtag_op;
  	enum ucc_geth_vlan_operation_non_tagged vnontag_op;
  	enum ucc_geth_qos_mode rqos;
ce973b141   Li Yang   [PATCH] Freescale...
1061
1062
  	u8 vpri;
  	u16 vid;
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1063
  };
ce973b141   Li Yang   [PATCH] Freescale...
1064
1065
  
  /* GETH protocol initialization structure */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1066
1067
  struct ucc_geth_info {
  	struct ucc_fast_info uf_info;
ce973b141   Li Yang   [PATCH] Freescale...
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
  	u8 numQueuesTx;
  	u8 numQueuesRx;
  	int ipCheckSumCheck;
  	int ipCheckSumGenerate;
  	int rxExtendedFiltering;
  	u32 extendedFilteringChainPointer;
  	u16 typeorlen;
  	int dynamicMaxFrameLength;
  	int dynamicMinFrameLength;
  	u8 nonBackToBackIfgPart1;
  	u8 nonBackToBackIfgPart2;
  	u8 miminumInterFrameGapEnforcement;
  	u8 backToBackInterFrameGap;
  	int ipAddressAlignment;
  	int lengthCheckRx;
  	u32 mblinterval;
  	u16 nortsrbytetime;
  	u8 fracsiz;
  	u8 strictpriorityq;
  	u8 txasap;
  	u8 extrabw;
  	int miiPreambleSupress;
  	u8 altBebTruncation;
  	int altBeb;
  	int backPressureNoBackoff;
  	int noBackoff;
  	int excessDefer;
  	u8 maxRetransmission;
  	u8 collisionWindow;
  	int pro;
  	int cap;
  	int rsh;
  	int rlpb;
  	int cam;
  	int bro;
  	int ecm;
  	int receiveFlowControl;
ac421852b   Li Yang   ucc_geth: add eth...
1105
  	int transmitFlowControl;
ce973b141   Li Yang   [PATCH] Freescale...
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
  	u8 maxGroupAddrInHash;
  	u8 maxIndAddrInHash;
  	u8 prel;
  	u16 maxFrameLength;
  	u16 minFrameLength;
  	u16 maxD1Length;
  	u16 maxD2Length;
  	u16 vlantype;
  	u16 vlantci;
  	u32 ecamptr;
  	u32 eventRegMask;
  	u16 pausePeriod;
  	u16 extensionField;
0b9da337d   Grant Likely   net: Rework ucc_g...
1119
  	struct device_node *phy_node;
fb1001f3d   Haiying Wang   net/ucc_geth: Add...
1120
  	struct device_node *tbi_node;
ce973b141   Li Yang   [PATCH] Freescale...
1121
1122
1123
1124
1125
1126
1127
1128
  	u8 weightfactor[NUM_TX_QUEUES];
  	u8 interruptcoalescingmaxvalue[NUM_RX_QUEUES];
  	u8 l2qt[UCC_GETH_VLAN_PRIORITY_MAX];
  	u8 l3qt[UCC_GETH_IP_PRIORITY_MAX];
  	u32 vtagtable[UCC_GETH_TX_VTAG_TABLE_ENTRY_MAX];
  	u8 iphoffset[TX_IP_OFFSET_ENTRY_MAX];
  	u16 bdRingLenTx[NUM_TX_QUEUES];
  	u16 bdRingLenRx[NUM_RX_QUEUES];
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1129
1130
  	enum ucc_geth_num_of_station_addresses numStationAddresses;
  	enum qe_fltr_largest_external_tbl_lookup_key_size
ce973b141   Li Yang   [PATCH] Freescale...
1131
  	    largestexternallookupkeysize;
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1132
1133
1134
1135
1136
1137
1138
1139
  	enum ucc_geth_statistics_gathering_mode statisticsMode;
  	enum ucc_geth_vlan_operation_tagged vlanOperationTagged;
  	enum ucc_geth_vlan_operation_non_tagged vlanOperationNonTagged;
  	enum ucc_geth_qos_mode rxQoSMode;
  	enum ucc_geth_flow_control_mode aufc;
  	enum ucc_geth_maccfg2_pad_and_crc_mode padAndCrc;
  	enum ucc_geth_num_of_threads numThreadsTx;
  	enum ucc_geth_num_of_threads numThreadsRx;
345f84227   Haiying Wang   net/ucc_geth: upd...
1140
1141
  	unsigned int riscTx;
  	unsigned int riscRx;
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1142
  };
ce973b141   Li Yang   [PATCH] Freescale...
1143
1144
  
  /* structure representing UCC GETH */
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1145
1146
1147
  struct ucc_geth_private {
  	struct ucc_geth_info *ug_info;
  	struct ucc_fast_private *uccf;
da1aa63ec   Anton Vorontsov   ucc_geth: Pass pr...
1148
1149
  	struct device *dev;
  	struct net_device *ndev;
bea3348ee   Stephen Hemminger   [NET]: Make NAPI ...
1150
  	struct napi_struct napi;
1762a29ae   Anton Vorontsov   ucc_geth: Fix TX ...
1151
  	struct work_struct timeout_work;
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1152
  	struct ucc_geth __iomem *ug_regs;
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1153
  	struct ucc_geth_init_pram *p_init_enet_param_shadow;
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1154
  	struct ucc_geth_exf_global_pram __iomem *p_exf_glbl_param;
ce973b141   Li Yang   [PATCH] Freescale...
1155
  	u32 exf_glbl_param_offset;
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1156
  	struct ucc_geth_rx_global_pram __iomem *p_rx_glbl_pram;
ce973b141   Li Yang   [PATCH] Freescale...
1157
  	u32 rx_glbl_pram_offset;
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1158
  	struct ucc_geth_tx_global_pram __iomem *p_tx_glbl_pram;
ce973b141   Li Yang   [PATCH] Freescale...
1159
  	u32 tx_glbl_pram_offset;
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1160
  	struct ucc_geth_send_queue_mem_region __iomem *p_send_q_mem_reg;
ce973b141   Li Yang   [PATCH] Freescale...
1161
  	u32 send_q_mem_reg_offset;
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1162
  	struct ucc_geth_thread_data_tx __iomem *p_thread_data_tx;
ce973b141   Li Yang   [PATCH] Freescale...
1163
  	u32 thread_dat_tx_offset;
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1164
  	struct ucc_geth_thread_data_rx __iomem *p_thread_data_rx;
ce973b141   Li Yang   [PATCH] Freescale...
1165
  	u32 thread_dat_rx_offset;
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1166
  	struct ucc_geth_scheduler __iomem *p_scheduler;
ce973b141   Li Yang   [PATCH] Freescale...
1167
  	u32 scheduler_offset;
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1168
  	struct ucc_geth_tx_firmware_statistics_pram __iomem *p_tx_fw_statistics_pram;
ce973b141   Li Yang   [PATCH] Freescale...
1169
  	u32 tx_fw_statistics_pram_offset;
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1170
  	struct ucc_geth_rx_firmware_statistics_pram __iomem *p_rx_fw_statistics_pram;
ce973b141   Li Yang   [PATCH] Freescale...
1171
  	u32 rx_fw_statistics_pram_offset;
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1172
  	struct ucc_geth_rx_interrupt_coalescing_table __iomem *p_rx_irq_coalescing_tbl;
ce973b141   Li Yang   [PATCH] Freescale...
1173
  	u32 rx_irq_coalescing_tbl_offset;
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1174
  	struct ucc_geth_rx_bd_queues_entry __iomem *p_rx_bd_qs_tbl;
ce973b141   Li Yang   [PATCH] Freescale...
1175
  	u32 rx_bd_qs_tbl_offset;
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1176
  	u8 __iomem *p_tx_bd_ring[NUM_TX_QUEUES];
ce973b141   Li Yang   [PATCH] Freescale...
1177
  	u32 tx_bd_ring_offset[NUM_TX_QUEUES];
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1178
  	u8 __iomem *p_rx_bd_ring[NUM_RX_QUEUES];
ce973b141   Li Yang   [PATCH] Freescale...
1179
  	u32 rx_bd_ring_offset[NUM_RX_QUEUES];
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1180
1181
1182
  	u8 __iomem *confBd[NUM_TX_QUEUES];
  	u8 __iomem *txBd[NUM_TX_QUEUES];
  	u8 __iomem *rxBd[NUM_RX_QUEUES];
ce973b141   Li Yang   [PATCH] Freescale...
1183
1184
  	int badFrame[NUM_RX_QUEUES];
  	u16 cpucount[NUM_TX_QUEUES];
6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1185
  	u16 __iomem *p_cpucount[NUM_TX_QUEUES];
ce973b141   Li Yang   [PATCH] Freescale...
1186
  	int indAddrRegUsed[NUM_OF_PADDRS];
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1187
  	u8 paddr[NUM_OF_PADDRS][ENET_NUM_OCTETS_PER_ADDRESS];	/* ethernet address */
ce973b141   Li Yang   [PATCH] Freescale...
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
  	u8 numGroupAddrInHash;
  	u8 numIndAddrInHash;
  	u8 numIndAddrInReg;
  	int rx_extended_features;
  	int rx_non_dynamic_extended_features;
  	struct list_head conf_skbs;
  	struct list_head group_hash_q;
  	struct list_head ind_hash_q;
  	u32 saved_uccm;
  	spinlock_t lock;
  	/* pointers to arrays of skbuffs for tx and rx */
  	struct sk_buff **tx_skbuff[NUM_TX_QUEUES];
  	struct sk_buff **rx_skbuff[NUM_RX_QUEUES];
  	/* indices pointing to the next free sbk in skb arrays */
  	u16 skb_curtx[NUM_TX_QUEUES];
  	u16 skb_currx[NUM_RX_QUEUES];
  	/* index of the first skb which hasn't been transmitted yet. */
  	u16 skb_dirtytx[NUM_TX_QUEUES];
50f238fdf   Anton Vorontsov   ucc_geth: Add sup...
1206
  	struct sk_buff_head rx_recycle;
ce973b141   Li Yang   [PATCH] Freescale...
1207
  	struct ugeth_mii_info *mii_info;
728de4c92   Kim Phillips   ucc_geth: migrate...
1208
1209
1210
1211
  	struct phy_device *phydev;
  	phy_interface_t phy_interface;
  	int max_speed;
  	uint32_t msg_enable;
ce973b141   Li Yang   [PATCH] Freescale...
1212
1213
1214
  	int oldspeed;
  	int oldduplex;
  	int oldlink;
2394905f6   Anton Vorontsov   ucc_geth: Impleme...
1215
  	int wol_en;
b1c4a9ddd   Haiying Wang   ucc_geth: Change ...
1216
1217
  
  	struct device_node *node;
18a8e8649   Li Yang   [PATCH] ucc_geth:...
1218
  };
ce973b141   Li Yang   [PATCH] Freescale...
1219

6fee40e9b   Andy Fleming   ucc_geth: Fix a b...
1220
1221
1222
1223
1224
1225
  void uec_set_ethtool_ops(struct net_device *netdev);
  int init_flow_control_params(u32 automatic_flow_control_mode,
  		int rx_flow_control_enable, int tx_flow_control_enable,
  		u16 pause_period, u16 extension_field,
  		u32 __iomem *upsmr_register, u32 __iomem *uempr_register,
  		u32 __iomem *maccfg1_register);
ce973b141   Li Yang   [PATCH] Freescale...
1226
  #endif				/* __UCC_GETH_H__ */