aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e/ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e1000e/ethtool.c')
-rw-r--r--drivers/net/e1000e/ethtool.c64
1 files changed, 33 insertions, 31 deletions
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 3b94a87b5272..4ae00567bba6 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -111,7 +111,7 @@ static int e1000_get_settings(struct net_device *netdev,
111 struct e1000_hw *hw = &adapter->hw; 111 struct e1000_hw *hw = &adapter->hw;
112 u32 status; 112 u32 status;
113 113
114 if (hw->media_type == e1000_media_type_copper) { 114 if (hw->phy.media_type == e1000_media_type_copper) {
115 115
116 ecmd->supported = (SUPPORTED_10baseT_Half | 116 ecmd->supported = (SUPPORTED_10baseT_Half |
117 SUPPORTED_10baseT_Full | 117 SUPPORTED_10baseT_Full |
@@ -165,7 +165,7 @@ static int e1000_get_settings(struct net_device *netdev,
165 ecmd->duplex = -1; 165 ecmd->duplex = -1;
166 } 166 }
167 167
168 ecmd->autoneg = ((hw->media_type == e1000_media_type_fiber) || 168 ecmd->autoneg = ((hw->phy.media_type == e1000_media_type_fiber) ||
169 hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE; 169 hw->mac.autoneg) ? AUTONEG_ENABLE : AUTONEG_DISABLE;
170 return 0; 170 return 0;
171} 171}
@@ -187,7 +187,7 @@ static int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
187 mac->autoneg = 0; 187 mac->autoneg = 0;
188 188
189 /* Fiber NICs only allow 1000 gbps Full duplex */ 189 /* Fiber NICs only allow 1000 gbps Full duplex */
190 if ((adapter->hw.media_type == e1000_media_type_fiber) && 190 if ((adapter->hw.phy.media_type == e1000_media_type_fiber) &&
191 spddplx != (SPEED_1000 + DUPLEX_FULL)) { 191 spddplx != (SPEED_1000 + DUPLEX_FULL)) {
192 ndev_err(adapter->netdev, "Unsupported Speed/Duplex " 192 ndev_err(adapter->netdev, "Unsupported Speed/Duplex "
193 "configuration\n"); 193 "configuration\n");
@@ -241,7 +241,7 @@ static int e1000_set_settings(struct net_device *netdev,
241 241
242 if (ecmd->autoneg == AUTONEG_ENABLE) { 242 if (ecmd->autoneg == AUTONEG_ENABLE) {
243 hw->mac.autoneg = 1; 243 hw->mac.autoneg = 1;
244 if (hw->media_type == e1000_media_type_fiber) 244 if (hw->phy.media_type == e1000_media_type_fiber)
245 hw->phy.autoneg_advertised = ADVERTISED_1000baseT_Full | 245 hw->phy.autoneg_advertised = ADVERTISED_1000baseT_Full |
246 ADVERTISED_FIBRE | 246 ADVERTISED_FIBRE |
247 ADVERTISED_Autoneg; 247 ADVERTISED_Autoneg;
@@ -250,6 +250,8 @@ static int e1000_set_settings(struct net_device *netdev,
250 ADVERTISED_TP | 250 ADVERTISED_TP |
251 ADVERTISED_Autoneg; 251 ADVERTISED_Autoneg;
252 ecmd->advertising = hw->phy.autoneg_advertised; 252 ecmd->advertising = hw->phy.autoneg_advertised;
253 if (adapter->fc_autoneg)
254 hw->fc.original_type = e1000_fc_default;
253 } else { 255 } else {
254 if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) { 256 if (e1000_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)) {
255 clear_bit(__E1000_RESETTING, &adapter->state); 257 clear_bit(__E1000_RESETTING, &adapter->state);
@@ -279,11 +281,11 @@ static void e1000_get_pauseparam(struct net_device *netdev,
279 pause->autoneg = 281 pause->autoneg =
280 (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE); 282 (adapter->fc_autoneg ? AUTONEG_ENABLE : AUTONEG_DISABLE);
281 283
282 if (hw->mac.fc == e1000_fc_rx_pause) { 284 if (hw->fc.type == e1000_fc_rx_pause) {
283 pause->rx_pause = 1; 285 pause->rx_pause = 1;
284 } else if (hw->mac.fc == e1000_fc_tx_pause) { 286 } else if (hw->fc.type == e1000_fc_tx_pause) {
285 pause->tx_pause = 1; 287 pause->tx_pause = 1;
286 } else if (hw->mac.fc == e1000_fc_full) { 288 } else if (hw->fc.type == e1000_fc_full) {
287 pause->rx_pause = 1; 289 pause->rx_pause = 1;
288 pause->tx_pause = 1; 290 pause->tx_pause = 1;
289 } 291 }
@@ -302,18 +304,18 @@ static int e1000_set_pauseparam(struct net_device *netdev,
302 msleep(1); 304 msleep(1);
303 305
304 if (pause->rx_pause && pause->tx_pause) 306 if (pause->rx_pause && pause->tx_pause)
305 hw->mac.fc = e1000_fc_full; 307 hw->fc.type = e1000_fc_full;
306 else if (pause->rx_pause && !pause->tx_pause) 308 else if (pause->rx_pause && !pause->tx_pause)
307 hw->mac.fc = e1000_fc_rx_pause; 309 hw->fc.type = e1000_fc_rx_pause;
308 else if (!pause->rx_pause && pause->tx_pause) 310 else if (!pause->rx_pause && pause->tx_pause)
309 hw->mac.fc = e1000_fc_tx_pause; 311 hw->fc.type = e1000_fc_tx_pause;
310 else if (!pause->rx_pause && !pause->tx_pause) 312 else if (!pause->rx_pause && !pause->tx_pause)
311 hw->mac.fc = e1000_fc_none; 313 hw->fc.type = e1000_fc_none;
312 314
313 hw->mac.original_fc = hw->mac.fc; 315 hw->fc.original_type = hw->fc.type;
314 316
315 if (adapter->fc_autoneg == AUTONEG_ENABLE) { 317 if (adapter->fc_autoneg == AUTONEG_ENABLE) {
316 hw->mac.fc = e1000_fc_default; 318 hw->fc.type = e1000_fc_default;
317 if (netif_running(adapter->netdev)) { 319 if (netif_running(adapter->netdev)) {
318 e1000e_down(adapter); 320 e1000e_down(adapter);
319 e1000e_up(adapter); 321 e1000e_up(adapter);
@@ -321,7 +323,7 @@ static int e1000_set_pauseparam(struct net_device *netdev,
321 e1000e_reset(adapter); 323 e1000e_reset(adapter);
322 } 324 }
323 } else { 325 } else {
324 retval = ((hw->media_type == e1000_media_type_fiber) ? 326 retval = ((hw->phy.media_type == e1000_media_type_fiber) ?
325 hw->mac.ops.setup_link(hw) : e1000e_force_mac_fc(hw)); 327 hw->mac.ops.setup_link(hw) : e1000e_force_mac_fc(hw));
326 } 328 }
327 329
@@ -1187,21 +1189,21 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1187 u32 ctrl_reg = 0; 1189 u32 ctrl_reg = 0;
1188 u32 stat_reg = 0; 1190 u32 stat_reg = 0;
1189 1191
1190 adapter->hw.mac.autoneg = 0; 1192 hw->mac.autoneg = 0;
1191 1193
1192 if (adapter->hw.phy.type == e1000_phy_m88) { 1194 if (hw->phy.type == e1000_phy_m88) {
1193 /* Auto-MDI/MDIX Off */ 1195 /* Auto-MDI/MDIX Off */
1194 e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, 0x0808); 1196 e1e_wphy(hw, M88E1000_PHY_SPEC_CTRL, 0x0808);
1195 /* reset to update Auto-MDI/MDIX */ 1197 /* reset to update Auto-MDI/MDIX */
1196 e1e_wphy(hw, PHY_CONTROL, 0x9140); 1198 e1e_wphy(hw, PHY_CONTROL, 0x9140);
1197 /* autoneg off */ 1199 /* autoneg off */
1198 e1e_wphy(hw, PHY_CONTROL, 0x8140); 1200 e1e_wphy(hw, PHY_CONTROL, 0x8140);
1199 } else if (adapter->hw.phy.type == e1000_phy_gg82563) 1201 } else if (hw->phy.type == e1000_phy_gg82563)
1200 e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 0x1CC); 1202 e1e_wphy(hw, GG82563_PHY_KMRN_MODE_CTRL, 0x1CC);
1201 1203
1202 ctrl_reg = er32(CTRL); 1204 ctrl_reg = er32(CTRL);
1203 1205
1204 if (adapter->hw.phy.type == e1000_phy_ife) { 1206 if (hw->phy.type == e1000_phy_ife) {
1205 /* force 100, set loopback */ 1207 /* force 100, set loopback */
1206 e1e_wphy(hw, PHY_CONTROL, 0x6100); 1208 e1e_wphy(hw, PHY_CONTROL, 0x6100);
1207 1209
@@ -1224,8 +1226,8 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1224 E1000_CTRL_FD); /* Force Duplex to FULL */ 1226 E1000_CTRL_FD); /* Force Duplex to FULL */
1225 } 1227 }
1226 1228
1227 if (adapter->hw.media_type == e1000_media_type_copper && 1229 if (hw->phy.media_type == e1000_media_type_copper &&
1228 adapter->hw.phy.type == e1000_phy_m88) { 1230 hw->phy.type == e1000_phy_m88) {
1229 ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ 1231 ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */
1230 } else { 1232 } else {
1231 /* 1233 /*
@@ -1243,7 +1245,7 @@ static int e1000_integrated_phy_loopback(struct e1000_adapter *adapter)
1243 * Disable the receiver on the PHY so when a cable is plugged in, the 1245 * Disable the receiver on the PHY so when a cable is plugged in, the
1244 * PHY does not begin to autoneg when a cable is reconnected to the NIC. 1246 * PHY does not begin to autoneg when a cable is reconnected to the NIC.
1245 */ 1247 */
1246 if (adapter->hw.phy.type == e1000_phy_m88) 1248 if (hw->phy.type == e1000_phy_m88)
1247 e1000_phy_disable_receiver(adapter); 1249 e1000_phy_disable_receiver(adapter);
1248 1250
1249 udelay(500); 1251 udelay(500);
@@ -1333,8 +1335,8 @@ static int e1000_setup_loopback_test(struct e1000_adapter *adapter)
1333 struct e1000_hw *hw = &adapter->hw; 1335 struct e1000_hw *hw = &adapter->hw;
1334 u32 rctl; 1336 u32 rctl;
1335 1337
1336 if (hw->media_type == e1000_media_type_fiber || 1338 if (hw->phy.media_type == e1000_media_type_fiber ||
1337 hw->media_type == e1000_media_type_internal_serdes) { 1339 hw->phy.media_type == e1000_media_type_internal_serdes) {
1338 switch (hw->mac.type) { 1340 switch (hw->mac.type) {
1339 case e1000_80003es2lan: 1341 case e1000_80003es2lan:
1340 return e1000_set_es2lan_mac_loopback(adapter); 1342 return e1000_set_es2lan_mac_loopback(adapter);
@@ -1349,7 +1351,7 @@ static int e1000_setup_loopback_test(struct e1000_adapter *adapter)
1349 ew32(RCTL, rctl); 1351 ew32(RCTL, rctl);
1350 return 0; 1352 return 0;
1351 } 1353 }
1352 } else if (hw->media_type == e1000_media_type_copper) { 1354 } else if (hw->phy.media_type == e1000_media_type_copper) {
1353 return e1000_integrated_phy_loopback(adapter); 1355 return e1000_integrated_phy_loopback(adapter);
1354 } 1356 }
1355 1357
@@ -1368,8 +1370,8 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter)
1368 1370
1369 switch (hw->mac.type) { 1371 switch (hw->mac.type) {
1370 case e1000_80003es2lan: 1372 case e1000_80003es2lan:
1371 if (hw->media_type == e1000_media_type_fiber || 1373 if (hw->phy.media_type == e1000_media_type_fiber ||
1372 hw->media_type == e1000_media_type_internal_serdes) { 1374 hw->phy.media_type == e1000_media_type_internal_serdes) {
1373 /* restore CTRL_EXT, stealing space from tx_fifo_head */ 1375 /* restore CTRL_EXT, stealing space from tx_fifo_head */
1374 ew32(CTRL_EXT, adapter->tx_fifo_head); 1376 ew32(CTRL_EXT, adapter->tx_fifo_head);
1375 adapter->tx_fifo_head = 0; 1377 adapter->tx_fifo_head = 0;
@@ -1377,8 +1379,8 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter)
1377 /* fall through */ 1379 /* fall through */
1378 case e1000_82571: 1380 case e1000_82571:
1379 case e1000_82572: 1381 case e1000_82572:
1380 if (hw->media_type == e1000_media_type_fiber || 1382 if (hw->phy.media_type == e1000_media_type_fiber ||
1381 hw->media_type == e1000_media_type_internal_serdes) { 1383 hw->phy.media_type == e1000_media_type_internal_serdes) {
1382#define E1000_SERDES_LB_OFF 0x400 1384#define E1000_SERDES_LB_OFF 0x400
1383 ew32(SCTL, E1000_SERDES_LB_OFF); 1385 ew32(SCTL, E1000_SERDES_LB_OFF);
1384 msleep(10); 1386 msleep(10);
@@ -1528,7 +1530,7 @@ static int e1000_link_test(struct e1000_adapter *adapter, u64 *data)
1528 struct e1000_hw *hw = &adapter->hw; 1530 struct e1000_hw *hw = &adapter->hw;
1529 1531
1530 *data = 0; 1532 *data = 0;
1531 if (hw->media_type == e1000_media_type_internal_serdes) { 1533 if (hw->phy.media_type == e1000_media_type_internal_serdes) {
1532 int i = 0; 1534 int i = 0;
1533 hw->mac.serdes_has_link = 0; 1535 hw->mac.serdes_has_link = 0;
1534 1536
@@ -1624,9 +1626,9 @@ static void e1000_diag_test(struct net_device *netdev,
1624 adapter->hw.mac.autoneg = autoneg; 1626 adapter->hw.mac.autoneg = autoneg;
1625 1627
1626 /* force this routine to wait until autoneg complete/timeout */ 1628 /* force this routine to wait until autoneg complete/timeout */
1627 adapter->hw.phy.wait_for_link = 1; 1629 adapter->hw.phy.autoneg_wait_to_complete = 1;
1628 e1000e_reset(adapter); 1630 e1000e_reset(adapter);
1629 adapter->hw.phy.wait_for_link = 0; 1631 adapter->hw.phy.autoneg_wait_to_complete = 0;
1630 1632
1631 clear_bit(__E1000_TESTING, &adapter->state); 1633 clear_bit(__E1000_TESTING, &adapter->state);
1632 if (if_running) 1634 if (if_running)