nsgphyreg.h revision 76479
176479Swpaul/*
276479Swpaul * Copyright (c) 2001 Wind River Systems
376479Swpaul * Copyright (c) 2001
476479Swpaul *	Bill Paul <wpaul@bsdi.com>.  All rights reserved.
576479Swpaul *
676479Swpaul * Redistribution and use in source and binary forms, with or without
776479Swpaul * modification, are permitted provided that the following conditions
876479Swpaul * are met:
976479Swpaul * 1. Redistributions of source code must retain the above copyright
1076479Swpaul *    notice, this list of conditions and the following disclaimer.
1176479Swpaul * 2. Redistributions in binary form must reproduce the above copyright
1276479Swpaul *    notice, this list of conditions and the following disclaimer in the
1376479Swpaul *    documentation and/or other materials provided with the distribution.
1476479Swpaul * 3. All advertising materials mentioning features or use of this software
1576479Swpaul *    must display the following acknowledgement:
1676479Swpaul *	This product includes software developed by Bill Paul.
1776479Swpaul * 4. Neither the name of the author nor the names of any co-contributors
1876479Swpaul *    may be used to endorse or promote products derived from this software
1976479Swpaul *    without specific prior written permission.
2076479Swpaul *
2176479Swpaul * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
2276479Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2376479Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2476479Swpaul * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
2576479Swpaul * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2676479Swpaul * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2776479Swpaul * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2876479Swpaul * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2976479Swpaul * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3076479Swpaul * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
3176479Swpaul * THE POSSIBILITY OF SUCH DAMAGE.
3276479Swpaul *
3376479Swpaul * $FreeBSD: head/sys/dev/mii/nsgphyreg.h 76479 2001-05-11 19:56:39Z wpaul $
3476479Swpaul */
3576479Swpaul
3676479Swpaul#ifndef _DEV_MII_NSGPHYREG_H_
3776479Swpaul#define	_DEV_MII_NSGPHYREG_H_
3876479Swpaul
3976479Swpaul/*
4076479Swpaul * NatSemi DP83891 registers
4176479Swpaul */
4276479Swpaul
4376479Swpaul#define NSGPHY_MII_BMCR		0x00
4476479Swpaul#define NSGPHY_BMCR_RESET	0x8000
4576479Swpaul#define NSGPHY_BMCR_LOOP	0x4000
4676479Swpaul#define NSGPHY_BMCR_SPD0	0x2000	/* speed select, lower bit */
4776479Swpaul#define NSGPHY_BMCR_AUTOEN	0x1000	/* Autoneg enabled */
4876479Swpaul#define NSGPHY_BMCR_PDOWN	0x0800	/* Power down */
4976479Swpaul#define NSGPHY_BMCR_ISO		0x0400	/* Isolate */
5076479Swpaul#define NSGPHY_BMCR_STARTNEG	0x0200	/* Restart autoneg */
5176479Swpaul#define NSGPHY_BMCR_FDX		0x0100	/* Duplex mode */
5276479Swpaul#define NSGPHY_BMCR_CTEST	0x0080	/* Collision test enable */
5376479Swpaul#define NSGPHY_BMCR_SPD1	0x0040	/* Speed select, upper bit */
5476479Swpaul
5576479Swpaul#define NSGPHY_S1000		NSGPHY_BMCR_SPD1	/* 1000mbps */
5676479Swpaul#define NSGPHY_S100		NSGPHY_BMCR_SPD0	/* 100mpbs */
5776479Swpaul#define NSGPHY_S10		0			/* 10mbps */
5876479Swpaul
5976479Swpaul#define NSGPHY_MII_BMSR		0x01
6076479Swpaul#define NSGPHY_BMSR_100BT4	0x8000	/* 100baseT4 support */
6176479Swpaul#define NSGPHY_BMSR_100FDX	0x4000	/* 100baseTX full duplex */
6276479Swpaul#define NSGPHY_BMSR_100HDX	0x2000	/* 100baseTX half duplex */
6376479Swpaul#define NSGPHY_BMSR_10FDX	0x1000	/* 10baseT full duplex */
6476479Swpaul#define NSGPHY_BMSR_10HDX	0x0800	/* 10baseT half duplex */
6576479Swpaul#define NSGPHY_BMSR_100T2FDX	0x0400	/* 100baseT2 full duplex */
6676479Swpaul#define NSGPHY_BMSR_100T2HDX	0x0200	/* 100baseT2 full duplex */
6776479Swpaul#define NSGPHY_BMSR_EXTSTS	0x0100	/* 1000baseT Extended status present */
6876479Swpaul#define NSGPHY_BMSR_PRESUB	0x0040	/* Preamble surpression */
6976479Swpaul#define NSGPHY_BMSR_ACOMP	0x0020	/* Autoneg complete */
7076479Swpaul#define NSGPHY_BMSR_RFAULT	0x0010	/* Remote fault condition occured */
7176479Swpaul#define NSGPHY_BMSR_ANEG	0x0008	/* Autoneg capable */
7276479Swpaul#define NSGPHY_BMSR_LINK	0x0004	/* Link status */
7376479Swpaul#define NSGPHY_BMSR_JABBER	0x0002	/* Jabber detected */
7476479Swpaul#define NSGPHY_BMSR_EXT		0x0001	/* Extended capability */
7576479Swpaul
7676479Swpaul#define NSGPHY_MII_ANAR		0x04
7776479Swpaul#define NSGPHY_ANAR_NP		0x8000	/* Next page */
7876479Swpaul#define NSGPHY_ANAR_RF		0x2000	/* Remote fault */
7976479Swpaul#define NSGPHY_ANAR_ASP		0x0800	/* Asymetric Pause */
8076479Swpaul#define NSGPHY_ANAR_PC		0x0400	/* Pause capable */
8176479Swpaul#define NSGPHY_ANAR_100T4	0x0200	/* 100baseT4 support */
8276479Swpaul#define NSGPHY_ANAR_100FDX	0x0100	/* 100baseTX full duplex support */
8376479Swpaul#define NSGPHY_ANAR_100HDX	0x0080	/* 100baseTX half duplex support */
8476479Swpaul#define NSGPHY_ANAR_10FDX	0x0040	/* 10baseT full duplex support */
8576479Swpaul#define NSGPHY_ANAR_10HDX	0x0020	/* 10baseT half duplex support */
8676479Swpaul#define NSGPHY_ANAR_SEL		0x001F	/* selector field, 00001=Ethernet */
8776479Swpaul
8876479Swpaul#define NSGPHY_MII_ANLPAR	0x05
8976479Swpaul#define NSGPHY_ANLPAR_NP	0x8000	/* Next page */
9076479Swpaul#define NSGPHY_ANLPAR_RF	0x2000	/* Remote fault */
9176479Swpaul#define NSGPHY_ANLPAR_ASP	0x0800	/* Asymetric Pause */
9276479Swpaul#define NSGPHY_ANLPAR_PC	0x0400	/* Pause capable */
9376479Swpaul#define NSGPHY_ANLPAR_100T4	0x0200	/* 100baseT4 support */
9476479Swpaul#define NSGPHY_ANLPAR_100FDX	0x0100	/* 100baseTX full duplex support */
9576479Swpaul#define NSGPHY_ANLPAR_100HDX	0x0080	/* 100baseTX half duplex support */
9676479Swpaul#define NSGPHY_ANLPAR_10FDX	0x0040	/* 10baseT full duplex support */
9776479Swpaul#define NSGPHY_ANLPAR_10HDX	0x0020	/* 10baseT half duplex support */
9876479Swpaul#define NSGPHY_ANLPAR_SEL	0x001F	/* selector field, 00001=Ethernet */
9976479Swpaul
10076479Swpaul#define NSGPHY_SEL_TYPE		0x0001	/* ethernet */
10176479Swpaul
10276479Swpaul#define NSGPHY_MII_ANER		0x06
10376479Swpaul#define NSGPHY_ANER_PDF		0x0010	/* Parallel detection fault */
10476479Swpaul#define NSGPHY_ANER_LPNP	0x0008	/* Link partner can next page */
10576479Swpaul#define NSGPHY_ANER_NP		0x0004	/* Local PHY can next page */
10676479Swpaul#define NSGPHY_ANER_RX		0x0002	/* Next page received */
10776479Swpaul#define NSGPHY_ANER_LPAN	0x0001 	/* Link partner autoneg capable */
10876479Swpaul
10976479Swpaul#define NSGPHY_MII_NEXTP	0x07	/* Next page */
11076479Swpaul#define NSGPHY_NEXTP_NP		0x8000	/* Next page indication */
11176479Swpaul#define NSGPHY_NEXTP_MP		0x2000	/* Message page */
11276479Swpaul#define NSGPHY_NEXTP_ACK2	0x1000	/* Acknowledge 2 */
11376479Swpaul#define NSGPHY_NEXTP_TOGGLE	0x0800	/* Toggle */
11476479Swpaul#define NSGPHY_NEXTP_CODE	0x07FF	/* Code field */
11576479Swpaul
11676479Swpaul#define NSGPHY_MII_NEXTP_LP	0x08	/* Next page of link partner */
11776479Swpaul#define NSGPHY_NEXTPLP_NP	0x8000	/* Next page indication */
11876479Swpaul#define NSGPHY_NEXTPLP_MP	0x2000	/* Message page */
11976479Swpaul#define NSGPHY_NEXTPLP_ACK2	0x1000	/* Acknowledge 2 */
12076479Swpaul#define NSGPHY_NEXTPLP_TOGGLE	0x0800	/* Toggle */
12176479Swpaul#define NSGPHY_NEXTPLP_CODE	0x07FF	/* Code field */
12276479Swpaul
12376479Swpaul#define NSGPHY_MII_1000CTL	0x09	/* 1000baseT control */
12476479Swpaul#define NSGPHY_1000CTL_TST	0xE000	/* test modes */
12576479Swpaul#define NSGPHY_1000CTL_MSE	0x1000	/* Master/Slave config enable */
12676479Swpaul#define NSGPHY_1000CTL_MSC	0x0800	/* Master/Slave setting */
12776479Swpaul#define NSGPHY_1000CTL_RD	0x0400	/* Port type: Repeater/DTE */
12876479Swpaul#define NSGPHY_1000CTL_AFD	0x0200	/* Advertise full duplex */
12976479Swpaul#define NSGPHY_1000CTL_AHD	0x0100	/* Advertise half duplex */
13076479Swpaul
13176479Swpaul#define NSGPHY_MII_1000STS	0x0A	/* 1000baseT status */
13276479Swpaul#define NSGPHY_1000STS_MSF	0x8000	/* Master/slave fault */
13376479Swpaul#define NSGPHY_1000STS_MSR	0x4000	/* Master/slave result */
13476479Swpaul#define NSGPHY_1000STS_LRS	0x2000	/* Local receiver status */
13576479Swpaul#define NSGPHY_1000STS_RRS	0x1000	/* Remote receiver status */
13676479Swpaul#define NSGPHY_1000STS_LPFD	0x0800	/* Link partner can FD */
13776479Swpaul#define NSGPHY_1000STS_LPHD	0x0400	/* Link partner can HD */
13876479Swpaul#define NSGPHY_1000STS_ASM_DIR	0x0200	/* Asymetric pause capable */
13976479Swpaul#define NSGPHY_1000STS_IEC	0x00FF	/* Idle error count */
14076479Swpaul
14176479Swpaul#define NSGPHY_MII_EXTSTS	0x0F	/* Extended status */
14276479Swpaul#define NSGPHY_EXTSTS_X_FD_CAP	0x8000	/* 1000base-X FD capable */
14376479Swpaul#define NSGPHY_EXTSTS_X_HD_CAP	0x4000	/* 1000base-X HD capable */
14476479Swpaul#define NSGPHY_EXTSTS_T_FD_CAP	0x2000	/* 1000base-T FD capable */
14576479Swpaul#define NSGPHY_EXTSTS_T_HD_CAP	0x1000	/* 1000base-T HD capable */
14676479Swpaul
14776479Swpaul#define NSGPHY_MII_STRAPOPT	0x10	/* Strap options */
14876479Swpaul#define NSGPHY_STRAPOPT_PHYADDR	0xF800	/* PHY address */
14976479Swpaul#define NSGPHY_STRAPOPT_COMPAT	0x0400	/* Broadcom compat mode */
15076479Swpaul#define NSGPHY_STRAPOPT_MMSE	0x0200	/* Manual master/slave enable */
15176479Swpaul#define NSGPHY_STRAPOPT_ANEG	0x0100	/* Autoneg enable */
15276479Swpaul#define NSGPHY_STRAPOPT_MMSV	0x0080	/* Manual master/slave setting */
15376479Swpaul#define NSGPHY_STRAPOPT_1000HDX	0x0010	/* Advertise 1000 half-duplex */
15476479Swpaul#define NSGPHY_STRAPOPT_1000FDX	0x0008	/* Advertise 1000 full-duplex */
15576479Swpaul#define NSGPHY_STRAPOPT_100_ADV	0x0004	/* Advertise 100 full/half-duplex */
15676479Swpaul#define NSGPHY_STRAPOPT_SPDSEL	0x0003	/* speed selection */
15776479Swpaul
15876479Swpaul#define NSGPHY_MII_PHYSUP	0x11	/* PHY support/current status */
15976479Swpaul#define NSGPHY_PHYSUP_SPDSTS	0x0018	/* speed status */
16076479Swpaul#define NSGPHY_PHYSUP_LNKSTS	0x0004	/* link status */
16176479Swpaul#define NSGPHY_PHYSUP_DUPSTS	0x0002	/* duplex status 1 == full */
16276479Swpaul#define NSGPHY_PHYSUP_10BT	0x0001	/* 10baseT resolved */
16376479Swpaul
16476479Swpaul#define NSGPHY_SPDSTS_1000	0x0010
16576479Swpaul#define NSGPHY_SPDSTS_100	0x0008
16676479Swpaul#define NSGPHY_SPDSTS_10	0x0000
16776479Swpaul
16876479Swpaul#endif /* _DEV_NSGPHY_MIIREG_H_ */
169