2 * gem_mii.h: mii header for gem
4 * Copyright (c) 2002-2007 Masayuki Murayama. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
16 * 3. Neither the name of the author nor the names of its contributors may be
17 * used to endorse or promote products derived from this software without
18 * specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
35 * gem_mii.h : MII registers
40 #ifdef GEM_CONFIG_GLDv3
41 #include <sys/miiregs.h>
47 #define MII_AN_ADVERT 4
48 #define MII_AN_LPABLE 5
49 #define MII_AN_EXPANSION 6
50 #define MII_AN_NXTPGXMIT 7
51 #endif /* GEM_CONFIG_GLDv3 */
53 #define MII_AN_LPANXT 8
54 #define MII_MS_CONTROL 9
55 #define MII_MS_STATUS 10
56 #define MII_XSTATUS 15
58 /* for 1000BaseT support */
59 #define MII_1000TC MII_MS_CONTROL
60 #define MII_1000TS MII_MS_STATUS
61 #ifndef GEM_CONFIG_GLDv3
62 #define MII_CONTROL_RESET 0x8000
63 #define MII_CONTROL_LOOPBACK 0x4000
64 #define MII_CONTROL_100MB 0x2000
65 #define MII_CONTROL_ANE 0x1000
66 #define MII_CONTROL_PWRDN 0x0800
67 #define MII_CONTROL_ISOLATE 0x0400
68 #define MII_CONTROL_RSAN 0x0200
69 #define MII_CONTROL_FDUPLEX 0x0100
70 #define MII_CONTROL_COLTST 0x0080
71 #endif /* !GEM_CONFIG_GLDv3 */
72 #define MII_CONTROL_SPEED 0x2040
74 #define MII_CONTROL_10MB 0x0000
75 #define MII_CONTROL_1000MB 0x0040
77 #define MII_CONTROL_BITS \
89 #ifndef GEM_CONFIG_GLDv3
90 #define MII_STATUS_100_BASE_T4 0x8000
91 #define MII_STATUS_100_BASEX_FD 0x4000
92 #define MII_STATUS_100_BASEX 0x2000
93 #define MII_STATUS_10_FD 0x1000
94 #define MII_STATUS_10 0x0800
95 #define MII_STATUS_MFPRMBLSUPR 0x0040
96 #define MII_STATUS_ANDONE 0x0020
97 #define MII_STATUS_REMFAULT 0x0010
98 #define MII_STATUS_CANAUTONEG 0x0008
99 #define MII_STATUS_LINKUP 0x0004
100 #define MII_STATUS_JABBERING 0x0002
101 #define MII_STATUS_EXTENDED 0x0001
102 #endif /* !GEM_CONFIG_GLDv3 */
103 #define MII_STATUS_XSTATUS 0x0100
104 #define MII_STATUS_100_BASE_T2_FD 0x0400
105 #define MII_STATUS_100_BASE_T2 0x0200
107 #define MII_STATUS_ABILITY_TECH \
108 (MII_STATUS_100_BASE_T4 | \
109 MII_STATUS_100_BASEX_FD | \
110 MII_STATUS_100_BASEX | \
115 #define MII_STATUS_BITS \
122 "\013100_BASE_T2_FD" \
132 #ifndef GEM_CONFIG_GLDv3
133 #define MII_AN_ADVERT_NP 0x8000
134 #define MII_AN_ADVERT_REMFAULT 0x2000
135 #define MII_AN_ADVERT_SELECTOR 0x001f
136 #endif /* !GEM_CONFIG_GLDv3 */
138 #define MII_ABILITY_ASM_DIR 0x0800 /* for annex 28B */
139 #ifndef MII_ABILITY_PAUSE
140 #define MII_ABILITY_PAUSE 0x0400 /* for IEEE 802.3x */
142 #ifndef GEM_CONFIG_GLDv3
143 #define MII_ABILITY_100BASE_T4 0x0200
144 #define MII_ABILITY_100BASE_TX_FD 0x0100
145 #define MII_ABILITY_100BASE_TX 0x0080
146 #define MII_ABILITY_10BASE_T_FD 0x0040
147 #define MII_ABILITY_10BASE_T 0x0020
148 #endif /* !GEM_CONFIG_GLDv3 */
150 #define MII_AN_LPABLE_NP 0x8000
152 #define MII_ABILITY_TECH \
153 (MII_ABILITY_100BASE_T4 | \
154 MII_ABILITY_100BASE_TX_FD | \
155 MII_ABILITY_100BASE_TX | \
156 MII_ABILITY_10BASE_T | \
157 MII_ABILITY_10BASE_T_FD)
159 #define MII_ABILITY_ALL \
160 (MII_AN_ADVERT_REMFAULT | \
161 MII_ABILITY_ASM_DIR | \
162 MII_ABILITY_PAUSE | \
166 #define MII_ABILITY_BITS \
172 "\011100BASE_TX_FD" \
176 #ifndef GEM_CONFIG_GLDv3
177 #define MII_AN_EXP_PARFAULT 0x0010
178 #define MII_AN_EXP_LPCANNXTP 0x0008
179 #define MII_AN_EXP_CANNXTPP 0x0004
180 #define MII_AN_EXP_PAGERCVD 0x0002
181 #define MII_AN_EXP_LPCANAN 0x0001
182 #endif /* !GEM_CONFIG_GLDv3 */
184 #define MII_AN_EXP_BITS \
192 #define MII_1000TC_TESTMODE 0xe000
193 #define MII_1000TC_CFG_EN 0x1000
194 #define MII_1000TC_CFG_VAL 0x0800
195 #define MII_1000TC_PORTTYPE 0x0400
196 #define MII_1000TC_ADV_FULL 0x0200
197 #define MII_1000TC_ADV_HALF 0x0100
199 #define MII_1000TC_BITS \
207 #define MII_1000TS_CFG_FAULT 0x8000
208 #define MII_1000TS_CFG_MASTER 0x4000
209 #define MII_1000TS_LOCALRXOK 0x2000
210 #define MII_1000TS_REMOTERXOK 0x1000
211 #define MII_1000TS_LP_FULL 0x0800
212 #define MII_1000TS_LP_HALF 0x0400
214 #define MII_1000TS_BITS \
218 "\014CFG_LOCALRXOK" \
219 "\013CFG_REMOTERXOK" \
223 #define MII_XSTATUS_1000BASEX_FD 0x8000
224 #define MII_XSTATUS_1000BASEX 0x4000
225 #define MII_XSTATUS_1000BASET_FD 0x2000
226 #define MII_XSTATUS_1000BASET 0x1000
228 #define MII_XSTATUS_BITS \
235 #define MII_READ_CMD(p, r) \
236 ((6<<(18+5+5)) | ((p)<<(18+5)) | ((r)<<18))
238 #define MII_WRITE_CMD(p, r, v) \
239 ((5<<(18+5+5)) | ((p)<<(18+5)) | ((r)<<18) | (2 << 16) | (v))
241 #endif /* _GEM_MII_H_ */