xref: /titanic_51/usr/src/uts/common/sys/miiregs.h (revision 015a6ef6781cc3ceba8ad3bfbae98449b6002a1f)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50f80586bSgd78059  * Common Development and Distribution License (the "License").
60f80586bSgd78059  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22bdb9230aSGarrett D'Amore  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*
277c478bd9Sstevel@tonic-gate  * Definitions for MII registers from 802.3u and vendor documentation
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
30bdb9230aSGarrett D'Amore #ifndef _SYS_MIIREGS_H
31bdb9230aSGarrett D'Amore #define	_SYS_MIIREGS_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifdef __cplusplus
347c478bd9Sstevel@tonic-gate extern "C" {
357c478bd9Sstevel@tonic-gate #endif
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /* Register addresses: Section 22.2.4 */
387c478bd9Sstevel@tonic-gate #define	MII_CONTROL		0
397c478bd9Sstevel@tonic-gate #define	MII_STATUS		1
407c478bd9Sstevel@tonic-gate #define	MII_PHYIDH		2
417c478bd9Sstevel@tonic-gate #define	MII_PHYIDL		3
427c478bd9Sstevel@tonic-gate #define	MII_AN_ADVERT		4	/* Auto negotiation advertisement. */
437c478bd9Sstevel@tonic-gate #define	MII_AN_LPABLE		5	/* Auto neg. Link Partner Ability  */
447c478bd9Sstevel@tonic-gate #define	MII_AN_EXPANSION	6	/* Auto neg. Expansion.		   */
457c478bd9Sstevel@tonic-gate #define	MII_AN_NXTPGXMIT	7	/* Auto neg. Next Page Transmit	   */
46bdb9230aSGarrett D'Amore #define	MII_AN_NXTPGLP		8	/* Link Part. Augo neg. Next Page  */
47bdb9230aSGarrett D'Amore #define	MII_MSCONTROL		9	/* 100Base-T2 and 1000 BaseT Ctrl. */
48bdb9230aSGarrett D'Amore #define	MII_MSSTATUS		10	/* 100Base-T2 and 1000 BaseT Stat. */
49bdb9230aSGarrett D'Amore #define	MII_EXTSTATUS		15	/* Extended status registers	   */
507c478bd9Sstevel@tonic-gate #define	MII_VENDOR(x)		(16+(x)) /* Vendor specific		   */
517c478bd9Sstevel@tonic-gate 
52bdb9230aSGarrett D'Amore /* Control register: 22.2.4.1, 28.2.4.1.1 */
537c478bd9Sstevel@tonic-gate #define	MII_CONTROL_RESET	(1<<15)
547c478bd9Sstevel@tonic-gate #define	MII_CONTROL_LOOPBACK	(1<<14)
557c478bd9Sstevel@tonic-gate #define	MII_CONTROL_100MB	(1<<13)
567c478bd9Sstevel@tonic-gate #define	MII_CONTROL_ANE		(1<<12)
577c478bd9Sstevel@tonic-gate #define	MII_CONTROL_PWRDN	(1<<11)
587c478bd9Sstevel@tonic-gate #define	MII_CONTROL_ISOLATE	(1<<10)
597c478bd9Sstevel@tonic-gate #define	MII_CONTROL_RSAN	(1<<9)
607c478bd9Sstevel@tonic-gate #define	MII_CONTROL_FDUPLEX	(1<<8)
617c478bd9Sstevel@tonic-gate #define	MII_CONTROL_COLTST	(1<<7)
62bdb9230aSGarrett D'Amore #define	MII_CONTROL_1GB		(1<<6)
63bdb9230aSGarrett D'Amore #define	MII_CONTROL_UNIDIR	(1<<5)
647c478bd9Sstevel@tonic-gate 
65bdb9230aSGarrett D'Amore /* Status register: 22.2.4.2, 28.2.4.1.2 */
667c478bd9Sstevel@tonic-gate #define	MII_STATUS_100_BASE_T4	(1<<15)
677c478bd9Sstevel@tonic-gate #define	MII_STATUS_100_BASEX_FD	(1<<14)
687c478bd9Sstevel@tonic-gate #define	MII_STATUS_100_BASEX	(1<<13)
697c478bd9Sstevel@tonic-gate #define	MII_STATUS_10_FD	(1<<12)
707c478bd9Sstevel@tonic-gate #define	MII_STATUS_10		(1<<11)
71bdb9230aSGarrett D'Amore #define	MII_STATUS_100T2_FD	(1<<10)
72bdb9230aSGarrett D'Amore #define	MII_STATUS_100T2	(1<<9)
73bdb9230aSGarrett D'Amore #define	MII_STATUS_EXTSTAT	(1<<8)
74bdb9230aSGarrett D'Amore #define	MII_STATUS_UNIDIR	(1<<7)
757c478bd9Sstevel@tonic-gate #define	MII_STATUS_MFPRMBLSUPR	(1<<6)
767c478bd9Sstevel@tonic-gate #define	MII_STATUS_ANDONE	(1<<5)
777c478bd9Sstevel@tonic-gate #define	MII_STATUS_REMFAULT	(1<<4)
787c478bd9Sstevel@tonic-gate #define	MII_STATUS_CANAUTONEG	(1<<3)
797c478bd9Sstevel@tonic-gate #define	MII_STATUS_LINKUP	(1<<2)
807c478bd9Sstevel@tonic-gate #define	MII_STATUS_JABBERING	(1<<1)
817c478bd9Sstevel@tonic-gate #define	MII_STATUS_EXTENDED	(1<<0)
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate /* Advertisement/Partner ability registers: 28.2.4.1.3/4 */
847c478bd9Sstevel@tonic-gate #define	MII_AN_ADVERT_NP	(1<<15)
857c478bd9Sstevel@tonic-gate #define	MII_AN_ADVERT_ACK	(1<<14)
867c478bd9Sstevel@tonic-gate #define	MII_AN_ADVERT_REMFAULT	(1<<13)
87bdb9230aSGarrett D'Amore #define	MII_AN_ADVERT_EXTNP	(1<<12)
88bdb9230aSGarrett D'Amore #define	MII_AN_ADVERT_TECHABLE	(0x7f<<5)
897c478bd9Sstevel@tonic-gate #define	MII_AN_ADVERT_SELECTOR	(0x1f)
90bdb9230aSGarrett D'Amore #define	MII_AN_SELECTOR_8023	0x0001
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate /* Technology field bits (above). From Annex 28B */
937c478bd9Sstevel@tonic-gate #define	MII_ABILITY_10BASE_T	(1<<5)
947c478bd9Sstevel@tonic-gate #define	MII_ABILITY_10BASE_T_FD	(1<<6)
957c478bd9Sstevel@tonic-gate #define	MII_ABILITY_100BASE_TX	(1<<7)
967c478bd9Sstevel@tonic-gate #define	MII_ABILITY_100BASE_TX_FD (1<<8)
977c478bd9Sstevel@tonic-gate #define	MII_ABILITY_100BASE_T4	(1<<9)
98bdb9230aSGarrett D'Amore #define	MII_ABILITY_PAUSE	(1<<10)
99bdb9230aSGarrett D'Amore #define	MII_ABILITY_ASMPAUSE	(1<<11)
100bdb9230aSGarrett D'Amore /* Override fields for 1000 Base-X: 37.2.5.1.3 */
101bdb9230aSGarrett D'Amore #define	MII_ABILITY_X_FD	(1<<5)
102bdb9230aSGarrett D'Amore #define	MII_ABILITY_X_HD	(1<<6)
103bdb9230aSGarrett D'Amore #define	MII_ABILITY_X_PAUSE	(1<<7)
104bdb9230aSGarrett D'Amore #define	MII_ABILITY_X_ASMPAUSE	(1<<8)
105bdb9230aSGarrett D'Amore /* Override fields for 100 Base T2: 32.5.4.2 */
106bdb9230aSGarrett D'Amore #define	MII_ABILITY_T2_FD	(1<<11)
107bdb9230aSGarrett D'Amore #define	MII_ABILITY_T2_HD	(1<<10)
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate /* Expansion register 28.2.4.1.5 */
1107c478bd9Sstevel@tonic-gate #define	MII_AN_EXP_PARFAULT	(1<<4)	/* fault detected		  */
1117c478bd9Sstevel@tonic-gate #define	MII_AN_EXP_LPCANNXTP	(1<<3)	/* Link partner is Next Page able */
1127c478bd9Sstevel@tonic-gate #define	MII_AN_EXP_CANNXTPP	(1<<2)	/* Local is next page able	  */
1137c478bd9Sstevel@tonic-gate #define	MII_AN_EXP_PAGERCVD	(1<<1)	/* A new page has been recvd.	  */
1147c478bd9Sstevel@tonic-gate #define	MII_AN_EXP_LPCANAN	(1<<0)	/* LP can auto-negotiate	  */
1157c478bd9Sstevel@tonic-gate 
116bdb9230aSGarrett D'Amore /* Master/Slave control: 40.5.1.1 */
117bdb9230aSGarrett D'Amore #define	MII_MSCONTROL_TEST_MASK	(3<<13)
118bdb9230aSGarrett D'Amore #define	MII_MSCONTROL_MANUAL	(1<<12)	/* manual master/slave control */
119bdb9230aSGarrett D'Amore #define	MII_MSCONTROL_MASTER	(1<<11)
120bdb9230aSGarrett D'Amore #define	MII_MSCONTROL_MULTIPORT	(1<<10)	/* DCE, default 0 for NICs */
121bdb9230aSGarrett D'Amore #define	MII_MSCONTROL_1000T_FD	(1<<9)
122bdb9230aSGarrett D'Amore #define	MII_MSCONTROL_1000T	(1<<8)
123bdb9230aSGarrett D'Amore 
124bdb9230aSGarrett D'Amore /* Master/Slave status: 40.5.1.1 */
125bdb9230aSGarrett D'Amore #define	MII_MSSTATUS_FAULT	(1<<15)	/* Master/slave config fault */
126bdb9230aSGarrett D'Amore #define	MII_MSSTATUS_MASTER	(1<<14)	/* Master/slave config result */
127bdb9230aSGarrett D'Amore #define	MII_MSSTATUS_RXSTAT	(1<<13)
128bdb9230aSGarrett D'Amore #define	MII_MSSTATUS_REMRXSTAT	(1<<12)
129bdb9230aSGarrett D'Amore #define	MII_MSSTATUS_LP1000T_FD	(1<<11)
130bdb9230aSGarrett D'Amore #define	MII_MSSTATUS_LP1000T	(1<<10)
131bdb9230aSGarrett D'Amore #define	MII_MSSTATUS_IDLE_ERR	(0xff)
132bdb9230aSGarrett D'Amore 
133bdb9230aSGarrett D'Amore /* Extended status: 22.2.4.4 */
134bdb9230aSGarrett D'Amore #define	MII_EXTSTATUS_1000X_FD	(1<<15)
135bdb9230aSGarrett D'Amore #define	MII_EXTSTATUS_1000X	(1<<14)
136bdb9230aSGarrett D'Amore #define	MII_EXTSTATUS_1000T_FD	(1<<13)
137bdb9230aSGarrett D'Amore #define	MII_EXTSTATUS_1000T	(1<<12)
138bdb9230aSGarrett D'Amore 
1397c478bd9Sstevel@tonic-gate /*
1407c478bd9Sstevel@tonic-gate  * Truncated OUIs as found in the PHY Identifier ( 22.2.4.3.1 ),
1417c478bd9Sstevel@tonic-gate  * and known models (and their registers) from those manufacturers
1427c478bd9Sstevel@tonic-gate  */
1437c478bd9Sstevel@tonic-gate 
144bdb9230aSGarrett D'Amore #define	MII_PHY_MFG(x)		(((x) >> 10) & 0x3fffff) /* 22 bits, 10-31 */
145bdb9230aSGarrett D'Amore #define	MII_PHY_MODEL(x)	(((x) >> 4) & 0x3f)	 /* 6 bits,4-9	   */
146bdb9230aSGarrett D'Amore #define	MII_PHY_REV(x)		((x) & 0xf)		 /* 4 bits, 0-3	   */
1477c478bd9Sstevel@tonic-gate 
148bdb9230aSGarrett D'Amore /*
149bdb9230aSGarrett D'Amore  * PHY manufacturer OUIs
150bdb9230aSGarrett D'Amore  */
151bdb9230aSGarrett D'Amore #define	MII_OUI_AMD			0x00001a
152bdb9230aSGarrett D'Amore #define	MII_OUI_AMD_2			0x000058
153*015a6ef6SSaurabh Misra #define	MII_OUI_ATTANSIC		0x001374
154bdb9230aSGarrett D'Amore #define	MII_OUI_BROADCOM		0x001018
155bdb9230aSGarrett D'Amore #define	MII_OUI_BROADCOM_2		0x000818
156bdb9230aSGarrett D'Amore #define	MII_OUI_CICADA			0x0003f1
157bdb9230aSGarrett D'Amore #define	MII_OUI_CICADA_2		0x00c08f
158bdb9230aSGarrett D'Amore #define	MII_OUI_DAVICOM			0x00606e
159bdb9230aSGarrett D'Amore #define	MII_OUI_DAVICOM_2		0x000676
160bdb9230aSGarrett D'Amore #define	MII_OUI_ICS			0x00057d
161bdb9230aSGarrett D'Amore #define	MII_OUI_ICPLUS			0x0090c3
162bdb9230aSGarrett D'Amore #define	MII_OUI_INTEL			0x00aa00
163bdb9230aSGarrett D'Amore #define	MII_OUI_INTEL_2			0x001f00
164bdb9230aSGarrett D'Amore #define	MII_OUI_MARVELL			0x005043
1657b4c5c8bSGarrett D'Amore #define	MII_OUI_NATIONAL_SEMI		0x080017
166bdb9230aSGarrett D'Amore #define	MII_OUI_NATIONAL_SEMI_2		0x1000e8
167bdb9230aSGarrett D'Amore #define	MII_OUI_QUALITY_SEMI		0x006051
168bdb9230aSGarrett D'Amore #define	MII_OUI_QUALITY_SEMI_2		0x00608a
1697c478bd9Sstevel@tonic-gate 
170bdb9230aSGarrett D'Amore /*
171bdb9230aSGarrett D'Amore  * PHY models
172bdb9230aSGarrett D'Amore  */
1737c478bd9Sstevel@tonic-gate 
174bdb9230aSGarrett D'Amore #define	MII_MODEL_AMD_AM79C901			0x37
175bdb9230aSGarrett D'Amore #define	MII_MODEL_AMD_AM79C972			0x01
176bdb9230aSGarrett D'Amore #define	MII_MODEL_AMD_AM79C973			0x36
1777c478bd9Sstevel@tonic-gate 
178bdb9230aSGarrett D'Amore #define	MII_MODEL_CICADA_CS8201			0x01
179bdb9230aSGarrett D'Amore #define	MII_MODEL_CICADA_CS8201A		0x20
180bdb9230aSGarrett D'Amore #define	MII_MODEL_CICADA_CS8201B		0x21
1817c478bd9Sstevel@tonic-gate 
182bdb9230aSGarrett D'Amore #define	MII_MODEL_DAVICOM_DM9101		0x00
183bdb9230aSGarrett D'Amore #define	MII_MODEL_DAVICOM_DM9102		0x04
184bdb9230aSGarrett D'Amore #define	MII_MODEL_DAVICOM_DM9161		0x08
1857c478bd9Sstevel@tonic-gate 
186bdb9230aSGarrett D'Amore #define	MII_MODEL_ICPLUS_IP101			0x05
1877c478bd9Sstevel@tonic-gate 
188bdb9230aSGarrett D'Amore #define	MII_MODEL_ICS_ICS1889			0x01
189bdb9230aSGarrett D'Amore #define	MII_MODEL_ICS_ICS1890			0x02
190bdb9230aSGarrett D'Amore #define	MII_MODEL_ICS_ICS1892			0x03
191bdb9230aSGarrett D'Amore #define	MII_MODEL_ICS_ICS1893			0x04
1927c478bd9Sstevel@tonic-gate 
193bdb9230aSGarrett D'Amore #define	MII_MODEL_INTEL_82553_CSTEP		0x35
194bdb9230aSGarrett D'Amore #define	MII_MODEL_INTEL_82555			0x15
195bdb9230aSGarrett D'Amore #define	MII_MODEL_INTEL_82562_EH		0x33
196bdb9230aSGarrett D'Amore #define	MII_MODEL_INTEL_82562_EM		0x31
197bdb9230aSGarrett D'Amore #define	MII_MODEL_INTEL_82562_ET		0x32
1987c478bd9Sstevel@tonic-gate 
199cea60642SGarrett D'Amore #define	MII_MODEL_MARVELL_88E1000		0x00
200cea60642SGarrett D'Amore #define	MII_MODEL_MARVELL_88E1011		0x02
201cea60642SGarrett D'Amore #define	MII_MODEL_MARVELL_88E1000_2		0x03
202cea60642SGarrett D'Amore #define	MII_MODEL_MARVELL_88E1000S		0x04
203cea60642SGarrett D'Amore #define	MII_MODEL_MARVELL_88E1000_3		0x05
204cea60642SGarrett D'Amore #define	MII_MODEL_MARVELL_88E3082		0x08	/* 10/100 */
205cea60642SGarrett D'Amore #define	MII_MODEL_MARVELL_88E1112		0x09
206cea60642SGarrett D'Amore #define	MII_MODEL_MARVELL_88E1149		0x0b
207cea60642SGarrett D'Amore #define	MII_MODEL_MARVELL_88E1111		0x0c
208cea60642SGarrett D'Amore #define	MII_MODEL_MARVELL_88E1116		0x21
209cea60642SGarrett D'Amore #define	MII_MODEL_MARVELL_88E1118		0x22
210cea60642SGarrett D'Amore #define	MII_MODEL_MARVELL_88E1116R		0x24
211cea60642SGarrett D'Amore #define	MII_MODEL_MARVELL_88E3016		0x26	/* 10/100 */
212cea60642SGarrett D'Amore 
213bdb9230aSGarrett D'Amore #define	MII_MODEL_NATIONAL_SEMI_DP83840		0x00
214bdb9230aSGarrett D'Amore #define	MII_MODEL_NATIONAL_SEMI_DP83843		0x01
215bdb9230aSGarrett D'Amore #define	MII_MODEL_NATIONAL_SEMI_DP83815		0x02
216bdb9230aSGarrett D'Amore #define	MII_MODEL_NATIONAL_SEMI_DP83847		0x03
217bdb9230aSGarrett D'Amore #define	MII_MODEL_NATIONAL_SEMI_DP83891		0x05
218bdb9230aSGarrett D'Amore #define	MII_MODEL_NATIONAL_SEMI_DP83861		0x06
2197c478bd9Sstevel@tonic-gate 
220bdb9230aSGarrett D'Amore #define	MII_MODEL_QUALITY_SEMI_QS6612		0x00
2217c478bd9Sstevel@tonic-gate 
2227c478bd9Sstevel@tonic-gate #ifdef __cplusplus
2237c478bd9Sstevel@tonic-gate }
2247c478bd9Sstevel@tonic-gate #endif
2257c478bd9Sstevel@tonic-gate 
226bdb9230aSGarrett D'Amore #endif /* _SYS_MIIREGS_H */
227