xref: /onnv-gate/usr/src/uts/common/io/sfe/sfe_mii.h (revision 9860:20e31304c39b)
15748Sduboff /*
25748Sduboff  *  sfe_mii.h: mii header for gem
35748Sduboff  *
45748Sduboff  * Copyright (c) 2002-2007 Masayuki Murayama.  All rights reserved.
55748Sduboff  *
65748Sduboff  * Redistribution and use in source and binary forms, with or without
75748Sduboff  * modification, are permitted provided that the following conditions are met:
85748Sduboff  *
95748Sduboff  * 1. Redistributions of source code must retain the above copyright notice,
105748Sduboff  *    this list of conditions and the following disclaimer.
115748Sduboff  *
125748Sduboff  * 2. Redistributions in binary form must reproduce the above copyright notice,
135748Sduboff  *    this list of conditions and the following disclaimer in the documentation
145748Sduboff  *    and/or other materials provided with the distribution.
155748Sduboff  *
165748Sduboff  * 3. Neither the name of the author nor the names of its contributors may be
175748Sduboff  *    used to endorse or promote products derived from this software without
185748Sduboff  *    specific prior written permission.
195748Sduboff  *
205748Sduboff  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
215748Sduboff  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
225748Sduboff  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
235748Sduboff  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
245748Sduboff  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
255748Sduboff  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
265748Sduboff  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
275748Sduboff  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
285748Sduboff  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
295748Sduboff  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
305748Sduboff  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
315748Sduboff  * DAMAGE.
325748Sduboff  */
335748Sduboff 
345748Sduboff /*
35*9860Sgdamore@opensolaris.org  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
36*9860Sgdamore@opensolaris.org  * Use is subject to license terms.
37*9860Sgdamore@opensolaris.org  */
38*9860Sgdamore@opensolaris.org 
39*9860Sgdamore@opensolaris.org /*
405748Sduboff  * sfe_mii.h : MII registers
415748Sduboff  */
425748Sduboff #ifndef _SFE_MII_H_
435748Sduboff #define	_SFE_MII_H_
445748Sduboff 
455748Sduboff #include <sys/miiregs.h>
465748Sduboff 
475748Sduboff #define	MII_AN_LPANXT		8
485748Sduboff #define	MII_MS_CONTROL		9
495748Sduboff #define	MII_MS_STATUS		10
505748Sduboff #define	MII_XSTATUS		15
515748Sduboff 
525748Sduboff /* for 1000BaseT support */
535748Sduboff #define	MII_1000TC		MII_MS_CONTROL
545748Sduboff #define	MII_1000TS		MII_MS_STATUS
555748Sduboff #define	MII_CONTROL_SPEED	0x2040
565748Sduboff 
575748Sduboff #define	MII_CONTROL_10MB	0x0000
585748Sduboff #define	MII_CONTROL_1000MB	0x0040
595748Sduboff 
605748Sduboff #define	MII_CONTROL_BITS	\
615748Sduboff 	"\020"	\
625748Sduboff 	"\020RESET"	\
635748Sduboff 	"\017LOOPBACK"	\
645748Sduboff 	"\016100MB"	\
655748Sduboff 	"\015ANE"	\
665748Sduboff 	"\014PWRDN"	\
675748Sduboff 	"\013ISOLATE"	\
685748Sduboff 	"\012RSAN"	\
695748Sduboff 	"\011FDUPLEX"	\
705748Sduboff 	"\010COLTST"	\
715748Sduboff 	"\0071000M"
725748Sduboff #define	MII_STATUS_XSTATUS		0x0100
735748Sduboff #define	MII_STATUS_100_BASE_T2_FD	0x0400
745748Sduboff #define	MII_STATUS_100_BASE_T2		0x0200
755748Sduboff 
765748Sduboff #define	MII_STATUS_ABILITY_TECH	\
775748Sduboff 	(MII_STATUS_100_BASE_T4	|	\
785748Sduboff 	MII_STATUS_100_BASEX_FD |	\
795748Sduboff 	MII_STATUS_100_BASEX |	\
805748Sduboff 	MII_STATUS_10 |	\
815748Sduboff 	MII_STATUS_10_FD)
825748Sduboff 
835748Sduboff 
845748Sduboff #define	MII_STATUS_BITS	\
855748Sduboff 	"\020"	\
865748Sduboff 	"\020100_BASE_T4"	\
875748Sduboff 	"\017100_BASEX_FD"	\
885748Sduboff 	"\016100_BASEX"	\
895748Sduboff 	"\01510_BASE_FD"	\
905748Sduboff 	"\01410_BASE"	\
915748Sduboff 	"\013100_BASE_T2_FD"	\
925748Sduboff 	"\012100_BASE_T2"	\
935748Sduboff 	"\011XSTATUS"	\
945748Sduboff 	"\007MFPRMBLSUPR"	\
955748Sduboff 	"\006ANDONE"	\
965748Sduboff 	"\005REMFAULT"	\
975748Sduboff 	"\004CANAUTONEG"	\
985748Sduboff 	"\003LINKUP"	\
995748Sduboff 	"\002JABBERING"	\
1005748Sduboff 	"\001EXTENDED"
1015748Sduboff 
1025748Sduboff #define	MII_ABILITY_TECH	\
1035748Sduboff 	(MII_ABILITY_100BASE_T4	|	\
1045748Sduboff 	MII_ABILITY_100BASE_TX_FD |	\
1055748Sduboff 	MII_ABILITY_100BASE_TX |	\
1065748Sduboff 	MII_ABILITY_10BASE_T |	\
1075748Sduboff 	MII_ABILITY_10BASE_T_FD)
1085748Sduboff 
1095748Sduboff #define	MII_ABILITY_ALL	\
1105748Sduboff 	(MII_AN_ADVERT_REMFAULT |	\
111*9860Sgdamore@opensolaris.org 	MII_ABILITY_ASMPAUSE |	\
1125748Sduboff 	MII_ABILITY_PAUSE |	\
1135748Sduboff 	MII_ABILITY_TECH)
1145748Sduboff 
1155748Sduboff 
1165748Sduboff #define	MII_ABILITY_BITS	\
1175748Sduboff 	"\020"	\
1185748Sduboff 	"\016REMFAULT"	\
1195748Sduboff 	"\014ASM_DIR"	\
1205748Sduboff 	"\013PAUSE"	\
1215748Sduboff 	"\012100BASE_T4"	\
1225748Sduboff 	"\011100BASE_TX_FD"	\
1235748Sduboff 	"\010100BASE_TX"	\
1245748Sduboff 	"\00710BASE_T_FD"	\
1255748Sduboff 	"\00610BASE_T"
1265748Sduboff 
1275748Sduboff #define	MII_AN_EXP_BITS	\
1285748Sduboff 	"\020"	\
1295748Sduboff 	"\005PARFAULT"	\
1305748Sduboff 	"\004LPCANNXTP"	\
1315748Sduboff 	"\003CANNXTPP"	\
1325748Sduboff 	"\002PAGERCVD"	\
1335748Sduboff 	"\001LPCANAN"
1345748Sduboff 
1355748Sduboff #define	MII_1000TC_TESTMODE	0xe000
1365748Sduboff #define	MII_1000TC_CFG_EN	0x1000
1375748Sduboff #define	MII_1000TC_CFG_VAL	0x0800
1385748Sduboff #define	MII_1000TC_PORTTYPE	0x0400
1395748Sduboff #define	MII_1000TC_ADV_FULL	0x0200
1405748Sduboff #define	MII_1000TC_ADV_HALF	0x0100
1415748Sduboff 
1425748Sduboff #define	MII_1000TC_BITS	\
1435748Sduboff 	"\020"	\
1445748Sduboff 	"\015CFG_EN"	\
1455748Sduboff 	"\014CFG_VAL"	\
1465748Sduboff 	"\013PORTTYPE"	\
1475748Sduboff 	"\012FULL"	\
1485748Sduboff 	"\011HALF"
1495748Sduboff 
1505748Sduboff #define	MII_1000TS_CFG_FAULT	0x8000
1515748Sduboff #define	MII_1000TS_CFG_MASTER	0x4000
1525748Sduboff #define	MII_1000TS_LOCALRXOK	0x2000
1535748Sduboff #define	MII_1000TS_REMOTERXOK	0x1000
1545748Sduboff #define	MII_1000TS_LP_FULL	0x0800
1555748Sduboff #define	MII_1000TS_LP_HALF	0x0400
1565748Sduboff 
1575748Sduboff #define	MII_1000TS_BITS	\
1585748Sduboff 	"\020"	\
1595748Sduboff 	"\020CFG_FAULT"	\
1605748Sduboff 	"\017CFG_MASTER"	\
1615748Sduboff 	"\014CFG_LOCALRXOK"	\
1625748Sduboff 	"\013CFG_REMOTERXOK"	\
1635748Sduboff 	"\012LP_FULL"	\
1645748Sduboff 	"\011LP_HALF"
1655748Sduboff 
1665748Sduboff #define	MII_XSTATUS_1000BASEX_FD	0x8000
1675748Sduboff #define	MII_XSTATUS_1000BASEX		0x4000
1685748Sduboff #define	MII_XSTATUS_1000BASET_FD	0x2000
1695748Sduboff #define	MII_XSTATUS_1000BASET		0x1000
1705748Sduboff 
1715748Sduboff #define	MII_XSTATUS_BITS	\
1725748Sduboff 	"\020"	\
1735748Sduboff 	"\0201000BASEX_FD"	\
1745748Sduboff 	"\0171000BASEX"		\
1755748Sduboff 	"\0161000BASET_FD"	\
1765748Sduboff 	"\0151000BASET"
1775748Sduboff 
1785748Sduboff #define	MII_READ_CMD(p, r)	\
1795748Sduboff 	((6<<(18+5+5)) | ((p)<<(18+5)) | ((r)<<18))
1805748Sduboff 
1815748Sduboff #define	MII_WRITE_CMD(p, r, v)	\
1825748Sduboff 	((5<<(18+5+5)) | ((p)<<(18+5)) | ((r)<<18) | (2 << 16) | (v))
1835748Sduboff 
1845748Sduboff #endif /* _SFE_MII_H_ */
185