This source file includes following definitions.
- skge_read32
- skge_read16
- skge_read8
- skge_write32
- skge_write16
- skge_write8
- xm_read32
- xm_read16
- xm_write32
- xm_write16
- xm_outhash
- xm_outaddr
- gma_read16
- gma_read32
- gma_write16
- gma_set_addr
1
2
3
4
5 #ifndef _SKGE_H
6 #define _SKGE_H
7 #include <linux/interrupt.h>
8
9
10 #define PCI_DEV_REG1 0x40
11 #define PCI_PHY_COMA 0x8000000
12 #define PCI_VIO 0x2000000
13
14 #define PCI_DEV_REG2 0x44
15 #define PCI_VPD_ROM_SZ 7L<<14
16 #define PCI_REV_DESC 1<<2
17
18 #define PCI_STATUS_ERROR_BITS (PCI_STATUS_DETECTED_PARITY | \
19 PCI_STATUS_SIG_SYSTEM_ERROR | \
20 PCI_STATUS_REC_MASTER_ABORT | \
21 PCI_STATUS_REC_TARGET_ABORT | \
22 PCI_STATUS_PARITY)
23
24 enum csr_regs {
25 B0_RAP = 0x0000,
26 B0_CTST = 0x0004,
27 B0_LED = 0x0006,
28 B0_POWER_CTRL = 0x0007,
29 B0_ISRC = 0x0008,
30 B0_IMSK = 0x000c,
31 B0_HWE_ISRC = 0x0010,
32 B0_HWE_IMSK = 0x0014,
33 B0_SP_ISRC = 0x0018,
34 B0_XM1_IMSK = 0x0020,
35 B0_XM1_ISRC = 0x0028,
36 B0_XM1_PHY_ADDR = 0x0030,
37 B0_XM1_PHY_DATA = 0x0034,
38 B0_XM2_IMSK = 0x0040,
39 B0_XM2_ISRC = 0x0048,
40 B0_XM2_PHY_ADDR = 0x0050,
41 B0_XM2_PHY_DATA = 0x0054,
42 B0_R1_CSR = 0x0060,
43 B0_R2_CSR = 0x0064,
44 B0_XS1_CSR = 0x0068,
45 B0_XA1_CSR = 0x006c,
46 B0_XS2_CSR = 0x0070,
47 B0_XA2_CSR = 0x0074,
48
49 B2_MAC_1 = 0x0100,
50 B2_MAC_2 = 0x0108,
51 B2_MAC_3 = 0x0110,
52 B2_CONN_TYP = 0x0118,
53 B2_PMD_TYP = 0x0119,
54 B2_MAC_CFG = 0x011a,
55 B2_CHIP_ID = 0x011b,
56 B2_E_0 = 0x011c,
57 B2_E_1 = 0x011d,
58 B2_E_2 = 0x011e,
59 B2_E_3 = 0x011f,
60 B2_FAR = 0x0120,
61 B2_FDP = 0x0124,
62 B2_LD_CTRL = 0x0128,
63 B2_LD_TEST = 0x0129,
64 B2_TI_INI = 0x0130,
65 B2_TI_VAL = 0x0134,
66 B2_TI_CTRL = 0x0138,
67 B2_TI_TEST = 0x0139,
68 B2_IRQM_INI = 0x0140,
69 B2_IRQM_VAL = 0x0144,
70 B2_IRQM_CTRL = 0x0148,
71 B2_IRQM_TEST = 0x0149,
72 B2_IRQM_MSK = 0x014c,
73 B2_IRQM_HWE_MSK = 0x0150,
74 B2_TST_CTRL1 = 0x0158,
75 B2_TST_CTRL2 = 0x0159,
76 B2_GP_IO = 0x015c,
77 B2_I2C_CTRL = 0x0160,
78 B2_I2C_DATA = 0x0164,
79 B2_I2C_IRQ = 0x0168,
80 B2_I2C_SW = 0x016c,
81 B2_BSC_INI = 0x0170,
82 B2_BSC_VAL = 0x0174,
83 B2_BSC_CTRL = 0x0178,
84 B2_BSC_STAT = 0x0179,
85 B2_BSC_TST = 0x017a,
86
87 B3_RAM_ADDR = 0x0180,
88 B3_RAM_DATA_LO = 0x0184,
89 B3_RAM_DATA_HI = 0x0188,
90 B3_RI_WTO_R1 = 0x0190,
91 B3_RI_WTO_XA1 = 0x0191,
92 B3_RI_WTO_XS1 = 0x0192,
93 B3_RI_RTO_R1 = 0x0193,
94 B3_RI_RTO_XA1 = 0x0194,
95 B3_RI_RTO_XS1 = 0x0195,
96 B3_RI_WTO_R2 = 0x0196,
97 B3_RI_WTO_XA2 = 0x0197,
98 B3_RI_WTO_XS2 = 0x0198,
99 B3_RI_RTO_R2 = 0x0199,
100 B3_RI_RTO_XA2 = 0x019a,
101 B3_RI_RTO_XS2 = 0x019b,
102 B3_RI_TO_VAL = 0x019c,
103 B3_RI_CTRL = 0x01a0,
104 B3_RI_TEST = 0x01a2,
105 B3_MA_TOINI_RX1 = 0x01b0,
106 B3_MA_TOINI_RX2 = 0x01b1,
107 B3_MA_TOINI_TX1 = 0x01b2,
108 B3_MA_TOINI_TX2 = 0x01b3,
109 B3_MA_TOVAL_RX1 = 0x01b4,
110 B3_MA_TOVAL_RX2 = 0x01b5,
111 B3_MA_TOVAL_TX1 = 0x01b6,
112 B3_MA_TOVAL_TX2 = 0x01b7,
113 B3_MA_TO_CTRL = 0x01b8,
114 B3_MA_TO_TEST = 0x01ba,
115 B3_MA_RCINI_RX1 = 0x01c0,
116 B3_MA_RCINI_RX2 = 0x01c1,
117 B3_MA_RCINI_TX1 = 0x01c2,
118 B3_MA_RCINI_TX2 = 0x01c3,
119 B3_MA_RCVAL_RX1 = 0x01c4,
120 B3_MA_RCVAL_RX2 = 0x01c5,
121 B3_MA_RCVAL_TX1 = 0x01c6,
122 B3_MA_RCVAL_TX2 = 0x01c7,
123 B3_MA_RC_CTRL = 0x01c8,
124 B3_MA_RC_TEST = 0x01ca,
125 B3_PA_TOINI_RX1 = 0x01d0,
126 B3_PA_TOINI_RX2 = 0x01d4,
127 B3_PA_TOINI_TX1 = 0x01d8,
128 B3_PA_TOINI_TX2 = 0x01dc,
129 B3_PA_TOVAL_RX1 = 0x01e0,
130 B3_PA_TOVAL_RX2 = 0x01e4,
131 B3_PA_TOVAL_TX1 = 0x01e8,
132 B3_PA_TOVAL_TX2 = 0x01ec,
133 B3_PA_CTRL = 0x01f0,
134 B3_PA_TEST = 0x01f2,
135 };
136
137
138 enum {
139 CS_CLK_RUN_HOT = 1<<13,
140 CS_CLK_RUN_RST = 1<<12,
141 CS_CLK_RUN_ENA = 1<<11,
142 CS_VAUX_AVAIL = 1<<10,
143 CS_BUS_CLOCK = 1<<9,
144 CS_BUS_SLOT_SZ = 1<<8,
145 CS_ST_SW_IRQ = 1<<7,
146 CS_CL_SW_IRQ = 1<<6,
147 CS_STOP_DONE = 1<<5,
148 CS_STOP_MAST = 1<<4,
149 CS_MRST_CLR = 1<<3,
150 CS_MRST_SET = 1<<2,
151 CS_RST_CLR = 1<<1,
152 CS_RST_SET = 1,
153
154
155
156 LED_STAT_ON = 1<<1,
157 LED_STAT_OFF = 1,
158
159
160 PC_VAUX_ENA = 1<<7,
161 PC_VAUX_DIS = 1<<6,
162 PC_VCC_ENA = 1<<5,
163 PC_VCC_DIS = 1<<4,
164 PC_VAUX_ON = 1<<3,
165 PC_VAUX_OFF = 1<<2,
166 PC_VCC_ON = 1<<1,
167 PC_VCC_OFF = 1<<0,
168 };
169
170
171 enum {
172 IS_ALL_MSK = 0xbffffffful,
173 IS_HW_ERR = 1<<31,
174
175 IS_PA_TO_RX1 = 1<<29,
176 IS_PA_TO_RX2 = 1<<28,
177 IS_PA_TO_TX1 = 1<<27,
178 IS_PA_TO_TX2 = 1<<26,
179 IS_I2C_READY = 1<<25,
180 IS_IRQ_SW = 1<<24,
181 IS_EXT_REG = 1<<23,
182
183 IS_TIMINT = 1<<22,
184 IS_MAC1 = 1<<21,
185 IS_LNK_SYNC_M1 = 1<<20,
186 IS_MAC2 = 1<<19,
187 IS_LNK_SYNC_M2 = 1<<18,
188
189 IS_R1_B = 1<<17,
190 IS_R1_F = 1<<16,
191 IS_R1_C = 1<<15,
192
193 IS_R2_B = 1<<14,
194 IS_R2_F = 1<<13,
195 IS_R2_C = 1<<12,
196
197 IS_XS1_B = 1<<11,
198 IS_XS1_F = 1<<10,
199 IS_XS1_C = 1<<9,
200
201 IS_XA1_B = 1<<8,
202 IS_XA1_F = 1<<7,
203 IS_XA1_C = 1<<6,
204
205 IS_XS2_B = 1<<5,
206 IS_XS2_F = 1<<4,
207 IS_XS2_C = 1<<3,
208
209 IS_XA2_B = 1<<2,
210 IS_XA2_F = 1<<1,
211 IS_XA2_C = 1<<0,
212
213 IS_TO_PORT1 = IS_PA_TO_RX1 | IS_PA_TO_TX1,
214 IS_TO_PORT2 = IS_PA_TO_RX2 | IS_PA_TO_TX2,
215
216 IS_PORT_1 = IS_XA1_F| IS_R1_F | IS_TO_PORT1 | IS_MAC1,
217 IS_PORT_2 = IS_XA2_F| IS_R2_F | IS_TO_PORT2 | IS_MAC2,
218 };
219
220
221
222 enum {
223 IS_IRQ_TIST_OV = 1<<13,
224 IS_IRQ_SENSOR = 1<<12,
225 IS_IRQ_MST_ERR = 1<<11,
226 IS_IRQ_STAT = 1<<10,
227 IS_NO_STAT_M1 = 1<<9,
228 IS_NO_STAT_M2 = 1<<8,
229 IS_NO_TIST_M1 = 1<<7,
230 IS_NO_TIST_M2 = 1<<6,
231 IS_RAM_RD_PAR = 1<<5,
232 IS_RAM_WR_PAR = 1<<4,
233 IS_M1_PAR_ERR = 1<<3,
234 IS_M2_PAR_ERR = 1<<2,
235 IS_R1_PAR_ERR = 1<<1,
236 IS_R2_PAR_ERR = 1<<0,
237
238 IS_ERR_MSK = IS_IRQ_MST_ERR | IS_IRQ_STAT
239 | IS_RAM_RD_PAR | IS_RAM_WR_PAR
240 | IS_M1_PAR_ERR | IS_M2_PAR_ERR
241 | IS_R1_PAR_ERR | IS_R2_PAR_ERR,
242 };
243
244
245 enum {
246 TST_FRC_DPERR_MR = 1<<7,
247 TST_FRC_DPERR_MW = 1<<6,
248 TST_FRC_DPERR_TR = 1<<5,
249 TST_FRC_DPERR_TW = 1<<4,
250 TST_FRC_APERR_M = 1<<3,
251 TST_FRC_APERR_T = 1<<2,
252 TST_CFG_WRITE_ON = 1<<1,
253 TST_CFG_WRITE_OFF= 1<<0,
254 };
255
256
257 enum {
258 CFG_CHIP_R_MSK = 0xf<<4,
259
260 CFG_DIS_M2_CLK = 1<<1,
261 CFG_SNG_MAC = 1<<0,
262 };
263
264
265 enum {
266 CHIP_ID_GENESIS = 0x0a,
267 CHIP_ID_YUKON = 0xb0,
268 CHIP_ID_YUKON_LITE = 0xb1,
269 CHIP_ID_YUKON_LP = 0xb2,
270 CHIP_ID_YUKON_XL = 0xb3,
271 CHIP_ID_YUKON_EC = 0xb6,
272 CHIP_ID_YUKON_FE = 0xb7,
273
274 CHIP_REV_YU_LITE_A1 = 3,
275 CHIP_REV_YU_LITE_A3 = 7,
276 };
277
278
279
280 enum {
281 TIM_START = 1<<2,
282 TIM_STOP = 1<<1,
283 TIM_CLR_IRQ = 1<<0,
284 };
285
286
287
288
289 enum {
290 TIM_T_ON = 1<<2,
291 TIM_T_OFF = 1<<1,
292 TIM_T_STEP = 1<<0,
293 };
294
295
296 enum {
297 GP_DIR_9 = 1<<25,
298 GP_DIR_8 = 1<<24,
299 GP_DIR_7 = 1<<23,
300 GP_DIR_6 = 1<<22,
301 GP_DIR_5 = 1<<21,
302 GP_DIR_4 = 1<<20,
303 GP_DIR_3 = 1<<19,
304 GP_DIR_2 = 1<<18,
305 GP_DIR_1 = 1<<17,
306 GP_DIR_0 = 1<<16,
307
308 GP_IO_9 = 1<<9,
309 GP_IO_8 = 1<<8,
310 GP_IO_7 = 1<<7,
311 GP_IO_6 = 1<<6,
312 GP_IO_5 = 1<<5,
313 GP_IO_4 = 1<<4,
314 GP_IO_3 = 1<<3,
315 GP_IO_2 = 1<<2,
316 GP_IO_1 = 1<<1,
317 GP_IO_0 = 1<<0,
318 };
319
320
321
322
323 enum {
324 BMU_OWN = 1<<31,
325 BMU_STF = 1<<30,
326 BMU_EOF = 1<<29,
327 BMU_IRQ_EOB = 1<<28,
328 BMU_IRQ_EOF = 1<<27,
329
330 BMU_STFWD = 1<<26,
331 BMU_NO_FCS = 1<<25,
332 BMU_SW = 1<<24,
333
334 BMU_DEV_0 = 1<<26,
335 BMU_STAT_VAL = 1<<25,
336 BMU_TIST_VAL = 1<<24,
337
338 BMU_CHECK = 0x55<<16,
339 BMU_TCP_CHECK = 0x56<<16,
340 BMU_UDP_CHECK = 0x57<<16,
341 BMU_BBC = 0xffffL,
342 };
343
344
345 enum {
346 BSC_START = 1<<1,
347 BSC_STOP = 1<<0,
348 };
349
350
351 enum {
352 BSC_SRC = 1<<0,
353 };
354
355
356 enum {
357 BSC_T_ON = 1<<2,
358 BSC_T_OFF = 1<<1,
359 BSC_T_STEP = 1<<0,
360 };
361
362
363
364 #define RAM_ADR_RAN 0x0007ffffL
365
366
367
368 enum {
369 RI_CLR_RD_PERR = 1<<9,
370 RI_CLR_WR_PERR = 1<<8,
371
372 RI_RST_CLR = 1<<1,
373 RI_RST_SET = 1<<0,
374 };
375
376
377
378 enum {
379 MA_FOE_ON = 1<<3,
380 MA_FOE_OFF = 1<<2,
381 MA_RST_CLR = 1<<1,
382 MA_RST_SET = 1<<0,
383
384 };
385
386
387 #define SK_MAC_TO_53 72
388 #define SK_PKT_TO_53 0x2000
389 #define SK_PKT_TO_MAX 0xffff
390 #define SK_RI_TO_53 36
391
392
393
394 enum {
395 PA_CLR_TO_TX2 = 1<<13,
396 PA_CLR_TO_TX1 = 1<<12,
397 PA_CLR_TO_RX2 = 1<<11,
398 PA_CLR_TO_RX1 = 1<<10,
399 PA_ENA_TO_TX2 = 1<<9,
400 PA_DIS_TO_TX2 = 1<<8,
401 PA_ENA_TO_TX1 = 1<<7,
402 PA_DIS_TO_TX1 = 1<<6,
403 PA_ENA_TO_RX2 = 1<<5,
404 PA_DIS_TO_RX2 = 1<<4,
405 PA_ENA_TO_RX1 = 1<<3,
406 PA_DIS_TO_RX1 = 1<<2,
407 PA_RST_CLR = 1<<1,
408 PA_RST_SET = 1<<0,
409 };
410
411 #define PA_ENA_TO_ALL (PA_ENA_TO_RX1 | PA_ENA_TO_RX2 |\
412 PA_ENA_TO_TX1 | PA_ENA_TO_TX2)
413
414
415
416
417
418
419
420
421 #define TXA_MAX_VAL 0x00ffffffUL
422
423
424 enum {
425 TXA_ENA_FSYNC = 1<<7,
426 TXA_DIS_FSYNC = 1<<6,
427 TXA_ENA_ALLOC = 1<<5,
428 TXA_DIS_ALLOC = 1<<4,
429 TXA_START_RC = 1<<3,
430 TXA_STOP_RC = 1<<2,
431 TXA_ENA_ARB = 1<<1,
432 TXA_DIS_ARB = 1<<0,
433 };
434
435
436
437
438
439 enum {
440 TXA_ITI_INI = 0x0200,
441 TXA_ITI_VAL = 0x0204,
442 TXA_LIM_INI = 0x0208,
443 TXA_LIM_VAL = 0x020c,
444 TXA_CTRL = 0x0210,
445 TXA_TEST = 0x0211,
446 TXA_STAT = 0x0212,
447 };
448
449
450 enum {
451 B6_EXT_REG = 0x0300,
452 B7_CFG_SPC = 0x0380,
453 B8_RQ1_REGS = 0x0400,
454 B8_RQ2_REGS = 0x0480,
455 B8_TS1_REGS = 0x0600,
456 B8_TA1_REGS = 0x0680,
457 B8_TS2_REGS = 0x0700,
458 B8_TA2_REGS = 0x0780,
459 B16_RAM_REGS = 0x0800,
460 };
461
462
463 enum {
464 B8_Q_REGS = 0x0400,
465 Q_D = 0x00,
466 Q_DA_L = 0x20,
467 Q_DA_H = 0x24,
468 Q_AC_L = 0x28,
469 Q_AC_H = 0x2c,
470 Q_BC = 0x30,
471 Q_CSR = 0x34,
472 Q_F = 0x38,
473 Q_T1 = 0x3c,
474 Q_T1_TR = 0x3c,
475 Q_T1_WR = 0x3d,
476 Q_T1_RD = 0x3e,
477 Q_T1_SV = 0x3f,
478 Q_T2 = 0x40,
479 Q_T3 = 0x44,
480
481 };
482 #define Q_ADDR(reg, offs) (B8_Q_REGS + (reg) + (offs))
483
484
485 enum {
486
487 RB_START= 0x00,
488 RB_END = 0x04,
489 RB_WP = 0x08,
490 RB_RP = 0x0c,
491 RB_RX_UTPP= 0x10,
492 RB_RX_LTPP= 0x14,
493 RB_RX_UTHP= 0x18,
494 RB_RX_LTHP= 0x1c,
495
496 RB_PC = 0x20,
497 RB_LEV = 0x24,
498 RB_CTRL = 0x28,
499 RB_TST1 = 0x29,
500 RB_TST2 = 0x2a,
501 };
502
503
504 enum {
505 Q_R1 = 0x0000,
506 Q_R2 = 0x0080,
507 Q_XS1 = 0x0200,
508 Q_XA1 = 0x0280,
509 Q_XS2 = 0x0300,
510 Q_XA2 = 0x0380,
511 };
512
513
514 enum {
515 SK_MAC_XMAC = 0,
516 SK_MAC_GMAC = 1,
517 };
518
519
520 enum {
521 SK_PHY_XMAC = 0,
522 SK_PHY_BCOM = 1,
523 SK_PHY_LONE = 2,
524 SK_PHY_NAT = 3,
525 SK_PHY_MARV_COPPER= 4,
526 SK_PHY_MARV_FIBER = 5,
527 };
528
529
530 enum {
531 PHY_ADDR_XMAC = 0<<8,
532 PHY_ADDR_BCOM = 1<<8,
533
534
535 PHY_ADDR_MARV = 0,
536 };
537
538 #define RB_ADDR(offs, queue) ((u16)B16_RAM_REGS + (u16)(queue) + (offs))
539
540
541 enum {
542 RX_MFF_EA = 0x0c00,
543 RX_MFF_WP = 0x0c04,
544
545 RX_MFF_RP = 0x0c0c,
546 RX_MFF_PC = 0x0c10,
547 RX_MFF_LEV = 0x0c14,
548 RX_MFF_CTRL1 = 0x0c18,
549 RX_MFF_STAT_TO = 0x0c1a,
550 RX_MFF_TIST_TO = 0x0c1b,
551 RX_MFF_CTRL2 = 0x0c1c,
552 RX_MFF_TST1 = 0x0c1d,
553 RX_MFF_TST2 = 0x0c1e,
554
555 RX_LED_INI = 0x0c20,
556 RX_LED_VAL = 0x0c24,
557 RX_LED_CTRL = 0x0c28,
558 RX_LED_TST = 0x0c29,
559
560 LNK_SYNC_INI = 0x0c30,
561 LNK_SYNC_VAL = 0x0c34,
562 LNK_SYNC_CTRL = 0x0c38,
563 LNK_SYNC_TST = 0x0c39,
564 LNK_LED_REG = 0x0c3c,
565 };
566
567
568
569 enum {
570 MFF_ENA_RDY_PAT = 1<<13,
571 MFF_DIS_RDY_PAT = 1<<12,
572 MFF_ENA_TIM_PAT = 1<<11,
573 MFF_DIS_TIM_PAT = 1<<10,
574 MFF_ENA_ALM_FUL = 1<<9,
575 MFF_DIS_ALM_FUL = 1<<8,
576 MFF_ENA_PAUSE = 1<<7,
577 MFF_DIS_PAUSE = 1<<6,
578 MFF_ENA_FLUSH = 1<<5,
579 MFF_DIS_FLUSH = 1<<4,
580 MFF_ENA_TIST = 1<<3,
581 MFF_DIS_TIST = 1<<2,
582 MFF_CLR_INTIST = 1<<1,
583 MFF_CLR_INSTAT = 1<<0,
584 MFF_RX_CTRL_DEF = MFF_ENA_TIM_PAT,
585 };
586
587
588 enum {
589 MFF_CLR_PERR = 1<<15,
590
591 MFF_ENA_PKT_REC = 1<<13,
592 MFF_DIS_PKT_REC = 1<<12,
593
594 MFF_ENA_W4E = 1<<7,
595 MFF_DIS_W4E = 1<<6,
596
597 MFF_ENA_LOOPB = 1<<3,
598 MFF_DIS_LOOPB = 1<<2,
599 MFF_CLR_MAC_RST = 1<<1,
600 MFF_SET_MAC_RST = 1<<0,
601
602 MFF_TX_CTRL_DEF = MFF_ENA_PKT_REC | (u16) MFF_ENA_TIM_PAT | MFF_ENA_FLUSH,
603 };
604
605
606
607
608 enum {
609 MFF_WSP_T_ON = 1<<6,
610 MFF_WSP_T_OFF = 1<<5,
611 MFF_WSP_INC = 1<<4,
612 MFF_PC_DEC = 1<<3,
613 MFF_PC_T_ON = 1<<2,
614 MFF_PC_T_OFF = 1<<1,
615 MFF_PC_INC = 1<<0,
616 };
617
618
619
620 enum {
621 MFF_WP_T_ON = 1<<6,
622 MFF_WP_T_OFF = 1<<5,
623 MFF_WP_INC = 1<<4,
624
625 MFF_RP_T_ON = 1<<2,
626 MFF_RP_T_OFF = 1<<1,
627 MFF_RP_DEC = 1<<0,
628 };
629
630
631
632 enum {
633 MFF_ENA_OP_MD = 1<<3,
634 MFF_DIS_OP_MD = 1<<2,
635 MFF_RST_CLR = 1<<1,
636 MFF_RST_SET = 1<<0,
637 };
638
639
640
641
642
643
644
645 enum {
646 LED_START = 1<<2,
647 LED_STOP = 1<<1,
648 LED_STATE = 1<<0,
649 };
650
651
652
653
654 enum {
655 LED_T_ON = 1<<2,
656 LED_T_OFF = 1<<1,
657 LED_T_STEP = 1<<0,
658 };
659
660
661 enum {
662 LED_BLK_ON = 1<<5,
663 LED_BLK_OFF = 1<<4,
664 LED_SYNC_ON = 1<<3,
665 LED_SYNC_OFF = 1<<2,
666 LED_REG_ON = 1<<1,
667 LED_REG_OFF = 1<<0,
668 };
669
670
671 enum {
672 RX_GMF_EA = 0x0c40,
673 RX_GMF_AF_THR = 0x0c44,
674 RX_GMF_CTRL_T = 0x0c48,
675 RX_GMF_FL_MSK = 0x0c4c,
676 RX_GMF_FL_THR = 0x0c50,
677 RX_GMF_WP = 0x0c60,
678 RX_GMF_WLEV = 0x0c68,
679 RX_GMF_RP = 0x0c70,
680 RX_GMF_RLEV = 0x0c78,
681 };
682
683
684
685 enum {
686 TXA_INT_T_ON = 1<<5,
687 TXA_INT_T_OFF = 1<<4,
688 TXA_INT_T_STEP = 1<<3,
689 TXA_LIM_T_ON = 1<<2,
690 TXA_LIM_T_OFF = 1<<1,
691 TXA_LIM_T_STEP = 1<<0,
692 };
693
694
695 enum {
696 TXA_PRIO_XS = 1<<0,
697 };
698
699
700
701
702
703
704
705
706
707
708
709
710
711 enum {
712 CSR_SV_IDLE = 1<<24,
713
714 CSR_DESC_CLR = 1<<21,
715 CSR_DESC_SET = 1<<20,
716 CSR_FIFO_CLR = 1<<19,
717 CSR_FIFO_SET = 1<<18,
718 CSR_HPI_RUN = 1<<17,
719 CSR_HPI_RST = 1<<16,
720 CSR_SV_RUN = 1<<15,
721 CSR_SV_RST = 1<<14,
722 CSR_DREAD_RUN = 1<<13,
723 CSR_DREAD_RST = 1<<12,
724 CSR_DWRITE_RUN = 1<<11,
725 CSR_DWRITE_RST = 1<<10,
726 CSR_TRANS_RUN = 1<<9,
727 CSR_TRANS_RST = 1<<8,
728 CSR_ENA_POL = 1<<7,
729 CSR_DIS_POL = 1<<6,
730 CSR_STOP = 1<<5,
731 CSR_START = 1<<4,
732 CSR_IRQ_CL_P = 1<<3,
733 CSR_IRQ_CL_B = 1<<2,
734 CSR_IRQ_CL_F = 1<<1,
735 CSR_IRQ_CL_C = 1<<0,
736 };
737
738 #define CSR_SET_RESET (CSR_DESC_SET | CSR_FIFO_SET | CSR_HPI_RST |\
739 CSR_SV_RST | CSR_DREAD_RST | CSR_DWRITE_RST |\
740 CSR_TRANS_RST)
741 #define CSR_CLR_RESET (CSR_DESC_CLR | CSR_FIFO_CLR | CSR_HPI_RUN |\
742 CSR_SV_RUN | CSR_DREAD_RUN | CSR_DWRITE_RUN |\
743 CSR_TRANS_RUN)
744
745
746 enum {
747 F_ALM_FULL = 1<<27,
748 F_EMPTY = 1<<27,
749 F_FIFO_EOF = 1<<26,
750 F_WM_REACHED = 1<<25,
751
752 F_FIFO_LEVEL = 0x1fL<<16,
753 F_WATER_MARK = 0x0007ffL,
754 };
755
756
757
758
759
760
761
762
763
764
765
766
767
768 #define RB_MSK 0x0007ffff
769
770
771
772
773 enum {
774 RB_ENA_STFWD = 1<<5,
775 RB_DIS_STFWD = 1<<4,
776 RB_ENA_OP_MD = 1<<3,
777 RB_DIS_OP_MD = 1<<2,
778 RB_RST_CLR = 1<<1,
779 RB_RST_SET = 1<<0,
780 };
781
782
783 enum {
784 TX_MFF_EA = 0x0d00,
785 TX_MFF_WP = 0x0d04,
786 TX_MFF_WSP = 0x0d08,
787 TX_MFF_RP = 0x0d0c,
788 TX_MFF_PC = 0x0d10,
789 TX_MFF_LEV = 0x0d14,
790 TX_MFF_CTRL1 = 0x0d18,
791 TX_MFF_WAF = 0x0d1a,
792
793 TX_MFF_CTRL2 = 0x0d1c,
794 TX_MFF_TST1 = 0x0d1d,
795 TX_MFF_TST2 = 0x0d1e,
796
797 TX_LED_INI = 0x0d20,
798 TX_LED_VAL = 0x0d24,
799 TX_LED_CTRL = 0x0d28,
800 TX_LED_TST = 0x0d29,
801 };
802
803
804 #define SK_XMIT_DUR 0x002faf08UL
805 #define SK_BLK_DUR 0x01dcd650UL
806
807 #define SK_DPOLL_DEF 0x00ee6b28UL
808
809 #define SK_DPOLL_MAX 0x00ffffffUL
810
811
812 #define SK_FACT_62 100
813 #define SK_FACT_53 85
814 #define SK_FACT_78 125
815
816
817
818 enum {
819 TX_GMF_EA = 0x0d40,
820 TX_GMF_AE_THR = 0x0d44,
821 TX_GMF_CTRL_T = 0x0d48,
822
823 TX_GMF_WP = 0x0d60,
824 TX_GMF_WSP = 0x0d64,
825 TX_GMF_WLEV = 0x0d68,
826
827 TX_GMF_RP = 0x0d70,
828 TX_GMF_RSTP = 0x0d74,
829 TX_GMF_RLEV = 0x0d78,
830
831
832 B28_DPT_INI = 0x0e00,
833 B28_DPT_VAL = 0x0e04,
834 B28_DPT_CTRL = 0x0e08,
835
836 B28_DPT_TST = 0x0e0a,
837
838
839 GMAC_TI_ST_VAL = 0x0e14,
840 GMAC_TI_ST_CTRL = 0x0e18,
841 GMAC_TI_ST_TST = 0x0e1a,
842 };
843
844
845 enum {
846 LINKLED_OFF = 0x01,
847 LINKLED_ON = 0x02,
848 LINKLED_LINKSYNC_OFF = 0x04,
849 LINKLED_LINKSYNC_ON = 0x08,
850 LINKLED_BLINK_OFF = 0x10,
851 LINKLED_BLINK_ON = 0x20,
852 };
853
854
855 enum {
856 GMAC_CTRL = 0x0f00,
857 GPHY_CTRL = 0x0f04,
858 GMAC_IRQ_SRC = 0x0f08,
859 GMAC_IRQ_MSK = 0x0f0c,
860 GMAC_LINK_CTRL = 0x0f10,
861
862
863
864 WOL_REG_OFFS = 0x20,
865
866 WOL_CTRL_STAT = 0x0f20,
867 WOL_MATCH_CTL = 0x0f22,
868 WOL_MATCH_RES = 0x0f23,
869 WOL_MAC_ADDR = 0x0f24,
870 WOL_PATT_RPTR = 0x0f2c,
871
872
873
874 WOL_PATT_LEN_LO = 0x0f30,
875 WOL_PATT_LEN_HI = 0x0f34,
876
877
878
879 WOL_PATT_CNT_0 = 0x0f38,
880 WOL_PATT_CNT_4 = 0x0f3c,
881 };
882 #define WOL_REGS(port, x) (x + (port)*0x80)
883
884 enum {
885 WOL_PATT_RAM_1 = 0x1000,
886 WOL_PATT_RAM_2 = 0x1400,
887 };
888 #define WOL_PATT_RAM_BASE(port) (WOL_PATT_RAM_1 + (port)*0x400)
889
890 enum {
891 BASE_XMAC_1 = 0x2000,
892 BASE_GMAC_1 = 0x2800,
893 BASE_XMAC_2 = 0x3000,
894 BASE_GMAC_2 = 0x3800,
895 };
896
897
898
899
900 enum {
901 XMR_FS_LEN = 0x3fff<<18,
902 XMR_FS_LEN_SHIFT = 18,
903 XMR_FS_2L_VLAN = 1<<17,
904 XMR_FS_1_VLAN = 1<<16,
905 XMR_FS_BC = 1<<15,
906 XMR_FS_MC = 1<<14,
907 XMR_FS_UC = 1<<13,
908
909 XMR_FS_BURST = 1<<11,
910 XMR_FS_CEX_ERR = 1<<10,
911 XMR_FS_802_3 = 1<<9,
912 XMR_FS_COL_ERR = 1<<8,
913 XMR_FS_CAR_ERR = 1<<7,
914 XMR_FS_LEN_ERR = 1<<6,
915 XMR_FS_FRA_ERR = 1<<5,
916 XMR_FS_RUNT = 1<<4,
917 XMR_FS_LNG_ERR = 1<<3,
918 XMR_FS_FCS_ERR = 1<<2,
919 XMR_FS_ERR = 1<<1,
920 XMR_FS_MCTRL = 1<<0,
921
922
923
924
925
926
927
928
929
930 };
931
932
933
934
935 enum {
936 PHY_XMAC_CTRL = 0x00,
937 PHY_XMAC_STAT = 0x01,
938 PHY_XMAC_ID0 = 0x02,
939 PHY_XMAC_ID1 = 0x03,
940 PHY_XMAC_AUNE_ADV = 0x04,
941 PHY_XMAC_AUNE_LP = 0x05,
942 PHY_XMAC_AUNE_EXP = 0x06,
943 PHY_XMAC_NEPG = 0x07,
944 PHY_XMAC_NEPG_LP = 0x08,
945
946 PHY_XMAC_EXT_STAT = 0x0f,
947 PHY_XMAC_RES_ABI = 0x10,
948 };
949
950
951
952 enum {
953 PHY_BCOM_CTRL = 0x00,
954 PHY_BCOM_STAT = 0x01,
955 PHY_BCOM_ID0 = 0x02,
956 PHY_BCOM_ID1 = 0x03,
957 PHY_BCOM_AUNE_ADV = 0x04,
958 PHY_BCOM_AUNE_LP = 0x05,
959 PHY_BCOM_AUNE_EXP = 0x06,
960 PHY_BCOM_NEPG = 0x07,
961 PHY_BCOM_NEPG_LP = 0x08,
962
963 PHY_BCOM_1000T_CTRL = 0x09,
964 PHY_BCOM_1000T_STAT = 0x0a,
965 PHY_BCOM_EXT_STAT = 0x0f,
966 PHY_BCOM_P_EXT_CTRL = 0x10,
967 PHY_BCOM_P_EXT_STAT = 0x11,
968 PHY_BCOM_RE_CTR = 0x12,
969 PHY_BCOM_FC_CTR = 0x13,
970 PHY_BCOM_RNO_CTR = 0x14,
971
972 PHY_BCOM_AUX_CTRL = 0x18,
973 PHY_BCOM_AUX_STAT = 0x19,
974 PHY_BCOM_INT_STAT = 0x1a,
975 PHY_BCOM_INT_MASK = 0x1b,
976 };
977
978
979
980
981 enum {
982 PHY_MARV_CTRL = 0x00,
983 PHY_MARV_STAT = 0x01,
984 PHY_MARV_ID0 = 0x02,
985 PHY_MARV_ID1 = 0x03,
986 PHY_MARV_AUNE_ADV = 0x04,
987 PHY_MARV_AUNE_LP = 0x05,
988 PHY_MARV_AUNE_EXP = 0x06,
989 PHY_MARV_NEPG = 0x07,
990 PHY_MARV_NEPG_LP = 0x08,
991
992 PHY_MARV_1000T_CTRL = 0x09,
993 PHY_MARV_1000T_STAT = 0x0a,
994 PHY_MARV_EXT_STAT = 0x0f,
995 PHY_MARV_PHY_CTRL = 0x10,
996 PHY_MARV_PHY_STAT = 0x11,
997 PHY_MARV_INT_MASK = 0x12,
998 PHY_MARV_INT_STAT = 0x13,
999 PHY_MARV_EXT_CTRL = 0x14,
1000 PHY_MARV_RXE_CNT = 0x15,
1001 PHY_MARV_EXT_ADR = 0x16,
1002 PHY_MARV_PORT_IRQ = 0x17,
1003 PHY_MARV_LED_CTRL = 0x18,
1004 PHY_MARV_LED_OVER = 0x19,
1005 PHY_MARV_EXT_CTRL_2 = 0x1a,
1006 PHY_MARV_EXT_P_STAT = 0x1b,
1007 PHY_MARV_CABLE_DIAG = 0x1c,
1008 PHY_MARV_PAGE_ADDR = 0x1d,
1009 PHY_MARV_PAGE_DATA = 0x1e,
1010
1011
1012 PHY_MARV_FE_LED_PAR = 0x16,
1013 PHY_MARV_FE_LED_SER = 0x17,
1014 PHY_MARV_FE_VCT_TX = 0x1a,
1015 PHY_MARV_FE_VCT_RX = 0x1b,
1016 PHY_MARV_FE_SPEC_2 = 0x1c,
1017 };
1018
1019 enum {
1020 PHY_CT_RESET = 1<<15,
1021 PHY_CT_LOOP = 1<<14,
1022 PHY_CT_SPS_LSB = 1<<13,
1023 PHY_CT_ANE = 1<<12,
1024 PHY_CT_PDOWN = 1<<11,
1025 PHY_CT_ISOL = 1<<10,
1026 PHY_CT_RE_CFG = 1<<9,
1027 PHY_CT_DUP_MD = 1<<8,
1028 PHY_CT_COL_TST = 1<<7,
1029 PHY_CT_SPS_MSB = 1<<6,
1030 };
1031
1032 enum {
1033 PHY_CT_SP1000 = PHY_CT_SPS_MSB,
1034 PHY_CT_SP100 = PHY_CT_SPS_LSB,
1035 PHY_CT_SP10 = 0,
1036 };
1037
1038 enum {
1039 PHY_ST_EXT_ST = 1<<8,
1040
1041 PHY_ST_PRE_SUP = 1<<6,
1042 PHY_ST_AN_OVER = 1<<5,
1043 PHY_ST_REM_FLT = 1<<4,
1044 PHY_ST_AN_CAP = 1<<3,
1045 PHY_ST_LSYNC = 1<<2,
1046 PHY_ST_JAB_DET = 1<<1,
1047 PHY_ST_EXT_REG = 1<<0,
1048 };
1049
1050 enum {
1051 PHY_I1_OUI_MSK = 0x3f<<10,
1052 PHY_I1_MOD_NUM = 0x3f<<4,
1053 PHY_I1_REV_MSK = 0xf,
1054 };
1055
1056
1057 enum {
1058 PHY_BCOM_ID1_A1 = 0x6041,
1059 PHY_BCOM_ID1_B2 = 0x6043,
1060 PHY_BCOM_ID1_C0 = 0x6044,
1061 PHY_BCOM_ID1_C5 = 0x6047,
1062 };
1063
1064
1065 enum {
1066 PHY_MARV_ID0_VAL= 0x0141,
1067 PHY_MARV_ID1_B0 = 0x0C23,
1068 PHY_MARV_ID1_B2 = 0x0C25,
1069 PHY_MARV_ID1_C2 = 0x0CC2,
1070 PHY_MARV_ID1_Y2 = 0x0C91,
1071 };
1072
1073
1074 enum {
1075 PHY_AN_NXT_PG = 1<<15,
1076 PHY_AN_ACK = 1<<14,
1077 PHY_AN_RF = 1<<13,
1078
1079 PHY_AN_PAUSE_ASYM = 1<<11,
1080 PHY_AN_PAUSE_CAP = 1<<10,
1081 PHY_AN_100BASE4 = 1<<9,
1082 PHY_AN_100FULL = 1<<8,
1083 PHY_AN_100HALF = 1<<7,
1084 PHY_AN_10FULL = 1<<6,
1085 PHY_AN_10HALF = 1<<5,
1086 PHY_AN_CSMA = 1<<0,
1087 PHY_AN_SEL = 0x1f,
1088 PHY_AN_FULL = PHY_AN_100FULL | PHY_AN_10FULL | PHY_AN_CSMA,
1089 PHY_AN_ALL = PHY_AN_10HALF | PHY_AN_10FULL |
1090 PHY_AN_100HALF | PHY_AN_100FULL,
1091 };
1092
1093
1094 enum {
1095 PHY_X_AN_NXT_PG = 1<<15,
1096 PHY_X_AN_ACK = 1<<14,
1097 PHY_X_AN_RFB = 3<<12,
1098
1099 PHY_X_AN_PAUSE = 3<<7,
1100 PHY_X_AN_HD = 1<<6,
1101 PHY_X_AN_FD = 1<<5,
1102 };
1103
1104
1105 enum {
1106 PHY_X_P_NO_PAUSE= 0<<7,
1107 PHY_X_P_SYM_MD = 1<<7,
1108 PHY_X_P_ASYM_MD = 2<<7,
1109 PHY_X_P_BOTH_MD = 3<<7,
1110 };
1111
1112
1113
1114 enum {
1115 PHY_X_EX_FD = 1<<15,
1116 PHY_X_EX_HD = 1<<14,
1117 };
1118
1119
1120 enum {
1121 PHY_X_RS_PAUSE = 3<<7,
1122 PHY_X_RS_HD = 1<<6,
1123 PHY_X_RS_FD = 1<<5,
1124 PHY_X_RS_ABLMIS = 1<<4,
1125 PHY_X_RS_PAUMIS = 1<<3,
1126 };
1127
1128
1129 enum {
1130 X_RFB_OK = 0<<12,
1131 X_RFB_LF = 1<<12,
1132 X_RFB_OFF = 2<<12,
1133 X_RFB_AN_ERR = 3<<12,
1134 };
1135
1136
1137
1138 enum {
1139 PHY_B_1000C_TEST = 7<<13,
1140 PHY_B_1000C_MSE = 1<<12,
1141 PHY_B_1000C_MSC = 1<<11,
1142 PHY_B_1000C_RD = 1<<10,
1143 PHY_B_1000C_AFD = 1<<9,
1144 PHY_B_1000C_AHD = 1<<8,
1145 };
1146
1147
1148
1149 enum {
1150 PHY_B_1000S_MSF = 1<<15,
1151 PHY_B_1000S_MSR = 1<<14,
1152 PHY_B_1000S_LRS = 1<<13,
1153 PHY_B_1000S_RRS = 1<<12,
1154 PHY_B_1000S_LP_FD = 1<<11,
1155 PHY_B_1000S_LP_HD = 1<<10,
1156
1157 PHY_B_1000S_IEC = 0xff,
1158 };
1159
1160
1161 enum {
1162 PHY_B_ES_X_FD_CAP = 1<<15,
1163 PHY_B_ES_X_HD_CAP = 1<<14,
1164 PHY_B_ES_T_FD_CAP = 1<<13,
1165 PHY_B_ES_T_HD_CAP = 1<<12,
1166 };
1167
1168
1169 enum {
1170 PHY_B_PEC_MAC_PHY = 1<<15,
1171 PHY_B_PEC_DIS_CROSS = 1<<14,
1172 PHY_B_PEC_TX_DIS = 1<<13,
1173 PHY_B_PEC_INT_DIS = 1<<12,
1174 PHY_B_PEC_F_INT = 1<<11,
1175 PHY_B_PEC_BY_45 = 1<<10,
1176 PHY_B_PEC_BY_SCR = 1<<9,
1177 PHY_B_PEC_BY_MLT3 = 1<<8,
1178 PHY_B_PEC_BY_RXA = 1<<7,
1179 PHY_B_PEC_RES_SCR = 1<<6,
1180 PHY_B_PEC_EN_LTR = 1<<5,
1181 PHY_B_PEC_LED_ON = 1<<4,
1182 PHY_B_PEC_LED_OFF = 1<<3,
1183 PHY_B_PEC_EX_IPG = 1<<2,
1184 PHY_B_PEC_3_LED = 1<<1,
1185 PHY_B_PEC_HIGH_LA = 1<<0,
1186 };
1187
1188
1189 enum {
1190 PHY_B_PES_CROSS_STAT = 1<<13,
1191 PHY_B_PES_INT_STAT = 1<<12,
1192 PHY_B_PES_RRS = 1<<11,
1193 PHY_B_PES_LRS = 1<<10,
1194 PHY_B_PES_LOCKED = 1<<9,
1195 PHY_B_PES_LS = 1<<8,
1196 PHY_B_PES_RF = 1<<7,
1197 PHY_B_PES_CE_ER = 1<<6,
1198 PHY_B_PES_BAD_SSD = 1<<5,
1199 PHY_B_PES_BAD_ESD = 1<<4,
1200 PHY_B_PES_RX_ER = 1<<3,
1201 PHY_B_PES_TX_ER = 1<<2,
1202 PHY_B_PES_LOCK_ER = 1<<1,
1203 PHY_B_PES_MLT3_ER = 1<<0,
1204 };
1205
1206
1207
1208 enum {
1209 PHY_B_AN_RF = 1<<13,
1210
1211 PHY_B_AN_ASP = 1<<11,
1212 PHY_B_AN_PC = 1<<10,
1213 };
1214
1215
1216
1217 enum {
1218 PHY_B_FC_CTR = 0xff,
1219
1220
1221 PHY_B_RC_LOC_MSK = 0xff00,
1222 PHY_B_RC_REM_MSK = 0x00ff,
1223
1224
1225 PHY_B_AC_L_SQE = 1<<15,
1226 PHY_B_AC_LONG_PACK = 1<<14,
1227 PHY_B_AC_ER_CTRL = 3<<12,
1228
1229 PHY_B_AC_TX_TST = 1<<10,
1230
1231 PHY_B_AC_DIS_PRF = 1<<7,
1232
1233 PHY_B_AC_DIS_PM = 1<<5,
1234
1235 PHY_B_AC_DIAG = 1<<3,
1236 };
1237
1238
1239 enum {
1240 PHY_B_AS_AN_C = 1<<15,
1241 PHY_B_AS_AN_CA = 1<<14,
1242 PHY_B_AS_ANACK_D = 1<<13,
1243 PHY_B_AS_ANAB_D = 1<<12,
1244 PHY_B_AS_NPW = 1<<11,
1245 PHY_B_AS_AN_RES_MSK = 7<<8,
1246 PHY_B_AS_PDF = 1<<7,
1247 PHY_B_AS_RF = 1<<6,
1248 PHY_B_AS_ANP_R = 1<<5,
1249 PHY_B_AS_LP_ANAB = 1<<4,
1250 PHY_B_AS_LP_NPAB = 1<<3,
1251 PHY_B_AS_LS = 1<<2,
1252 PHY_B_AS_PRR = 1<<1,
1253 PHY_B_AS_PRT = 1<<0,
1254 };
1255 #define PHY_B_AS_PAUSE_MSK (PHY_B_AS_PRR | PHY_B_AS_PRT)
1256
1257
1258
1259 enum {
1260 PHY_B_IS_PSE = 1<<14,
1261 PHY_B_IS_MDXI_SC = 1<<13,
1262 PHY_B_IS_HCT = 1<<12,
1263 PHY_B_IS_LCT = 1<<11,
1264 PHY_B_IS_AN_PR = 1<<10,
1265 PHY_B_IS_NO_HDCL = 1<<9,
1266 PHY_B_IS_NO_HDC = 1<<8,
1267 PHY_B_IS_NEG_USHDC = 1<<7,
1268 PHY_B_IS_SCR_S_ER = 1<<6,
1269 PHY_B_IS_RRS_CHANGE = 1<<5,
1270 PHY_B_IS_LRS_CHANGE = 1<<4,
1271 PHY_B_IS_DUP_CHANGE = 1<<3,
1272 PHY_B_IS_LSP_CHANGE = 1<<2,
1273 PHY_B_IS_LST_CHANGE = 1<<1,
1274 PHY_B_IS_CRC_ER = 1<<0,
1275 };
1276 #define PHY_B_DEF_MSK \
1277 (~(PHY_B_IS_PSE | PHY_B_IS_AN_PR | PHY_B_IS_DUP_CHANGE | \
1278 PHY_B_IS_LSP_CHANGE | PHY_B_IS_LST_CHANGE))
1279
1280
1281 enum {
1282 PHY_B_P_NO_PAUSE = 0<<10,
1283 PHY_B_P_SYM_MD = 1<<10,
1284 PHY_B_P_ASYM_MD = 2<<10,
1285 PHY_B_P_BOTH_MD = 3<<10,
1286 };
1287
1288
1289
1290 enum {
1291 PHY_B_RES_1000FD = 7<<8,
1292 PHY_B_RES_1000HD = 6<<8,
1293 };
1294
1295
1296 enum {
1297 PHY_M_AN_NXT_PG = 1<<15,
1298 PHY_M_AN_ACK = 1<<14,
1299 PHY_M_AN_RF = 1<<13,
1300
1301 PHY_M_AN_ASP = 1<<11,
1302 PHY_M_AN_PC = 1<<10,
1303 PHY_M_AN_100_T4 = 1<<9,
1304 PHY_M_AN_100_FD = 1<<8,
1305 PHY_M_AN_100_HD = 1<<7,
1306 PHY_M_AN_10_FD = 1<<6,
1307 PHY_M_AN_10_HD = 1<<5,
1308 PHY_M_AN_SEL_MSK =0x1f<<4,
1309 };
1310
1311
1312 enum {
1313 PHY_M_AN_ASP_X = 1<<8,
1314 PHY_M_AN_PC_X = 1<<7,
1315 PHY_M_AN_1000X_AHD = 1<<6,
1316 PHY_M_AN_1000X_AFD = 1<<5,
1317 };
1318
1319
1320 enum {
1321 PHY_M_P_NO_PAUSE_X = 0<<7,
1322 PHY_M_P_SYM_MD_X = 1<<7,
1323 PHY_M_P_ASYM_MD_X = 2<<7,
1324 PHY_M_P_BOTH_MD_X = 3<<7,
1325 };
1326
1327
1328 enum {
1329 PHY_M_1000C_TEST= 7<<13,
1330 PHY_M_1000C_MSE = 1<<12,
1331 PHY_M_1000C_MSC = 1<<11,
1332 PHY_M_1000C_MPD = 1<<10,
1333 PHY_M_1000C_AFD = 1<<9,
1334 PHY_M_1000C_AHD = 1<<8,
1335 };
1336
1337
1338 enum {
1339 PHY_M_PC_TX_FFD_MSK = 3<<14,
1340 PHY_M_PC_RX_FFD_MSK = 3<<12,
1341 PHY_M_PC_ASS_CRS_TX = 1<<11,
1342 PHY_M_PC_FL_GOOD = 1<<10,
1343 PHY_M_PC_EN_DET_MSK = 3<<8,
1344 PHY_M_PC_ENA_EXT_D = 1<<7,
1345 PHY_M_PC_MDIX_MSK = 3<<5,
1346 PHY_M_PC_DIS_125CLK = 1<<4,
1347 PHY_M_PC_MAC_POW_UP = 1<<3,
1348 PHY_M_PC_SQE_T_ENA = 1<<2,
1349 PHY_M_PC_POL_R_DIS = 1<<1,
1350 PHY_M_PC_DIS_JABBER = 1<<0,
1351 };
1352
1353 enum {
1354 PHY_M_PC_EN_DET = 2<<8,
1355 PHY_M_PC_EN_DET_PLUS = 3<<8,
1356 };
1357
1358 enum {
1359 PHY_M_PC_MAN_MDI = 0,
1360 PHY_M_PC_MAN_MDIX = 1,
1361 PHY_M_PC_ENA_AUTO = 3,
1362 };
1363
1364
1365 enum {
1366 PHY_M_PC_ENA_DTE_DT = 1<<15,
1367 PHY_M_PC_ENA_ENE_DT = 1<<14,
1368 PHY_M_PC_DIS_NLP_CK = 1<<13,
1369 PHY_M_PC_ENA_LIP_NP = 1<<12,
1370 PHY_M_PC_DIS_NLP_GN = 1<<11,
1371
1372 PHY_M_PC_DIS_SCRAMB = 1<<9,
1373 PHY_M_PC_DIS_FEFI = 1<<8,
1374
1375 PHY_M_PC_SH_TP_SEL = 1<<6,
1376 PHY_M_PC_RX_FD_MSK = 3<<2,
1377 };
1378
1379
1380 enum {
1381 PHY_M_PS_SPEED_MSK = 3<<14,
1382 PHY_M_PS_SPEED_1000 = 1<<15,
1383 PHY_M_PS_SPEED_100 = 1<<14,
1384 PHY_M_PS_SPEED_10 = 0,
1385 PHY_M_PS_FULL_DUP = 1<<13,
1386 PHY_M_PS_PAGE_REC = 1<<12,
1387 PHY_M_PS_SPDUP_RES = 1<<11,
1388 PHY_M_PS_LINK_UP = 1<<10,
1389 PHY_M_PS_CABLE_MSK = 7<<7,
1390 PHY_M_PS_MDI_X_STAT = 1<<6,
1391 PHY_M_PS_DOWNS_STAT = 1<<5,
1392 PHY_M_PS_ENDET_STAT = 1<<4,
1393 PHY_M_PS_TX_P_EN = 1<<3,
1394 PHY_M_PS_RX_P_EN = 1<<2,
1395 PHY_M_PS_POL_REV = 1<<1,
1396 PHY_M_PS_JABBER = 1<<0,
1397 };
1398
1399 #define PHY_M_PS_PAUSE_MSK (PHY_M_PS_TX_P_EN | PHY_M_PS_RX_P_EN)
1400
1401
1402 enum {
1403 PHY_M_PS_DTE_DETECT = 1<<15,
1404 PHY_M_PS_RES_SPEED = 1<<14,
1405 };
1406
1407 enum {
1408 PHY_M_IS_AN_ERROR = 1<<15,
1409 PHY_M_IS_LSP_CHANGE = 1<<14,
1410 PHY_M_IS_DUP_CHANGE = 1<<13,
1411 PHY_M_IS_AN_PR = 1<<12,
1412 PHY_M_IS_AN_COMPL = 1<<11,
1413 PHY_M_IS_LST_CHANGE = 1<<10,
1414 PHY_M_IS_SYMB_ERROR = 1<<9,
1415 PHY_M_IS_FALSE_CARR = 1<<8,
1416 PHY_M_IS_FIFO_ERROR = 1<<7,
1417 PHY_M_IS_MDI_CHANGE = 1<<6,
1418 PHY_M_IS_DOWNSH_DET = 1<<5,
1419 PHY_M_IS_END_CHANGE = 1<<4,
1420
1421 PHY_M_IS_DTE_CHANGE = 1<<2,
1422 PHY_M_IS_POL_CHANGE = 1<<1,
1423 PHY_M_IS_JABBER = 1<<0,
1424
1425 PHY_M_IS_DEF_MSK = PHY_M_IS_AN_ERROR | PHY_M_IS_LSP_CHANGE |
1426 PHY_M_IS_LST_CHANGE | PHY_M_IS_FIFO_ERROR,
1427
1428 PHY_M_IS_AN_MSK = PHY_M_IS_AN_ERROR | PHY_M_IS_AN_COMPL,
1429 };
1430
1431
1432 enum {
1433 PHY_M_EC_ENA_BC_EXT = 1<<15,
1434 PHY_M_EC_ENA_LIN_LB = 1<<14,
1435
1436 PHY_M_EC_DIS_LINK_P = 1<<12,
1437 PHY_M_EC_M_DSC_MSK = 3<<10,
1438
1439 PHY_M_EC_S_DSC_MSK = 3<<8,
1440
1441 PHY_M_EC_M_DSC_MSK2 = 7<<9,
1442
1443 PHY_M_EC_DOWN_S_ENA = 1<<8,
1444
1445 PHY_M_EC_RX_TIM_CT = 1<<7,
1446 PHY_M_EC_MAC_S_MSK = 7<<4,
1447 PHY_M_EC_FIB_AN_ENA = 1<<3,
1448 PHY_M_EC_DTE_D_ENA = 1<<2,
1449 PHY_M_EC_TX_TIM_CT = 1<<1,
1450 PHY_M_EC_TRANS_DIS = 1<<0, };
1451
1452 #define PHY_M_EC_M_DSC(x) ((u16)(x)<<10)
1453 #define PHY_M_EC_S_DSC(x) ((u16)(x)<<8)
1454 #define PHY_M_EC_MAC_S(x) ((u16)(x)<<4)
1455
1456 #define PHY_M_EC_M_DSC_2(x) ((u16)(x)<<9)
1457
1458 enum {
1459 MAC_TX_CLK_0_MHZ = 2,
1460 MAC_TX_CLK_2_5_MHZ = 6,
1461 MAC_TX_CLK_25_MHZ = 7,
1462 };
1463
1464
1465 enum {
1466 PHY_M_LEDC_DIS_LED = 1<<15,
1467 PHY_M_LEDC_PULS_MSK = 7<<12,
1468 PHY_M_LEDC_F_INT = 1<<11,
1469 PHY_M_LEDC_BL_R_MSK = 7<<8,
1470 PHY_M_LEDC_DP_C_LSB = 1<<7,
1471 PHY_M_LEDC_TX_C_LSB = 1<<6,
1472 PHY_M_LEDC_LK_C_MSK = 7<<3,
1473
1474 };
1475 #define PHY_M_LED_PULS_DUR(x) (((u16)(x)<<12) & PHY_M_LEDC_PULS_MSK)
1476 #define PHY_M_LED_BLINK_RT(x) (((u16)(x)<<8) & PHY_M_LEDC_BL_R_MSK)
1477
1478 enum {
1479 PHY_M_LEDC_LINK_MSK = 3<<3,
1480
1481 PHY_M_LEDC_DP_CTRL = 1<<2,
1482 PHY_M_LEDC_DP_C_MSB = 1<<2,
1483 PHY_M_LEDC_RX_CTRL = 1<<1,
1484 PHY_M_LEDC_TX_CTRL = 1<<0,
1485 PHY_M_LEDC_TX_C_MSB = 1<<0,
1486 };
1487
1488 enum {
1489 PULS_NO_STR = 0,
1490 PULS_21MS = 1,
1491 PULS_42MS = 2,
1492 PULS_84MS = 3,
1493 PULS_170MS = 4,
1494 PULS_340MS = 5,
1495 PULS_670MS = 6,
1496 PULS_1300MS = 7,
1497 };
1498
1499
1500 enum {
1501 BLINK_42MS = 0,
1502 BLINK_84MS = 1,
1503 BLINK_170MS = 2,
1504 BLINK_340MS = 3,
1505 BLINK_670MS = 4,
1506 };
1507
1508
1509 #define PHY_M_LED_MO_SGMII(x) ((x)<<14)
1510
1511 #define PHY_M_LED_MO_DUP(x) ((x)<<10)
1512 #define PHY_M_LED_MO_10(x) ((x)<<8)
1513 #define PHY_M_LED_MO_100(x) ((x)<<6)
1514 #define PHY_M_LED_MO_1000(x) ((x)<<4)
1515 #define PHY_M_LED_MO_RX(x) ((x)<<2)
1516 #define PHY_M_LED_MO_TX(x) ((x)<<0)
1517
1518 enum {
1519 MO_LED_NORM = 0,
1520 MO_LED_BLINK = 1,
1521 MO_LED_OFF = 2,
1522 MO_LED_ON = 3,
1523 };
1524
1525
1526 enum {
1527 PHY_M_EC2_FI_IMPED = 1<<6,
1528 PHY_M_EC2_FO_IMPED = 1<<5,
1529 PHY_M_EC2_FO_M_CLK = 1<<4,
1530 PHY_M_EC2_FO_BOOST = 1<<3,
1531 PHY_M_EC2_FO_AM_MSK = 7,
1532 };
1533
1534
1535 enum {
1536 PHY_M_FC_AUTO_SEL = 1<<15,
1537 PHY_M_FC_AN_REG_ACC = 1<<14,
1538 PHY_M_FC_RESOLUTION = 1<<13,
1539 PHY_M_SER_IF_AN_BP = 1<<12,
1540 PHY_M_SER_IF_BP_ST = 1<<11,
1541 PHY_M_IRQ_POLARITY = 1<<10,
1542 PHY_M_DIS_AUT_MED = 1<<9,
1543
1544
1545 PHY_M_UNDOC1 = 1<<7,
1546 PHY_M_DTE_POW_STAT = 1<<4,
1547 PHY_M_MODE_MASK = 0xf,
1548 };
1549
1550
1551 enum {
1552 PHY_M_CABD_ENA_TEST = 1<<15,
1553 PHY_M_CABD_DIS_WAIT = 1<<15,
1554
1555 PHY_M_CABD_STAT_MSK = 3<<13,
1556 PHY_M_CABD_AMPL_MSK = 0x1f<<8,
1557
1558 PHY_M_CABD_DIST_MSK = 0xff,
1559 };
1560
1561
1562 enum {
1563 CABD_STAT_NORMAL= 0,
1564 CABD_STAT_SHORT = 1,
1565 CABD_STAT_OPEN = 2,
1566 CABD_STAT_FAIL = 3,
1567 };
1568
1569
1570
1571
1572 enum {
1573 PHY_M_FELP_LED2_MSK = 0xf<<8,
1574 PHY_M_FELP_LED1_MSK = 0xf<<4,
1575 PHY_M_FELP_LED0_MSK = 0xf,
1576 };
1577
1578 #define PHY_M_FELP_LED2_CTRL(x) (((x)<<8) & PHY_M_FELP_LED2_MSK)
1579 #define PHY_M_FELP_LED1_CTRL(x) (((x)<<4) & PHY_M_FELP_LED1_MSK)
1580 #define PHY_M_FELP_LED0_CTRL(x) (((x)<<0) & PHY_M_FELP_LED0_MSK)
1581
1582 enum {
1583 LED_PAR_CTRL_COLX = 0x00,
1584 LED_PAR_CTRL_ERROR = 0x01,
1585 LED_PAR_CTRL_DUPLEX = 0x02,
1586 LED_PAR_CTRL_DP_COL = 0x03,
1587 LED_PAR_CTRL_SPEED = 0x04,
1588 LED_PAR_CTRL_LINK = 0x05,
1589 LED_PAR_CTRL_TX = 0x06,
1590 LED_PAR_CTRL_RX = 0x07,
1591 LED_PAR_CTRL_ACT = 0x08,
1592 LED_PAR_CTRL_LNK_RX = 0x09,
1593 LED_PAR_CTRL_LNK_AC = 0x0a,
1594 LED_PAR_CTRL_ACT_BL = 0x0b,
1595 LED_PAR_CTRL_TX_BL = 0x0c,
1596 LED_PAR_CTRL_RX_BL = 0x0d,
1597 LED_PAR_CTRL_COL_BL = 0x0e,
1598 LED_PAR_CTRL_INACT = 0x0f
1599 };
1600
1601
1602 enum {
1603 PHY_M_FESC_DIS_WAIT = 1<<2,
1604 PHY_M_FESC_ENA_MCLK = 1<<1,
1605 PHY_M_FESC_SEL_CL_A = 1<<0,
1606 };
1607
1608
1609
1610 enum {
1611 PHY_M_LEDC_LOS_MSK = 0xf<<12,
1612 PHY_M_LEDC_INIT_MSK = 0xf<<8,
1613 PHY_M_LEDC_STA1_MSK = 0xf<<4,
1614 PHY_M_LEDC_STA0_MSK = 0xf,
1615 };
1616
1617 #define PHY_M_LEDC_LOS_CTRL(x) (((x)<<12) & PHY_M_LEDC_LOS_MSK)
1618 #define PHY_M_LEDC_INIT_CTRL(x) (((x)<<8) & PHY_M_LEDC_INIT_MSK)
1619 #define PHY_M_LEDC_STA1_CTRL(x) (((x)<<4) & PHY_M_LEDC_STA1_MSK)
1620 #define PHY_M_LEDC_STA0_CTRL(x) (((x)<<0) & PHY_M_LEDC_STA0_MSK)
1621
1622
1623
1624 enum {
1625 GM_GP_STAT = 0x0000,
1626 GM_GP_CTRL = 0x0004,
1627 GM_TX_CTRL = 0x0008,
1628 GM_RX_CTRL = 0x000c,
1629 GM_TX_FLOW_CTRL = 0x0010,
1630 GM_TX_PARAM = 0x0014,
1631 GM_SERIAL_MODE = 0x0018,
1632
1633 GM_SRC_ADDR_1L = 0x001c,
1634 GM_SRC_ADDR_1M = 0x0020,
1635 GM_SRC_ADDR_1H = 0x0024,
1636 GM_SRC_ADDR_2L = 0x0028,
1637 GM_SRC_ADDR_2M = 0x002c,
1638 GM_SRC_ADDR_2H = 0x0030,
1639
1640
1641 GM_MC_ADDR_H1 = 0x0034,
1642 GM_MC_ADDR_H2 = 0x0038,
1643 GM_MC_ADDR_H3 = 0x003c,
1644 GM_MC_ADDR_H4 = 0x0040,
1645
1646
1647 GM_TX_IRQ_SRC = 0x0044,
1648 GM_RX_IRQ_SRC = 0x0048,
1649 GM_TR_IRQ_SRC = 0x004c,
1650
1651
1652 GM_TX_IRQ_MSK = 0x0050,
1653 GM_RX_IRQ_MSK = 0x0054,
1654 GM_TR_IRQ_MSK = 0x0058,
1655
1656
1657 GM_SMI_CTRL = 0x0080,
1658 GM_SMI_DATA = 0x0084,
1659 GM_PHY_ADDR = 0x0088,
1660 };
1661
1662
1663 #define GM_MIB_CNT_BASE 0x0100
1664 #define GM_MIB_CNT_SIZE 44
1665
1666
1667
1668
1669
1670 enum {
1671 GM_RXF_UC_OK = GM_MIB_CNT_BASE + 0,
1672 GM_RXF_BC_OK = GM_MIB_CNT_BASE + 8,
1673 GM_RXF_MPAUSE = GM_MIB_CNT_BASE + 16,
1674 GM_RXF_MC_OK = GM_MIB_CNT_BASE + 24,
1675 GM_RXF_FCS_ERR = GM_MIB_CNT_BASE + 32,
1676
1677 GM_RXO_OK_LO = GM_MIB_CNT_BASE + 48,
1678 GM_RXO_OK_HI = GM_MIB_CNT_BASE + 56,
1679 GM_RXO_ERR_LO = GM_MIB_CNT_BASE + 64,
1680 GM_RXO_ERR_HI = GM_MIB_CNT_BASE + 72,
1681 GM_RXF_SHT = GM_MIB_CNT_BASE + 80,
1682 GM_RXE_FRAG = GM_MIB_CNT_BASE + 88,
1683 GM_RXF_64B = GM_MIB_CNT_BASE + 96,
1684 GM_RXF_127B = GM_MIB_CNT_BASE + 104,
1685 GM_RXF_255B = GM_MIB_CNT_BASE + 112,
1686 GM_RXF_511B = GM_MIB_CNT_BASE + 120,
1687 GM_RXF_1023B = GM_MIB_CNT_BASE + 128,
1688 GM_RXF_1518B = GM_MIB_CNT_BASE + 136,
1689 GM_RXF_MAX_SZ = GM_MIB_CNT_BASE + 144,
1690 GM_RXF_LNG_ERR = GM_MIB_CNT_BASE + 152,
1691 GM_RXF_JAB_PKT = GM_MIB_CNT_BASE + 160,
1692
1693 GM_RXE_FIFO_OV = GM_MIB_CNT_BASE + 176,
1694
1695 GM_TXF_UC_OK = GM_MIB_CNT_BASE + 192,
1696 GM_TXF_BC_OK = GM_MIB_CNT_BASE + 200,
1697 GM_TXF_MPAUSE = GM_MIB_CNT_BASE + 208,
1698 GM_TXF_MC_OK = GM_MIB_CNT_BASE + 216,
1699 GM_TXO_OK_LO = GM_MIB_CNT_BASE + 224,
1700 GM_TXO_OK_HI = GM_MIB_CNT_BASE + 232,
1701 GM_TXF_64B = GM_MIB_CNT_BASE + 240,
1702 GM_TXF_127B = GM_MIB_CNT_BASE + 248,
1703 GM_TXF_255B = GM_MIB_CNT_BASE + 256,
1704 GM_TXF_511B = GM_MIB_CNT_BASE + 264,
1705 GM_TXF_1023B = GM_MIB_CNT_BASE + 272,
1706 GM_TXF_1518B = GM_MIB_CNT_BASE + 280,
1707 GM_TXF_MAX_SZ = GM_MIB_CNT_BASE + 288,
1708
1709 GM_TXF_COL = GM_MIB_CNT_BASE + 304,
1710 GM_TXF_LAT_COL = GM_MIB_CNT_BASE + 312,
1711 GM_TXF_ABO_COL = GM_MIB_CNT_BASE + 320,
1712 GM_TXF_MUL_COL = GM_MIB_CNT_BASE + 328,
1713 GM_TXF_SNG_COL = GM_MIB_CNT_BASE + 336,
1714 GM_TXE_FIFO_UR = GM_MIB_CNT_BASE + 344,
1715 };
1716
1717
1718
1719 enum {
1720 GM_GPSR_SPEED = 1<<15,
1721 GM_GPSR_DUPLEX = 1<<14,
1722 GM_GPSR_FC_TX_DIS = 1<<13,
1723 GM_GPSR_LINK_UP = 1<<12,
1724 GM_GPSR_PAUSE = 1<<11,
1725 GM_GPSR_TX_ACTIVE = 1<<10,
1726 GM_GPSR_EXC_COL = 1<<9,
1727 GM_GPSR_LAT_COL = 1<<8,
1728
1729 GM_GPSR_PHY_ST_CH = 1<<5,
1730 GM_GPSR_GIG_SPEED = 1<<4,
1731 GM_GPSR_PART_MODE = 1<<3,
1732 GM_GPSR_FC_RX_DIS = 1<<2,
1733 GM_GPSR_PROM_EN = 1<<1,
1734 };
1735
1736
1737 enum {
1738 GM_GPCR_PROM_ENA = 1<<14,
1739 GM_GPCR_FC_TX_DIS = 1<<13,
1740 GM_GPCR_TX_ENA = 1<<12,
1741 GM_GPCR_RX_ENA = 1<<11,
1742 GM_GPCR_BURST_ENA = 1<<10,
1743 GM_GPCR_LOOP_ENA = 1<<9,
1744 GM_GPCR_PART_ENA = 1<<8,
1745 GM_GPCR_GIGS_ENA = 1<<7,
1746 GM_GPCR_FL_PASS = 1<<6,
1747 GM_GPCR_DUP_FULL = 1<<5,
1748 GM_GPCR_FC_RX_DIS = 1<<4,
1749 GM_GPCR_SPEED_100 = 1<<3,
1750 GM_GPCR_AU_DUP_DIS = 1<<2,
1751 GM_GPCR_AU_FCT_DIS = 1<<1,
1752 GM_GPCR_AU_SPD_DIS = 1<<0,
1753 };
1754
1755 #define GM_GPCR_SPEED_1000 (GM_GPCR_GIGS_ENA | GM_GPCR_SPEED_100)
1756 #define GM_GPCR_AU_ALL_DIS (GM_GPCR_AU_DUP_DIS | GM_GPCR_AU_FCT_DIS|GM_GPCR_AU_SPD_DIS)
1757
1758
1759 enum {
1760 GM_TXCR_FORCE_JAM = 1<<15,
1761 GM_TXCR_CRC_DIS = 1<<14,
1762 GM_TXCR_PAD_DIS = 1<<13,
1763 GM_TXCR_COL_THR_MSK = 7<<10,
1764 };
1765
1766 #define TX_COL_THR(x) (((x)<<10) & GM_TXCR_COL_THR_MSK)
1767 #define TX_COL_DEF 0x04
1768
1769
1770 enum {
1771 GM_RXCR_UCF_ENA = 1<<15,
1772 GM_RXCR_MCF_ENA = 1<<14,
1773 GM_RXCR_CRC_DIS = 1<<13,
1774 GM_RXCR_PASS_FC = 1<<12,
1775 };
1776
1777
1778 enum {
1779 GM_TXPA_JAMLEN_MSK = 0x03<<14,
1780 GM_TXPA_JAMIPG_MSK = 0x1f<<9,
1781 GM_TXPA_JAMDAT_MSK = 0x1f<<4,
1782
1783 TX_JAM_LEN_DEF = 0x03,
1784 TX_JAM_IPG_DEF = 0x0b,
1785 TX_IPG_JAM_DEF = 0x1c,
1786 };
1787
1788 #define TX_JAM_LEN_VAL(x) (((x)<<14) & GM_TXPA_JAMLEN_MSK)
1789 #define TX_JAM_IPG_VAL(x) (((x)<<9) & GM_TXPA_JAMIPG_MSK)
1790 #define TX_IPG_JAM_DATA(x) (((x)<<4) & GM_TXPA_JAMDAT_MSK)
1791
1792
1793
1794 enum {
1795 GM_SMOD_DATABL_MSK = 0x1f<<11,
1796 GM_SMOD_LIMIT_4 = 1<<10,
1797 GM_SMOD_VLAN_ENA = 1<<9,
1798 GM_SMOD_JUMBO_ENA = 1<<8,
1799 GM_SMOD_IPG_MSK = 0x1f
1800 };
1801
1802 #define DATA_BLIND_VAL(x) (((x)<<11) & GM_SMOD_DATABL_MSK)
1803 #define DATA_BLIND_DEF 0x04
1804
1805 #define IPG_DATA_VAL(x) (x & GM_SMOD_IPG_MSK)
1806 #define IPG_DATA_DEF 0x1e
1807
1808
1809 enum {
1810 GM_SMI_CT_PHY_A_MSK = 0x1f<<11,
1811 GM_SMI_CT_REG_A_MSK = 0x1f<<6,
1812 GM_SMI_CT_OP_RD = 1<<5,
1813 GM_SMI_CT_RD_VAL = 1<<4,
1814 GM_SMI_CT_BUSY = 1<<3,
1815 };
1816
1817 #define GM_SMI_CT_PHY_AD(x) (((x)<<11) & GM_SMI_CT_PHY_A_MSK)
1818 #define GM_SMI_CT_REG_AD(x) (((x)<<6) & GM_SMI_CT_REG_A_MSK)
1819
1820
1821 enum {
1822 GM_PAR_MIB_CLR = 1<<5,
1823 GM_PAR_MIB_TST = 1<<4,
1824 };
1825
1826
1827 enum {
1828 GMR_FS_LEN = 0xffff<<16,
1829 GMR_FS_LEN_SHIFT = 16,
1830 GMR_FS_VLAN = 1<<13,
1831 GMR_FS_JABBER = 1<<12,
1832 GMR_FS_UN_SIZE = 1<<11,
1833 GMR_FS_MC = 1<<10,
1834 GMR_FS_BC = 1<<9,
1835 GMR_FS_RX_OK = 1<<8,
1836 GMR_FS_GOOD_FC = 1<<7,
1837 GMR_FS_BAD_FC = 1<<6,
1838 GMR_FS_MII_ERR = 1<<5,
1839 GMR_FS_LONG_ERR = 1<<4,
1840 GMR_FS_FRAGMENT = 1<<3,
1841
1842 GMR_FS_CRC_ERR = 1<<1,
1843 GMR_FS_RX_FF_OV = 1<<0,
1844
1845
1846
1847
1848 GMR_FS_ANY_ERR = GMR_FS_CRC_ERR | GMR_FS_LONG_ERR |
1849 GMR_FS_MII_ERR | GMR_FS_BAD_FC | GMR_FS_GOOD_FC |
1850 GMR_FS_JABBER,
1851
1852 RX_FF_FL_DEF_MSK = GMR_FS_CRC_ERR | GMR_FS_RX_FF_OV |GMR_FS_MII_ERR |
1853 GMR_FS_BAD_FC | GMR_FS_UN_SIZE | GMR_FS_JABBER,
1854 };
1855
1856
1857 enum {
1858 GMF_WP_TST_ON = 1<<14,
1859 GMF_WP_TST_OFF = 1<<13,
1860 GMF_WP_STEP = 1<<12,
1861
1862 GMF_RP_TST_ON = 1<<10,
1863 GMF_RP_TST_OFF = 1<<9,
1864 GMF_RP_STEP = 1<<8,
1865 GMF_RX_F_FL_ON = 1<<7,
1866 GMF_RX_F_FL_OFF = 1<<6,
1867 GMF_CLI_RX_FO = 1<<5,
1868 GMF_CLI_RX_FC = 1<<4,
1869 GMF_OPER_ON = 1<<3,
1870 GMF_OPER_OFF = 1<<2,
1871 GMF_RST_CLR = 1<<1,
1872 GMF_RST_SET = 1<<0,
1873
1874 RX_GMF_FL_THR_DEF = 0xa,
1875 };
1876
1877
1878
1879 enum {
1880 GMF_WSP_TST_ON = 1<<18,
1881 GMF_WSP_TST_OFF = 1<<17,
1882 GMF_WSP_STEP = 1<<16,
1883
1884 GMF_CLI_TX_FU = 1<<6,
1885 GMF_CLI_TX_FC = 1<<5,
1886 GMF_CLI_TX_PE = 1<<4,
1887 };
1888
1889
1890 enum {
1891 GMT_ST_START = 1<<2,
1892 GMT_ST_STOP = 1<<1,
1893 GMT_ST_CLR_IRQ = 1<<0,
1894 };
1895
1896
1897 enum {
1898 GMC_H_BURST_ON = 1<<7,
1899 GMC_H_BURST_OFF = 1<<6,
1900 GMC_F_LOOPB_ON = 1<<5,
1901 GMC_F_LOOPB_OFF = 1<<4,
1902 GMC_PAUSE_ON = 1<<3,
1903 GMC_PAUSE_OFF = 1<<2,
1904 GMC_RST_CLR = 1<<1,
1905 GMC_RST_SET = 1<<0,
1906 };
1907
1908
1909 enum {
1910 GPC_SEL_BDT = 1<<28,
1911 GPC_INT_POL_HI = 1<<27,
1912 GPC_75_OHM = 1<<26,
1913 GPC_DIS_FC = 1<<25,
1914 GPC_DIS_SLEEP = 1<<24,
1915 GPC_HWCFG_M_3 = 1<<23,
1916 GPC_HWCFG_M_2 = 1<<22,
1917 GPC_HWCFG_M_1 = 1<<21,
1918 GPC_HWCFG_M_0 = 1<<20,
1919 GPC_ANEG_0 = 1<<19,
1920 GPC_ENA_XC = 1<<18,
1921 GPC_DIS_125 = 1<<17,
1922 GPC_ANEG_3 = 1<<16,
1923 GPC_ANEG_2 = 1<<15,
1924 GPC_ANEG_1 = 1<<14,
1925 GPC_ENA_PAUSE = 1<<13,
1926 GPC_PHYADDR_4 = 1<<12,
1927 GPC_PHYADDR_3 = 1<<11,
1928 GPC_PHYADDR_2 = 1<<10,
1929 GPC_PHYADDR_1 = 1<<9,
1930 GPC_PHYADDR_0 = 1<<8,
1931
1932 GPC_RST_CLR = 1<<1,
1933 GPC_RST_SET = 1<<0,
1934 };
1935
1936 #define GPC_HWCFG_GMII_COP (GPC_HWCFG_M_3|GPC_HWCFG_M_2 | GPC_HWCFG_M_1 | GPC_HWCFG_M_0)
1937 #define GPC_HWCFG_GMII_FIB (GPC_HWCFG_M_2 | GPC_HWCFG_M_1 | GPC_HWCFG_M_0)
1938 #define GPC_ANEG_ADV_ALL_M (GPC_ANEG_3 | GPC_ANEG_2 | GPC_ANEG_1 | GPC_ANEG_0)
1939
1940
1941 #define GPC_FRC10MBIT_HALF 0
1942 #define GPC_FRC10MBIT_FULL GPC_ANEG_0
1943 #define GPC_FRC100MBIT_HALF GPC_ANEG_1
1944 #define GPC_FRC100MBIT_FULL (GPC_ANEG_0 | GPC_ANEG_1)
1945
1946
1947
1948 #define GPC_ADV_1000_HALF GPC_ANEG_2
1949 #define GPC_ADV_1000_FULL GPC_ANEG_3
1950 #define GPC_ADV_ALL (GPC_ANEG_2 | GPC_ANEG_3)
1951
1952
1953
1954 #define GPC_FORCE_MASTER 0
1955 #define GPC_FORCE_SLAVE GPC_ANEG_0
1956 #define GPC_PREF_MASTER GPC_ANEG_1
1957 #define GPC_PREF_SLAVE (GPC_ANEG_1 | GPC_ANEG_0)
1958
1959
1960
1961 enum {
1962 GM_IS_TX_CO_OV = 1<<5,
1963 GM_IS_RX_CO_OV = 1<<4,
1964 GM_IS_TX_FF_UR = 1<<3,
1965 GM_IS_TX_COMPL = 1<<2,
1966 GM_IS_RX_FF_OR = 1<<1,
1967 GM_IS_RX_COMPL = 1<<0,
1968
1969 #define GMAC_DEF_MSK (GM_IS_RX_FF_OR | GM_IS_TX_FF_UR)
1970
1971
1972
1973 GMLC_RST_CLR = 1<<1,
1974 GMLC_RST_SET = 1<<0,
1975
1976
1977
1978 WOL_CTL_LINK_CHG_OCC = 1<<15,
1979 WOL_CTL_MAGIC_PKT_OCC = 1<<14,
1980 WOL_CTL_PATTERN_OCC = 1<<13,
1981 WOL_CTL_CLEAR_RESULT = 1<<12,
1982 WOL_CTL_ENA_PME_ON_LINK_CHG = 1<<11,
1983 WOL_CTL_DIS_PME_ON_LINK_CHG = 1<<10,
1984 WOL_CTL_ENA_PME_ON_MAGIC_PKT = 1<<9,
1985 WOL_CTL_DIS_PME_ON_MAGIC_PKT = 1<<8,
1986 WOL_CTL_ENA_PME_ON_PATTERN = 1<<7,
1987 WOL_CTL_DIS_PME_ON_PATTERN = 1<<6,
1988 WOL_CTL_ENA_LINK_CHG_UNIT = 1<<5,
1989 WOL_CTL_DIS_LINK_CHG_UNIT = 1<<4,
1990 WOL_CTL_ENA_MAGIC_PKT_UNIT = 1<<3,
1991 WOL_CTL_DIS_MAGIC_PKT_UNIT = 1<<2,
1992 WOL_CTL_ENA_PATTERN_UNIT = 1<<1,
1993 WOL_CTL_DIS_PATTERN_UNIT = 1<<0,
1994 };
1995
1996 #define WOL_CTL_DEFAULT \
1997 (WOL_CTL_DIS_PME_ON_LINK_CHG | \
1998 WOL_CTL_DIS_PME_ON_PATTERN | \
1999 WOL_CTL_DIS_PME_ON_MAGIC_PKT | \
2000 WOL_CTL_DIS_LINK_CHG_UNIT | \
2001 WOL_CTL_DIS_PATTERN_UNIT | \
2002 WOL_CTL_DIS_MAGIC_PKT_UNIT)
2003
2004
2005 #define WOL_CTL_PATT_ENA(x) (1 << (x))
2006
2007
2008
2009 enum {
2010 XM_MMU_CMD = 0x0000,
2011 XM_POFF = 0x0008,
2012 XM_BURST = 0x000c,
2013 XM_1L_VLAN_TAG = 0x0010,
2014 XM_2L_VLAN_TAG = 0x0014,
2015 XM_TX_CMD = 0x0020,
2016 XM_TX_RT_LIM = 0x0024,
2017 XM_TX_STIME = 0x0028,
2018 XM_TX_IPG = 0x002c,
2019 XM_RX_CMD = 0x0030,
2020 XM_PHY_ADDR = 0x0034,
2021 XM_PHY_DATA = 0x0038,
2022 XM_GP_PORT = 0x0040,
2023 XM_IMSK = 0x0044,
2024 XM_ISRC = 0x0048,
2025 XM_HW_CFG = 0x004c,
2026 XM_TX_LO_WM = 0x0060,
2027 XM_TX_HI_WM = 0x0062,
2028 XM_TX_THR = 0x0064,
2029 XM_HT_THR = 0x0066,
2030 XM_PAUSE_DA = 0x0068,
2031 XM_CTL_PARA = 0x0070,
2032 XM_MAC_OPCODE = 0x0074,
2033 XM_MAC_PTIME = 0x0076,
2034 XM_TX_STAT = 0x0078,
2035
2036 XM_EXM_START = 0x0080,
2037 #define XM_EXM(reg) (XM_EXM_START + ((reg) << 3))
2038 };
2039
2040 enum {
2041 XM_SRC_CHK = 0x0100,
2042 XM_SA = 0x0108,
2043 XM_HSM = 0x0110,
2044 XM_RX_LO_WM = 0x0118,
2045 XM_RX_HI_WM = 0x011a,
2046 XM_RX_THR = 0x011c,
2047 XM_DEV_ID = 0x0120,
2048 XM_MODE = 0x0124,
2049 XM_LSA = 0x0128,
2050 XM_TS_READ = 0x0130,
2051 XM_TS_LOAD = 0x0134,
2052 XM_STAT_CMD = 0x0200,
2053 XM_RX_CNT_EV = 0x0204,
2054 XM_TX_CNT_EV = 0x0208,
2055 XM_RX_EV_MSK = 0x020c,
2056 XM_TX_EV_MSK = 0x0210,
2057 XM_TXF_OK = 0x0280,
2058 XM_TXO_OK_HI = 0x0284,
2059 XM_TXO_OK_LO = 0x0288,
2060 XM_TXF_BC_OK = 0x028c,
2061 XM_TXF_MC_OK = 0x0290,
2062 XM_TXF_UC_OK = 0x0294,
2063 XM_TXF_LONG = 0x0298,
2064 XM_TXE_BURST = 0x029c,
2065 XM_TXF_MPAUSE = 0x02a0,
2066 XM_TXF_MCTRL = 0x02a4,
2067 XM_TXF_SNG_COL = 0x02a8,
2068 XM_TXF_MUL_COL = 0x02ac,
2069 XM_TXF_ABO_COL = 0x02b0,
2070 XM_TXF_LAT_COL = 0x02b4,
2071 XM_TXF_DEF = 0x02b8,
2072 XM_TXF_EX_DEF = 0x02bc,
2073 XM_TXE_FIFO_UR = 0x02c0,
2074 XM_TXE_CS_ERR = 0x02c4,
2075 XM_TXP_UTIL = 0x02c8,
2076 XM_TXF_64B = 0x02d0,
2077 XM_TXF_127B = 0x02d4,
2078 XM_TXF_255B = 0x02d8,
2079 XM_TXF_511B = 0x02dc,
2080 XM_TXF_1023B = 0x02e0,
2081 XM_TXF_MAX_SZ = 0x02e4,
2082 XM_RXF_OK = 0x0300,
2083 XM_RXO_OK_HI = 0x0304,
2084 XM_RXO_OK_LO = 0x0308,
2085 XM_RXF_BC_OK = 0x030c,
2086 XM_RXF_MC_OK = 0x0310,
2087 XM_RXF_UC_OK = 0x0314,
2088 XM_RXF_MPAUSE = 0x0318,
2089 XM_RXF_MCTRL = 0x031c,
2090 XM_RXF_INV_MP = 0x0320,
2091 XM_RXF_INV_MOC = 0x0324,
2092 XM_RXE_BURST = 0x0328,
2093 XM_RXE_FMISS = 0x032c,
2094 XM_RXF_FRA_ERR = 0x0330,
2095 XM_RXE_FIFO_OV = 0x0334,
2096 XM_RXF_JAB_PKT = 0x0338,
2097 XM_RXE_CAR_ERR = 0x033c,
2098 XM_RXF_LEN_ERR = 0x0340,
2099 XM_RXE_SYM_ERR = 0x0344,
2100 XM_RXE_SHT_ERR = 0x0348,
2101 XM_RXE_RUNT = 0x034c,
2102 XM_RXF_LNG_ERR = 0x0350,
2103 XM_RXF_FCS_ERR = 0x0354,
2104 XM_RXF_CEX_ERR = 0x035c,
2105 XM_RXP_UTIL = 0x0360,
2106 XM_RXF_64B = 0x0368,
2107 XM_RXF_127B = 0x036c,
2108 XM_RXF_255B = 0x0370,
2109 XM_RXF_511B = 0x0374,
2110 XM_RXF_1023B = 0x0378,
2111 XM_RXF_MAX_SZ = 0x037c,
2112 };
2113
2114
2115 enum {
2116 XM_MMU_PHY_RDY = 1<<12,
2117 XM_MMU_PHY_BUSY = 1<<11,
2118 XM_MMU_IGN_PF = 1<<10,
2119 XM_MMU_MAC_LB = 1<<9,
2120 XM_MMU_FRC_COL = 1<<7,
2121 XM_MMU_SIM_COL = 1<<6,
2122 XM_MMU_NO_PRE = 1<<5,
2123 XM_MMU_GMII_FD = 1<<4,
2124 XM_MMU_RAT_CTRL = 1<<3,
2125 XM_MMU_GMII_LOOP= 1<<2,
2126 XM_MMU_ENA_RX = 1<<1,
2127 XM_MMU_ENA_TX = 1<<0,
2128 };
2129
2130
2131
2132 enum {
2133 XM_TX_BK2BK = 1<<6,
2134 XM_TX_ENC_BYP = 1<<5,
2135 XM_TX_SAM_LINE = 1<<4,
2136 XM_TX_NO_GIG_MD = 1<<3,
2137 XM_TX_NO_PRE = 1<<2,
2138 XM_TX_NO_CRC = 1<<1,
2139 XM_TX_AUTO_PAD = 1<<0,
2140 };
2141
2142
2143 #define XM_RT_LIM_MSK 0x1f
2144
2145
2146
2147 #define XM_STIME_MSK 0x7f
2148
2149
2150
2151 #define XM_IPG_MSK 0xff
2152
2153
2154
2155 enum {
2156 XM_RX_LENERR_OK = 1<<8,
2157
2158 XM_RX_BIG_PK_OK = 1<<7,
2159
2160 XM_RX_IPG_CAP = 1<<6,
2161 XM_RX_TP_MD = 1<<5,
2162 XM_RX_STRIP_FCS = 1<<4,
2163 XM_RX_SELF_RX = 1<<3,
2164 XM_RX_SAM_LINE = 1<<2,
2165 XM_RX_STRIP_PAD = 1<<1,
2166 XM_RX_DIS_CEXT = 1<<0,
2167 };
2168
2169
2170
2171 enum {
2172 XM_GP_ANIP = 1<<6,
2173 XM_GP_FRC_INT = 1<<5,
2174 XM_GP_RES_MAC = 1<<3,
2175 XM_GP_RES_STAT = 1<<2,
2176 XM_GP_INP_ASS = 1<<0,
2177 };
2178
2179
2180
2181
2182 enum {
2183 XM_IS_LNK_AE = 1<<14,
2184 XM_IS_TX_ABORT = 1<<13,
2185 XM_IS_FRC_INT = 1<<12,
2186 XM_IS_INP_ASS = 1<<11,
2187 XM_IS_LIPA_RC = 1<<10,
2188 XM_IS_RX_PAGE = 1<<9,
2189 XM_IS_TX_PAGE = 1<<8,
2190 XM_IS_AND = 1<<7,
2191 XM_IS_TSC_OV = 1<<6,
2192 XM_IS_RXC_OV = 1<<5,
2193 XM_IS_TXC_OV = 1<<4,
2194 XM_IS_RXF_OV = 1<<3,
2195 XM_IS_TXF_UR = 1<<2,
2196 XM_IS_TX_COMP = 1<<1,
2197 XM_IS_RX_COMP = 1<<0,
2198
2199 XM_IMSK_DISABLE = 0xffff,
2200 };
2201
2202
2203 enum {
2204 XM_HW_GEN_EOP = 1<<3,
2205 XM_HW_COM4SIG = 1<<2,
2206 XM_HW_GMII_MD = 1<<0,
2207 };
2208
2209
2210
2211
2212 #define XM_TX_WM_MSK 0x01ff
2213
2214
2215
2216
2217 #define XM_THR_MSK 0x03ff
2218
2219
2220
2221 enum {
2222 XM_ST_VALID = (1UL<<31),
2223 XM_ST_BYTE_CNT = (0x3fffL<<17),
2224 XM_ST_RETRY_CNT = (0x1fL<<12),
2225 XM_ST_EX_COL = 1<<11,
2226 XM_ST_EX_DEF = 1<<10,
2227 XM_ST_BURST = 1<<9,
2228 XM_ST_DEFER = 1<<8,
2229 XM_ST_BC = 1<<7,
2230 XM_ST_MC = 1<<6,
2231 XM_ST_UC = 1<<5,
2232 XM_ST_TX_UR = 1<<4,
2233 XM_ST_CS_ERR = 1<<3,
2234 XM_ST_LAT_COL = 1<<2,
2235 XM_ST_MUL_COL = 1<<1,
2236 XM_ST_SGN_COL = 1<<0,
2237 };
2238
2239
2240
2241 #define XM_RX_WM_MSK 0x03ff
2242
2243
2244
2245 #define XM_DEV_OUI (0x00ffffffUL<<8)
2246 #define XM_DEV_REV (0x07L << 5)
2247
2248
2249
2250 enum {
2251 XM_MD_ENA_REJ = 1<<26,
2252 XM_MD_SPOE_E = 1<<25,
2253
2254 XM_MD_TX_REP = 1<<24,
2255 XM_MD_SPOFF_I = 1<<23,
2256
2257 XM_MD_LE_STW = 1<<22,
2258 XM_MD_TX_CONT = 1<<21,
2259 XM_MD_TX_PAUSE = 1<<20,
2260 XM_MD_ATS = 1<<19,
2261 XM_MD_SPOL_I = 1<<18,
2262
2263 XM_MD_SPOH_I = 1<<17,
2264
2265 XM_MD_CAP = 1<<16,
2266 XM_MD_ENA_HASH = 1<<15,
2267 XM_MD_CSA = 1<<14,
2268 XM_MD_CAA = 1<<13,
2269 XM_MD_RX_MCTRL = 1<<12,
2270 XM_MD_RX_RUNT = 1<<11,
2271 XM_MD_RX_IRLE = 1<<10,
2272 XM_MD_RX_LONG = 1<<9,
2273 XM_MD_RX_CRCE = 1<<8,
2274 XM_MD_RX_ERR = 1<<7,
2275 XM_MD_DIS_UC = 1<<6,
2276 XM_MD_DIS_MC = 1<<5,
2277 XM_MD_DIS_BC = 1<<4,
2278 XM_MD_ENA_PROM = 1<<3,
2279 XM_MD_ENA_BE = 1<<2,
2280 XM_MD_FTF = 1<<1,
2281 XM_MD_FRF = 1<<0,
2282 };
2283
2284 #define XM_PAUSE_MODE (XM_MD_SPOE_E | XM_MD_SPOL_I | XM_MD_SPOH_I)
2285 #define XM_DEF_MODE (XM_MD_RX_RUNT | XM_MD_RX_IRLE | XM_MD_RX_LONG |\
2286 XM_MD_RX_CRCE | XM_MD_RX_ERR | XM_MD_CSA)
2287
2288
2289 enum {
2290 XM_SC_SNP_RXC = 1<<5,
2291 XM_SC_SNP_TXC = 1<<4,
2292 XM_SC_CP_RXC = 1<<3,
2293 XM_SC_CP_TXC = 1<<2,
2294 XM_SC_CLR_RXC = 1<<1,
2295 XM_SC_CLR_TXC = 1<<0,
2296 };
2297
2298
2299
2300
2301 enum {
2302 XMR_MAX_SZ_OV = 1<<31,
2303 XMR_1023B_OV = 1<<30,
2304 XMR_511B_OV = 1<<29,
2305 XMR_255B_OV = 1<<28,
2306 XMR_127B_OV = 1<<27,
2307 XMR_64B_OV = 1<<26,
2308 XMR_UTIL_OV = 1<<25,
2309 XMR_UTIL_UR = 1<<24,
2310 XMR_CEX_ERR_OV = 1<<23,
2311 XMR_FCS_ERR_OV = 1<<21,
2312 XMR_LNG_ERR_OV = 1<<20,
2313 XMR_RUNT_OV = 1<<19,
2314 XMR_SHT_ERR_OV = 1<<18,
2315 XMR_SYM_ERR_OV = 1<<17,
2316 XMR_CAR_ERR_OV = 1<<15,
2317 XMR_JAB_PKT_OV = 1<<14,
2318 XMR_FIFO_OV = 1<<13,
2319 XMR_FRA_ERR_OV = 1<<12,
2320 XMR_FMISS_OV = 1<<11,
2321 XMR_BURST = 1<<10,
2322 XMR_INV_MOC = 1<<9,
2323 XMR_INV_MP = 1<<8,
2324 XMR_MCTRL_OV = 1<<7,
2325 XMR_MPAUSE_OV = 1<<6,
2326 XMR_UC_OK_OV = 1<<5,
2327 XMR_MC_OK_OV = 1<<4,
2328 XMR_BC_OK_OV = 1<<3,
2329 XMR_OK_LO_OV = 1<<2,
2330 XMR_OK_HI_OV = 1<<1,
2331 XMR_OK_OV = 1<<0,
2332 };
2333
2334 #define XMR_DEF_MSK (XMR_OK_LO_OV | XMR_OK_HI_OV)
2335
2336
2337
2338 enum {
2339 XMT_MAX_SZ_OV = 1<<25,
2340 XMT_1023B_OV = 1<<24,
2341 XMT_511B_OV = 1<<23,
2342 XMT_255B_OV = 1<<22,
2343 XMT_127B_OV = 1<<21,
2344 XMT_64B_OV = 1<<20,
2345 XMT_UTIL_OV = 1<<19,
2346 XMT_UTIL_UR = 1<<18,
2347 XMT_CS_ERR_OV = 1<<17,
2348 XMT_FIFO_UR_OV = 1<<16,
2349 XMT_EX_DEF_OV = 1<<15,
2350 XMT_DEF = 1<<14,
2351 XMT_LAT_COL_OV = 1<<13,
2352 XMT_ABO_COL_OV = 1<<12,
2353 XMT_MUL_COL_OV = 1<<11,
2354 XMT_SNG_COL = 1<<10,
2355 XMT_MCTRL_OV = 1<<9,
2356 XMT_MPAUSE = 1<<8,
2357 XMT_BURST = 1<<7,
2358 XMT_LONG = 1<<6,
2359 XMT_UC_OK_OV = 1<<5,
2360 XMT_MC_OK_OV = 1<<4,
2361 XMT_BC_OK_OV = 1<<3,
2362 XMT_OK_LO_OV = 1<<2,
2363 XMT_OK_HI_OV = 1<<1,
2364 XMT_OK_OV = 1<<0,
2365 };
2366
2367 #define XMT_DEF_MSK (XMT_OK_LO_OV | XMT_OK_HI_OV)
2368
2369 struct skge_rx_desc {
2370 u32 control;
2371 u32 next_offset;
2372 u32 dma_lo;
2373 u32 dma_hi;
2374 u32 status;
2375 u32 timestamp;
2376 u16 csum2;
2377 u16 csum1;
2378 u16 csum2_start;
2379 u16 csum1_start;
2380 };
2381
2382 struct skge_tx_desc {
2383 u32 control;
2384 u32 next_offset;
2385 u32 dma_lo;
2386 u32 dma_hi;
2387 u32 status;
2388 u32 csum_offs;
2389 u16 csum_write;
2390 u16 csum_start;
2391 u32 rsvd;
2392 };
2393
2394 struct skge_element {
2395 struct skge_element *next;
2396 void *desc;
2397 struct sk_buff *skb;
2398 DEFINE_DMA_UNMAP_ADDR(mapaddr);
2399 DEFINE_DMA_UNMAP_LEN(maplen);
2400 };
2401
2402 struct skge_ring {
2403 struct skge_element *to_clean;
2404 struct skge_element *to_use;
2405 struct skge_element *start;
2406 unsigned long count;
2407 };
2408
2409
2410 struct skge_hw {
2411 void __iomem *regs;
2412 struct pci_dev *pdev;
2413 spinlock_t hw_lock;
2414 u32 intr_mask;
2415 struct net_device *dev[2];
2416
2417 u8 chip_id;
2418 u8 chip_rev;
2419 u8 copper;
2420 u8 ports;
2421 u8 phy_type;
2422
2423 u32 ram_size;
2424 u32 ram_offset;
2425 u16 phy_addr;
2426 spinlock_t phy_lock;
2427 struct tasklet_struct phy_task;
2428
2429 char irq_name[0];
2430 };
2431
2432 enum pause_control {
2433 FLOW_MODE_NONE = 1,
2434 FLOW_MODE_LOC_SEND = 2,
2435 FLOW_MODE_SYMMETRIC = 3,
2436 FLOW_MODE_SYM_OR_REM = 4,
2437
2438
2439 };
2440
2441 enum pause_status {
2442 FLOW_STAT_INDETERMINATED=0,
2443 FLOW_STAT_NONE,
2444 FLOW_STAT_REM_SEND,
2445 FLOW_STAT_LOC_SEND,
2446 FLOW_STAT_SYMMETRIC,
2447 };
2448
2449
2450 struct skge_port {
2451 struct skge_hw *hw;
2452 struct net_device *netdev;
2453 struct napi_struct napi;
2454 int port;
2455 u32 msg_enable;
2456
2457 struct skge_ring tx_ring;
2458
2459 struct skge_ring rx_ring ____cacheline_aligned_in_smp;
2460 unsigned int rx_buf_size;
2461
2462 struct timer_list link_timer;
2463 enum pause_control flow_control;
2464 enum pause_status flow_status;
2465 u8 blink_on;
2466 u8 wol;
2467 u8 autoneg;
2468 u8 duplex;
2469 u16 speed;
2470 u32 advertising;
2471
2472 void *mem;
2473 dma_addr_t dma;
2474 unsigned long mem_size;
2475 #ifdef CONFIG_SKGE_DEBUG
2476 struct dentry *debugfs;
2477 #endif
2478 };
2479
2480
2481
2482 static inline u32 skge_read32(const struct skge_hw *hw, int reg)
2483 {
2484 return readl(hw->regs + reg);
2485 }
2486
2487 static inline u16 skge_read16(const struct skge_hw *hw, int reg)
2488 {
2489 return readw(hw->regs + reg);
2490 }
2491
2492 static inline u8 skge_read8(const struct skge_hw *hw, int reg)
2493 {
2494 return readb(hw->regs + reg);
2495 }
2496
2497 static inline void skge_write32(const struct skge_hw *hw, int reg, u32 val)
2498 {
2499 writel(val, hw->regs + reg);
2500 }
2501
2502 static inline void skge_write16(const struct skge_hw *hw, int reg, u16 val)
2503 {
2504 writew(val, hw->regs + reg);
2505 }
2506
2507 static inline void skge_write8(const struct skge_hw *hw, int reg, u8 val)
2508 {
2509 writeb(val, hw->regs + reg);
2510 }
2511
2512
2513 #define SK_REG(port,reg) (((port)<<7)+(u16)(reg))
2514 #define SK_XMAC_REG(port, reg) \
2515 ((BASE_XMAC_1 + (port) * (BASE_XMAC_2 - BASE_XMAC_1)) | (reg) << 1)
2516
2517 static inline u32 xm_read32(const struct skge_hw *hw, int port, int reg)
2518 {
2519 u32 v;
2520 v = skge_read16(hw, SK_XMAC_REG(port, reg));
2521 v |= (u32)skge_read16(hw, SK_XMAC_REG(port, reg+2)) << 16;
2522 return v;
2523 }
2524
2525 static inline u16 xm_read16(const struct skge_hw *hw, int port, int reg)
2526 {
2527 return skge_read16(hw, SK_XMAC_REG(port,reg));
2528 }
2529
2530 static inline void xm_write32(const struct skge_hw *hw, int port, int r, u32 v)
2531 {
2532 skge_write16(hw, SK_XMAC_REG(port,r), v & 0xffff);
2533 skge_write16(hw, SK_XMAC_REG(port,r+2), v >> 16);
2534 }
2535
2536 static inline void xm_write16(const struct skge_hw *hw, int port, int r, u16 v)
2537 {
2538 skge_write16(hw, SK_XMAC_REG(port,r), v);
2539 }
2540
2541 static inline void xm_outhash(const struct skge_hw *hw, int port, int reg,
2542 const u8 *hash)
2543 {
2544 xm_write16(hw, port, reg, (u16)hash[0] | ((u16)hash[1] << 8));
2545 xm_write16(hw, port, reg+2, (u16)hash[2] | ((u16)hash[3] << 8));
2546 xm_write16(hw, port, reg+4, (u16)hash[4] | ((u16)hash[5] << 8));
2547 xm_write16(hw, port, reg+6, (u16)hash[6] | ((u16)hash[7] << 8));
2548 }
2549
2550 static inline void xm_outaddr(const struct skge_hw *hw, int port, int reg,
2551 const u8 *addr)
2552 {
2553 xm_write16(hw, port, reg, (u16)addr[0] | ((u16)addr[1] << 8));
2554 xm_write16(hw, port, reg+2, (u16)addr[2] | ((u16)addr[3] << 8));
2555 xm_write16(hw, port, reg+4, (u16)addr[4] | ((u16)addr[5] << 8));
2556 }
2557
2558 #define SK_GMAC_REG(port,reg) \
2559 (BASE_GMAC_1 + (port) * (BASE_GMAC_2-BASE_GMAC_1) + (reg))
2560
2561 static inline u16 gma_read16(const struct skge_hw *hw, int port, int reg)
2562 {
2563 return skge_read16(hw, SK_GMAC_REG(port,reg));
2564 }
2565
2566 static inline u32 gma_read32(const struct skge_hw *hw, int port, int reg)
2567 {
2568 return (u32) skge_read16(hw, SK_GMAC_REG(port,reg))
2569 | ((u32)skge_read16(hw, SK_GMAC_REG(port,reg+4)) << 16);
2570 }
2571
2572 static inline void gma_write16(const struct skge_hw *hw, int port, int r, u16 v)
2573 {
2574 skge_write16(hw, SK_GMAC_REG(port,r), v);
2575 }
2576
2577 static inline void gma_set_addr(struct skge_hw *hw, int port, int reg,
2578 const u8 *addr)
2579 {
2580 gma_write16(hw, port, reg, (u16) addr[0] | ((u16) addr[1] << 8));
2581 gma_write16(hw, port, reg+4,(u16) addr[2] | ((u16) addr[3] << 8));
2582 gma_write16(hw, port, reg+8,(u16) addr[4] | ((u16) addr[5] << 8));
2583 }
2584
2585 #endif