summaryrefslogtreecommitdiff
path: root/sys/dev/mii/mii.h
diff options
context:
space:
mode:
authorNathan Binkert <nate@cvs.openbsd.org>2001-06-08 02:16:42 +0000
committerNathan Binkert <nate@cvs.openbsd.org>2001-06-08 02:16:42 +0000
commit8f0b00e0a2fd9f1d4a58ba708e6d9b464063f14d (patch)
tree19f4c99ee334735227a88287627fdebfc89bf84e /sys/dev/mii/mii.h
parent9e436197a7a21d6181bf07840edd20711a785e1e (diff)
Add some general support info for gigabit phys
Fix some comments Remove some dead code From NetBSD
Diffstat (limited to 'sys/dev/mii/mii.h')
-rw-r--r--sys/dev/mii/mii.h51
1 files changed, 45 insertions, 6 deletions
diff --git a/sys/dev/mii/mii.h b/sys/dev/mii/mii.h
index ead15f2bc5d..f8abe567722 100644
--- a/sys/dev/mii/mii.h
+++ b/sys/dev/mii/mii.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: mii.h,v 1.2 2000/08/26 20:04:17 nate Exp $ */
-/* $NetBSD: mii.h,v 1.2 1999/09/29 22:49:33 thorpej Exp $ */
+/* $OpenBSD: mii.h,v 1.3 2001/06/08 02:16:41 nate Exp $ */
+/* $NetBSD: mii.h,v 1.6 2001/04/30 19:49:08 thorpej Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer. All rights reserved.
@@ -54,13 +54,20 @@
#define MII_BMCR 0x00 /* Basic mode control register (rw) */
#define BMCR_RESET 0x8000 /* reset */
#define BMCR_LOOP 0x4000 /* loopback */
-#define BMCR_S100 0x2000 /* speed (10/100) select */
+#define BMCR_SPEED0 0x2000 /* speed selection (LSB) */
#define BMCR_AUTOEN 0x1000 /* autonegotiation enable */
#define BMCR_PDOWN 0x0800 /* power down */
#define BMCR_ISO 0x0400 /* isolate */
#define BMCR_STARTNEG 0x0200 /* restart autonegotiation */
#define BMCR_FDX 0x0100 /* Set duplex mode */
#define BMCR_CTEST 0x0080 /* collision test */
+#define BMCR_SPEED1 0x0040 /* speed selection (MSB) */
+
+#define BMCR_S10 0x0000 /* 10 Mb/s */
+#define BMCR_S100 BMCR_SPEED0 /* 100 Mb/s */
+#define BMCR_S1000 BMCR_SPEED1 /* 1000 Mb/s */
+
+#define BMCR_SPEED(x) ((x) & (BMCR_SPEED0|BMCR_SPEED1))
#define MII_BMSR 0x01 /* Basic mode status register (ro) */
#define BMSR_100T4 0x8000 /* 100 base T4 capable */
@@ -69,15 +76,25 @@
#define BMSR_10TFDX 0x1000 /* 10 base T full duplex capable */
#define BMSR_10THDX 0x0800 /* 10 base T half duplex capable */
#define BMSR_MFPS 0x0040 /* MII Frame Preamble Suppression */
+#define BMSR_100T2FDX 0x0400 /* 100 base T2 full duplex capable */
+#define BMSR_100T2HDX 0x0200 /* 100 base T2 half duplex capable */
+#define BMSR_EXTSTAT 0x0100 /* Extended status in register 15 */
+#define BMSR_MFPS 0x0040 /* MII Frame Preamble Suppression */
#define BMSR_ACOMP 0x0020 /* Autonegotiation complete */
#define BMSR_RFAULT 0x0010 /* Link partner fault */
#define BMSR_ANEG 0x0008 /* Autonegotiation capable */
#define BMSR_LINK 0x0004 /* Link status */
#define BMSR_JABBER 0x0002 /* Jabber detected */
-#define BMSR_EXT 0x0001 /* Extended capability */
+#define BMSR_EXTCAP 0x0001 /* Extended capability */
-#define BMSR_MEDIAMASK (BMSR_100T4|BMSR_100TXFDX|BMSR_100TXHDX|BMSR_10TFDX| \
- BMSR_10THDX|BMSR_ANEG)
+ /*
+ * Note that the EXTSTAT bit indicates that there is extended status
+ * info available in register 15, but 802.3 section 22.2.4.3 also
+ * states that that all 1000 Mb/s capable PHYs will set this bit to 1.
+ */
+
+#define BMSR_MEDIAMASK (BMSR_100T4|BMSR_100TXFDX|BMSR_100TXHDX| \
+ BMSR_10TFDX|BMSR_10THDX|BMSR_100T2FDX|BMSR_100T2HDX)
/*
* Convert BMSR media capabilities to ANAR bits for autonegotiation.
@@ -97,6 +114,7 @@
#define MII_REV(id2) ((id2) & IDR2_REV)
#define MII_ANAR 0x04 /* Autonegotiation advertisement (rw) */
+ /* section 28.2.4.1 and 37.2.6.1 */
#define ANAR_NP 0x8000 /* Next page (ro) */
#define ANAR_ACK 0x4000 /* link partner abilities acknowledged (ro) */
#define ANAR_RF 0x2000 /* remote fault (ro) */
@@ -109,6 +127,7 @@
#define ANAR_CSMA 0x0001 /* protocol selector CSMA/CD */
#define MII_ANLPAR 0x05 /* Autonegotiation lnk partner abilities (rw) */
+ /* section 28.2.4.1 and 37.2.6.1 */
#define ANLPAR_NP 0x8000 /* Next page (ro) */
#define ANLPAR_ACK 0x4000 /* link partner accepted ACK (ro) */
#define ANLPAR_RF 0x2000 /* remote fault (ro) */
@@ -121,10 +140,30 @@
#define ANLPAR_CSMA 0x0001 /* protocol selector CSMA/CD */
#define MII_ANER 0x06 /* Autonegotiation expansion (ro) */
+ /* section 28.2.4.1 and 37.2.6.1 */
#define ANER_MLF 0x0010 /* multiple link detection fault */
#define ANER_LPNP 0x0008 /* link parter next page-able */
#define ANER_NP 0x0004 /* next page-able */
#define ANER_PAGE_RX 0x0002 /* Page received */
#define ANER_LPAN 0x0001 /* link parter autoneg-able */
+#define MII_ANNP 0x07 /* Autonegotiation next page */
+ /* section 28.2.4.1 and 37.2.6.1 */
+
+#define MII_ANLPRNP 0x08 /* Autonegotiation link partner rx next page */
+ /* section 32.5.1 and 37.2.6.1 */
+
+#define MII_100T2CR 0x09 /* 100base-T2 control register */
+
+#define MII_100T2SR 0x0a /* 100base-T2 status register */
+
+#define MII_EXTSR 0x0f /* Extended status register */
+#define EXTSR_1000XFDX 0x8000 /* 1000X full-duplex capable */
+#define EXTSR_1000XHDX 0x4000 /* 1000X half-duplex capable */
+#define EXTSR_1000TFDX 0x2000 /* 1000T full-duplex capable */
+#define EXTSR_1000THDX 0x1000 /* 1000T half-duplex capable */
+
+#define EXTSR_MEDIAMASK (EXTSR_1000XFDX|EXTSR_1000XHDX| \
+ EXTSR_1000TFDX|EXTSR_1000THDX)
+
#endif /* _DEV_MII_MII_H_ */