xref: /titanic_51/usr/src/uts/common/sys/miiregs.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 1997-2003 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*
28*7c478bd9Sstevel@tonic-gate  * Definitions for MII registers from 802.3u and vendor documentation
29*7c478bd9Sstevel@tonic-gate  */
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #ifndef _MIIREGS_H
32*7c478bd9Sstevel@tonic-gate #define	_MIIREGS_H
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
37*7c478bd9Sstevel@tonic-gate extern "C" {
38*7c478bd9Sstevel@tonic-gate #endif
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate /* Register addresses: Section 22.2.4 */
41*7c478bd9Sstevel@tonic-gate #define	MII_CONTROL		0
42*7c478bd9Sstevel@tonic-gate #define	MII_STATUS		1
43*7c478bd9Sstevel@tonic-gate #define	MII_PHYIDH		2
44*7c478bd9Sstevel@tonic-gate #define	MII_PHYIDL		3
45*7c478bd9Sstevel@tonic-gate #define	MII_AN_ADVERT		4	/* Auto negotiation advertisement. */
46*7c478bd9Sstevel@tonic-gate #define	MII_AN_LPABLE		5	/* Auto neg. Link Partner Ability  */
47*7c478bd9Sstevel@tonic-gate #define	MII_AN_EXPANSION	6	/* Auto neg. Expansion.		   */
48*7c478bd9Sstevel@tonic-gate #define	MII_AN_NXTPGXMIT	7	/* Auto neg. Next Page Transmit	   */
49*7c478bd9Sstevel@tonic-gate #define	MII_RESERVED		8	/* Reserved up to 16		   */
50*7c478bd9Sstevel@tonic-gate #define	MII_VENDOR(x)		(16+(x)) /* Vendor specific		   */
51*7c478bd9Sstevel@tonic-gate 
52*7c478bd9Sstevel@tonic-gate /* Control register: 22.2.4.1 */
53*7c478bd9Sstevel@tonic-gate #define	MII_CONTROL_RESET	(1<<15)
54*7c478bd9Sstevel@tonic-gate #define	MII_CONTROL_LOOPBACK	(1<<14)
55*7c478bd9Sstevel@tonic-gate #define	MII_CONTROL_100MB	(1<<13)
56*7c478bd9Sstevel@tonic-gate #define	MII_CONTROL_ANE		(1<<12)
57*7c478bd9Sstevel@tonic-gate #define	MII_CONTROL_PWRDN	(1<<11)
58*7c478bd9Sstevel@tonic-gate #define	MII_CONTROL_ISOLATE	(1<<10)
59*7c478bd9Sstevel@tonic-gate #define	MII_CONTROL_RSAN	(1<<9)
60*7c478bd9Sstevel@tonic-gate #define	MII_CONTROL_FDUPLEX	(1<<8)
61*7c478bd9Sstevel@tonic-gate #define	MII_CONTROL_COLTST	(1<<7)
62*7c478bd9Sstevel@tonic-gate #define	MII_CONTROL_RESERVED	0x7f
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate /* Status register: 22.2.4.2 */
65*7c478bd9Sstevel@tonic-gate #define	MII_STATUS_100_BASE_T4	(1<<15)
66*7c478bd9Sstevel@tonic-gate #define	MII_STATUS_100_BASEX_FD	(1<<14)
67*7c478bd9Sstevel@tonic-gate #define	MII_STATUS_100_BASEX	(1<<13)
68*7c478bd9Sstevel@tonic-gate #define	MII_STATUS_10_FD	(1<<12)
69*7c478bd9Sstevel@tonic-gate #define	MII_STATUS_10		(1<<11)
70*7c478bd9Sstevel@tonic-gate #define	MII_STATUS_RESERVED	(0xf<<7)
71*7c478bd9Sstevel@tonic-gate #define	MII_STATUS_MFPRMBLSUPR	(1<<6)
72*7c478bd9Sstevel@tonic-gate #define	MII_STATUS_ANDONE	(1<<5)
73*7c478bd9Sstevel@tonic-gate #define	MII_STATUS_REMFAULT	(1<<4)
74*7c478bd9Sstevel@tonic-gate #define	MII_STATUS_CANAUTONEG	(1<<3)
75*7c478bd9Sstevel@tonic-gate #define	MII_STATUS_LINKUP	(1<<2)
76*7c478bd9Sstevel@tonic-gate #define	MII_STATUS_JABBERING	(1<<1)
77*7c478bd9Sstevel@tonic-gate #define	MII_STATUS_EXTENDED	(1<<0)
78*7c478bd9Sstevel@tonic-gate 
79*7c478bd9Sstevel@tonic-gate /* Advertisement/Partner ability registers: 28.2.4.1.3/4 */
80*7c478bd9Sstevel@tonic-gate 
81*7c478bd9Sstevel@tonic-gate #define	MII_AN_ADVERT_NP	(1<<15)
82*7c478bd9Sstevel@tonic-gate #define	MII_AN_ADVERT_ACK	(1<<14)
83*7c478bd9Sstevel@tonic-gate #define	MII_AN_ADVERT_REMFAULT	(1<<13)
84*7c478bd9Sstevel@tonic-gate #define	MII_AN_ADVERT_RESERVED	(3<<11)
85*7c478bd9Sstevel@tonic-gate #define	MII_AN_ADVERT_FCS	(1<<10)
86*7c478bd9Sstevel@tonic-gate #define	MII_AN_ADVERT_TECHABLE	(0xff<<5)
87*7c478bd9Sstevel@tonic-gate #define	MII_AN_ADVERT_SELECTOR	(0x1f)
88*7c478bd9Sstevel@tonic-gate 
89*7c478bd9Sstevel@tonic-gate /* Technology field bits (above). From Annex 28B */
90*7c478bd9Sstevel@tonic-gate #define	MII_ABILITY_10BASE_T	(1<<5)
91*7c478bd9Sstevel@tonic-gate #define	MII_ABILITY_10BASE_T_FD	(1<<6)
92*7c478bd9Sstevel@tonic-gate #define	MII_ABILITY_100BASE_TX	(1<<7)
93*7c478bd9Sstevel@tonic-gate #define	MII_ABILITY_100BASE_TX_FD (1<<8)
94*7c478bd9Sstevel@tonic-gate #define	MII_ABILITY_100BASE_T4	(1<<9)
95*7c478bd9Sstevel@tonic-gate 
96*7c478bd9Sstevel@tonic-gate /* Expansion register 28.2.4.1.5 */
97*7c478bd9Sstevel@tonic-gate #define	MII_AN_EXP_PARFAULT	(1<<4)	/* fault detected		  */
98*7c478bd9Sstevel@tonic-gate #define	MII_AN_EXP_LPCANNXTP	(1<<3)	/* Link partner is Next Page able */
99*7c478bd9Sstevel@tonic-gate #define	MII_AN_EXP_CANNXTPP	(1<<2)	/* Local is next page able	  */
100*7c478bd9Sstevel@tonic-gate #define	MII_AN_EXP_PAGERCVD	(1<<1)	/* A new page has been recvd.	  */
101*7c478bd9Sstevel@tonic-gate #define	MII_AN_EXP_LPCANAN	(1<<0)	/* LP can auto-negotiate	  */
102*7c478bd9Sstevel@tonic-gate 
103*7c478bd9Sstevel@tonic-gate /*
104*7c478bd9Sstevel@tonic-gate  * Truncated OUIs as found in the PHY Identifier ( 22.2.4.3.1 ),
105*7c478bd9Sstevel@tonic-gate  * and known models (and their registers) from those manufacturers
106*7c478bd9Sstevel@tonic-gate  */
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate #define	PHY_MANUFACTURER(x)	(((x) >> 10) & 0x3fffff) /* 22 bits, 10-31 */
109*7c478bd9Sstevel@tonic-gate #define	PHY_MODEL(x)		(((x) >> 4) & 0x3f)	 /* 6 bits,4-9	   */
110*7c478bd9Sstevel@tonic-gate #define	PHY_REVISION(x)		((x) & 0xf)		 /* 4 bits, 0-3	   */
111*7c478bd9Sstevel@tonic-gate 
112*7c478bd9Sstevel@tonic-gate #define	OUI_NATIONAL_SEMICONDUCTOR 0x80017
113*7c478bd9Sstevel@tonic-gate #define	NS_DP83840		0x00
114*7c478bd9Sstevel@tonic-gate #define	MII_83840_ADDR		25
115*7c478bd9Sstevel@tonic-gate #define	NS83840_ADDR_SPEED10	(1<<6)
116*7c478bd9Sstevel@tonic-gate #define	NS83840_ADDR_CONSTAT	(1<<5)
117*7c478bd9Sstevel@tonic-gate #define	NS83840_ADDR_ADDR	(0x1f<<0)
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate #define	OUI_INTEL		0x0aa00
120*7c478bd9Sstevel@tonic-gate #define	INTEL_82553_CSTEP	0x35	/* A and B steps are non-standard */
121*7c478bd9Sstevel@tonic-gate #define	MII_82553_EX0		16
122*7c478bd9Sstevel@tonic-gate #define	I82553_EX0_FDUPLEX	(1<<0)
123*7c478bd9Sstevel@tonic-gate #define	I82553_EX0_100MB	(1<<1)
124*7c478bd9Sstevel@tonic-gate #define	I82553_EX0_WAKE		(1<<2)
125*7c478bd9Sstevel@tonic-gate #define	I82553_EX0_SQUELCH	(3<<3) /* 3:4 */
126*7c478bd9Sstevel@tonic-gate #define	I82553_EX0_REVCNTR	(7<<5) /* 5:7 */
127*7c478bd9Sstevel@tonic-gate #define	I82553_EX0_FRCFAIL	(1<<8)
128*7c478bd9Sstevel@tonic-gate #define	I82553_EX0_TEST		(0x1f<<9) /* 13:9 */
129*7c478bd9Sstevel@tonic-gate #define	I82553_EX0_LINKDIS	(1<<14)
130*7c478bd9Sstevel@tonic-gate #define	I82553_EX0_JABDIS	(1<<15)
131*7c478bd9Sstevel@tonic-gate 
132*7c478bd9Sstevel@tonic-gate #define	MII_82553_EX1
133*7c478bd9Sstevel@tonic-gate #define	I82553_EX1_RESERVE	(0x1ff<<0) /* 0:8 */
134*7c478bd9Sstevel@tonic-gate #define	I82553_EX1_CH2EOF	(1<<9)
135*7c478bd9Sstevel@tonic-gate #define	I82553_EX1_MNCHSTR	(1<<10)
136*7c478bd9Sstevel@tonic-gate #define	I82553_EX1_EOP		(1<<11)
137*7c478bd9Sstevel@tonic-gate #define	I82553_EX1_BADCODE	(1<<12)
138*7c478bd9Sstevel@tonic-gate #define	I82553_EX1_INVALCODE	(1<<13)
139*7c478bd9Sstevel@tonic-gate #define	I82553_EX1_DCBALANCE	(1<<14)
140*7c478bd9Sstevel@tonic-gate #define	I82553_EX1_PAIRSKEW	(1<<15)
141*7c478bd9Sstevel@tonic-gate 
142*7c478bd9Sstevel@tonic-gate #define	INTEL_82555		0x15
143*7c478bd9Sstevel@tonic-gate #define	INTEL_82562_EH		0x33
144*7c478bd9Sstevel@tonic-gate #define	INTEL_82562_ET		0x32
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate #define	OUI_ICS			0x57d
147*7c478bd9Sstevel@tonic-gate #define	ICS_1890		2
148*7c478bd9Sstevel@tonic-gate #define	ICS_1889		1
149*7c478bd9Sstevel@tonic-gate #define	ICS_EXCTRL		16
150*7c478bd9Sstevel@tonic-gate #define	ICS_EXCTRL_CMDOVRD	(1<<15)
151*7c478bd9Sstevel@tonic-gate #define	ICS_EXCTRL_PHYADDR	(0x1f<<6)
152*7c478bd9Sstevel@tonic-gate #define	ICS_EXCTRL_SCSTEST	(1<<5)
153*7c478bd9Sstevel@tonic-gate #define	ICS_EXCTRL_INVECTEST	(1<<2)
154*7c478bd9Sstevel@tonic-gate #define	ICS_EXCTRL_SCDISABLE	(1<<0)
155*7c478bd9Sstevel@tonic-gate 
156*7c478bd9Sstevel@tonic-gate #define	ICS_QUICKPOLL		17
157*7c478bd9Sstevel@tonic-gate #define	ICS_QUICKPOLL_100MB	(1<<15)
158*7c478bd9Sstevel@tonic-gate #define	ICS_QUICKPOLL_FDUPLEX	(1<<14)
159*7c478bd9Sstevel@tonic-gate #define	ICS_QUICKPOLL_ANPROG	(7<<11)
160*7c478bd9Sstevel@tonic-gate #define	ICS_QUICKPOLL_RSE	(1<<10)
161*7c478bd9Sstevel@tonic-gate #define	ICS_QUICKPOLL_PLLLOCK	(1<<9)
162*7c478bd9Sstevel@tonic-gate #define	ICS_QUICKPOLL_FALSECD	(1<<8)
163*7c478bd9Sstevel@tonic-gate #define	ICS_QUICKPOLL_SYMINVAL	(1<<7)
164*7c478bd9Sstevel@tonic-gate #define	ICS_QUICKPOLL_SYMHALT	(1<<6)
165*7c478bd9Sstevel@tonic-gate #define	ICS_QUICKPOLL_PREMEND	(1<<5)
166*7c478bd9Sstevel@tonic-gate #define	ICS_QUICKPOLL_ANDONE	(1<<4)
167*7c478bd9Sstevel@tonic-gate #define	ICS_QUICKPOLL_RESERVED	(1<<3)
168*7c478bd9Sstevel@tonic-gate #define	ICS_QUICKPOLL_JABBER	(1<<2)
169*7c478bd9Sstevel@tonic-gate #define	ICS_QUICKPOLL_REMFAULT	(1<<1)
170*7c478bd9Sstevel@tonic-gate #define	ICS_QUICKPOLL_LINKSTAT	(1<<0)
171*7c478bd9Sstevel@tonic-gate 
172*7c478bd9Sstevel@tonic-gate #define	ICS_10BASET		18
173*7c478bd9Sstevel@tonic-gate #define	ICS_10BASET_REMJABBER	(1<<15)
174*7c478bd9Sstevel@tonic-gate #define	ICS_10BASET_REVPOLARITY (1<<14)
175*7c478bd9Sstevel@tonic-gate #define	ICS_10BASET_RESERVED	(0xff<<6)
176*7c478bd9Sstevel@tonic-gate #define	ICS_10BASET_NOJABBER	(1<<5)
177*7c478bd9Sstevel@tonic-gate #define	ICS_10BASET_NORMLOOP	(1<<4)
178*7c478bd9Sstevel@tonic-gate #define	ICS_10BASET_NOAUTOPOLL	(1<<3)
179*7c478bd9Sstevel@tonic-gate #define	ICS_10BASET_NOSQE	(1<<2)
180*7c478bd9Sstevel@tonic-gate #define	ICS_10BASET_NOLINKLOSS	(1<<1)
181*7c478bd9Sstevel@tonic-gate #define	ICS_10BASET_NOSQUELCH	(1<<0)
182*7c478bd9Sstevel@tonic-gate 
183*7c478bd9Sstevel@tonic-gate #define	ICS_EXCTRL2		19
184*7c478bd9Sstevel@tonic-gate #define	ICS_EXCTRL2_ISREPEATER	(1<<15)
185*7c478bd9Sstevel@tonic-gate #define	ICS_EXCTRL2_SOFTPRI	(1<<14)
186*7c478bd9Sstevel@tonic-gate #define	ICS_EXCTRL2_LPCANREMF	(1<<13)
187*7c478bd9Sstevel@tonic-gate #define	ICS_EXCTRL2_RMFSXMITED	(1<<10)
188*7c478bd9Sstevel@tonic-gate #define	ICS_EXCTRL2_ANPWRREMF	(1<<4)
189*7c478bd9Sstevel@tonic-gate #define	ICS_EXCTRL2_10BASETQUAL (1<<2)
190*7c478bd9Sstevel@tonic-gate #define	ICS_EXCTRL2_AUTOPWRDN	(1<<0)
191*7c478bd9Sstevel@tonic-gate 
192*7c478bd9Sstevel@tonic-gate #define	OUI_DAVICOM		0x0606e
193*7c478bd9Sstevel@tonic-gate 
194*7c478bd9Sstevel@tonic-gate #define	DM_SCR			16
195*7c478bd9Sstevel@tonic-gate #define	DM_SCR_F_TX		(1<<10)
196*7c478bd9Sstevel@tonic-gate #define	DM_SCR_UTP		(1<<9)
197*7c478bd9Sstevel@tonic-gate #define	DM_SCR_F_LINK_100	(1<<7)
198*7c478bd9Sstevel@tonic-gate #define	DM_SCR_LED_CTL		(1<<5)
199*7c478bd9Sstevel@tonic-gate #define	DM_SCR_SMRST		(1<<3)
200*7c478bd9Sstevel@tonic-gate #define	DM_SCR_MFPSC		(1<<2)
201*7c478bd9Sstevel@tonic-gate #define	DM_SCR_SLEEP		(1<<1)
202*7c478bd9Sstevel@tonic-gate #define	DM_SCR_RLOUT		(1<<0)
203*7c478bd9Sstevel@tonic-gate 
204*7c478bd9Sstevel@tonic-gate #define	DM_SCSR			17
205*7c478bd9Sstevel@tonic-gate #define	DM_SCSR_100FDX		(1<<15)
206*7c478bd9Sstevel@tonic-gate #define	DM_SCSR_100HDX		(1<<14)
207*7c478bd9Sstevel@tonic-gate #define	DM_SCSR_10FDX		(1<<13)
208*7c478bd9Sstevel@tonic-gate #define	DM_SCSR_10HDX		(1<<12)
209*7c478bd9Sstevel@tonic-gate #define	DM_SCSR_PHYAD		(0x1f<<4)
210*7c478bd9Sstevel@tonic-gate #define	DM_SCSR_ANMB		(0x0f)
211*7c478bd9Sstevel@tonic-gate 
212*7c478bd9Sstevel@tonic-gate #define	DM_10BT			18
213*7c478bd9Sstevel@tonic-gate #define	DM_10BT_LB_EN		(1<<14)
214*7c478bd9Sstevel@tonic-gate #define	DM_10BT_HBE		(1<<13)
215*7c478bd9Sstevel@tonic-gate #define	DM_10BT_JABEN		(1<<11)
216*7c478bd9Sstevel@tonic-gate 
217*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
218*7c478bd9Sstevel@tonic-gate }
219*7c478bd9Sstevel@tonic-gate #endif
220*7c478bd9Sstevel@tonic-gate 
221*7c478bd9Sstevel@tonic-gate #endif /* _MIIREGS_H */
222