xref: /openbmc/u-boot/include/tsec.h (revision 2abe361c03b43e6dcf68f54e96b5c05156c49284)
1dd3d1f56SAndy Fleming /*
2dd3d1f56SAndy Fleming  *  tsec.h
3dd3d1f56SAndy Fleming  *
4dd3d1f56SAndy Fleming  *  Driver for the Motorola Triple Speed Ethernet Controller
5dd3d1f56SAndy Fleming  *
6dd3d1f56SAndy Fleming  *  This software may be used and distributed according to the
7dd3d1f56SAndy Fleming  *  terms of the GNU Public License, Version 2, incorporated
8dd3d1f56SAndy Fleming  *  herein by reference.
9dd3d1f56SAndy Fleming  *
10dd3d1f56SAndy Fleming  * Copyright 2004, 2007 Freescale Semiconductor, Inc.
11dd3d1f56SAndy Fleming  * (C) Copyright 2003, Motorola, Inc.
12dd3d1f56SAndy Fleming  * maintained by Xianghua Xiao (x.xiao@motorola.com)
13dd3d1f56SAndy Fleming  * author Andy Fleming
14dd3d1f56SAndy Fleming  *
15dd3d1f56SAndy Fleming  */
16dd3d1f56SAndy Fleming 
17dd3d1f56SAndy Fleming #ifndef __TSEC_H
18dd3d1f56SAndy Fleming #define __TSEC_H
19dd3d1f56SAndy Fleming 
20dd3d1f56SAndy Fleming #include <net.h>
21dd3d1f56SAndy Fleming #include <config.h>
22dd3d1f56SAndy Fleming 
23dd3d1f56SAndy Fleming #ifndef CFG_TSEC1_OFFSET
24dd3d1f56SAndy Fleming     #define CFG_TSEC1_OFFSET	(0x24000)
25dd3d1f56SAndy Fleming #endif
26dd3d1f56SAndy Fleming 
27dd3d1f56SAndy Fleming #define TSEC_SIZE	0x01000
28dd3d1f56SAndy Fleming 
29dd3d1f56SAndy Fleming /* FIXME:  Should these be pushed back to 83xx and 85xx config files? */
3075b9d4aeSAndy Fleming #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) \
3175b9d4aeSAndy Fleming 	|| defined(CONFIG_MPC83XX)
32dd3d1f56SAndy Fleming     #define TSEC_BASE_ADDR	(CFG_IMMR + CFG_TSEC1_OFFSET)
33dd3d1f56SAndy Fleming #endif
34dd3d1f56SAndy Fleming 
3575b9d4aeSAndy Fleming #define STD_TSEC_INFO(num) \
3675b9d4aeSAndy Fleming {			\
3775b9d4aeSAndy Fleming 	.regs = (tsec_t *)(TSEC_BASE_ADDR + ((num - 1) * TSEC_SIZE)), \
3875b9d4aeSAndy Fleming 	.miiregs = (tsec_t *)TSEC_BASE_ADDR, \
3975b9d4aeSAndy Fleming 	.devname = CONFIG_TSEC##num##_NAME, \
4075b9d4aeSAndy Fleming 	.phyaddr = TSEC##num##_PHY_ADDR, \
4175b9d4aeSAndy Fleming 	.flags = TSEC##num##_FLAGS \
4275b9d4aeSAndy Fleming }
4375b9d4aeSAndy Fleming 
4475b9d4aeSAndy Fleming #define SET_STD_TSEC_INFO(x, num) \
4575b9d4aeSAndy Fleming {			\
4675b9d4aeSAndy Fleming 	x.regs = (tsec_t *)(TSEC_BASE_ADDR + ((num - 1) * TSEC_SIZE)); \
4775b9d4aeSAndy Fleming 	x.miiregs = (tsec_t *)TSEC_BASE_ADDR; \
4875b9d4aeSAndy Fleming 	x.devname = CONFIG_TSEC##num##_NAME; \
4975b9d4aeSAndy Fleming 	x.phyaddr = TSEC##num##_PHY_ADDR; \
5075b9d4aeSAndy Fleming 	x.flags = TSEC##num##_FLAGS;\
5175b9d4aeSAndy Fleming }
5275b9d4aeSAndy Fleming 
5375b9d4aeSAndy Fleming 
54dd3d1f56SAndy Fleming 
55dd3d1f56SAndy Fleming #define MAC_ADDR_LEN 6
56dd3d1f56SAndy Fleming 
57dd3d1f56SAndy Fleming /* #define TSEC_TIMEOUT	1000000 */
58dd3d1f56SAndy Fleming #define TSEC_TIMEOUT 1000
59dd3d1f56SAndy Fleming #define TOUT_LOOP	1000000
60dd3d1f56SAndy Fleming 
61dd3d1f56SAndy Fleming #define PHY_AUTONEGOTIATE_TIMEOUT	5000 /* in ms */
62dd3d1f56SAndy Fleming 
63*2abe361cSAndy Fleming /* TBI register addresses */
64*2abe361cSAndy Fleming #define TBI_CR			0x00
65*2abe361cSAndy Fleming #define TBI_SR			0x01
66*2abe361cSAndy Fleming #define TBI_ANA			0x04
67*2abe361cSAndy Fleming #define TBI_ANLPBPA		0x05
68*2abe361cSAndy Fleming #define TBI_ANEX		0x06
69*2abe361cSAndy Fleming #define TBI_TBICON		0x11
70*2abe361cSAndy Fleming 
71*2abe361cSAndy Fleming /* TBI MDIO register bit fields*/
72*2abe361cSAndy Fleming #define TBICON_CLK_SELECT	0x0020
73*2abe361cSAndy Fleming #define TBIANA_ASYMMETRIC_PAUSE 0x0100
74*2abe361cSAndy Fleming #define TBIANA_SYMMETRIC_PAUSE  0x0080
75*2abe361cSAndy Fleming #define TBIANA_HALF_DUPLEX	0x0040
76*2abe361cSAndy Fleming #define TBIANA_FULL_DUPLEX	0x0020
77*2abe361cSAndy Fleming #define TBICR_PHY_RESET		0x8000
78*2abe361cSAndy Fleming #define TBICR_ANEG_ENABLE	0x1000
79*2abe361cSAndy Fleming #define TBICR_RESTART_ANEG	0x0200
80*2abe361cSAndy Fleming #define TBICR_FULL_DUPLEX	0x0100
81*2abe361cSAndy Fleming #define TBICR_SPEED1_SET	0x0040
82*2abe361cSAndy Fleming 
83*2abe361cSAndy Fleming 
84dd3d1f56SAndy Fleming /* MAC register bits */
85dd3d1f56SAndy Fleming #define MACCFG1_SOFT_RESET	0x80000000
86dd3d1f56SAndy Fleming #define MACCFG1_RESET_RX_MC	0x00080000
87dd3d1f56SAndy Fleming #define MACCFG1_RESET_TX_MC	0x00040000
88dd3d1f56SAndy Fleming #define MACCFG1_RESET_RX_FUN	0x00020000
89dd3d1f56SAndy Fleming #define	MACCFG1_RESET_TX_FUN	0x00010000
90dd3d1f56SAndy Fleming #define MACCFG1_LOOPBACK	0x00000100
91dd3d1f56SAndy Fleming #define MACCFG1_RX_FLOW		0x00000020
92dd3d1f56SAndy Fleming #define MACCFG1_TX_FLOW		0x00000010
93dd3d1f56SAndy Fleming #define MACCFG1_SYNCD_RX_EN	0x00000008
94dd3d1f56SAndy Fleming #define MACCFG1_RX_EN		0x00000004
95dd3d1f56SAndy Fleming #define MACCFG1_SYNCD_TX_EN	0x00000002
96dd3d1f56SAndy Fleming #define MACCFG1_TX_EN		0x00000001
97dd3d1f56SAndy Fleming 
98dd3d1f56SAndy Fleming #define MACCFG2_INIT_SETTINGS	0x00007205
99dd3d1f56SAndy Fleming #define MACCFG2_FULL_DUPLEX	0x00000001
100dd3d1f56SAndy Fleming #define MACCFG2_IF		0x00000300
101dd3d1f56SAndy Fleming #define MACCFG2_GMII		0x00000200
102dd3d1f56SAndy Fleming #define MACCFG2_MII		0x00000100
103dd3d1f56SAndy Fleming 
104dd3d1f56SAndy Fleming #define ECNTRL_INIT_SETTINGS	0x00001000
105dd3d1f56SAndy Fleming #define ECNTRL_TBI_MODE		0x00000020
106dd3d1f56SAndy Fleming #define ECNTRL_R100		0x00000008
107dd3d1f56SAndy Fleming #define ECNTRL_SGMII_MODE	0x00000002
108dd3d1f56SAndy Fleming 
109dd3d1f56SAndy Fleming #define miim_end -2
110dd3d1f56SAndy Fleming #define miim_read -1
111dd3d1f56SAndy Fleming 
112dd3d1f56SAndy Fleming #ifndef CFG_TBIPA_VALUE
113dd3d1f56SAndy Fleming     #define CFG_TBIPA_VALUE	0x1f
114dd3d1f56SAndy Fleming #endif
115dd3d1f56SAndy Fleming #define MIIMCFG_INIT_VALUE	0x00000003
116dd3d1f56SAndy Fleming #define MIIMCFG_RESET		0x80000000
117dd3d1f56SAndy Fleming 
118dd3d1f56SAndy Fleming #define MIIMIND_BUSY		0x00000001
119dd3d1f56SAndy Fleming #define MIIMIND_NOTVALID	0x00000004
120dd3d1f56SAndy Fleming 
121dd3d1f56SAndy Fleming #define MIIM_CONTROL		0x00
122dd3d1f56SAndy Fleming #define MIIM_CONTROL_RESET	0x00009140
123dd3d1f56SAndy Fleming #define MIIM_CONTROL_INIT	0x00001140
124dd3d1f56SAndy Fleming #define MIIM_CONTROL_RESTART	0x00001340
125dd3d1f56SAndy Fleming #define MIIM_ANEN		0x00001000
126dd3d1f56SAndy Fleming 
127dd3d1f56SAndy Fleming #define MIIM_CR			0x00
128dd3d1f56SAndy Fleming #define MIIM_CR_RST		0x00008000
129dd3d1f56SAndy Fleming #define MIIM_CR_INIT		0x00001000
130dd3d1f56SAndy Fleming 
131dd3d1f56SAndy Fleming #define MIIM_STATUS		0x1
132dd3d1f56SAndy Fleming #define MIIM_STATUS_AN_DONE	0x00000020
133dd3d1f56SAndy Fleming #define MIIM_STATUS_LINK	0x0004
134dd3d1f56SAndy Fleming #define PHY_BMSR_AUTN_ABLE	0x0008
135dd3d1f56SAndy Fleming #define PHY_BMSR_AUTN_COMP	0x0020
136dd3d1f56SAndy Fleming 
137dd3d1f56SAndy Fleming #define MIIM_PHYIR1		0x2
138dd3d1f56SAndy Fleming #define MIIM_PHYIR2		0x3
139dd3d1f56SAndy Fleming 
140dd3d1f56SAndy Fleming #define MIIM_ANAR		0x4
141dd3d1f56SAndy Fleming #define MIIM_ANAR_INIT		0x1e1
142dd3d1f56SAndy Fleming 
143dd3d1f56SAndy Fleming #define MIIM_TBI_ANLPBPA	0x5
144dd3d1f56SAndy Fleming #define MIIM_TBI_ANLPBPA_HALF	0x00000040
145dd3d1f56SAndy Fleming #define MIIM_TBI_ANLPBPA_FULL	0x00000020
146dd3d1f56SAndy Fleming 
147dd3d1f56SAndy Fleming #define MIIM_TBI_ANEX		0x6
148dd3d1f56SAndy Fleming #define MIIM_TBI_ANEX_NP	0x00000004
149dd3d1f56SAndy Fleming #define MIIM_TBI_ANEX_PRX	0x00000002
150dd3d1f56SAndy Fleming 
151dd3d1f56SAndy Fleming #define MIIM_GBIT_CONTROL	0x9
152dd3d1f56SAndy Fleming #define MIIM_GBIT_CONTROL_INIT	0xe00
153dd3d1f56SAndy Fleming 
154dd3d1f56SAndy Fleming #define MIIM_EXT_PAGE_ACCESS	0x1f
155dd3d1f56SAndy Fleming 
156dd3d1f56SAndy Fleming /* Broadcom BCM54xx -- taken from linux sungem_phy */
157dd3d1f56SAndy Fleming #define MIIM_BCM54xx_AUXSTATUS			0x19
158dd3d1f56SAndy Fleming #define MIIM_BCM54xx_AUXSTATUS_LINKMODE_MASK	0x0700
159dd3d1f56SAndy Fleming #define MIIM_BCM54xx_AUXSTATUS_LINKMODE_SHIFT	8
160dd3d1f56SAndy Fleming 
161dd3d1f56SAndy Fleming /* Cicada Auxiliary Control/Status Register */
162dd3d1f56SAndy Fleming #define MIIM_CIS8201_AUX_CONSTAT	0x1c
163dd3d1f56SAndy Fleming #define MIIM_CIS8201_AUXCONSTAT_INIT	0x0004
164dd3d1f56SAndy Fleming #define MIIM_CIS8201_AUXCONSTAT_DUPLEX	0x0020
165dd3d1f56SAndy Fleming #define MIIM_CIS8201_AUXCONSTAT_SPEED	0x0018
166dd3d1f56SAndy Fleming #define MIIM_CIS8201_AUXCONSTAT_GBIT	0x0010
167dd3d1f56SAndy Fleming #define MIIM_CIS8201_AUXCONSTAT_100	0x0008
168dd3d1f56SAndy Fleming 
169dd3d1f56SAndy Fleming /* Cicada Extended Control Register 1 */
170dd3d1f56SAndy Fleming #define MIIM_CIS8201_EXT_CON1		0x17
171dd3d1f56SAndy Fleming #define MIIM_CIS8201_EXTCON1_INIT	0x0000
172dd3d1f56SAndy Fleming 
173dd3d1f56SAndy Fleming /* Cicada 8204 Extended PHY Control Register 1 */
174dd3d1f56SAndy Fleming #define MIIM_CIS8204_EPHY_CON		0x17
175dd3d1f56SAndy Fleming #define MIIM_CIS8204_EPHYCON_INIT	0x0006
176dd3d1f56SAndy Fleming #define MIIM_CIS8204_EPHYCON_RGMII	0x1100
177dd3d1f56SAndy Fleming 
178dd3d1f56SAndy Fleming /* Cicada 8204 Serial LED Control Register */
179dd3d1f56SAndy Fleming #define MIIM_CIS8204_SLED_CON		0x1b
180dd3d1f56SAndy Fleming #define MIIM_CIS8204_SLEDCON_INIT	0x1115
181dd3d1f56SAndy Fleming 
182dd3d1f56SAndy Fleming #define MIIM_GBIT_CON		0x09
183dd3d1f56SAndy Fleming #define MIIM_GBIT_CON_ADVERT	0x0e00
184dd3d1f56SAndy Fleming 
185dd3d1f56SAndy Fleming /* Entry for Vitesse VSC8244 regs starts here */
186dd3d1f56SAndy Fleming /* Vitesse VSC8244 Auxiliary Control/Status Register */
187dd3d1f56SAndy Fleming #define MIIM_VSC8244_AUX_CONSTAT	0x1c
188dd3d1f56SAndy Fleming #define MIIM_VSC8244_AUXCONSTAT_INIT	0x0000
189dd3d1f56SAndy Fleming #define MIIM_VSC8244_AUXCONSTAT_DUPLEX	0x0020
190dd3d1f56SAndy Fleming #define MIIM_VSC8244_AUXCONSTAT_SPEED	0x0018
191dd3d1f56SAndy Fleming #define MIIM_VSC8244_AUXCONSTAT_GBIT	0x0010
192dd3d1f56SAndy Fleming #define MIIM_VSC8244_AUXCONSTAT_100	0x0008
193dd3d1f56SAndy Fleming #define MIIM_CONTROL_INIT_LOOPBACK	0x4000
194dd3d1f56SAndy Fleming 
195dd3d1f56SAndy Fleming /* Vitesse VSC8244 Extended PHY Control Register 1 */
196dd3d1f56SAndy Fleming #define MIIM_VSC8244_EPHY_CON		0x17
197dd3d1f56SAndy Fleming #define MIIM_VSC8244_EPHYCON_INIT	0x0006
198dd3d1f56SAndy Fleming 
199dd3d1f56SAndy Fleming /* Vitesse VSC8244 Serial LED Control Register */
200dd3d1f56SAndy Fleming #define MIIM_VSC8244_LED_CON		0x1b
201dd3d1f56SAndy Fleming #define MIIM_VSC8244_LEDCON_INIT	0xF011
202dd3d1f56SAndy Fleming 
203dd3d1f56SAndy Fleming /* Entry for Vitesse VSC8601 regs starts here (Not complete) */
204dd3d1f56SAndy Fleming /* Vitesse VSC8601 Extended PHY Control Register 1 */
205dd3d1f56SAndy Fleming #define MIIM_VSC8601_EPHY_CON		0x17
206dd3d1f56SAndy Fleming #define MIIM_VSC8601_EPHY_CON_INIT_SKEW	0x1120
207dd3d1f56SAndy Fleming #define MIIM_VSC8601_SKEW_CTRL		0x1c
208dd3d1f56SAndy Fleming 
209dd3d1f56SAndy Fleming /* 88E1011 PHY Status Register */
210dd3d1f56SAndy Fleming #define MIIM_88E1011_PHY_STATUS		0x11
211dd3d1f56SAndy Fleming #define MIIM_88E1011_PHYSTAT_SPEED	0xc000
212dd3d1f56SAndy Fleming #define MIIM_88E1011_PHYSTAT_GBIT	0x8000
213dd3d1f56SAndy Fleming #define MIIM_88E1011_PHYSTAT_100	0x4000
214dd3d1f56SAndy Fleming #define MIIM_88E1011_PHYSTAT_DUPLEX	0x2000
215dd3d1f56SAndy Fleming #define MIIM_88E1011_PHYSTAT_SPDDONE	0x0800
216dd3d1f56SAndy Fleming #define MIIM_88E1011_PHYSTAT_LINK	0x0400
217dd3d1f56SAndy Fleming 
218dd3d1f56SAndy Fleming #define MIIM_88E1011_PHY_SCR		0x10
219dd3d1f56SAndy Fleming #define MIIM_88E1011_PHY_MDI_X_AUTO	0x0060
220dd3d1f56SAndy Fleming 
221dd3d1f56SAndy Fleming /* 88E1111 PHY LED Control Register */
222dd3d1f56SAndy Fleming #define MIIM_88E1111_PHY_LED_CONTROL	24
223dd3d1f56SAndy Fleming #define MIIM_88E1111_PHY_LED_DIRECT	0x4100
224dd3d1f56SAndy Fleming #define MIIM_88E1111_PHY_LED_COMBINE	0x411C
225dd3d1f56SAndy Fleming 
226dd3d1f56SAndy Fleming /* 88E1121 PHY LED Control Register */
227dd3d1f56SAndy Fleming #define MIIM_88E1121_PHY_LED_CTRL	16
228dd3d1f56SAndy Fleming #define MIIM_88E1121_PHY_LED_PAGE	3
229dd3d1f56SAndy Fleming #define MIIM_88E1121_PHY_LED_DEF	0x0030
230dd3d1f56SAndy Fleming 
231dd3d1f56SAndy Fleming #define MIIM_88E1121_PHY_PAGE		22
232dd3d1f56SAndy Fleming 
233dd3d1f56SAndy Fleming /* 88E1145 Extended PHY Specific Control Register */
234dd3d1f56SAndy Fleming #define MIIM_88E1145_PHY_EXT_CR 20
235dd3d1f56SAndy Fleming #define MIIM_M88E1145_RGMII_RX_DELAY	0x0080
236dd3d1f56SAndy Fleming #define MIIM_M88E1145_RGMII_TX_DELAY	0x0002
237dd3d1f56SAndy Fleming 
238dd3d1f56SAndy Fleming #define MIIM_88E1145_PHY_PAGE	29
239dd3d1f56SAndy Fleming #define MIIM_88E1145_PHY_CAL_OV 30
240dd3d1f56SAndy Fleming 
241dd3d1f56SAndy Fleming /* RTL8211B PHY Status Register */
242dd3d1f56SAndy Fleming #define MIIM_RTL8211B_PHY_STATUS	0x11
243dd3d1f56SAndy Fleming #define MIIM_RTL8211B_PHYSTAT_SPEED	0xc000
244dd3d1f56SAndy Fleming #define MIIM_RTL8211B_PHYSTAT_GBIT	0x8000
245dd3d1f56SAndy Fleming #define MIIM_RTL8211B_PHYSTAT_100	0x4000
246dd3d1f56SAndy Fleming #define MIIM_RTL8211B_PHYSTAT_DUPLEX	0x2000
247dd3d1f56SAndy Fleming #define MIIM_RTL8211B_PHYSTAT_SPDDONE	0x0800
248dd3d1f56SAndy Fleming #define MIIM_RTL8211B_PHYSTAT_LINK	0x0400
249dd3d1f56SAndy Fleming 
250dd3d1f56SAndy Fleming /* DM9161 Control register values */
251dd3d1f56SAndy Fleming #define MIIM_DM9161_CR_STOP	0x0400
252dd3d1f56SAndy Fleming #define MIIM_DM9161_CR_RSTAN	0x1200
253dd3d1f56SAndy Fleming 
254dd3d1f56SAndy Fleming #define MIIM_DM9161_SCR		0x10
255dd3d1f56SAndy Fleming #define MIIM_DM9161_SCR_INIT	0x0610
256dd3d1f56SAndy Fleming 
257dd3d1f56SAndy Fleming /* DM9161 Specified Configuration and Status Register */
258dd3d1f56SAndy Fleming #define MIIM_DM9161_SCSR	0x11
259dd3d1f56SAndy Fleming #define MIIM_DM9161_SCSR_100F	0x8000
260dd3d1f56SAndy Fleming #define MIIM_DM9161_SCSR_100H	0x4000
261dd3d1f56SAndy Fleming #define MIIM_DM9161_SCSR_10F	0x2000
262dd3d1f56SAndy Fleming #define MIIM_DM9161_SCSR_10H	0x1000
263dd3d1f56SAndy Fleming 
264dd3d1f56SAndy Fleming /* DM9161 10BT Configuration/Status */
265dd3d1f56SAndy Fleming #define MIIM_DM9161_10BTCSR	0x12
266dd3d1f56SAndy Fleming #define MIIM_DM9161_10BTCSR_INIT	0x7800
267dd3d1f56SAndy Fleming 
268dd3d1f56SAndy Fleming /* LXT971 Status 2 registers */
269dd3d1f56SAndy Fleming #define MIIM_LXT971_SR2		     0x11  /* Status Register 2  */
270dd3d1f56SAndy Fleming #define MIIM_LXT971_SR2_SPEED_MASK 0x4200
271dd3d1f56SAndy Fleming #define MIIM_LXT971_SR2_10HDX	   0x0000  /*  10 Mbit half duplex selected */
272dd3d1f56SAndy Fleming #define MIIM_LXT971_SR2_10FDX	   0x0200  /*  10 Mbit full duplex selected */
273dd3d1f56SAndy Fleming #define MIIM_LXT971_SR2_100HDX	   0x4000  /* 100 Mbit half duplex selected */
274dd3d1f56SAndy Fleming #define MIIM_LXT971_SR2_100FDX	   0x4200  /* 100 Mbit full duplex selected */
275dd3d1f56SAndy Fleming 
276dd3d1f56SAndy Fleming /* DP83865 Control register values */
277dd3d1f56SAndy Fleming #define MIIM_DP83865_CR_INIT	0x9200
278dd3d1f56SAndy Fleming 
279dd3d1f56SAndy Fleming /* DP83865 Link and Auto-Neg Status Register */
280dd3d1f56SAndy Fleming #define MIIM_DP83865_LANR	0x11
281dd3d1f56SAndy Fleming #define MIIM_DP83865_SPD_MASK	0x0018
282dd3d1f56SAndy Fleming #define MIIM_DP83865_SPD_1000	0x0010
283dd3d1f56SAndy Fleming #define MIIM_DP83865_SPD_100	0x0008
284dd3d1f56SAndy Fleming #define MIIM_DP83865_DPX_FULL	0x0002
285dd3d1f56SAndy Fleming 
286dd3d1f56SAndy Fleming #define MIIM_READ_COMMAND	0x00000001
287dd3d1f56SAndy Fleming 
288dd3d1f56SAndy Fleming #define MRBLR_INIT_SETTINGS	PKTSIZE_ALIGN
289dd3d1f56SAndy Fleming 
290dd3d1f56SAndy Fleming #define MINFLR_INIT_SETTINGS	0x00000040
291dd3d1f56SAndy Fleming 
292dd3d1f56SAndy Fleming #define DMACTRL_INIT_SETTINGS	0x000000c3
293dd3d1f56SAndy Fleming #define DMACTRL_GRS		0x00000010
294dd3d1f56SAndy Fleming #define DMACTRL_GTS		0x00000008
295dd3d1f56SAndy Fleming 
296dd3d1f56SAndy Fleming #define TSTAT_CLEAR_THALT	0x80000000
297dd3d1f56SAndy Fleming #define RSTAT_CLEAR_RHALT	0x00800000
298dd3d1f56SAndy Fleming 
299dd3d1f56SAndy Fleming 
300dd3d1f56SAndy Fleming #define IEVENT_INIT_CLEAR	0xffffffff
301dd3d1f56SAndy Fleming #define IEVENT_BABR		0x80000000
302dd3d1f56SAndy Fleming #define IEVENT_RXC		0x40000000
303dd3d1f56SAndy Fleming #define IEVENT_BSY		0x20000000
304dd3d1f56SAndy Fleming #define IEVENT_EBERR		0x10000000
305dd3d1f56SAndy Fleming #define IEVENT_MSRO		0x04000000
306dd3d1f56SAndy Fleming #define IEVENT_GTSC		0x02000000
307dd3d1f56SAndy Fleming #define IEVENT_BABT		0x01000000
308dd3d1f56SAndy Fleming #define IEVENT_TXC		0x00800000
309dd3d1f56SAndy Fleming #define IEVENT_TXE		0x00400000
310dd3d1f56SAndy Fleming #define IEVENT_TXB		0x00200000
311dd3d1f56SAndy Fleming #define IEVENT_TXF		0x00100000
312dd3d1f56SAndy Fleming #define IEVENT_IE		0x00080000
313dd3d1f56SAndy Fleming #define IEVENT_LC		0x00040000
314dd3d1f56SAndy Fleming #define IEVENT_CRL		0x00020000
315dd3d1f56SAndy Fleming #define IEVENT_XFUN		0x00010000
316dd3d1f56SAndy Fleming #define IEVENT_RXB0		0x00008000
317dd3d1f56SAndy Fleming #define IEVENT_GRSC		0x00000100
318dd3d1f56SAndy Fleming #define IEVENT_RXF0		0x00000080
319dd3d1f56SAndy Fleming 
320dd3d1f56SAndy Fleming #define IMASK_INIT_CLEAR	0x00000000
321dd3d1f56SAndy Fleming #define IMASK_TXEEN		0x00400000
322dd3d1f56SAndy Fleming #define IMASK_TXBEN		0x00200000
323dd3d1f56SAndy Fleming #define IMASK_TXFEN		0x00100000
324dd3d1f56SAndy Fleming #define IMASK_RXFEN0		0x00000080
325dd3d1f56SAndy Fleming 
326dd3d1f56SAndy Fleming 
327dd3d1f56SAndy Fleming /* Default Attribute fields */
328dd3d1f56SAndy Fleming #define ATTR_INIT_SETTINGS     0x000000c0
329dd3d1f56SAndy Fleming #define ATTRELI_INIT_SETTINGS  0x00000000
330dd3d1f56SAndy Fleming 
331dd3d1f56SAndy Fleming 
332dd3d1f56SAndy Fleming /* TxBD status field bits */
333dd3d1f56SAndy Fleming #define TXBD_READY		0x8000
334dd3d1f56SAndy Fleming #define TXBD_PADCRC		0x4000
335dd3d1f56SAndy Fleming #define TXBD_WRAP		0x2000
336dd3d1f56SAndy Fleming #define TXBD_INTERRUPT		0x1000
337dd3d1f56SAndy Fleming #define TXBD_LAST		0x0800
338dd3d1f56SAndy Fleming #define TXBD_CRC		0x0400
339dd3d1f56SAndy Fleming #define TXBD_DEF		0x0200
340dd3d1f56SAndy Fleming #define TXBD_HUGEFRAME		0x0080
341dd3d1f56SAndy Fleming #define TXBD_LATECOLLISION	0x0080
342dd3d1f56SAndy Fleming #define TXBD_RETRYLIMIT		0x0040
343dd3d1f56SAndy Fleming #define	TXBD_RETRYCOUNTMASK	0x003c
344dd3d1f56SAndy Fleming #define TXBD_UNDERRUN		0x0002
345dd3d1f56SAndy Fleming #define TXBD_STATS		0x03ff
346dd3d1f56SAndy Fleming 
347dd3d1f56SAndy Fleming /* RxBD status field bits */
348dd3d1f56SAndy Fleming #define RXBD_EMPTY		0x8000
349dd3d1f56SAndy Fleming #define RXBD_RO1		0x4000
350dd3d1f56SAndy Fleming #define RXBD_WRAP		0x2000
351dd3d1f56SAndy Fleming #define RXBD_INTERRUPT		0x1000
352dd3d1f56SAndy Fleming #define RXBD_LAST		0x0800
353dd3d1f56SAndy Fleming #define RXBD_FIRST		0x0400
354dd3d1f56SAndy Fleming #define RXBD_MISS		0x0100
355dd3d1f56SAndy Fleming #define RXBD_BROADCAST		0x0080
356dd3d1f56SAndy Fleming #define RXBD_MULTICAST		0x0040
357dd3d1f56SAndy Fleming #define RXBD_LARGE		0x0020
358dd3d1f56SAndy Fleming #define RXBD_NONOCTET		0x0010
359dd3d1f56SAndy Fleming #define RXBD_SHORT		0x0008
360dd3d1f56SAndy Fleming #define RXBD_CRCERR		0x0004
361dd3d1f56SAndy Fleming #define RXBD_OVERRUN		0x0002
362dd3d1f56SAndy Fleming #define RXBD_TRUNCATED		0x0001
363dd3d1f56SAndy Fleming #define RXBD_STATS		0x003f
364dd3d1f56SAndy Fleming 
365dd3d1f56SAndy Fleming typedef struct txbd8
366dd3d1f56SAndy Fleming {
367dd3d1f56SAndy Fleming 	ushort	     status;	     /* Status Fields */
368dd3d1f56SAndy Fleming 	ushort	     length;	     /* Buffer length */
369dd3d1f56SAndy Fleming 	uint	     bufPtr;	     /* Buffer Pointer */
370dd3d1f56SAndy Fleming } txbd8_t;
371dd3d1f56SAndy Fleming 
372dd3d1f56SAndy Fleming typedef struct rxbd8
373dd3d1f56SAndy Fleming {
374dd3d1f56SAndy Fleming 	ushort	     status;	     /* Status Fields */
375dd3d1f56SAndy Fleming 	ushort	     length;	     /* Buffer Length */
376dd3d1f56SAndy Fleming 	uint	     bufPtr;	     /* Buffer Pointer */
377dd3d1f56SAndy Fleming } rxbd8_t;
378dd3d1f56SAndy Fleming 
379dd3d1f56SAndy Fleming typedef struct rmon_mib
380dd3d1f56SAndy Fleming {
381dd3d1f56SAndy Fleming 	/* Transmit and Receive Counters */
382dd3d1f56SAndy Fleming 	uint	tr64;		/* Transmit and Receive 64-byte Frame Counter */
383dd3d1f56SAndy Fleming 	uint	tr127;		/* Transmit and Receive 65-127 byte Frame Counter */
384dd3d1f56SAndy Fleming 	uint	tr255;		/* Transmit and Receive 128-255 byte Frame Counter */
385dd3d1f56SAndy Fleming 	uint	tr511;		/* Transmit and Receive 256-511 byte Frame Counter */
386dd3d1f56SAndy Fleming 	uint	tr1k;		/* Transmit and Receive 512-1023 byte Frame Counter */
387dd3d1f56SAndy Fleming 	uint	trmax;		/* Transmit and Receive 1024-1518 byte Frame Counter */
388dd3d1f56SAndy Fleming 	uint	trmgv;		/* Transmit and Receive 1519-1522 byte Good VLAN Frame */
389dd3d1f56SAndy Fleming 	/* Receive Counters */
390dd3d1f56SAndy Fleming 	uint	rbyt;		/* Receive Byte Counter */
391dd3d1f56SAndy Fleming 	uint	rpkt;		/* Receive Packet Counter */
392dd3d1f56SAndy Fleming 	uint	rfcs;		/* Receive FCS Error Counter */
393dd3d1f56SAndy Fleming 	uint	rmca;		/* Receive Multicast Packet (Counter) */
394dd3d1f56SAndy Fleming 	uint	rbca;		/* Receive Broadcast Packet */
395dd3d1f56SAndy Fleming 	uint	rxcf;		/* Receive Control Frame Packet */
396dd3d1f56SAndy Fleming 	uint	rxpf;		/* Receive Pause Frame Packet */
397dd3d1f56SAndy Fleming 	uint	rxuo;		/* Receive Unknown OP Code */
398dd3d1f56SAndy Fleming 	uint	raln;		/* Receive Alignment Error */
399dd3d1f56SAndy Fleming 	uint	rflr;		/* Receive Frame Length Error */
400dd3d1f56SAndy Fleming 	uint	rcde;		/* Receive Code Error */
401dd3d1f56SAndy Fleming 	uint	rcse;		/* Receive Carrier Sense Error */
402dd3d1f56SAndy Fleming 	uint	rund;		/* Receive Undersize Packet */
403dd3d1f56SAndy Fleming 	uint	rovr;		/* Receive Oversize Packet */
404dd3d1f56SAndy Fleming 	uint	rfrg;		/* Receive Fragments */
405dd3d1f56SAndy Fleming 	uint	rjbr;		/* Receive Jabber */
406dd3d1f56SAndy Fleming 	uint	rdrp;		/* Receive Drop */
407dd3d1f56SAndy Fleming 	/* Transmit Counters */
408dd3d1f56SAndy Fleming 	uint	tbyt;		/* Transmit Byte Counter */
409dd3d1f56SAndy Fleming 	uint	tpkt;		/* Transmit Packet */
410dd3d1f56SAndy Fleming 	uint	tmca;		/* Transmit Multicast Packet */
411dd3d1f56SAndy Fleming 	uint	tbca;		/* Transmit Broadcast Packet */
412dd3d1f56SAndy Fleming 	uint	txpf;		/* Transmit Pause Control Frame */
413dd3d1f56SAndy Fleming 	uint	tdfr;		/* Transmit Deferral Packet */
414dd3d1f56SAndy Fleming 	uint	tedf;		/* Transmit Excessive Deferral Packet */
415dd3d1f56SAndy Fleming 	uint	tscl;		/* Transmit Single Collision Packet */
416dd3d1f56SAndy Fleming 	/* (0x2_n700) */
417dd3d1f56SAndy Fleming 	uint	tmcl;		/* Transmit Multiple Collision Packet */
418dd3d1f56SAndy Fleming 	uint	tlcl;		/* Transmit Late Collision Packet */
419dd3d1f56SAndy Fleming 	uint	txcl;		/* Transmit Excessive Collision Packet */
420dd3d1f56SAndy Fleming 	uint	tncl;		/* Transmit Total Collision */
421dd3d1f56SAndy Fleming 
422dd3d1f56SAndy Fleming 	uint	res2;
423dd3d1f56SAndy Fleming 
424dd3d1f56SAndy Fleming 	uint	tdrp;		/* Transmit Drop Frame */
425dd3d1f56SAndy Fleming 	uint	tjbr;		/* Transmit Jabber Frame */
426dd3d1f56SAndy Fleming 	uint	tfcs;		/* Transmit FCS Error */
427dd3d1f56SAndy Fleming 	uint	txcf;		/* Transmit Control Frame */
428dd3d1f56SAndy Fleming 	uint	tovr;		/* Transmit Oversize Frame */
429dd3d1f56SAndy Fleming 	uint	tund;		/* Transmit Undersize Frame */
430dd3d1f56SAndy Fleming 	uint	tfrg;		/* Transmit Fragments Frame */
431dd3d1f56SAndy Fleming 	/* General Registers */
432dd3d1f56SAndy Fleming 	uint	car1;		/* Carry Register One */
433dd3d1f56SAndy Fleming 	uint	car2;		/* Carry Register Two */
434dd3d1f56SAndy Fleming 	uint	cam1;		/* Carry Register One Mask */
435dd3d1f56SAndy Fleming 	uint	cam2;		/* Carry Register Two Mask */
436dd3d1f56SAndy Fleming } rmon_mib_t;
437dd3d1f56SAndy Fleming 
438dd3d1f56SAndy Fleming typedef struct tsec_hash_regs
439dd3d1f56SAndy Fleming {
440dd3d1f56SAndy Fleming 	uint	iaddr0;		/* Individual Address Register 0 */
441dd3d1f56SAndy Fleming 	uint	iaddr1;		/* Individual Address Register 1 */
442dd3d1f56SAndy Fleming 	uint	iaddr2;		/* Individual Address Register 2 */
443dd3d1f56SAndy Fleming 	uint	iaddr3;		/* Individual Address Register 3 */
444dd3d1f56SAndy Fleming 	uint	iaddr4;		/* Individual Address Register 4 */
445dd3d1f56SAndy Fleming 	uint	iaddr5;		/* Individual Address Register 5 */
446dd3d1f56SAndy Fleming 	uint	iaddr6;		/* Individual Address Register 6 */
447dd3d1f56SAndy Fleming 	uint	iaddr7;		/* Individual Address Register 7 */
448dd3d1f56SAndy Fleming 	uint	res1[24];
449dd3d1f56SAndy Fleming 	uint	gaddr0;		/* Group Address Register 0 */
450dd3d1f56SAndy Fleming 	uint	gaddr1;		/* Group Address Register 1 */
451dd3d1f56SAndy Fleming 	uint	gaddr2;		/* Group Address Register 2 */
452dd3d1f56SAndy Fleming 	uint	gaddr3;		/* Group Address Register 3 */
453dd3d1f56SAndy Fleming 	uint	gaddr4;		/* Group Address Register 4 */
454dd3d1f56SAndy Fleming 	uint	gaddr5;		/* Group Address Register 5 */
455dd3d1f56SAndy Fleming 	uint	gaddr6;		/* Group Address Register 6 */
456dd3d1f56SAndy Fleming 	uint	gaddr7;		/* Group Address Register 7 */
457dd3d1f56SAndy Fleming 	uint	res2[24];
458dd3d1f56SAndy Fleming } tsec_hash_t;
459dd3d1f56SAndy Fleming 
460dd3d1f56SAndy Fleming typedef struct tsec
461dd3d1f56SAndy Fleming {
462dd3d1f56SAndy Fleming 	/* General Control and Status Registers (0x2_n000) */
463dd3d1f56SAndy Fleming 	uint	res000[4];
464dd3d1f56SAndy Fleming 
465dd3d1f56SAndy Fleming 	uint	ievent;		/* Interrupt Event */
466dd3d1f56SAndy Fleming 	uint	imask;		/* Interrupt Mask */
467dd3d1f56SAndy Fleming 	uint	edis;		/* Error Disabled */
468dd3d1f56SAndy Fleming 	uint	res01c;
469dd3d1f56SAndy Fleming 	uint	ecntrl;		/* Ethernet Control */
470dd3d1f56SAndy Fleming 	uint	minflr;		/* Minimum Frame Length */
471dd3d1f56SAndy Fleming 	uint	ptv;		/* Pause Time Value */
472dd3d1f56SAndy Fleming 	uint	dmactrl;	/* DMA Control */
473dd3d1f56SAndy Fleming 	uint	tbipa;		/* TBI PHY Address */
474dd3d1f56SAndy Fleming 
475dd3d1f56SAndy Fleming 	uint	res034[3];
476dd3d1f56SAndy Fleming 	uint	res040[48];
477dd3d1f56SAndy Fleming 
478dd3d1f56SAndy Fleming 	/* Transmit Control and Status Registers (0x2_n100) */
479dd3d1f56SAndy Fleming 	uint	tctrl;		/* Transmit Control */
480dd3d1f56SAndy Fleming 	uint	tstat;		/* Transmit Status */
481dd3d1f56SAndy Fleming 	uint	res108;
482dd3d1f56SAndy Fleming 	uint	tbdlen;		/* Tx BD Data Length */
483dd3d1f56SAndy Fleming 	uint	res110[5];
484dd3d1f56SAndy Fleming 	uint	ctbptr;		/* Current TxBD Pointer */
485dd3d1f56SAndy Fleming 	uint	res128[23];
486dd3d1f56SAndy Fleming 	uint	tbptr;		/* TxBD Pointer */
487dd3d1f56SAndy Fleming 	uint	res188[30];
488dd3d1f56SAndy Fleming 	/* (0x2_n200) */
489dd3d1f56SAndy Fleming 	uint	res200;
490dd3d1f56SAndy Fleming 	uint	tbase;		/* TxBD Base Address */
491dd3d1f56SAndy Fleming 	uint	res208[42];
492dd3d1f56SAndy Fleming 	uint	ostbd;		/* Out of Sequence TxBD */
493dd3d1f56SAndy Fleming 	uint	ostbdp;		/* Out of Sequence Tx Data Buffer Pointer */
494dd3d1f56SAndy Fleming 	uint	res2b8[18];
495dd3d1f56SAndy Fleming 
496dd3d1f56SAndy Fleming 	/* Receive Control and Status Registers (0x2_n300) */
497dd3d1f56SAndy Fleming 	uint	rctrl;		/* Receive Control */
498dd3d1f56SAndy Fleming 	uint	rstat;		/* Receive Status */
499dd3d1f56SAndy Fleming 	uint	res308;
500dd3d1f56SAndy Fleming 	uint	rbdlen;		/* RxBD Data Length */
501dd3d1f56SAndy Fleming 	uint	res310[4];
502dd3d1f56SAndy Fleming 	uint	res320;
503dd3d1f56SAndy Fleming 	uint	crbptr;	/* Current Receive Buffer Pointer */
504dd3d1f56SAndy Fleming 	uint	res328[6];
505dd3d1f56SAndy Fleming 	uint	mrblr;	/* Maximum Receive Buffer Length */
506dd3d1f56SAndy Fleming 	uint	res344[16];
507dd3d1f56SAndy Fleming 	uint	rbptr;	/* RxBD Pointer */
508dd3d1f56SAndy Fleming 	uint	res388[30];
509dd3d1f56SAndy Fleming 	/* (0x2_n400) */
510dd3d1f56SAndy Fleming 	uint	res400;
511dd3d1f56SAndy Fleming 	uint	rbase;	/* RxBD Base Address */
512dd3d1f56SAndy Fleming 	uint	res408[62];
513dd3d1f56SAndy Fleming 
514dd3d1f56SAndy Fleming 	/* MAC Registers (0x2_n500) */
515dd3d1f56SAndy Fleming 	uint	maccfg1;	/* MAC Configuration #1 */
516dd3d1f56SAndy Fleming 	uint	maccfg2;	/* MAC Configuration #2 */
517dd3d1f56SAndy Fleming 	uint	ipgifg;		/* Inter Packet Gap/Inter Frame Gap */
518dd3d1f56SAndy Fleming 	uint	hafdup;		/* Half-duplex */
519dd3d1f56SAndy Fleming 	uint	maxfrm;		/* Maximum Frame */
520dd3d1f56SAndy Fleming 	uint	res514;
521dd3d1f56SAndy Fleming 	uint	res518;
522dd3d1f56SAndy Fleming 
523dd3d1f56SAndy Fleming 	uint	res51c;
524dd3d1f56SAndy Fleming 
525dd3d1f56SAndy Fleming 	uint	miimcfg;	/* MII Management: Configuration */
526dd3d1f56SAndy Fleming 	uint	miimcom;	/* MII Management: Command */
527dd3d1f56SAndy Fleming 	uint	miimadd;	/* MII Management: Address */
528dd3d1f56SAndy Fleming 	uint	miimcon;	/* MII Management: Control */
529dd3d1f56SAndy Fleming 	uint	miimstat;	/* MII Management: Status */
530dd3d1f56SAndy Fleming 	uint	miimind;	/* MII Management: Indicators */
531dd3d1f56SAndy Fleming 
532dd3d1f56SAndy Fleming 	uint	res538;
533dd3d1f56SAndy Fleming 
534dd3d1f56SAndy Fleming 	uint	ifstat;		/* Interface Status */
535dd3d1f56SAndy Fleming 	uint	macstnaddr1;	/* Station Address, part 1 */
536dd3d1f56SAndy Fleming 	uint	macstnaddr2;	/* Station Address, part 2 */
537dd3d1f56SAndy Fleming 	uint	res548[46];
538dd3d1f56SAndy Fleming 
539dd3d1f56SAndy Fleming 	/* (0x2_n600) */
540dd3d1f56SAndy Fleming 	uint	res600[32];
541dd3d1f56SAndy Fleming 
542dd3d1f56SAndy Fleming 	/* RMON MIB Registers (0x2_n680-0x2_n73c) */
543dd3d1f56SAndy Fleming 	rmon_mib_t	rmon;
544dd3d1f56SAndy Fleming 	uint	res740[48];
545dd3d1f56SAndy Fleming 
546dd3d1f56SAndy Fleming 	/* Hash Function Registers (0x2_n800) */
547dd3d1f56SAndy Fleming 	tsec_hash_t	hash;
548dd3d1f56SAndy Fleming 
549dd3d1f56SAndy Fleming 	uint	res900[128];
550dd3d1f56SAndy Fleming 
551dd3d1f56SAndy Fleming 	/* Pattern Registers (0x2_nb00) */
552dd3d1f56SAndy Fleming 	uint	resb00[62];
553dd3d1f56SAndy Fleming 	uint	attr;	   /* Default Attribute Register */
554dd3d1f56SAndy Fleming 	uint	attreli;	   /* Default Attribute Extract Length and Index */
555dd3d1f56SAndy Fleming 
556dd3d1f56SAndy Fleming 	/* TSEC Future Expansion Space (0x2_nc00-0x2_nffc) */
557dd3d1f56SAndy Fleming 	uint	resc00[256];
558dd3d1f56SAndy Fleming } tsec_t;
559dd3d1f56SAndy Fleming 
560dd3d1f56SAndy Fleming #define TSEC_GIGABIT (1)
561dd3d1f56SAndy Fleming 
562dd3d1f56SAndy Fleming /* This flag currently only has
563dd3d1f56SAndy Fleming  * meaning if we're using the eTSEC */
564dd3d1f56SAndy Fleming #define TSEC_REDUCED	(1 << 1)
565dd3d1f56SAndy Fleming 
566*2abe361cSAndy Fleming #define TSEC_SGMII	(1 << 2)
567*2abe361cSAndy Fleming 
568dd3d1f56SAndy Fleming struct tsec_private {
569dd3d1f56SAndy Fleming 	volatile tsec_t *regs;
570dd3d1f56SAndy Fleming 	volatile tsec_t *phyregs;
571dd3d1f56SAndy Fleming 	struct phy_info *phyinfo;
572dd3d1f56SAndy Fleming 	uint phyaddr;
573dd3d1f56SAndy Fleming 	u32 flags;
574dd3d1f56SAndy Fleming 	uint link;
575dd3d1f56SAndy Fleming 	uint duplexity;
576dd3d1f56SAndy Fleming 	uint speed;
577dd3d1f56SAndy Fleming };
578dd3d1f56SAndy Fleming 
579dd3d1f56SAndy Fleming 
580dd3d1f56SAndy Fleming /*
581dd3d1f56SAndy Fleming  * struct phy_cmd:  A command for reading or writing a PHY register
582dd3d1f56SAndy Fleming  *
583dd3d1f56SAndy Fleming  * mii_reg:  The register to read or write
584dd3d1f56SAndy Fleming  *
585dd3d1f56SAndy Fleming  * mii_data:  For writes, the value to put in the register.
586dd3d1f56SAndy Fleming  *	A value of -1 indicates this is a read.
587dd3d1f56SAndy Fleming  *
588dd3d1f56SAndy Fleming  * funct: A function pointer which is invoked for each command.
589dd3d1f56SAndy Fleming  *	For reads, this function will be passed the value read
590dd3d1f56SAndy Fleming  *	from the PHY, and process it.
591dd3d1f56SAndy Fleming  *	For writes, the result of this function will be written
592dd3d1f56SAndy Fleming  *	to the PHY register
593dd3d1f56SAndy Fleming  */
594dd3d1f56SAndy Fleming struct phy_cmd {
595dd3d1f56SAndy Fleming 	uint mii_reg;
596dd3d1f56SAndy Fleming 	uint mii_data;
597dd3d1f56SAndy Fleming 	uint (*funct) (uint mii_reg, struct tsec_private * priv);
598dd3d1f56SAndy Fleming };
599dd3d1f56SAndy Fleming 
600dd3d1f56SAndy Fleming /* struct phy_info: a structure which defines attributes for a PHY
601dd3d1f56SAndy Fleming  *
602dd3d1f56SAndy Fleming  * id will contain a number which represents the PHY.  During
603dd3d1f56SAndy Fleming  * startup, the driver will poll the PHY to find out what its
604dd3d1f56SAndy Fleming  * UID--as defined by registers 2 and 3--is.  The 32-bit result
605dd3d1f56SAndy Fleming  * gotten from the PHY will be shifted right by "shift" bits to
606dd3d1f56SAndy Fleming  * discard any bits which may change based on revision numbers
607dd3d1f56SAndy Fleming  * unimportant to functionality
608dd3d1f56SAndy Fleming  *
609dd3d1f56SAndy Fleming  * The struct phy_cmd entries represent pointers to an arrays of
610dd3d1f56SAndy Fleming  * commands which tell the driver what to do to the PHY.
611dd3d1f56SAndy Fleming  */
612dd3d1f56SAndy Fleming struct phy_info {
613dd3d1f56SAndy Fleming 	uint id;
614dd3d1f56SAndy Fleming 	char *name;
615dd3d1f56SAndy Fleming 	uint shift;
616dd3d1f56SAndy Fleming 	/* Called to configure the PHY, and modify the controller
617dd3d1f56SAndy Fleming 	 * based on the results */
618dd3d1f56SAndy Fleming 	struct phy_cmd *config;
619dd3d1f56SAndy Fleming 
620dd3d1f56SAndy Fleming 	/* Called when starting up the controller */
621dd3d1f56SAndy Fleming 	struct phy_cmd *startup;
622dd3d1f56SAndy Fleming 
623dd3d1f56SAndy Fleming 	/* Called when bringing down the controller */
624dd3d1f56SAndy Fleming 	struct phy_cmd *shutdown;
625dd3d1f56SAndy Fleming };
626dd3d1f56SAndy Fleming 
627dd3d1f56SAndy Fleming struct tsec_info_struct {
62875b9d4aeSAndy Fleming 	tsec_t *regs;
62975b9d4aeSAndy Fleming 	tsec_t *miiregs;
63075b9d4aeSAndy Fleming 	char *devname;
631dd3d1f56SAndy Fleming 	unsigned int phyaddr;
632dd3d1f56SAndy Fleming 	u32 flags;
633dd3d1f56SAndy Fleming };
634dd3d1f56SAndy Fleming 
63575b9d4aeSAndy Fleming int tsec_initialize(bd_t * bis, struct tsec_info_struct *tsec_info);
63675b9d4aeSAndy Fleming int tsec_standard_init(bd_t *bis);
63775b9d4aeSAndy Fleming int tsec_eth_init(bd_t *bis, struct tsec_info_struct *tsec_info, int num);
63875b9d4aeSAndy Fleming 
639dd3d1f56SAndy Fleming #endif /* __TSEC_H */
640