Browse Source

[ethernet] Update mii.h and use it in drivers that had a private copy

Signed-off-by: Michael Brown <mcb30@etherboot.org>
tags/v0.9.8
Daniel Verkamp 15 years ago
parent
commit
b8469eddaa

+ 1
- 0
src/drivers/net/bnx2.c View File

@@ -20,6 +20,7 @@ FILE_LICENCE ( GPL_ANY );
20 20
 #include <gpxe/pci.h>
21 21
 #include <gpxe/ethernet.h>
22 22
 #include "string.h"
23
+#include <mii.h>
23 24
 #include "bnx2.h"
24 25
 #include "bnx2_fw.h"
25 26
 

+ 0
- 107
src/drivers/net/bnx2.h View File

@@ -92,113 +92,6 @@ typedef int pci_power_t;
92 92
 #define WAKE_MAGIC		(1 << 5)
93 93
 #define WAKE_MAGICSECURE	(1 << 6) /* only meaningful if WAKE_MAGIC */
94 94
 
95
-/* Generic MII registers. */
96
-
97
-#define MII_BMCR            0x00        /* Basic mode control register */
98
-#define MII_BMSR            0x01        /* Basic mode status register  */
99
-#define MII_PHYSID1         0x02        /* PHYS ID 1                   */
100
-#define MII_PHYSID2         0x03        /* PHYS ID 2                   */
101
-#define MII_ADVERTISE       0x04        /* Advertisement control reg   */
102
-#define MII_LPA             0x05        /* Link partner ability reg    */
103
-#define MII_EXPANSION       0x06        /* Expansion register          */
104
-#define MII_CTRL1000        0x09        /* 1000BASE-T control          */
105
-#define MII_STAT1000        0x0a        /* 1000BASE-T status           */
106
-#define MII_DCOUNTER        0x12        /* Disconnect counter          */
107
-#define MII_FCSCOUNTER      0x13        /* False carrier counter       */
108
-#define MII_NWAYTEST        0x14        /* N-way auto-neg test reg     */
109
-#define MII_RERRCOUNTER     0x15        /* Receive error counter       */
110
-#define MII_SREVISION       0x16        /* Silicon revision            */
111
-#define MII_RESV1           0x17        /* Reserved...                 */
112
-#define MII_LBRERROR        0x18        /* Lpback, rx, bypass error    */
113
-#define MII_PHYADDR         0x19        /* PHY address                 */
114
-#define MII_RESV2           0x1a        /* Reserved...                 */
115
-#define MII_TPISTATUS       0x1b        /* TPI status for 10mbps       */
116
-#define MII_NCONFIG         0x1c        /* Network interface config    */
117
-
118
-/* Basic mode control register. */
119
-#define BMCR_RESV               0x007f  /* Unused...                   */
120
-#define BMCR_SPEED1000		0x0040  /* MSB of Speed (1000)         */
121
-#define BMCR_CTST               0x0080  /* Collision test              */
122
-#define BMCR_FULLDPLX           0x0100  /* Full duplex                 */
123
-#define BMCR_ANRESTART          0x0200  /* Auto negotiation restart    */
124
-#define BMCR_ISOLATE            0x0400  /* Disconnect DP83840 from MII */
125
-#define BMCR_PDOWN              0x0800  /* Powerdown the DP83840       */
126
-#define BMCR_ANENABLE           0x1000  /* Enable auto negotiation     */
127
-#define BMCR_SPEED100           0x2000  /* Select 100Mbps              */
128
-#define BMCR_LOOPBACK           0x4000  /* TXD loopback bits           */
129
-#define BMCR_RESET              0x8000  /* Reset the DP83840           */
130
-
131
-/* Basic mode status register. */
132
-#define BMSR_ERCAP              0x0001  /* Ext-reg capability          */
133
-#define BMSR_JCD                0x0002  /* Jabber detected             */
134
-#define BMSR_LSTATUS            0x0004  /* Link status                 */
135
-#define BMSR_ANEGCAPABLE        0x0008  /* Able to do auto-negotiation */
136
-#define BMSR_RFAULT             0x0010  /* Remote fault detected       */
137
-#define BMSR_ANEGCOMPLETE       0x0020  /* Auto-negotiation complete   */
138
-#define BMSR_RESV               0x07c0  /* Unused...                   */
139
-#define BMSR_10HALF             0x0800  /* Can do 10mbps, half-duplex  */
140
-#define BMSR_10FULL             0x1000  /* Can do 10mbps, full-duplex  */
141
-#define BMSR_100HALF            0x2000  /* Can do 100mbps, half-duplex */
142
-#define BMSR_100FULL            0x4000  /* Can do 100mbps, full-duplex */
143
-#define BMSR_100BASE4           0x8000  /* Can do 100mbps, 4k packets  */
144
-
145
-/* Advertisement control register. */
146
-#define ADVERTISE_SLCT          0x001f  /* Selector bits               */
147
-#define ADVERTISE_CSMA          0x0001  /* Only selector supported     */
148
-#define ADVERTISE_10HALF        0x0020  /* Try for 10mbps half-duplex  */
149
-#define ADVERTISE_10FULL        0x0040  /* Try for 10mbps full-duplex  */
150
-#define ADVERTISE_100HALF       0x0080  /* Try for 100mbps half-duplex */
151
-#define ADVERTISE_100FULL       0x0100  /* Try for 100mbps full-duplex */
152
-#define ADVERTISE_100BASE4      0x0200  /* Try for 100mbps 4k packets  */
153
-#define ADVERTISE_RESV          0x1c00  /* Unused...                   */
154
-#define ADVERTISE_RFAULT        0x2000  /* Say we can detect faults    */
155
-#define ADVERTISE_LPACK         0x4000  /* Ack link partners response  */
156
-#define ADVERTISE_NPAGE         0x8000  /* Next page bit               */
157
-#define ADVERTISE_1000XFULL     0x0020  /* Try for 1000BASE-X full-duplex */
158
-#define ADVERTISE_10FULL        0x0040  /* Try for 10mbps full-duplex  */
159
-#define ADVERTISE_1000XHALF     0x0040  /* Try for 1000BASE-X half-duplex */
160
-#define ADVERTISE_1000XPAUSE    0x0080  /* Try for 1000BASE-X pause    */
161
-#define ADVERTISE_PAUSE_CAP     0x0400  /* Try for pause               */
162
-#define ADVERTISE_1000XPSE_ASYM 0x0100  /* Try for 1000BASE-X asym pause */
163
-#define ADVERTISE_PAUSE_ASYM    0x0800  /* Try for asymetric pause     */
164
-
165
-#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \
166
-			ADVERTISE_CSMA)
167
-#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
168
-                       ADVERTISE_100HALF | ADVERTISE_100FULL)
169
-
170
-/* Link partner ability register. */
171
-#define LPA_SLCT                0x001f  /* Same as advertise selector  */
172
-#define LPA_10HALF              0x0020  /* Can do 10mbps half-duplex   */
173
-#define LPA_10FULL              0x0040  /* Can do 10mbps full-duplex   */
174
-#define LPA_100HALF             0x0080  /* Can do 100mbps half-duplex  */
175
-#define LPA_100FULL             0x0100  /* Can do 100mbps full-duplex  */
176
-#define LPA_100BASE4            0x0200  /* Can do 100mbps 4k packets   */
177
-#define LPA_RESV                0x1c00  /* Unused...                   */
178
-#define LPA_RFAULT              0x2000  /* Link partner faulted        */
179
-#define LPA_LPACK               0x4000  /* Link partner acked us       */
180
-#define LPA_NPAGE               0x8000  /* Next page bit               */
181
-
182
-#define LPA_DUPLEX		(LPA_10FULL | LPA_100FULL)
183
-#define LPA_100			(LPA_100FULL | LPA_100HALF | LPA_100BASE4)
184
-
185
-/* Expansion register for auto-negotiation. */
186
-#define EXPANSION_NWAY          0x0001  /* Can do N-way auto-nego      */
187
-#define EXPANSION_LCWP          0x0002  /* Got new RX page code word   */
188
-#define EXPANSION_ENABLENPAGE   0x0004  /* This enables npage words    */
189
-#define EXPANSION_NPCAPABLE     0x0008  /* Link partner supports npage */
190
-#define EXPANSION_MFAULTS       0x0010  /* Multiple faults detected    */
191
-#define EXPANSION_RESV          0xffe0  /* Unused...                   */
192
-
193
-/* 1000BASE-T Control register */
194
-#define ADVERTISE_1000FULL      0x0200  /* Advertise 1000BASE-T full duplex */
195
-#define ADVERTISE_1000HALF      0x0100  /* Advertise 1000BASE-T half duplex */
196
-
197
-/* N-way test register. */
198
-#define NWAYTEST_RESV1          0x00ff  /* Unused...                   */
199
-#define NWAYTEST_LOOPBACK       0x0100  /* Enable loopback for N-way   */
200
-#define NWAYTEST_RESV2          0xfe00  /* Unused...                   */
201
-
202 95
 /* The following are all involved in forcing a particular link
203 96
  *  * mode for the device for setting things.  When getting the
204 97
  *   * devices settings, these indicate the current mode and whether

+ 34
- 49
src/drivers/net/etherfabric.c View File

@@ -32,6 +32,7 @@ FILE_LICENCE ( GPL_ANY );
32 32
 #include <gpxe/iobuf.h>
33 33
 #include <gpxe/netdevice.h>
34 34
 #include <gpxe/timer.h>
35
+#include <mii.h>
35 36
 #include "etherfabric.h"
36 37
 #include "etherfabric_nic.h"
37 38
 
@@ -84,39 +85,23 @@ static void falcon_mdio_write (struct efab_nic *efab, int device,
84 85
 static int falcon_mdio_read ( struct efab_nic *efab, int device, int location );
85 86
 
86 87
 /* GMII registers */
