xref: /titanic_41/usr/src/uts/common/io/sfe/sfe_mii.h (revision bdb9230ac765cb7af3fc1f4119caf2c5720dceb3)
1f8919bdaSduboff /*
2f8919bdaSduboff  *  sfe_mii.h: mii header for gem
3f8919bdaSduboff  *
4f8919bdaSduboff  * Copyright (c) 2002-2007 Masayuki Murayama.  All rights reserved.
5f8919bdaSduboff  *
6f8919bdaSduboff  * Redistribution and use in source and binary forms, with or without
7f8919bdaSduboff  * modification, are permitted provided that the following conditions are met:
8f8919bdaSduboff  *
9f8919bdaSduboff  * 1. Redistributions of source code must retain the above copyright notice,
10f8919bdaSduboff  *    this list of conditions and the following disclaimer.
11f8919bdaSduboff  *
12f8919bdaSduboff  * 2. Redistributions in binary form must reproduce the above copyright notice,
13f8919bdaSduboff  *    this list of conditions and the following disclaimer in the documentation
14f8919bdaSduboff  *    and/or other materials provided with the distribution.
15f8919bdaSduboff  *
16f8919bdaSduboff  * 3. Neither the name of the author nor the names of its contributors may be
17f8919bdaSduboff  *    used to endorse or promote products derived from this software without
18f8919bdaSduboff  *    specific prior written permission.
19f8919bdaSduboff  *
20f8919bdaSduboff  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21f8919bdaSduboff  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22f8919bdaSduboff  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23f8919bdaSduboff  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24f8919bdaSduboff  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25f8919bdaSduboff  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26f8919bdaSduboff  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27f8919bdaSduboff  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28f8919bdaSduboff  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29f8919bdaSduboff  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30f8919bdaSduboff  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
31f8919bdaSduboff  * DAMAGE.
32f8919bdaSduboff  */
33f8919bdaSduboff 
34f8919bdaSduboff /*
35*bdb9230aSGarrett D'Amore  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
36*bdb9230aSGarrett D'Amore  * Use is subject to license terms.
37*bdb9230aSGarrett D'Amore  */
38*bdb9230aSGarrett D'Amore 
39*bdb9230aSGarrett D'Amore /*
40f8919bdaSduboff  * sfe_mii.h : MII registers
41f8919bdaSduboff  */
42f8919bdaSduboff #ifndef _SFE_MII_H_
43f8919bdaSduboff #define	_SFE_MII_H_
44f8919bdaSduboff 
45f8919bdaSduboff #include <sys/miiregs.h>
46f8919bdaSduboff 
47f8919bdaSduboff #define	MII_AN_LPANXT		8
48f8919bdaSduboff #define	MII_MS_CONTROL		9
49f8919bdaSduboff #define	MII_MS_STATUS		10
50f8919bdaSduboff #define	MII_XSTATUS		15
51f8919bdaSduboff 
52f8919bdaSduboff /* for 1000BaseT support */
53f8919bdaSduboff #define	MII_1000TC		MII_MS_CONTROL
54f8919bdaSduboff #define	MII_1000TS		MII_MS_STATUS
55f8919bdaSduboff #define	MII_CONTROL_SPEED	0x2040
56f8919bdaSduboff 
57f8919bdaSduboff #define	MII_CONTROL_10MB	0x0000
58f8919bdaSduboff #define	MII_CONTROL_1000MB	0x0040
59f8919bdaSduboff 
60f8919bdaSduboff #define	MII_CONTROL_BITS	\
61f8919bdaSduboff 	"\020"	\
62f8919bdaSduboff 	"\020RESET"	\
63f8919bdaSduboff 	"\017LOOPBACK"	\
64f8919bdaSduboff 	"\016100MB"	\
65f8919bdaSduboff 	"\015ANE"	\
66f8919bdaSduboff 	"\014PWRDN"	\
67f8919bdaSduboff 	"\013ISOLATE"	\
68f8919bdaSduboff 	"\012RSAN"	\
69f8919bdaSduboff 	"\011FDUPLEX"	\
70f8919bdaSduboff 	"\010COLTST"	\
71f8919bdaSduboff 	"\0071000M"
72f8919bdaSduboff #define	MII_STATUS_XSTATUS		0x0100
73f8919bdaSduboff #define	MII_STATUS_100_BASE_T2_FD	0x0400
74f8919bdaSduboff #define	MII_STATUS_100_BASE_T2		0x0200
75f8919bdaSduboff 
76f8919bdaSduboff #define	MII_STATUS_ABILITY_TECH	\
77f8919bdaSduboff 	(MII_STATUS_100_BASE_T4	|	\
78f8919bdaSduboff 	MII_STATUS_100_BASEX_FD |	\
79f8919bdaSduboff 	MII_STATUS_100_BASEX |	\
80f8919bdaSduboff 	MII_STATUS_10 |	\
81f8919bdaSduboff 	MII_STATUS_10_FD)
82f8919bdaSduboff 
83f8919bdaSduboff 
84f8919bdaSduboff #define	MII_STATUS_BITS	\
85f8919bdaSduboff 	"\020"	\
86f8919bdaSduboff 	"\020100_BASE_T4"	\
87f8919bdaSduboff 	"\017100_BASEX_FD"	\
88f8919bdaSduboff 	"\016100_BASEX"	\
89f8919bdaSduboff 	"\01510_BASE_FD"	\
90f8919bdaSduboff 	"\01410_BASE"	\
91f8919bdaSduboff 	"\013100_BASE_T2_FD"	\
92f8919bdaSduboff 	"\012100_BASE_T2"	\
93f8919bdaSduboff 	"\011XSTATUS"	\
94f8919bdaSduboff 	"\007MFPRMBLSUPR"	\
95f8919bdaSduboff 	"\006ANDONE"	\
96f8919bdaSduboff 	"\005REMFAULT"	\
97f8919bdaSduboff 	"\004CANAUTONEG"	\
98f8919bdaSduboff 	"\003LINKUP"	\
99f8919bdaSduboff 	"\002JABBERING"	\
100f8919bdaSduboff 	"\001EXTENDED"
101f8919bdaSduboff 
102f8919bdaSduboff #define	MII_ABILITY_TECH	\
103f8919bdaSduboff 	(MII_ABILITY_100BASE_T4	|	\
104f8919bdaSduboff 	MII_ABILITY_100BASE_TX_FD |	\
105f8919bdaSduboff 	MII_ABILITY_100BASE_TX |	\
106f8919bdaSduboff 	MII_ABILITY_10BASE_T |	\
107f8919bdaSduboff 	MII_ABILITY_10BASE_T_FD)
108f8919bdaSduboff 
109f8919bdaSduboff #define	MII_ABILITY_ALL	\
110f8919bdaSduboff 	(MII_AN_ADVERT_REMFAULT |	\
111*bdb9230aSGarrett D'Amore 	MII_ABILITY_ASMPAUSE |	\
112f8919bdaSduboff 	MII_ABILITY_PAUSE |	\
113f8919bdaSduboff 	MII_ABILITY_TECH)
114f8919bdaSduboff 
115f8919bdaSduboff 
116f8919bdaSduboff #define	MII_ABILITY_BITS	\
117f8919bdaSduboff 	"\020"	\
118f8919bdaSduboff 	"\016REMFAULT"	\
119f8919bdaSduboff 	"\014ASM_DIR"	\
120f8919bdaSduboff 	"\013PAUSE"	\
121f8919bdaSduboff 	"\012100BASE_T4"	\
122f8919bdaSduboff 	"\011100BASE_TX_FD"	\
123f8919bdaSduboff 	"\010100BASE_TX"	\
124f8919bdaSduboff 	"\00710BASE_T_FD"	\
125f8919bdaSduboff 	"\00610BASE_T"
126f8919bdaSduboff 
127f8919bdaSduboff #define	MII_AN_EXP_BITS	\
128f8919bdaSduboff 	"\020"	\
129f8919bdaSduboff 	"\005PARFAULT"	\
130f8919bdaSduboff 	"\004LPCANNXTP"	\
131f8919bdaSduboff 	"\003CANNXTPP"	\
132f8919bdaSduboff 	"\002PAGERCVD"	\
133f8919bdaSduboff 	"\001LPCANAN"
134f8919bdaSduboff 
135f8919bdaSduboff #define	MII_1000TC_TESTMODE	0xe000
136f8919bdaSduboff #define	MII_1000TC_CFG_EN	0x1000
137f8919bdaSduboff #define	MII_1000TC_CFG_VAL	0x0800
138f8919bdaSduboff #define	MII_1000TC_PORTTYPE	0x0400
139f8919bdaSduboff #define	MII_1000TC_ADV_FULL	0x0200
140f8919bdaSduboff #define	MII_1000TC_ADV_HALF	0x0100
141f8919bdaSduboff 
142f8919bdaSduboff #define	MII_1000TC_BITS	\
143f8919bdaSduboff 	"\020"	\
144f8919bdaSduboff 	"\015CFG_EN"	\
145f8919bdaSduboff 	"\014CFG_VAL"	\
146f8919bdaSduboff 	"\013PORTTYPE"	\
147f8919bdaSduboff 	"\012FULL"	\
148f8919bdaSduboff 	"\011HALF"
149f8919bdaSduboff 
150f8919bdaSduboff #define	MII_1000TS_CFG_FAULT	0x8000
151f8919bdaSduboff #define	MII_1000TS_CFG_MASTER	0x4000
152f8919bdaSduboff #define	MII_1000TS_LOCALRXOK	0x2000
153f8919bdaSduboff #define	MII_1000TS_REMOTERXOK	0x1000
154f8919bdaSduboff #define	MII_1000TS_LP_FULL	0x0800
155f8919bdaSduboff #define	MII_1000TS_LP_HALF	0x0400
156f8919bdaSduboff 
157f8919bdaSduboff #define	MII_1000TS_BITS	\
158f8919bdaSduboff 	"\020"	\
159f8919bdaSduboff 	"\020CFG_FAULT"	\
160f8919bdaSduboff 	"\017CFG_MASTER"	\
161f8919bdaSduboff 	"\014CFG_LOCALRXOK"	\
162f8919bdaSduboff 	"\013CFG_REMOTERXOK"	\
163f8919bdaSduboff 	"\012LP_FULL"	\
164f8919bdaSduboff 	"\011LP_HALF"
165f8919bdaSduboff 
166f8919bdaSduboff #define	MII_XSTATUS_1000BASEX_FD	0x8000
167f8919bdaSduboff #define	MII_XSTATUS_1000BASEX		0x4000
168f8919bdaSduboff #define	MII_XSTATUS_1000BASET_FD	0x2000
169f8919bdaSduboff #define	MII_XSTATUS_1000BASET		0x1000
170f8919bdaSduboff 
171f8919bdaSduboff #define	MII_XSTATUS_BITS	\
172f8919bdaSduboff 	"\020"	\
173f8919bdaSduboff 	"\0201000BASEX_FD"	\
174f8919bdaSduboff 	"\0171000BASEX"		\
175f8919bdaSduboff 	"\0161000BASET_FD"	\
176f8919bdaSduboff 	"\0151000BASET"
177f8919bdaSduboff 
178f8919bdaSduboff #define	MII_READ_CMD(p, r)	\
179f8919bdaSduboff 	((6<<(18+5+5)) | ((p)<<(18+5)) | ((r)<<18))
180f8919bdaSduboff 
181f8919bdaSduboff #define	MII_WRITE_CMD(p, r, v)	\
182f8919bdaSduboff 	((5<<(18+5+5)) | ((p)<<(18+5)) | ((r)<<18) | (2 << 16) | (v))
183f8919bdaSduboff 
184f8919bdaSduboff #endif /* _SFE_MII_H_ */
185