blob: cee30037db03dee0fb30b4c4f36605ecf55ac1d5 [file] [log] [blame]
wdenk9c53f402003-10-15 23:53:47 +00001/*
2 * tsec.h
3 *
4 * Driver for the Motorola Triple Speed Ethernet Controller
5 *
6 * This software may be used and distributed according to the
7 * terms of the GNU Public License, Version 2, incorporated
8 * herein by reference.
9 *
wdenka445ddf2004-06-09 00:34:46 +000010 * Copyright 2004 Freescale Semiconductor.
wdenk9c53f402003-10-15 23:53:47 +000011 * (C) Copyright 2003, Motorola, Inc.
12 * maintained by Xianghua Xiao (x.xiao@motorola.com)
13 * author Andy Fleming
14 *
15 */
16
17#ifndef __TSEC_H
18#define __TSEC_H
19
20#include <net.h>
Eran Liberty9095d4a2005-07-28 10:08:46 -050021#include <config.h>
wdenk9c53f402003-10-15 23:53:47 +000022
Eran Liberty9095d4a2005-07-28 10:08:46 -050023#ifndef CFG_TSEC1_OFFSET
24 #define CFG_TSEC1_OFFSET (0x24000)
25#endif
26
wdenka445ddf2004-06-09 00:34:46 +000027#define TSEC_SIZE 0x01000
wdenk9c53f402003-10-15 23:53:47 +000028
Eran Liberty9095d4a2005-07-28 10:08:46 -050029/* FIXME: Should these be pushed back to 83xx and 85xx config files? */
Jon Loeliger5c8aa972006-04-26 17:58:56 -050030#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
Eran Liberty9095d4a2005-07-28 10:08:46 -050031 #define TSEC_BASE_ADDR (CFG_IMMR + CFG_TSEC1_OFFSET)
32#elif defined(CONFIG_MPC83XX)
Timur Tabi386a2802006-11-03 12:00:28 -060033 #define TSEC_BASE_ADDR (CFG_IMMR + CFG_TSEC1_OFFSET)
Eran Liberty9095d4a2005-07-28 10:08:46 -050034#endif
35
36
wdenk9c53f402003-10-15 23:53:47 +000037#define MAC_ADDR_LEN 6
38
wdenka445ddf2004-06-09 00:34:46 +000039/* #define TSEC_TIMEOUT 1000000 */
40#define TSEC_TIMEOUT 1000
wdenk9c53f402003-10-15 23:53:47 +000041#define TOUT_LOOP 1000000
42
Stefan Roesec0dc34f2005-09-21 18:20:22 +020043#define PHY_AUTONEGOTIATE_TIMEOUT 5000 /* in ms */
44
wdenk9c53f402003-10-15 23:53:47 +000045/* MAC register bits */
46#define MACCFG1_SOFT_RESET 0x80000000
47#define MACCFG1_RESET_RX_MC 0x00080000
48#define MACCFG1_RESET_TX_MC 0x00040000
49#define MACCFG1_RESET_RX_FUN 0x00020000
50#define MACCFG1_RESET_TX_FUN 0x00010000
51#define MACCFG1_LOOPBACK 0x00000100
52#define MACCFG1_RX_FLOW 0x00000020
53#define MACCFG1_TX_FLOW 0x00000010
54#define MACCFG1_SYNCD_RX_EN 0x00000008
55#define MACCFG1_RX_EN 0x00000004
56#define MACCFG1_SYNCD_TX_EN 0x00000002
57#define MACCFG1_TX_EN 0x00000001
58
59#define MACCFG2_INIT_SETTINGS 0x00007205
60#define MACCFG2_FULL_DUPLEX 0x00000001
61#define MACCFG2_IF 0x00000300
wdenka445ddf2004-06-09 00:34:46 +000062#define MACCFG2_GMII 0x00000200
wdenk9c53f402003-10-15 23:53:47 +000063#define MACCFG2_MII 0x00000100
64
65#define ECNTRL_INIT_SETTINGS 0x00001000
66#define ECNTRL_TBI_MODE 0x00000020
Jon Loeliger77a4f6e2005-07-25 14:05:07 -050067#define ECNTRL_R100 0x00000008
wdenk9c53f402003-10-15 23:53:47 +000068
wdenka445ddf2004-06-09 00:34:46 +000069#define miim_end -2
70#define miim_read -1
71
wdenk9c53f402003-10-15 23:53:47 +000072#define TBIPA_VALUE 0x1f
73#define MIIMCFG_INIT_VALUE 0x00000003
74#define MIIMCFG_RESET 0x80000000
75
76#define MIIMIND_BUSY 0x00000001
77#define MIIMIND_NOTVALID 0x00000004
78
wdenk9c53f402003-10-15 23:53:47 +000079#define MIIM_CONTROL 0x00
wdenka445ddf2004-06-09 00:34:46 +000080#define MIIM_CONTROL_RESET 0x00009140
wdenk9c53f402003-10-15 23:53:47 +000081#define MIIM_CONTROL_INIT 0x00001140
Stefan Roesec0dc34f2005-09-21 18:20:22 +020082#define MIIM_CONTROL_RESTART 0x00001340
wdenk9c53f402003-10-15 23:53:47 +000083#define MIIM_ANEN 0x00001000
wdenka445ddf2004-06-09 00:34:46 +000084
85#define MIIM_CR 0x00
86#define MIIM_CR_RST 0x00008000
87#define MIIM_CR_INIT 0x00001000
wdenk78924a72004-04-18 21:45:42 +000088
89#define MIIM_STATUS 0x1
90#define MIIM_STATUS_AN_DONE 0x00000020
wdenka445ddf2004-06-09 00:34:46 +000091#define MIIM_STATUS_LINK 0x0004
Stefan Roesec0dc34f2005-09-21 18:20:22 +020092#define PHY_BMSR_AUTN_ABLE 0x0008
93#define PHY_BMSR_AUTN_COMP 0x0020
wdenk9c53f402003-10-15 23:53:47 +000094
wdenka445ddf2004-06-09 00:34:46 +000095#define MIIM_PHYIR1 0x2
96#define MIIM_PHYIR2 0x3
wdenk9c53f402003-10-15 23:53:47 +000097
wdenka445ddf2004-06-09 00:34:46 +000098#define MIIM_ANAR 0x4
99#define MIIM_ANAR_INIT 0x1e1
wdenk9c53f402003-10-15 23:53:47 +0000100
101#define MIIM_TBI_ANLPBPA 0x5
102#define MIIM_TBI_ANLPBPA_HALF 0x00000040
103#define MIIM_TBI_ANLPBPA_FULL 0x00000020
104
wdenka445ddf2004-06-09 00:34:46 +0000105#define MIIM_TBI_ANEX 0x6
106#define MIIM_TBI_ANEX_NP 0x00000004
107#define MIIM_TBI_ANEX_PRX 0x00000002
108
109#define MIIM_GBIT_CONTROL 0x9
110#define MIIM_GBIT_CONTROL_INIT 0xe00
wdenk9c53f402003-10-15 23:53:47 +0000111
wdenka445ddf2004-06-09 00:34:46 +0000112/* Cicada Auxiliary Control/Status Register */
113#define MIIM_CIS8201_AUX_CONSTAT 0x1c
114#define MIIM_CIS8201_AUXCONSTAT_INIT 0x0004
115#define MIIM_CIS8201_AUXCONSTAT_DUPLEX 0x0020
116#define MIIM_CIS8201_AUXCONSTAT_SPEED 0x0018
117#define MIIM_CIS8201_AUXCONSTAT_GBIT 0x0010
118#define MIIM_CIS8201_AUXCONSTAT_100 0x0008
wdenk9c53f402003-10-15 23:53:47 +0000119
wdenka445ddf2004-06-09 00:34:46 +0000120/* Cicada Extended Control Register 1 */
121#define MIIM_CIS8201_EXT_CON1 0x17
122#define MIIM_CIS8201_EXTCON1_INIT 0x0000
wdenk9c53f402003-10-15 23:53:47 +0000123
wdenka445ddf2004-06-09 00:34:46 +0000124/* Cicada 8204 Extended PHY Control Register 1 */
125#define MIIM_CIS8204_EPHY_CON 0x17
126#define MIIM_CIS8204_EPHYCON_INIT 0x0006
Wolfgang Denk4de55c02006-03-12 18:09:47 +0100127#define MIIM_CIS8204_EPHYCON_RGMII 0x1100
wdenka445ddf2004-06-09 00:34:46 +0000128
129/* Cicada 8204 Serial LED Control Register */
130#define MIIM_CIS8204_SLED_CON 0x1b
131#define MIIM_CIS8204_SLEDCON_INIT 0x1115
wdenk9c53f402003-10-15 23:53:47 +0000132
133#define MIIM_GBIT_CON 0x09
wdenk78924a72004-04-18 21:45:42 +0000134#define MIIM_GBIT_CON_ADVERT 0x0e00
wdenk9c53f402003-10-15 23:53:47 +0000135
Jon Loeliger5c8aa972006-04-26 17:58:56 -0500136/* Entry for Vitesse VSC8244 regs starts here */
137/* Vitesse VSC8244 Auxiliary Control/Status Register */
138#define MIIM_VSC8244_AUX_CONSTAT 0x1c
139#define MIIM_VSC8244_AUXCONSTAT_INIT 0x0000
140#define MIIM_VSC8244_AUXCONSTAT_DUPLEX 0x0020
141#define MIIM_VSC8244_AUXCONSTAT_SPEED 0x0018
142#define MIIM_VSC8244_AUXCONSTAT_GBIT 0x0010
143#define MIIM_VSC8244_AUXCONSTAT_100 0x0008
144#define MIIM_CONTROL_INIT_LOOPBACK 0x4000
145
146/* Vitesse VSC8244 Extended PHY Control Register 1 */
147#define MIIM_VSC8244_EPHY_CON 0x17
148#define MIIM_VSC8244_EPHYCON_INIT 0x0006
149
150/* Vitesse VSC8244 Serial LED Control Register */
151#define MIIM_VSC8244_LED_CON 0x1b
152#define MIIM_VSC8244_LEDCON_INIT 0xF011
153
wdenka445ddf2004-06-09 00:34:46 +0000154/* 88E1011 PHY Status Register */
155#define MIIM_88E1011_PHY_STATUS 0x11
156#define MIIM_88E1011_PHYSTAT_SPEED 0xc000
157#define MIIM_88E1011_PHYSTAT_GBIT 0x8000
158#define MIIM_88E1011_PHYSTAT_100 0x4000
159#define MIIM_88E1011_PHYSTAT_DUPLEX 0x2000
160#define MIIM_88E1011_PHYSTAT_SPDDONE 0x0800
161#define MIIM_88E1011_PHYSTAT_LINK 0x0400
162
Andy Fleming239e75f2006-09-13 10:34:18 -0500163#define MIIM_88E1011_PHY_SCR 0x10
164#define MIIM_88E1011_PHY_MDI_X_AUTO 0x0060
165
166/* 88E1111 PHY LED Control Register */
167#define MIIM_88E1111_PHY_LED_CONTROL 24
168#define MIIM_88E1111_PHY_LED_DIRECT 0x4100
169#define MIIM_88E1111_PHY_LED_COMBINE 0x411C
170
171/* 88E1145 Extended PHY Specific Control Register */
172#define MIIM_88E1145_PHY_EXT_CR 20
173#define MIIM_M88E1145_RGMII_RX_DELAY 0x0080
174#define MIIM_M88E1145_RGMII_TX_DELAY 0x0002
175
176#define MIIM_88E1145_PHY_PAGE 29
177#define MIIM_88E1145_PHY_CAL_OV 30
178
179
wdenka445ddf2004-06-09 00:34:46 +0000180/* DM9161 Control register values */
181#define MIIM_DM9161_CR_STOP 0x0400
182#define MIIM_DM9161_CR_RSTAN 0x1200
183
184#define MIIM_DM9161_SCR 0x10
185#define MIIM_DM9161_SCR_INIT 0x0610
186
187/* DM9161 Specified Configuration and Status Register */
188#define MIIM_DM9161_SCSR 0x11
189#define MIIM_DM9161_SCSR_100F 0x8000
190#define MIIM_DM9161_SCSR_100H 0x4000
191#define MIIM_DM9161_SCSR_10F 0x2000
192#define MIIM_DM9161_SCSR_10H 0x1000
193
194/* DM9161 10BT Configuration/Status */
195#define MIIM_DM9161_10BTCSR 0x12
196#define MIIM_DM9161_10BTCSR_INIT 0x7800
wdenk9c53f402003-10-15 23:53:47 +0000197
wdenkf41ff3b2005-04-04 23:43:44 +0000198/* LXT971 Status 2 registers */
Wolfgang Denka79c44f2006-03-12 18:06:37 +0100199#define MIIM_LXT971_SR2 0x11 /* Status Register 2 */
200#define MIIM_LXT971_SR2_SPEED_MASK 0x4200
201#define MIIM_LXT971_SR2_10HDX 0x0000 /* 10 Mbit half duplex selected */
202#define MIIM_LXT971_SR2_10FDX 0x0200 /* 10 Mbit full duplex selected */
203#define MIIM_LXT971_SR2_100HDX 0x4000 /* 100 Mbit half duplex selected */
204#define MIIM_LXT971_SR2_100FDX 0x4200 /* 100 Mbit full duplex selected */
wdenkf41ff3b2005-04-04 23:43:44 +0000205
Wolfgang Denkf0c4e462006-03-12 22:50:55 +0100206/* DP83865 Control register values */
207#define MIIM_DP83865_CR_INIT 0x9200
208
209/* DP83865 Link and Auto-Neg Status Register */
210#define MIIM_DP83865_LANR 0x11
211#define MIIM_DP83865_SPD_MASK 0x0018
212#define MIIM_DP83865_SPD_1000 0x0010
213#define MIIM_DP83865_SPD_100 0x0008
214#define MIIM_DP83865_DPX_FULL 0x0002
215
wdenk9c53f402003-10-15 23:53:47 +0000216#define MIIM_READ_COMMAND 0x00000001
217
218#define MRBLR_INIT_SETTINGS PKTSIZE_ALIGN
219
220#define MINFLR_INIT_SETTINGS 0x00000040
221
222#define DMACTRL_INIT_SETTINGS 0x000000c3
223#define DMACTRL_GRS 0x00000010
224#define DMACTRL_GTS 0x00000008
225
226#define TSTAT_CLEAR_THALT 0x80000000
227#define RSTAT_CLEAR_RHALT 0x00800000
228
wdenk9c53f402003-10-15 23:53:47 +0000229
wdenk9c53f402003-10-15 23:53:47 +0000230#define IEVENT_INIT_CLEAR 0xffffffff
231#define IEVENT_BABR 0x80000000
232#define IEVENT_RXC 0x40000000
233#define IEVENT_BSY 0x20000000
234#define IEVENT_EBERR 0x10000000
235#define IEVENT_MSRO 0x04000000
236#define IEVENT_GTSC 0x02000000
237#define IEVENT_BABT 0x01000000
238#define IEVENT_TXC 0x00800000
239#define IEVENT_TXE 0x00400000
240#define IEVENT_TXB 0x00200000
241#define IEVENT_TXF 0x00100000
242#define IEVENT_IE 0x00080000
243#define IEVENT_LC 0x00040000
244#define IEVENT_CRL 0x00020000
245#define IEVENT_XFUN 0x00010000
246#define IEVENT_RXB0 0x00008000
247#define IEVENT_GRSC 0x00000100
248#define IEVENT_RXF0 0x00000080
249
250#define IMASK_INIT_CLEAR 0x00000000
251#define IMASK_TXEEN 0x00400000
252#define IMASK_TXBEN 0x00200000
253#define IMASK_TXFEN 0x00100000
254#define IMASK_RXFEN0 0x00000080
255
256
257/* Default Attribute fields */
258#define ATTR_INIT_SETTINGS 0x000000c0
259#define ATTRELI_INIT_SETTINGS 0x00000000
260
261
262/* TxBD status field bits */
263#define TXBD_READY 0x8000
264#define TXBD_PADCRC 0x4000
265#define TXBD_WRAP 0x2000
266#define TXBD_INTERRUPT 0x1000
267#define TXBD_LAST 0x0800
268#define TXBD_CRC 0x0400
269#define TXBD_DEF 0x0200
270#define TXBD_HUGEFRAME 0x0080
271#define TXBD_LATECOLLISION 0x0080
272#define TXBD_RETRYLIMIT 0x0040
273#define TXBD_RETRYCOUNTMASK 0x003c
274#define TXBD_UNDERRUN 0x0002
275#define TXBD_STATS 0x03ff
276
277/* RxBD status field bits */
278#define RXBD_EMPTY 0x8000
279#define RXBD_RO1 0x4000
280#define RXBD_WRAP 0x2000
281#define RXBD_INTERRUPT 0x1000
282#define RXBD_LAST 0x0800
283#define RXBD_FIRST 0x0400
284#define RXBD_MISS 0x0100
285#define RXBD_BROADCAST 0x0080
286#define RXBD_MULTICAST 0x0040
287#define RXBD_LARGE 0x0020
288#define RXBD_NONOCTET 0x0010
289#define RXBD_SHORT 0x0008
290#define RXBD_CRCERR 0x0004
291#define RXBD_OVERRUN 0x0002
292#define RXBD_TRUNCATED 0x0001
293#define RXBD_STATS 0x003f
294
295typedef struct txbd8
296{
297 ushort status; /* Status Fields */
298 ushort length; /* Buffer length */
299 uint bufPtr; /* Buffer Pointer */
300} txbd8_t;
301
302typedef struct rxbd8
303{
304 ushort status; /* Status Fields */
305 ushort length; /* Buffer Length */
306 uint bufPtr; /* Buffer Pointer */
307} rxbd8_t;
308
309typedef struct rmon_mib
310{
311 /* Transmit and Receive Counters */
312 uint tr64; /* Transmit and Receive 64-byte Frame Counter */
313 uint tr127; /* Transmit and Receive 65-127 byte Frame Counter */
314 uint tr255; /* Transmit and Receive 128-255 byte Frame Counter */
315 uint tr511; /* Transmit and Receive 256-511 byte Frame Counter */
316 uint tr1k; /* Transmit and Receive 512-1023 byte Frame Counter */
317 uint trmax; /* Transmit and Receive 1024-1518 byte Frame Counter */
318 uint trmgv; /* Transmit and Receive 1519-1522 byte Good VLAN Frame */
319 /* Receive Counters */
320 uint rbyt; /* Receive Byte Counter */
321 uint rpkt; /* Receive Packet Counter */
322 uint rfcs; /* Receive FCS Error Counter */
323 uint rmca; /* Receive Multicast Packet (Counter) */
324 uint rbca; /* Receive Broadcast Packet */
325 uint rxcf; /* Receive Control Frame Packet */
326 uint rxpf; /* Receive Pause Frame Packet */
327 uint rxuo; /* Receive Unknown OP Code */
328 uint raln; /* Receive Alignment Error */
329 uint rflr; /* Receive Frame Length Error */
330 uint rcde; /* Receive Code Error */
331 uint rcse; /* Receive Carrier Sense Error */
332 uint rund; /* Receive Undersize Packet */
333 uint rovr; /* Receive Oversize Packet */
334 uint rfrg; /* Receive Fragments */
335 uint rjbr; /* Receive Jabber */
336 uint rdrp; /* Receive Drop */
337 /* Transmit Counters */
338 uint tbyt; /* Transmit Byte Counter */
339 uint tpkt; /* Transmit Packet */
340 uint tmca; /* Transmit Multicast Packet */
341 uint tbca; /* Transmit Broadcast Packet */
342 uint txpf; /* Transmit Pause Control Frame */
343 uint tdfr; /* Transmit Deferral Packet */
344 uint tedf; /* Transmit Excessive Deferral Packet */
345 uint tscl; /* Transmit Single Collision Packet */
346 /* (0x2_n700) */
347 uint tmcl; /* Transmit Multiple Collision Packet */
348 uint tlcl; /* Transmit Late Collision Packet */
349 uint txcl; /* Transmit Excessive Collision Packet */
350 uint tncl; /* Transmit Total Collision */
351
352 uint res2;
353
354 uint tdrp; /* Transmit Drop Frame */
355 uint tjbr; /* Transmit Jabber Frame */
356 uint tfcs; /* Transmit FCS Error */
357 uint txcf; /* Transmit Control Frame */
358 uint tovr; /* Transmit Oversize Frame */
359 uint tund; /* Transmit Undersize Frame */
360 uint tfrg; /* Transmit Fragments Frame */
361 /* General Registers */
362 uint car1; /* Carry Register One */
363 uint car2; /* Carry Register Two */
364 uint cam1; /* Carry Register One Mask */
365 uint cam2; /* Carry Register Two Mask */
366} rmon_mib_t;
367
368typedef struct tsec_hash_regs
369{
370 uint iaddr0; /* Individual Address Register 0 */
371 uint iaddr1; /* Individual Address Register 1 */
372 uint iaddr2; /* Individual Address Register 2 */
373 uint iaddr3; /* Individual Address Register 3 */
374 uint iaddr4; /* Individual Address Register 4 */
375 uint iaddr5; /* Individual Address Register 5 */
376 uint iaddr6; /* Individual Address Register 6 */
377 uint iaddr7; /* Individual Address Register 7 */
378 uint res1[24];
379 uint gaddr0; /* Group Address Register 0 */
380 uint gaddr1; /* Group Address Register 1 */
381 uint gaddr2; /* Group Address Register 2 */
382 uint gaddr3; /* Group Address Register 3 */
383 uint gaddr4; /* Group Address Register 4 */
384 uint gaddr5; /* Group Address Register 5 */
385 uint gaddr6; /* Group Address Register 6 */
386 uint gaddr7; /* Group Address Register 7 */
387 uint res2[24];
388} tsec_hash_t;
389
390typedef struct tsec
391{
392 /* General Control and Status Registers (0x2_n000) */
393 uint res000[4];
394
395 uint ievent; /* Interrupt Event */
396 uint imask; /* Interrupt Mask */
397 uint edis; /* Error Disabled */
398 uint res01c;
399 uint ecntrl; /* Ethernet Control */
400 uint minflr; /* Minimum Frame Length */
401 uint ptv; /* Pause Time Value */
402 uint dmactrl; /* DMA Control */
403 uint tbipa; /* TBI PHY Address */
404
405 uint res034[3];
406 uint res040[48];
407
408 /* Transmit Control and Status Registers (0x2_n100) */
409 uint tctrl; /* Transmit Control */
410 uint tstat; /* Transmit Status */
411 uint res108;
412 uint tbdlen; /* Tx BD Data Length */
413 uint res110[5];
414 uint ctbptr; /* Current TxBD Pointer */
415 uint res128[23];
416 uint tbptr; /* TxBD Pointer */
417 uint res188[30];
418 /* (0x2_n200) */
419 uint res200;
420 uint tbase; /* TxBD Base Address */
421 uint res208[42];
422 uint ostbd; /* Out of Sequence TxBD */
423 uint ostbdp; /* Out of Sequence Tx Data Buffer Pointer */
424 uint res2b8[18];
425
426 /* Receive Control and Status Registers (0x2_n300) */
427 uint rctrl; /* Receive Control */
428 uint rstat; /* Receive Status */
429 uint res308;
430 uint rbdlen; /* RxBD Data Length */
431 uint res310[4];
432 uint res320;
433 uint crbptr; /* Current Receive Buffer Pointer */
434 uint res328[6];
435 uint mrblr; /* Maximum Receive Buffer Length */
436 uint res344[16];
437 uint rbptr; /* RxBD Pointer */
438 uint res388[30];
439 /* (0x2_n400) */
440 uint res400;
441 uint rbase; /* RxBD Base Address */
442 uint res408[62];
443
444 /* MAC Registers (0x2_n500) */
445 uint maccfg1; /* MAC Configuration #1 */
446 uint maccfg2; /* MAC Configuration #2 */
447 uint ipgifg; /* Inter Packet Gap/Inter Frame Gap */
448 uint hafdup; /* Half-duplex */
449 uint maxfrm; /* Maximum Frame */
450 uint res514;
451 uint res518;
452
453 uint res51c;
454
455 uint miimcfg; /* MII Management: Configuration */
456 uint miimcom; /* MII Management: Command */
457 uint miimadd; /* MII Management: Address */
458 uint miimcon; /* MII Management: Control */
459 uint miimstat; /* MII Management: Status */
460 uint miimind; /* MII Management: Indicators */
461
462 uint res538;
463
464 uint ifstat; /* Interface Status */
465 uint macstnaddr1; /* Station Address, part 1 */
466 uint macstnaddr2; /* Station Address, part 2 */
467 uint res548[46];
468
469 /* (0x2_n600) */
470 uint res600[32];
471
472 /* RMON MIB Registers (0x2_n680-0x2_n73c) */
473 rmon_mib_t rmon;
474 uint res740[48];
475
476 /* Hash Function Registers (0x2_n800) */
477 tsec_hash_t hash;
478
479 uint res900[128];
480
481 /* Pattern Registers (0x2_nb00) */
482 uint resb00[62];
483 uint attr; /* Default Attribute Register */
484 uint attreli; /* Default Attribute Extract Length and Index */
485
486 /* TSEC Future Expansion Space (0x2_nc00-0x2_nffc) */
487 uint resc00[256];
488} tsec_t;
489
Jon Loeliger77a4f6e2005-07-25 14:05:07 -0500490#define TSEC_GIGABIT (1)
491
492/* This flag currently only has
493 * meaning if we're using the eTSEC */
494#define TSEC_REDUCED (1 << 1)
495
wdenka445ddf2004-06-09 00:34:46 +0000496struct tsec_private {
497 volatile tsec_t *regs;
498 volatile tsec_t *phyregs;
499 struct phy_info *phyinfo;
500 uint phyaddr;
Jon Loeliger77a4f6e2005-07-25 14:05:07 -0500501 u32 flags;
wdenka445ddf2004-06-09 00:34:46 +0000502 uint link;
503 uint duplexity;
504 uint speed;
505};
506
507
508/*
509 * struct phy_cmd: A command for reading or writing a PHY register
510 *
511 * mii_reg: The register to read or write
512 *
513 * mii_data: For writes, the value to put in the register.
514 * A value of -1 indicates this is a read.
515 *
516 * funct: A function pointer which is invoked for each command.
517 * For reads, this function will be passed the value read
518 * from the PHY, and process it.
519 * For writes, the result of this function will be written
520 * to the PHY register
521 */
522struct phy_cmd {
523 uint mii_reg;
524 uint mii_data;
525 uint (*funct) (uint mii_reg, struct tsec_private* priv);
526};
527
528/* struct phy_info: a structure which defines attributes for a PHY
529 *
530 * id will contain a number which represents the PHY. During
531 * startup, the driver will poll the PHY to find out what its
532 * UID--as defined by registers 2 and 3--is. The 32-bit result
533 * gotten from the PHY will be shifted right by "shift" bits to
534 * discard any bits which may change based on revision numbers
535 * unimportant to functionality
536 *
537 * The struct phy_cmd entries represent pointers to an arrays of
538 * commands which tell the driver what to do to the PHY.
539 */
540struct phy_info {
541 uint id;
542 char *name;
543 uint shift;
544 /* Called to configure the PHY, and modify the controller
545 * based on the results */
546 struct phy_cmd *config;
547
548 /* Called when starting up the controller */
549 struct phy_cmd *startup;
550
551 /* Called when bringing down the controller */
552 struct phy_cmd *shutdown;
553};
554
wdenk9c53f402003-10-15 23:53:47 +0000555#endif /* __TSEC_H */