87
-#define MII_BMSR		0x01	/* Basic mode status register  */
88
-#define MII_ADVERTISE		0x04	/* Advertisement control register */
89
-#define MII_LPA			0x05	/* Link partner ability register*/
90
-#define GMII_GTCR		0x09	/* 1000BASE-T control register */
91
-#define GMII_GTSR		0x0a	/* 1000BASE-T status register */
92 88
 #define GMII_PSSR		0x11	/* PHY-specific status register */
93 89
 
94
-/* Basic mode status register. */
95
-#define BMSR_LSTATUS		0x0004	/* Link status                 */
96
-
97
-/* Link partner ability register. */
98
-#define LPA_10HALF              0x0020  /* Can do 10mbps half-duplex   */
99
-#define LPA_10FULL              0x0040  /* Can do 10mbps full-duplex   */
100
-#define LPA_100HALF             0x0080  /* Can do 100mbps half-duplex  */
101
-#define LPA_100FULL             0x0100  /* Can do 100mbps full-duplex  */
102
-#define LPA_100BASE4            0x0200  /* Can do 100mbps 4k packets   */
103
-#define LPA_PAUSE		0x0400	/* Bit 10 - MAC pause */
104
-
105 90
 /* Pseudo extensions to the link partner ability register */
106
-#define LPA_1000FULL		0x00020000
107
-#define LPA_1000HALF		0x00010000
108
-#define LPA_10000FULL		0x00040000
109
-#define LPA_10000HALF		0x00080000
91
+#define LPA_EF_1000FULL		0x00020000
92
+#define LPA_EF_1000HALF		0x00010000
93
+#define LPA_EF_10000FULL		0x00040000
94
+#define LPA_EF_10000HALF		0x00080000
110 95
 
111 96
 #define LPA_100			(LPA_100FULL | LPA_100HALF | LPA_100BASE4)
112
-#define LPA_1000		( LPA_1000FULL | LPA_1000HALF )
113
-#define LPA_10000               ( LPA_10000FULL | LPA_10000HALF )
114
-#define LPA_DUPLEX		( LPA_10FULL | LPA_100FULL | LPA_1000FULL | \
115
-				  LPA_10000FULL )
97
+#define LPA_EF_1000		( LPA_EF_1000FULL | LPA_EF_1000HALF )
98
+#define LPA_EF_10000               ( LPA_EF_10000FULL | LPA_EF_10000HALF )
99
+#define LPA_EF_DUPLEX		( LPA_10FULL | LPA_100FULL | LPA_EF_1000FULL | \
100
+				  LPA_EF_10000FULL )
116 101
 
117 102
 /* Mask of bits not associated with speed or duplexity. */
118 103
 #define LPA_OTHER		~( LPA_10FULL | LPA_10HALF | LPA_100FULL | \
119
-				   LPA_100HALF | LPA_1000FULL | LPA_1000HALF )
104
+				   LPA_100HALF | LPA_EF_1000FULL | LPA_EF_1000HALF )
120 105
 
121 106
 /* PHY-specific status register */
122 107
 #define PSSR_LSTATUS		0x0400	/* Bit 10 - link status */
@@ -131,9 +116,9 @@ gmii_autoneg_advertised ( struct efab_nic *efab )
131 116
 	unsigned int mii_advertise;
132 117
 	unsigned int gmii_advertise;
133 118
 
134
-	/* Extended bits are in bits 8 and 9 of GMII_GTCR */
119
+	/* Extended bits are in bits 8 and 9 of MII_CTRL1000 */
135 120
 	mii_advertise = falcon_mdio_read ( efab, 0, MII_ADVERTISE );
136
-	gmii_advertise = ( ( falcon_mdio_read ( efab, 0, GMII_GTCR ) >> 8 )
121
+	gmii_advertise = ( ( falcon_mdio_read ( efab, 0, MII_CTRL1000 ) >> 8 )
137 122
 			   & 0x03 );
138 123
 	return ( ( gmii_advertise << 16 ) | mii_advertise );
139 124
 }
@@ -148,9 +133,9 @@ gmii_autoneg_lpa ( struct efab_nic *efab )
148 133
 	unsigned int mii_lpa;
149 134
 	unsigned int gmii_lpa;
150 135
 
151
-	/* Extended bits are in bits 10 and 11 of GMII_GTSR */
136
+	/* Extended bits are in bits 10 and 11 of MII_STAT1000 */
152 137
 	mii_lpa = falcon_mdio_read ( efab, 0, MII_LPA );
153
-	gmii_lpa = ( falcon_mdio_read ( efab, 0, GMII_GTSR ) >> 10 ) & 0x03;
138
+	gmii_lpa = ( falcon_mdio_read ( efab, 0, MII_STAT1000 ) >> 10 ) & 0x03;
154 139
 	return ( ( gmii_lpa << 16 ) | mii_lpa );
155 140
 }
156 141
 
@@ -166,10 +151,10 @@ gmii_nway_result ( unsigned int negotiated )
166 151
 	/* Mask out the speed and duplexity bits */
167 152
 	other_bits = negotiated & LPA_OTHER;
168 153
 
169
-	if ( negotiated & LPA_1000FULL )
170
-		return ( other_bits | LPA_1000FULL );
171
-	else if ( negotiated & LPA_1000HALF )
172
-		return ( other_bits | LPA_1000HALF );
154
+	if ( negotiated & LPA_EF_1000FULL )
155
+		return ( other_bits | LPA_EF_1000FULL );
156
+	else if ( negotiated & LPA_EF_1000HALF )
157
+		return ( other_bits | LPA_EF_1000HALF );
173 158
 	else if ( negotiated & LPA_100FULL )
174 159
 		return ( other_bits | LPA_100FULL );
175 160
 	else if ( negotiated & LPA_100BASE4 )
@@ -1740,9 +1725,9 @@ falcon_reconfigure_mac_wrapper ( struct efab_nic *efab )
1740 1725
 	efab_oword_t reg;
1741 1726
 	int link_speed;
1742 1727
 
1743
-	if ( efab->link_options & LPA_10000 ) {
1728
+	if ( efab->link_options & LPA_EF_10000 ) {
1744 1729
 		link_speed = 0x3;
1745
-	} else if ( efab->link_options & LPA_1000 ) {
1730
+	} else if ( efab->link_options & LPA_EF_1000 ) {
1746 1731
 		link_speed = 0x2;
1747 1732
 	} else if ( efab->link_options & LPA_100 ) {
1748 1733
 		link_speed = 0x1;
@@ -1951,8 +1936,8 @@ mentormac_init ( struct efab_nic *efab )
1951 1936
 	efab_dword_t reg;
1952 1937
 
1953 1938
 	/* Configuration register 1 */
1954
-	pause = ( efab->link_options & LPA_PAUSE ) ? 1 : 0;
1955
-	if ( ! ( efab->link_options & LPA_DUPLEX ) ) {
1939
+	pause = ( efab->link_options & LPA_PAUSE_CAP ) ? 1 : 0;
1940
+	if ( ! ( efab->link_options & LPA_EF_DUPLEX ) ) {
1956 1941
 		/* Half-duplex operation requires TX flow control */
1957 1942
 		pause = 1;
1958 1943
 	}
@@ -1965,8 +1950,8 @@ mentormac_init ( struct efab_nic *efab )
1965 1950
 	udelay ( 10 );
1966 1951
 
1967 1952
 	/* Configuration register 2 */
1968
-	if_mode = ( efab->link_options & LPA_1000 ) ? 2 : 1;
1969
-	full_duplex = ( efab->link_options & LPA_DUPLEX ) ? 1 : 0;
1953
+	if_mode = ( efab->link_options & LPA_EF_1000 ) ? 2 : 1;
1954
+	full_duplex = ( efab->link_options & LPA_EF_DUPLEX ) ? 1 : 0;
1970 1955
 	EFAB_POPULATE_DWORD_4 ( reg,
1971 1956
 				GM_IF_MODE, if_mode,
1972 1957
 				GM_PAD_CRC_EN, 1,
@@ -2018,8 +2003,8 @@ mentormac_init ( struct efab_nic *efab )
2018 2003
 	udelay ( 10 );
2019 2004
 	
2020 2005
 	/* FIFO configuration register 5 */
2021
-	bytemode = ( efab->link_options & LPA_1000 ) ? 1 : 0;
2022
-	half_duplex = ( efab->link_options & LPA_DUPLEX ) ? 0 : 1;
2006
+	bytemode = ( efab->link_options & LPA_EF_1000 ) ? 1 : 0;
2007
+	half_duplex = ( efab->link_options & LPA_EF_DUPLEX ) ? 0 : 1;
2023 2008
 	falcon_gmac_readl ( efab, &reg, GMF_CFG5_REG_MAC );
2024 2009
 	EFAB_SET_DWORD_FIELD ( reg, GMF_CFGBYTMODE, bytemode );
2025 2010
 	EFAB_SET_DWORD_FIELD ( reg, GMF_CFGHDPLX, half_duplex );
@@ -2415,7 +2400,7 @@ static int
2415 2400
 falcon_xaui_phy_init ( struct efab_nic *efab )
2416 2401
 {
2417 2402
 	/* CX4 is always 10000FD only */
2418
-	efab->link_options = LPA_10000FULL;
2403
+	efab->link_options = LPA_EF_10000FULL;
2419 2404
 
2420 2405
 	/* There is no PHY! */
2421 2406
 	return 0;
@@ -2480,7 +2465,7 @@ falcon_xfp_phy_init ( struct efab_nic *efab )
2480 2465
 	int rc;
2481 2466
 
2482 2467
 	/* Optical link is always 10000FD only */
2483
-	efab->link_options = LPA_10000FULL;
2468
+	efab->link_options = LPA_EF_10000FULL;
2484 2469
 
2485 2470
 	/* Reset the PHY */
2486 2471
 	rc = mdio_clause45_reset_mmd ( efab, MDIO_MMD_PHYXS );
@@ -2567,7 +2552,7 @@ falcon_txc_phy_init ( struct efab_nic *efab )
2567 2552
 	int rc;
2568 2553
 
2569 2554
 	/* CX4 is always 10000FD only */
2570
-	efab->link_options = LPA_10000FULL;
2555
+	efab->link_options = LPA_EF_10000FULL;
2571 2556
 
2572 2557
 	/* reset the phy */
2573 2558
 	rc = mdio_clause45_reset_mmd ( efab, MDIO_MMD_PMAPMD );
@@ -2685,7 +2670,7 @@ falcon_tenxpress_phy_init ( struct efab_nic *efab )
2685 2670
 	int rc, reg;
2686 2671
 
2687 2672
 	/* 10XPRESS is always 10000FD (at the moment) */
2688
-	efab->link_options = LPA_10000FULL;
2673
+	efab->link_options = LPA_EF_10000FULL;
2689 2674
 
2690 2675
 	/* Wait for the blocks to come out of reset */
2691 2676
 	rc = mdio_clause45_wait_reset_mmds ( efab );
@@ -2765,7 +2750,7 @@ falcon_pm8358_phy_init ( struct efab_nic *efab )
2765 2750
 	int rc, reg, i;
2766 2751
 
2767 2752
 	/* This is a XAUI retimer part */
2768
-	efab->link_options = LPA_10000FULL;
2753
+	efab->link_options = LPA_EF_10000FULL;
2769 2754
 
2770 2755
 	rc = mdio_clause45_reset_mmd ( efab, MDIO_MMDREG_DEVS0_DTEXS );
2771 2756
 	if ( rc )
@@ -4039,10 +4024,10 @@ efab_init_mac ( struct efab_nic *efab )
4039 4024
 		}
4040 4025
 
4041 4026
 		EFAB_LOG ( "\n%dMbps %s-duplex\n",
4042
-			   ( efab->link_options & LPA_10000 ? 10000 :
4043
-			     ( efab->link_options & LPA_1000 ? 1000 :
4027
+			   ( efab->link_options & LPA_EF_10000 ? 10000 :
4028
+			     ( efab->link_options & LPA_EF_1000 ? 1000 :
4044 4029
 			       ( efab->link_options & LPA_100 ? 100 : 10 ) ) ),
4045
-			   ( efab->link_options & LPA_DUPLEX ?
4030
+			   ( efab->link_options & LPA_EF_DUPLEX ?
4046 4031
 			     "full" : "half" ) );
4047 4032
 
4048 4033
 		/* TODO: Move link state handling to the poll() routine */

+ 4
- 31
src/drivers/net/forcedeth.c View File

@@ -373,13 +373,6 @@ enum {
373 373
 #define PHY_1000	0x2
374 374
 #define PHY_HALF	0x100
375 375
 
376
-/* FIXME: MII defines that should be added to <linux/mii.h> */
377
-#define MII_1000BT_CR	0x09
378
-#define MII_1000BT_SR	0x0a
379
-#define ADVERTISE_1000FULL	0x0200
380
-#define ADVERTISE_1000HALF	0x0100
381
-#define LPA_1000FULL	0x0800
382
-#define LPA_1000HALF	0x0400
383 376
 
384 377
 /* Bit to know if MAC addr is stored in correct order */
385 378
 #define MAC_ADDR_CORRECT	0x01
@@ -465,26 +458,6 @@ static int reg_delay(int offset, u32 mask,
465 458
 }
466 459
 
467 460
 #define MII_READ	(-1)
468
-#define MII_PHYSID1         0x02	/* PHYS ID 1                   */
469
-#define MII_PHYSID2         0x03	/* PHYS ID 2                   */
470
-#define MII_BMCR            0x00	/* Basic mode control register */
471
-#define MII_BMSR            0x01	/* Basic mode status register  */
472
-#define MII_ADVERTISE       0x04	/* Advertisement control reg   */
473
-#define MII_LPA             0x05	/* Link partner ability reg    */
474
-
475
-#define BMSR_ANEGCOMPLETE       0x0020	/* Auto-negotiation complete   */
476
-
477
-/* Link partner ability register. */
478
-#define LPA_SLCT                0x001f	/* Same as advertise selector  */
479
-#define LPA_10HALF              0x0020	/* Can do 10mbps half-duplex   */
480
-#define LPA_10FULL              0x0040	/* Can do 10mbps full-duplex   */
481
-#define LPA_100HALF             0x0080	/* Can do 100mbps half-duplex  */
482
-#define LPA_100FULL             0x0100	/* Can do 100mbps full-duplex  */
483
-#define LPA_100BASE4            0x0200	/* Can do 100mbps 4k packets   */
484
-#define LPA_RESV                0x1c00	/* Unused...                   */
485
-#define LPA_RFAULT              0x2000	/* Link partner faulted        */
486
-#define LPA_LPACK               0x4000	/* Link partner acked us       */
487
-#define LPA_NPAGE               0x8000	/* Next page bit               */
488 461
 
489 462
 /* mii_rw: read/write a register on the PHY.
490 463
  *
@@ -586,7 +559,7 @@ static int phy_init(struct nic *nic)
586 559
 	if (mii_status & PHY_GIGABIT) {
587 560
 		np->gigabit = PHY_GIGABIT;
588 561
 		mii_control_1000 =
589
-		    mii_rw(nic, np->phyaddr, MII_1000BT_CR, MII_READ);
562
+		    mii_rw(nic, np->phyaddr, MII_CTRL1000, MII_READ);
590 563
 		mii_control_1000 &= ~ADVERTISE_1000HALF;
591 564
 		if (phyinterface & PHY_RGMII)
592 565
 			mii_control_1000 |= ADVERTISE_1000FULL;
@@ -594,7 +567,7 @@ static int phy_init(struct nic *nic)
594 567
 			mii_control_1000 &= ~ADVERTISE_1000FULL;
595 568
 
596 569
 		if (mii_rw
597
-		    (nic, np->phyaddr, MII_1000BT_CR, mii_control_1000)) {
570
+		    (nic, np->phyaddr, MII_CTRL1000, mii_control_1000)) {
598 571
 			printf("phy init failed.\n");
599 572
 			return PHY_ERROR;
600 573
 		}
@@ -788,9 +761,9 @@ static int update_linkspeed(struct nic *nic)
788 761
 	retval = 1;
789 762
 	if (np->gigabit == PHY_GIGABIT) {
790 763
 		control_1000 =
791
-		    mii_rw(nic, np->phyaddr, MII_1000BT_CR, MII_READ);
764
+		    mii_rw(nic, np->phyaddr, MII_CTRL1000, MII_READ);
792 765
 		status_1000 =
793
-		    mii_rw(nic, np->phyaddr, MII_1000BT_SR, MII_READ);
766
+		    mii_rw(nic, np->phyaddr, MII_STAT1000, MII_READ);
794 767
 
795 768
 		if ((control_1000 & ADVERTISE_1000FULL) &&
796 769
 		    (status_1000 & LPA_1000FULL)) {

+ 1
- 65
src/drivers/net/mtd80x.c View File

@@ -32,6 +32,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
32 32
 /* to get the PCI support functions, if this is a PCI NIC */
33 33
 #include <gpxe/pci.h>
34 34
 #include <gpxe/ethernet.h>
35
+#include <mii.h>
35 36
 
36 37
 /* Condensed operations for readability. */
37 38
 #define virt_to_le32desc(addr)  cpu_to_le32(virt_to_bus(addr))
@@ -61,71 +62,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
61 62
  */
62 63
 #define PKT_BUF_SZ 1536
63 64
 
64
-/* Generic MII registers. */
65
-
66
-#define MII_BMCR            0x00        /* Basic mode control register */
67
-#define MII_BMSR            0x01        /* Basic mode status register  */
68
-#define MII_PHYSID1         0x02        /* PHYS ID 1                   */
69
-#define MII_PHYSID2         0x03        /* PHYS ID 2                   */
70
-#define MII_ADVERTISE       0x04        /* Advertisement control reg   */
71
-#define MII_LPA             0x05        /* Link partner ability reg    */
72
-#define MII_EXPANSION       0x06        /* Expansion register          */
73
-#define MII_DCOUNTER        0x12        /* Disconnect counter          */
74
-#define MII_FCSCOUNTER      0x13        /* False carrier counter       */
75
-#define MII_NWAYTEST        0x14        /* N-way auto-neg test reg     */
76
-#define MII_RERRCOUNTER     0x15        /* Receive error counter       */
77
-#define MII_SREVISION       0x16        /* Silicon revision            */
78
-#define MII_RESV1           0x17        /* Reserved...                 */
79
-#define MII_LBRERROR        0x18        /* Lpback, rx, bypass error    */
80
-#define MII_PHYADDR         0x19        /* PHY address                 */
81
-#define MII_RESV2           0x1a        /* Reserved...                 */
82
-#define MII_TPISTATUS       0x1b        /* TPI status for 10mbps       */
83
-#define MII_NCONFIG         0x1c        /* Network interface config    */
84
-
85
-/* Basic mode control register. */
86
-#define BMCR_RESV               0x007f  /* Unused...                   */
87
-#define BMCR_CTST               0x0080  /* Collision test              */
88
-#define BMCR_FULLDPLX           0x0100  /* Full duplex                 */
89
-#define BMCR_ANRESTART          0x0200  /* Auto negotiation restart    */
90
-#define BMCR_ISOLATE            0x0400  /* Disconnect DP83840 from MII */
91
-#define BMCR_PDOWN              0x0800  /* Powerdown the DP83840       */
92
-#define BMCR_ANENABLE           0x1000  /* Enable auto negotiation     */
93
-#define BMCR_SPEED100           0x2000  /* Select 100Mbps              */
94
-#define BMCR_LOOPBACK           0x4000  /* TXD loopback bits           */
95
-#define BMCR_RESET              0x8000  /* Reset the DP83840           */
96
-
97
-/* Basic mode status register. */
98
-#define BMSR_ERCAP              0x0001  /* Ext-reg capability          */
99
-#define BMSR_JCD                0x0002  /* Jabber detected             */
100
-#define BMSR_LSTATUS            0x0004  /* Link status                 */
101
-#define BMSR_ANEGCAPABLE        0x0008  /* Able to do auto-negotiation */
102
-#define BMSR_RFAULT             0x0010  /* Remote fault detected       */
103
-#define BMSR_ANEGCOMPLETE       0x0020  /* Auto-negotiation complete   */
104
-#define BMSR_RESV               0x07c0  /* Unused...                   */
105
-#define BMSR_10HALF             0x0800  /* Can do 10mbps, half-duplex  */
106
-#define BMSR_10FULL             0x1000  /* Can do 10mbps, full-duplex  */
107
-#define BMSR_100HALF            0x2000  /* Can do 100mbps, half-duplex */
108
-#define BMSR_100FULL            0x4000  /* Can do 100mbps, full-duplex */
109
-#define BMSR_100BASE4           0x8000  /* Can do 100mbps, 4k packets  */
110
-
111
-/* Advertisement control register. */
112
-#define ADVERTISE_SLCT          0x001f  /* Selector bits               */
113
-#define ADVERTISE_CSMA          0x0001  /* Only selector supported     */
114
-#define ADVERTISE_10HALF        0x0020  /* Try for 10mbps half-duplex  */
115
-#define ADVERTISE_10FULL        0x0040  /* Try for 10mbps full-duplex  */
116
-#define ADVERTISE_100HALF       0x0080  /* Try for 100mbps half-duplex */
117
-#define ADVERTISE_100FULL       0x0100  /* Try for 100mbps full-duplex */
118
-#define ADVERTISE_100BASE4      0x0200  /* Try for 100mbps 4k packets  */
119
-#define ADVERTISE_RESV          0x1c00  /* Unused...                   */
120
-#define ADVERTISE_RFAULT        0x2000  /* Say we can detect faults    */
121
-#define ADVERTISE_LPACK         0x4000  /* Ack link partners response  */
122
-#define ADVERTISE_NPAGE         0x8000  /* Next page bit               */
123
-
124
-#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \
125
-			ADVERTISE_CSMA)
126
-#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
127
-                       ADVERTISE_100HALF | ADVERTISE_100FULL)
128
-
129 65
 /* for different PHY */
130 66
 enum phy_type_flags {
131 67
     MysonPHY = 1,

+ 1
- 0
src/drivers/net/r8169.c View File

@@ -41,6 +41,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
41 41
 #include <gpxe/netdevice.h>
42 42
 #include <gpxe/pci.h>
43 43
 #include <gpxe/timer.h>
44
+#include <mii.h>
44 45
 
45 46
 #include "r8169.h"
46 47
 

+ 0
- 81
src/drivers/net/r8169.h View File

@@ -54,90 +54,9 @@ FILE_LICENCE ( GPL2_OR_LATER );
54 54
 #define DUPLEX_HALF		0x00
55 55
 #define DUPLEX_FULL		0x01
56 56
 
57
-/* Generic MII registers. */
58
-
59
-#define MII_BMCR            0x00        /* Basic mode control register */
60
-#define MII_BMSR            0x01        /* Basic mode status register  */
61
-#define MII_PHYSID1         0x02        /* PHYS ID 1                   */
62
-#define MII_PHYSID2         0x03        /* PHYS ID 2                   */
63
-#define MII_ADVERTISE       0x04        /* Advertisement control reg   */
64
-#define MII_LPA             0x05        /* Link partner ability reg    */
65
-#define MII_EXPANSION       0x06        /* Expansion register          */
66
-#define MII_CTRL1000        0x09        /* 1000BASE-T control          */
67
-#define MII_STAT1000        0x0a        /* 1000BASE-T status           */
68
-#define MII_ESTATUS	    0x0f	/* Extended Status */
69
-#define MII_DCOUNTER        0x12        /* Disconnect counter          */
70
-#define MII_FCSCOUNTER      0x13        /* False carrier counter       */
71
-#define MII_NWAYTEST        0x14        /* N-way auto-neg test reg     */
72
-#define MII_RERRCOUNTER     0x15        /* Receive error counter       */
73
-#define MII_SREVISION       0x16        /* Silicon revision            */
74
-#define MII_RESV1           0x17        /* Reserved...                 */
75
-#define MII_LBRERROR        0x18        /* Lpback, rx, bypass error    */
76
-#define MII_PHYADDR         0x19        /* PHY address                 */
77
-#define MII_RESV2           0x1a        /* Reserved...                 */
78
-#define MII_TPISTATUS       0x1b        /* TPI status for 10mbps       */
79
-#define MII_NCONFIG         0x1c        /* Network interface config    */
80
-
81
-/* Basic mode control register. */
82
-#define BMCR_RESV               0x003f  /* Unused...                   */
83
-#define BMCR_SPEED1000		0x0040  /* MSB of Speed (1000)         */
84
-#define BMCR_CTST               0x0080  /* Collision test              */
85
-#define BMCR_FULLDPLX           0x0100  /* Full duplex                 */
86
-#define BMCR_ANRESTART          0x0200  /* Auto negotiation restart    */
87
-#define BMCR_ISOLATE            0x0400  /* Disconnect DP83840 from MII */
88
-#define BMCR_PDOWN              0x0800  /* Powerdown the DP83840       */
89
-#define BMCR_ANENABLE           0x1000  /* Enable auto negotiation     */
90
-#define BMCR_SPEED100           0x2000  /* Select 100Mbps              */
91
-#define BMCR_LOOPBACK           0x4000  /* TXD loopback bits           */
92
-#define BMCR_RESET              0x8000  /* Reset the DP83840           */
93
-
94
-/* Basic mode status register. */
95
-#define BMSR_ERCAP              0x0001  /* Ext-reg capability          */
96
-#define BMSR_JCD                0x0002  /* Jabber detected             */
97
-#define BMSR_LSTATUS            0x0004  /* Link status                 */
98
-#define BMSR_ANEGCAPABLE        0x0008  /* Able to do auto-negotiation */
99
-#define BMSR_RFAULT             0x0010  /* Remote fault detected       */
100
-#define BMSR_ANEGCOMPLETE       0x0020  /* Auto-negotiation complete   */
101
-#define BMSR_RESV               0x00c0  /* Unused...                   */
102
-#define BMSR_ESTATEN		0x0100	/* Extended Status in R15 */
103
-#define BMSR_100HALF2           0x0200  /* Can do 100BASE-T2 HDX */
104
-#define BMSR_100FULL2           0x0400  /* Can do 100BASE-T2 FDX */
105
-#define BMSR_10HALF             0x0800  /* Can do 10mbps, half-duplex  */
106
-#define BMSR_10FULL             0x1000  /* Can do 10mbps, full-duplex  */
107
-#define BMSR_100HALF            0x2000  /* Can do 100mbps, half-duplex */
108
-#define BMSR_100FULL            0x4000  /* Can do 100mbps, full-duplex */
109
-#define BMSR_100BASE4           0x8000  /* Can do 100mbps, 4k packets  */
110
-
111 57
 #define AUTONEG_DISABLE		0x00
112 58
 #define AUTONEG_ENABLE		0x01
113 59
 
114
-#define MII_ADVERTISE           0x04        /* Advertisement control reg   */
115
-#define ADVERTISE_SLCT          0x001f  /* Selector bits               */
116
-#define ADVERTISE_CSMA          0x0001  /* Only selector supported     */
117
-#define ADVERTISE_10HALF        0x0020  /* Try for 10mbps half-duplex  */
118
-#define ADVERTISE_1000XFULL     0x0020  /* Try for 1000BASE-X full-duplex */
119
-#define ADVERTISE_10FULL        0x0040  /* Try for 10mbps full-duplex  */
120
-#define ADVERTISE_1000XHALF     0x0040  /* Try for 1000BASE-X half-duplex */
121
-#define ADVERTISE_100HALF       0x0080  /* Try for 100mbps half-duplex */
122
-#define ADVERTISE_1000XPAUSE    0x0080  /* Try for 1000BASE-X pause    */
123
-#define ADVERTISE_100FULL       0x0100  /* Try for 100mbps full-duplex */
124
-#define ADVERTISE_1000XPSE_ASYM 0x0100  /* Try for 1000BASE-X asym pause */
125
-#define ADVERTISE_100BASE4      0x0200  /* Try for 100mbps 4k packets  */
126
-#define ADVERTISE_PAUSE_CAP     0x0400  /* Try for pause               */
127
-#define ADVERTISE_PAUSE_ASYM    0x0800  /* Try for asymetric pause     */
128
-#define ADVERTISE_RESV          0x1000  /* Unused...                   */
129
-#define ADVERTISE_RFAULT        0x2000  /* Say we can detect faults    */
130
-#define ADVERTISE_LPACK         0x4000  /* Ack link partners response  */
131
-#define ADVERTISE_NPAGE         0x8000  /* Next page bit               */
132
-#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \
133
-			ADVERTISE_CSMA)
134
-#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
135
-		       ADVERTISE_100HALF | ADVERTISE_100FULL)
136
-
137
-/* 1000BASE-T Control register */
138
-#define ADVERTISE_1000FULL      0x0200  /* Advertise 1000BASE-T full duplex */
139
-#define ADVERTISE_1000HALF      0x0100  /* Advertise 1000BASE-T half duplex */
140
-
141 60
 /* MAC address length */
142 61
 #define MAC_ADDR_LEN	6
143 62
 

+ 0
- 8
src/drivers/net/smc9000.h View File

@@ -231,14 +231,6 @@ typedef unsigned long int		dword;
231 231
 #define RS_MULTICAST	0x0001
232 232
 #define RS_ERRORS	(RS_ALGNERR | RS_BADCRC | RS_TOOLONG | RS_TOOSHORT)
233 233
 
234
-// Management Interface Register (MII)
235
-#define MII_REG         0x0008
236
-#define MII_MSK_CRS100  0x4000 // Disables CRS100 detection during tx half dup
237
-#define MII_MDOE        0x0008 // MII Output Enable
238
-#define MII_MCLK        0x0004 // MII Clock, pin MDCLK
239
-#define MII_MDI         0x0002 // MII Input, pin MDI
240
-#define MII_MDO         0x0001 // MII Output, pin MDO
241
-
242 234
 // PHY Register Addresses (LAN91C111 Internal PHY)
243 235
 
244 236
 // PHY Control Register

+ 1
- 0
src/drivers/net/tg3.c View File

@@ -20,6 +20,7 @@ FILE_LICENCE ( GPL2_ONLY );
20 20
 #include <gpxe/pci.h>
21 21
 #include <gpxe/ethernet.h>
22 22
 #include "string.h"
23
+#include <mii.h>
23 24
 #include "tg3.h"
24 25
 
25 26
 #define SUPPORT_COPPER_PHY  1

+ 0
- 107
src/drivers/net/tg3.h View File

@@ -77,100 +77,6 @@ typedef unsigned long dma_addr_t;
77 77
 #define WAKE_MAGIC		(1 << 5)
78 78
 #define WAKE_MAGICSECURE	(1 << 6) /* only meaningful if WAKE_MAGIC */
79 79
 
80
-/* Generic MII registers. */
81
-
82
-#define MII_BMCR            0x00        /* Basic mode control register */
83
-#define MII_BMSR            0x01        /* Basic mode status register  */
84
-#define MII_PHYSID1         0x02        /* PHYS ID 1                   */
85
-#define MII_PHYSID2         0x03        /* PHYS ID 2                   */
86
-#define MII_ADVERTISE       0x04        /* Advertisement control reg   */
87
-#define MII_LPA             0x05        /* Link partner ability reg    */
88
-#define MII_EXPANSION       0x06        /* Expansion register          */
89
-#define MII_DCOUNTER        0x12        /* Disconnect counter          */
90
-#define MII_FCSCOUNTER      0x13        /* False carrier counter       */
91
-#define MII_NWAYTEST        0x14        /* N-way auto-neg test reg     */
92
-#define MII_RERRCOUNTER     0x15        /* Receive error counter       */
93
-#define MII_SREVISION       0x16        /* Silicon revision            */
94
-#define MII_RESV1           0x17        /* Reserved...                 */
95
-#define MII_LBRERROR        0x18        /* Lpback, rx, bypass error    */
96
-#define MII_PHYADDR         0x19        /* PHY address                 */
97
-#define MII_RESV2           0x1a        /* Reserved...                 */
98
-#define MII_TPISTATUS       0x1b        /* TPI status for 10mbps       */
99
-#define MII_NCONFIG         0x1c        /* Network interface config    */
100
-
101
-/* Basic mode control register. */
102
-#define BMCR_RESV               0x007f  /* Unused...                   */
103
-#define BMCR_CTST               0x0080  /* Collision test              */
104
-#define BMCR_FULLDPLX           0x0100  /* Full duplex                 */
105
-#define BMCR_ANRESTART          0x0200  /* Auto negotiation restart    */
106
-#define BMCR_ISOLATE            0x0400  /* Disconnect DP83840 from MII */
107
-#define BMCR_PDOWN              0x0800  /* Powerdown the DP83840       */
108
-#define BMCR_ANENABLE           0x1000  /* Enable auto negotiation     */
109
-#define BMCR_SPEED100           0x2000  /* Select 100Mbps              */
110
-#define BMCR_LOOPBACK           0x4000  /* TXD loopback bits           */
111
-#define BMCR_RESET              0x8000  /* Reset the DP83840           */
112
-
113
-/* Basic mode status register. */
114
-#define BMSR_ERCAP              0x0001  /* Ext-reg capability          */
115
-#define BMSR_JCD                0x0002  /* Jabber detected             */
116
-#define BMSR_LSTATUS            0x0004  /* Link status                 */
117
-#define BMSR_ANEGCAPABLE        0x0008  /* Able to do auto-negotiation */
118
-#define BMSR_RFAULT             0x0010  /* Remote fault detected       */
119
-#define BMSR_ANEGCOMPLETE       0x0020  /* Auto-negotiation complete   */
120
-#define BMSR_RESV               0x07c0  /* Unused...                   */
121
-#define BMSR_10HALF             0x0800  /* Can do 10mbps, half-duplex  */
122
-#define BMSR_10FULL             0x1000  /* Can do 10mbps, full-duplex  */
123
-#define BMSR_100HALF            0x2000  /* Can do 100mbps, half-duplex */
124
-#define BMSR_100FULL            0x4000  /* Can do 100mbps, full-duplex */
125
-#define BMSR_100BASE4           0x8000  /* Can do 100mbps, 4k packets  */
126
-
127
-/* Advertisement control register. */
128
-#define ADVERTISE_SLCT          0x001f  /* Selector bits               */
129
-#define ADVERTISE_CSMA          0x0001  /* Only selector supported     */
130
-#define ADVERTISE_10HALF        0x0020  /* Try for 10mbps half-duplex  */
131
-#define ADVERTISE_10FULL        0x0040  /* Try for 10mbps full-duplex  */
132
-#define ADVERTISE_100HALF       0x0080  /* Try for 100mbps half-duplex */
133
-#define ADVERTISE_100FULL       0x0100  /* Try for 100mbps full-duplex */
134
-#define ADVERTISE_100BASE4      0x0200  /* Try for 100mbps 4k packets  */
135
-#define ADVERTISE_RESV          0x1c00  /* Unused...                   */
136
-#define ADVERTISE_RFAULT        0x2000  /* Say we can detect faults    */
137
-#define ADVERTISE_LPACK         0x4000  /* Ack link partners response  */
138
-#define ADVERTISE_NPAGE         0x8000  /* Next page bit               */
139
-
140
-#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \
141
-			ADVERTISE_CSMA)
142
-#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
143
-                       ADVERTISE_100HALF | ADVERTISE_100FULL)
144
-
145
-/* Link partner ability register. */
146
-#define LPA_SLCT                0x001f  /* Same as advertise selector  */
147
-#define LPA_10HALF              0x0020  /* Can do 10mbps half-duplex   */
148
-#define LPA_10FULL              0x0040  /* Can do 10mbps full-duplex   */
149
-#define LPA_100HALF             0x0080  /* Can do 100mbps half-duplex  */
150
-#define LPA_100FULL             0x0100  /* Can do 100mbps full-duplex  */
151
-#define LPA_100BASE4            0x0200  /* Can do 100mbps 4k packets   */
152
-#define LPA_RESV                0x1c00  /* Unused...                   */
153
-#define LPA_RFAULT              0x2000  /* Link partner faulted        */
154
-#define LPA_LPACK               0x4000  /* Link partner acked us       */
155
-#define LPA_NPAGE               0x8000  /* Next page bit               */
156
-
157
-#define LPA_DUPLEX		(LPA_10FULL | LPA_100FULL)
158
-#define LPA_100			(LPA_100FULL | LPA_100HALF | LPA_100BASE4)
159
-
160
-/* Expansion register for auto-negotiation. */
161
-#define EXPANSION_NWAY          0x0001  /* Can do N-way auto-nego      */
162
-#define EXPANSION_LCWP          0x0002  /* Got new RX page code word   */
163
-#define EXPANSION_ENABLENPAGE   0x0004  /* This enables npage words    */
164
-#define EXPANSION_NPCAPABLE     0x0008  /* Link partner supports npage */
165
-#define EXPANSION_MFAULTS       0x0010  /* Multiple faults detected    */
166
-#define EXPANSION_RESV          0xffe0  /* Unused...                   */
167
-
168
-/* N-way test register. */
169
-#define NWAYTEST_RESV1          0x00ff  /* Unused...                   */
170
-#define NWAYTEST_LOOPBACK       0x0100  /* Enable loopback for N-way   */
171
-#define NWAYTEST_RESV2          0xfe00  /* Unused...                   */
172
-
173
-
174 80
 /* From tg3.h */
175 81
 
176 82
 #define TG3_64BIT_REG_HIGH		0x00UL
@@ -1634,19 +1540,6 @@ typedef unsigned long dma_addr_t;
1634 1540
 #define MII_TG3_INT_DUPLEXCHG		0x0008
1635 1541
 #define MII_TG3_INT_ANEG_PAGE_RX	0x0400
1636 1542
 
1637
-/* XXX Add this to mii.h */
1638
-#ifndef ADVERTISE_PAUSE
1639
-#define ADVERTISE_PAUSE_CAP		0x0400
1640
-#endif
1641
-#ifndef ADVERTISE_PAUSE_ASYM
1642
-#define ADVERTISE_PAUSE_ASYM		0x0800
1643
-#endif
1644
-#ifndef LPA_PAUSE
1645
-#define LPA_PAUSE_CAP			0x0400
1646
-#endif
1647
-#ifndef LPA_PAUSE_ASYM
1648
-#define LPA_PAUSE_ASYM			0x0800
1649
-#endif
1650 1543
 
1651 1544
 /* There are two ways to manage the TX descriptors on the tigon3.
1652 1545
  * Either the descriptors are in host DMA'able memory, or they

+ 49
- 48
src/drivers/net/tlan.c View File

@@ -44,6 +44,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
44 44
 #include "nic.h"
45 45
 #include <gpxe/pci.h>
46 46
 #include <gpxe/ethernet.h>
47
+#include <mii.h>
47 48
 #include "tlan.h"
48 49
 
49 50
 #define drv_version "v1.4"
@@ -400,21 +401,21 @@ void TLan_FinishReset(struct nic *nic)
400 401
 	}
401 402
 	TLan_DioWrite8(BASE, TLAN_NET_MASK, data);
402 403
 	TLan_DioWrite16(BASE, TLAN_MAX_RX, ((1536) + 7) & ~7);
403
-	TLan_MiiReadReg(nic, phy, MII_GEN_ID_HI, &tlphy_id1);
404
-	TLan_MiiReadReg(nic, phy, MII_GEN_ID_LO, &tlphy_id2);
404
+	TLan_MiiReadReg(nic, phy, MII_PHYSID1, &tlphy_id1);
405
+	TLan_MiiReadReg(nic, phy, MII_PHYSID2, &tlphy_id2);
405 406
 
406 407
 	if ((tlan_pci_tbl[chip_idx].flags & TLAN_ADAPTER_UNMANAGED_PHY)
407 408
 	    || (priv->aui)) {
408
-		status = MII_GS_LINK;
409
+		status = BMSR_LSTATUS;
409 410
 		DBG ( "TLAN:  %s: Link forced.\n", priv->nic_name );
410 411
 	} else {
411
-		TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status);
412
+		TLan_MiiReadReg(nic, phy, MII_BMSR, &status);
412 413
 		udelay(1000);
413
-		TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status);
414
-		if ((status & MII_GS_LINK) &&	/* We only support link info on Nat.Sem. PHY's */
414
+		TLan_MiiReadReg(nic, phy, MII_BMSR, &status);
415
+		if ((status & BMSR_LSTATUS) &&	/* We only support link info on Nat.Sem. PHY's */
415 416
 		    (tlphy_id1 == NAT_SEM_ID1)
416 417
 		    && (tlphy_id2 == NAT_SEM_ID2)) {
417
-			TLan_MiiReadReg(nic, phy, MII_AN_LPA, &partner);
418
+			TLan_MiiReadReg(nic, phy, MII_LPA, &partner);
418 419
 			TLan_MiiReadReg(nic, phy, TLAN_TLPHY_PAR,
419 420
 					&tlphy_par);
420 421
 
@@ -450,7 +451,7 @@ void TLan_FinishReset(struct nic *nic)
450 451
 			mdelay(10000);
451 452
 			TLan_PhyMonitor(nic);
452 453
 #endif
453
-		} else if (status & MII_GS_LINK) {
454
+		} else if (status & BMSR_LSTATUS) {
454 455
 			DBG ( "TLAN: %s: Link active\n", priv->nic_name );
455 456
 			TLan_DioWrite8(BASE, TLAN_LED_REG, TLAN_LED_LINK);
456 457
 		}
@@ -465,7 +466,7 @@ void TLan_FinishReset(struct nic *nic)
465 466
 		TLan_DioWrite8(BASE, TLAN_NET_SIO, sio);
466 467
 	}
467 468
 
468
-	if (status & MII_GS_LINK) {
469
+	if (status & BMSR_LSTATUS) {
469 470
 		TLan_SetMac(nic, 0, nic->node_addr);
470 471
 		priv->phyOnline = 1;
471 472
 		outb((TLAN_HC_INT_ON >> 8), BASE + TLAN_HOST_CMD + 1);
@@ -1346,7 +1347,7 @@ void TLan_PhyDetect(struct nic *nic)
1346 1347
 		return;
1347 1348
 	}
1348 1349
 
1349
-	TLan_MiiReadReg(nic, TLAN_PHY_MAX_ADDR, MII_GEN_ID_HI, &hi);
1350
+	TLan_MiiReadReg(nic, TLAN_PHY_MAX_ADDR, MII_PHYSID1, &hi);
1350 1351
 
1351 1352
 	if (hi != 0xFFFF) {
1352 1353
 		priv->phy[0] = TLAN_PHY_MAX_ADDR;
@@ -1356,9 +1357,9 @@ void TLan_PhyDetect(struct nic *nic)
1356 1357
 
1357 1358
 	priv->phy[1] = TLAN_PHY_NONE;
1358 1359
 	for (phy = 0; phy <= TLAN_PHY_MAX_ADDR; phy++) {
1359
-		TLan_MiiReadReg(nic, phy, MII_GEN_CTL, &control);
1360
-		TLan_MiiReadReg(nic, phy, MII_GEN_ID_HI, &hi);
1361
-		TLan_MiiReadReg(nic, phy, MII_GEN_ID_LO, &lo);
1360
+		TLan_MiiReadReg(nic, phy, MII_BMCR, &control);
1361
+		TLan_MiiReadReg(nic, phy, MII_PHYSID1, &hi);
1362
+		TLan_MiiReadReg(nic, phy, MII_PHYSID2, &lo);
1362 1363
 		if ((control != 0xFFFF) || (hi != 0xFFFF)
1363 1364
 		    || (lo != 0xFFFF)) {
1364 1365
 			printf("PHY found at %hX %hX %hX %hX\n", 
@@ -1386,15 +1387,15 @@ void TLan_PhyPowerDown(struct nic *nic)
1386 1387
 
1387 1388
 	u16 value;
1388 1389
 	DBG ( "%s: Powering down PHY(s).\n", priv->nic_name );
1389
-	value = MII_GC_PDOWN | MII_GC_LOOPBK | MII_GC_ISOLATE;
1390
+	value = BMCR_PDOWN | BMCR_LOOPBACK | BMCR_ISOLATE;
1390 1391
 	TLan_MiiSync(BASE);
1391
-	TLan_MiiWriteReg(nic, priv->phy[priv->phyNum], MII_GEN_CTL, value);
1392
+	TLan_MiiWriteReg(nic, priv->phy[priv->phyNum], MII_BMCR, value);
1392 1393
 	if ((priv->phyNum == 0) && (priv->phy[1] != TLAN_PHY_NONE)
1393 1394
 	    &&
1394 1395
 	    (!(tlan_pci_tbl[chip_idx].
1395 1396
 	       flags & TLAN_ADAPTER_USE_INTERN_10))) {
1396 1397
 		TLan_MiiSync(BASE);
1397
-		TLan_MiiWriteReg(nic, priv->phy[1], MII_GEN_CTL, value);
1398
+		TLan_MiiWriteReg(nic, priv->phy[1], MII_BMCR, value);
1398 1399
 	}
1399 1400
 
1400 1401
 	/* Wait for 50 ms and powerup
@@ -1414,8 +1415,8 @@ void TLan_PhyPowerUp(struct nic *nic)
1414 1415
 
1415 1416
 	DBG ( "%s: Powering up PHY.\n", priv->nic_name );
1416 1417
 	TLan_MiiSync(BASE);
1417
-	value = MII_GC_LOOPBK;
1418
-	TLan_MiiWriteReg(nic, priv->phy[priv->phyNum], MII_GEN_CTL, value);
1418
+	value = BMCR_LOOPBACK;
1419
+	TLan_MiiWriteReg(nic, priv->phy[priv->phyNum], MII_BMCR, value);
1419 1420
 	TLan_MiiSync(BASE);
1420 1421
 	/* Wait for 500 ms and reset the
1421 1422
 	 * tranceiver.  The TLAN docs say both 50 ms and
@@ -1436,11 +1437,11 @@ void TLan_PhyReset(struct nic *nic)
1436 1437
 
1437 1438
 	DBG ( "%s: Reseting PHY.\n", priv->nic_name );
1438 1439
 	TLan_MiiSync(BASE);
1439
-	value = MII_GC_LOOPBK | MII_GC_RESET;
1440
-	TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, value);
1441
-	TLan_MiiReadReg(nic, phy, MII_GEN_CTL, &value);
1442
-	while (value & MII_GC_RESET) {
1443
-		TLan_MiiReadReg(nic, phy, MII_GEN_CTL, &value);
1440
+	value = BMCR_LOOPBACK | BMCR_RESET;
1441
+	TLan_MiiWriteReg(nic, phy, MII_BMCR, value);
1442
+	TLan_MiiReadReg(nic, phy, MII_BMCR, &value);
1443
+	while (value & BMCR_RESET) {
1444
+		TLan_MiiReadReg(nic, phy, MII_BMCR, &value);
1444 1445
 	}
1445 1446
 
1446 1447
 	/* Wait for 500 ms and initialize.
@@ -1466,34 +1467,34 @@ void TLan_PhyStartLink(struct nic *nic)
1466 1467
 
1467 1468
 	phy = priv->phy[priv->phyNum];
1468 1469
 	DBG ( "%s: Trying to activate link.\n", priv->nic_name );
1469
-	TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status);
1470
-	TLan_MiiReadReg(nic, phy, MII_GEN_STS, &ability);
1470
+	TLan_MiiReadReg(nic, phy, MII_BMSR, &status);
1471
+	TLan_MiiReadReg(nic, phy, MII_BMSR, &ability);
1471 1472
 
1472
-	if ((status & MII_GS_AUTONEG) && (!priv->aui)) {
1473
+	if ((status & BMSR_ANEGCAPABLE) && (!priv->aui)) {
1473 1474
 		ability = status >> 11;
1474 1475
 		if (priv->speed == TLAN_SPEED_10 &&
1475 1476
 		    priv->duplex == TLAN_DUPLEX_HALF) {
1476
-			TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x0000);
1477
+			TLan_MiiWriteReg(nic, phy, MII_BMCR, 0x0000);
1477 1478
 		} else if (priv->speed == TLAN_SPEED_10 &&
1478 1479
 			   priv->duplex == TLAN_DUPLEX_FULL) {
1479 1480
 			priv->tlanFullDuplex = TRUE;
1480
-			TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x0100);
1481
+			TLan_MiiWriteReg(nic, phy, MII_BMCR, 0x0100);
1481 1482
 		} else if (priv->speed == TLAN_SPEED_100 &&
1482 1483
 			   priv->duplex == TLAN_DUPLEX_HALF) {
1483
-			TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x2000);
1484
+			TLan_MiiWriteReg(nic, phy, MII_BMCR, 0x2000);
1484 1485
 		} else if (priv->speed == TLAN_SPEED_100 &&
1485 1486
 			   priv->duplex == TLAN_DUPLEX_FULL) {
1486 1487
 			priv->tlanFullDuplex = TRUE;
1487
-			TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x2100);
1488
+			TLan_MiiWriteReg(nic, phy, MII_BMCR, 0x2100);
1488 1489
 		} else {
1489 1490
 
1490 1491
 			/* Set Auto-Neg advertisement */
1491
-			TLan_MiiWriteReg(nic, phy, MII_AN_ADV,
1492
+			TLan_MiiWriteReg(nic, phy, MII_ADVERTISE,
1492 1493
 					 (ability << 5) | 1);
1493 1494
 			/* Enablee Auto-Neg */
1494
-			TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x1000);
1495
+			TLan_MiiWriteReg(nic, phy, MII_BMCR, 0x1000);
1495 1496
 			/* Restart Auto-Neg */
1496
-			TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, 0x1200);
1497
+			TLan_MiiWriteReg(nic, phy, MII_BMCR, 0x1200);
1497 1498
 			/* Wait for 4 sec for autonegotiation
1498 1499
 			 * to complete.  The max spec time is less than this
1499 1500
 			 * but the card need additional time to start AN.
@@ -1527,14 +1528,14 @@ void TLan_PhyStartLink(struct nic *nic)
1527 1528
 		} else {
1528 1529
 			tctl &= ~TLAN_TC_AUISEL;
1529 1530
 			if (priv->duplex == TLAN_DUPLEX_FULL) {
1530
-				control |= MII_GC_DUPLEX;
1531
+				control |= BMCR_FULLDPLX;
1531 1532
 				priv->tlanFullDuplex = TRUE;
1532 1533
 			}
1533 1534
 			if (priv->speed == TLAN_SPEED_100) {
1534
-				control |= MII_GC_SPEEDSEL;
1535
+				control |= BMCR_SPEED100;
1535 1536
 			}
1536 1537
 		}
1537
-		TLan_MiiWriteReg(nic, phy, MII_GEN_CTL, control);
1538
+		TLan_MiiWriteReg(nic, phy, MII_BMCR, control);
1538 1539
 		TLan_MiiWriteReg(nic, phy, TLAN_TLPHY_CTL, tctl);
1539 1540
 	}
1540 1541
 
@@ -1559,11 +1560,11 @@ void TLan_PhyFinishAutoNeg(struct nic *nic)
1559 1560
 
1560 1561
 	phy = priv->phy[priv->phyNum];
1561 1562
 
1562
-	TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status);
1563
+	TLan_MiiReadReg(nic, phy, MII_BMSR, &status);
1563 1564
 	udelay(1000);
1564
-	TLan_MiiReadReg(nic, phy, MII_GEN_STS, &status);
1565
+	TLan_MiiReadReg(nic, phy, MII_BMSR, &status);
1565 1566
 
1566
-	if (!(status & MII_GS_AUTOCMPLT)) {
1567
+	if (!(status & BMSR_ANEGCOMPLETE)) {
1567 1568
 		/* Wait for 8 sec to give the process
1568 1569
 		 * more time.  Perhaps we should fail after a while.
1569 1570
 		 */
@@ -1584,8 +1585,8 @@ void TLan_PhyFinishAutoNeg(struct nic *nic)
1584 1585
 	}
1585 1586
 
1586 1587
 	DBG ( "TLAN: %s: Autonegotiation complete.\n", priv->nic_name );
1587
-	TLan_MiiReadReg(nic, phy, MII_AN_ADV, &an_adv);
1588
-	TLan_MiiReadReg(nic, phy, MII_AN_LPA, &an_lpa);
1588
+	TLan_MiiReadReg(nic, phy, MII_ADVERTISE, &an_adv);
1589
+	TLan_MiiReadReg(nic, phy, MII_LPA, &an_lpa);
1589 1590
 	mode = an_adv & an_lpa & 0x03E0;
1590 1591
 	if (mode & 0x0100) {
1591 1592
 		printf("Full Duplex\n");
@@ -1612,13 +1613,13 @@ void TLan_PhyFinishAutoNeg(struct nic *nic)
1612 1613
 	if (priv->phyNum == 0) {
1613 1614
 		if ((priv->duplex == TLAN_DUPLEX_FULL)
1614 1615
 		    || (an_adv & an_lpa & 0x0040)) {
1615
-			TLan_MiiWriteReg(nic, phy, MII_GEN_CTL,
1616
-					 MII_GC_AUTOENB | MII_GC_DUPLEX);
1616
+			TLan_MiiWriteReg(nic, phy, MII_BMCR,
1617
+					 BMCR_ANENABLE | BMCR_FULLDPLX);
1617 1618
 			DBG 
1618 1619
 			    ( "TLAN:  Starting internal PHY with FULL-DUPLEX\n" );
1619 1620
 		} else {
1620
-			TLan_MiiWriteReg(nic, phy, MII_GEN_CTL,
1621
-					 MII_GC_AUTOENB);
1621
+			TLan_MiiWriteReg(nic, phy, MII_BMCR,
1622
+					 BMCR_ANENABLE);
1622 1623
 			DBG 
1623 1624
 			    ( "TLAN:  Starting internal PHY with HALF-DUPLEX\n" );
1624 1625
 		}
@@ -1661,10 +1662,10 @@ void TLan_PhyMonitor(struct net_device *dev)
1661 1662
 	phy = priv->phy[priv->phyNum];
1662 1663
 
1663 1664
 	/* Get PHY status register */
1664
-	TLan_MiiReadReg(nic, phy, MII_GEN_STS, &phy_status);
1665
+	TLan_MiiReadReg(nic, phy, MII_BMSR, &phy_status);
1665 1666
 
1666 1667
 	/* Check if link has been lost */
1667
-	if (!(phy_status & MII_GS_LINK)) {
1668
+	if (!(phy_status & BMSR_LSTATUS)) {
1668 1669
 		if (priv->link) {
1669 1670
 			priv->link = 0;
1670 1671
 			printf("TLAN: %s has lost link\n", priv->nic_name);
@@ -1677,7 +1678,7 @@ void TLan_PhyMonitor(struct net_device *dev)
1677 1678
 	}
1678 1679
 
1679 1680
 	/* Link restablished? */
1680
-	if ((phy_status & MII_GS_LINK) && !priv->link) {
1681
+	if ((phy_status & BMSR_LSTATUS) && !priv->link) {
1681 1682
 		priv->link = 1;
1682 1683
 		printf("TLAN: %s has reestablished link\n",
1683 1684
 		       priv->nic_name);

+ 0
- 35
src/drivers/net/tlan.h View File

@@ -313,41 +313,6 @@ typedef struct tlan_adapter_entry {
313 313
 
314 314
 /* ThunderLAN MII Registers */
315 315
 
316
-/* Generic MII/PHY Registers */
317
-
318
-#define MII_GEN_CTL			0x00
319
-#define 	MII_GC_RESET		0x8000
320
-#define		MII_GC_LOOPBK		0x4000
321
-#define		MII_GC_SPEEDSEL		0x2000
322
-#define		MII_GC_AUTOENB		0x1000
323
-#define		MII_GC_PDOWN		0x0800
324
-#define		MII_GC_ISOLATE		0x0400
325
-#define		MII_GC_AUTORSRT		0x0200
326
-#define		MII_GC_DUPLEX		0x0100
327
-#define		MII_GC_COLTEST		0x0080
328
-#define		MII_GC_RESERVED		0x007F
329
-#define MII_GEN_STS			0x01
330
-#define		MII_GS_100BT4		0x8000
331
-#define		MII_GS_100BTXFD		0x4000
332
-#define		MII_GS_100BTXHD		0x2000
333
-#define		MII_GS_10BTFD		0x1000
334
-#define		MII_GS_10BTHD		0x0800
335
-#define		MII_GS_RESERVED		0x07C0
336
-#define		MII_GS_AUTOCMPLT	0x0020
337
-#define		MII_GS_RFLT		0x0010
338
-#define		MII_GS_AUTONEG		0x0008
339
-#define		MII_GS_LINK		0x0004
340
-#define		MII_GS_JABBER		0x0002
341
-#define		MII_GS_EXTCAP		0x0001
342
-#define MII_GEN_ID_HI			0x02
343
-#define MII_GEN_ID_LO			0x03
344
-#define 	MII_GIL_OUI		0xFC00
345
-#define 	MII_GIL_MODEL		0x03F0
346
-#define 	MII_GIL_REVISION	0x000F
347
-#define MII_AN_ADV			0x04
348
-#define MII_AN_LPA			0x05
349
-#define MII_AN_EXP			0x06
350
-
351 316
 /* ThunderLAN Specific MII/PHY Registers */
352 317
 
353 318
 #define TLAN_TLPHY_ID			0x10

+ 36
- 4
src/include/mii.h View File

@@ -24,6 +24,9 @@ FILE_LICENCE ( GPL2_ONLY );
24 24
 #define MII_ADVERTISE       0x04	/* Advertisement control reg   */
25 25
 #define MII_LPA             0x05	/* Link partner ability reg    */
26 26
 #define MII_EXPANSION       0x06        /* Expansion register          */
27
+#define MII_CTRL1000        0x09        /* 1000BASE-T control          */
28
+#define MII_STAT1000        0x0a        /* 1000BASE-T status           */
29
+#define MII_ESTATUS         0x0f        /* Extended Status */
27 30
 #define MII_DCOUNTER        0x12        /* Disconnect counter          */
28 31
 #define MII_FCSCOUNTER      0x13        /* False carrier counter       */
29 32
 #define MII_NWAYTEST        0x14        /* N-way auto-neg test reg     */
@@ -37,7 +40,8 @@ FILE_LICENCE ( GPL2_ONLY );
37 40
 #define MII_NCONFIG         0x1c        /* Network interface config    */
38 41
 
39 42
 /* Basic mode control register. */
40
-#define BMCR_RESV               0x007f  /* Unused...                   */
43
+#define BMCR_RESV               0x003f  /* Unused...                   */
44
+#define BMCR_SPEED1000          0x0040  /* MSB of Speed (1000)         */
41 45
 #define BMCR_CTST               0x0080  /* Collision test              */
42 46
 #define BMCR_FULLDPLX           0x0100	/* Full duplex                 */
43 47
 #define BMCR_ANRESTART          0x0200	/* Auto negotiation restart    */
@@ -55,7 +59,10 @@ FILE_LICENCE ( GPL2_ONLY );
55 59
 #define BMSR_ANEGCAPABLE        0x0008  /* Able to do auto-negotiation */
56 60
 #define BMSR_RFAULT             0x0010  /* Remote fault detected       */
57 61
 #define BMSR_ANEGCOMPLETE       0x0020  /* Auto-negotiation complete   */
58
-#define BMSR_RESV               0x07c0  /* Unused...                   */
62
+#define BMSR_RESV               0x00c0  /* Unused...                   */
63
+#define BMSR_ESTATEN            0x0100  /* Extended Status in R15 */
64
+#define BMSR_100HALF2           0x0200  /* Can do 100BASE-T2 HDX */
65
+#define BMSR_100FULL2           0x0400  /* Can do 100BASE-T2 FDX */
59 66
 #define BMSR_10HALF             0x0800  /* Can do 10mbps, half-duplex  */
60 67
 #define BMSR_10FULL             0x1000  /* Can do 10mbps, full-duplex  */
61 68
 #define BMSR_100HALF            0x2000  /* Can do 100mbps, half-duplex */
@@ -66,11 +73,17 @@ FILE_LICENCE ( GPL2_ONLY );
66 73
 #define ADVERTISE_SLCT          0x001f  /* Selector bits               */
67 74
 #define ADVERTISE_CSMA          0x0001  /* Only selector supported     */
68 75
 #define ADVERTISE_10HALF        0x0020	/* Try for 10mbps half-duplex  */
76
+#define ADVERTISE_1000XFULL     0x0020  /* Try for 1000BASE-X full-duplex */
69 77
 #define ADVERTISE_10FULL        0x0040	/* Try for 10mbps full-duplex  */
78
+#define ADVERTISE_1000XHALF     0x0040  /* Try for 1000BASE-X half-duplex */
70 79
 #define ADVERTISE_100HALF       0x0080	/* Try for 100mbps half-duplex */
80
+#define ADVERTISE_1000XPAUSE    0x0080  /* Try for 1000BASE-X pause    */
71 81
 #define ADVERTISE_100FULL       0x0100	/* Try for 100mbps full-duplex */
82
+#define ADVERTISE_1000XPSE_ASYM 0x0100  /* Try for 1000BASE-X asym pause */
72 83
 #define ADVERTISE_100BASE4      0x0200  /* Try for 100mbps 4k packets  */
73
-#define ADVERTISE_RESV          0x1c00  /* Unused...                   */
84
+#define ADVERTISE_PAUSE_CAP     0x0400  /* Try for pause               */
85
+#define ADVERTISE_PAUSE_ASYM    0x0800  /* Try for asymetric pause     */
86
+#define ADVERTISE_RESV          0x1000  /* Unused...                   */
74 87
 #define ADVERTISE_RFAULT        0x2000  /* Say we can detect faults    */
75 88
 #define ADVERTISE_LPACK         0x4000  /* Ack link partners response  */
76 89
 #define ADVERTISE_NPAGE         0x8000  /* Next page bit               */
@@ -83,11 +96,17 @@ FILE_LICENCE ( GPL2_ONLY );
83 96
 /* Link partner ability register. */
84 97
 #define LPA_SLCT                0x001f  /* Same as advertise selector  */
85 98
 #define LPA_10HALF              0x0020  /* Can do 10mbps half-duplex   */
99
+#define LPA_1000XFULL           0x0020  /* Can do 1000BASE-X full-duplex */
86 100
 #define LPA_10FULL              0x0040  /* Can do 10mbps full-duplex   */
101
+#define LPA_1000XHALF           0x0040  /* Can do 1000BASE-X half-duplex */
87 102
 #define LPA_100HALF             0x0080  /* Can do 100mbps half-duplex  */
103
+#define LPA_1000XPAUSE          0x0080  /* Can do 1000BASE-X pause     */
88 104
 #define LPA_100FULL             0x0100  /* Can do 100mbps full-duplex  */
105
+#define LPA_1000XPAUSE_ASYM     0x0100  /* Can do 1000BASE-X pause asym*/
89 106
 #define LPA_100BASE4            0x0200  /* Can do 100mbps 4k packets   */
90
-#define LPA_RESV                0x1c00  /* Unused...                   */
107
+#define LPA_PAUSE_CAP           0x0400  /* Can pause                   */
108
+#define LPA_PAUSE_ASYM          0x0800  /* Can pause asymetrically     */
109
+#define LPA_RESV                0x1000  /* Unused...                   */
91 110
 #define LPA_RFAULT              0x2000  /* Link partner faulted        */
92 111
 #define LPA_LPACK               0x4000  /* Link partner acked us       */
93 112
 #define LPA_NPAGE               0x8000  /* Next page bit               */
@@ -103,11 +122,24 @@ FILE_LICENCE ( GPL2_ONLY );
103 122
 #define EXPANSION_MFAULTS       0x0010  /* Multiple faults detected    */
104 123
 #define EXPANSION_RESV          0xffe0  /* Unused...                   */
105 124
 
125
+#define ESTATUS_1000_TFULL      0x2000  /* Can do 1000BT Full */
126
+#define ESTATUS_1000_THALF      0x1000  /* Can do 1000BT Half */
127
+
106 128
 /* N-way test register. */
107 129
 #define NWAYTEST_RESV1          0x00ff  /* Unused...                   */
108 130
 #define NWAYTEST_LOOPBACK       0x0100  /* Enable loopback for N-way   */
109 131
 #define NWAYTEST_RESV2          0xfe00  /* Unused...                   */
110 132
 
133
+/* 1000BASE-T Control register */
134
+#define ADVERTISE_1000FULL      0x0200  /* Advertise 1000BASE-T full duplex */
135
+#define ADVERTISE_1000HALF      0x0100  /* Advertise 1000BASE-T half duplex */
136
+
137
+/* 1000BASE-T Status register */
138
+#define LPA_1000LOCALRXOK       0x2000  /* Link partner local receiver status */
139
+#define LPA_1000REMRXOK         0x1000  /* Link partner remote receiver status */
140
+#define LPA_1000FULL            0x0800  /* Link partner 1000BASE-T full duplex */
141
+#define LPA_1000HALF            0x0400  /* Link partner 1000BASE-T half duplex */
142
+
111 143
 #include <gpxe/netdevice.h>
112 144
 
113 145
 struct mii_if_info {

Loading…
Cancel
Save