diff options
author | Carolyn Wyborny <carolyn.wyborny@intel.com> | 2012-06-08 01:01:39 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2012-09-05 01:43:59 -0400 |
commit | 8aa23f0d8601b5bc84c8fc07b9cc45079984ef3d (patch) | |
tree | b687476d42449bf0996bd6de4ad03f2d8dcd0afa /drivers/net/ethernet/intel/igb/igb_ethtool.c | |
parent | 600e177920df936d03b807780ca92c662af98990 (diff) |
igb: Add loopback test support for i210
Early release of i210 devices had the loopback test of the ethtool
self-test disabled. This patch enables the loopback test for i210 devices.
Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/igb/igb_ethtool.c')
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_ethtool.c | 51 |
1 files changed, 16 insertions, 35 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index be02168f1308..c4def55567f5 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c | |||
@@ -1511,33 +1511,22 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter) | |||
1511 | { | 1511 | { |
1512 | struct e1000_hw *hw = &adapter->hw; | 1512 | struct e1000_hw *hw = &adapter->hw; |
1513 | u32 ctrl_reg = 0; | 1513 | u32 ctrl_reg = 0; |
1514 | u16 phy_reg = 0; | ||
1515 | 1514 | ||
1516 | hw->mac.autoneg = false; | 1515 | hw->mac.autoneg = false; |
1517 | 1516 | ||
1518 | switch (hw->phy.type) { | 1517 | if (hw->phy.type == e1000_phy_m88) { |
1519 | case e1000_phy_m88: | 1518 | if (hw->phy.id != I210_I_PHY_ID) { |
1520 | /* Auto-MDI/MDIX Off */ | 1519 | /* Auto-MDI/MDIX Off */ |
1521 | igb_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, 0x0808); | 1520 | igb_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, 0x0808); |
1522 | /* reset to update Auto-MDI/MDIX */ | 1521 | /* reset to update Auto-MDI/MDIX */ |
1523 | igb_write_phy_reg(hw, PHY_CONTROL, 0x9140); | 1522 | igb_write_phy_reg(hw, PHY_CONTROL, 0x9140); |
1524 | /* autoneg off */ | 1523 | /* autoneg off */ |
1525 | igb_write_phy_reg(hw, PHY_CONTROL, 0x8140); | 1524 | igb_write_phy_reg(hw, PHY_CONTROL, 0x8140); |
1526 | break; | 1525 | } else { |
1527 | case e1000_phy_82580: | 1526 | /* force 1000, set loopback */ |
1528 | /* enable MII loopback */ | 1527 | igb_write_phy_reg(hw, I347AT4_PAGE_SELECT, 0); |
1529 | igb_write_phy_reg(hw, I82580_PHY_LBK_CTRL, 0x8041); | 1528 | igb_write_phy_reg(hw, PHY_CONTROL, 0x4140); |
1530 | break; | 1529 | } |
1531 | case e1000_phy_i210: | ||
1532 | /* set loopback speed in PHY */ | ||
1533 | igb_read_phy_reg(hw, (GS40G_PAGE_SELECT & GS40G_PAGE_2), | ||
1534 | &phy_reg); | ||
1535 | phy_reg |= GS40G_MAC_SPEED_1G; | ||
1536 | igb_write_phy_reg(hw, (GS40G_PAGE_SELECT & GS40G_PAGE_2), | ||
1537 | phy_reg); | ||
1538 | ctrl_reg = rd32(E1000_CTRL_EXT); | ||
1539 | default: | ||
1540 | break; | ||
1541 | } | 1530 | } |
1542 | 1531 | ||
1543 | /* add small delay to avoid loopback test failure */ | 1532 | /* add small delay to avoid loopback test failure */ |
@@ -1555,7 +1544,7 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter) | |||
1555 | E1000_CTRL_FD | /* Force Duplex to FULL */ | 1544 | E1000_CTRL_FD | /* Force Duplex to FULL */ |
1556 | E1000_CTRL_SLU); /* Set link up enable bit */ | 1545 | E1000_CTRL_SLU); /* Set link up enable bit */ |
1557 | 1546 | ||
1558 | if ((hw->phy.type == e1000_phy_m88) || (hw->phy.type == e1000_phy_i210)) | 1547 | if (hw->phy.type == e1000_phy_m88) |
1559 | ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ | 1548 | ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */ |
1560 | 1549 | ||
1561 | wr32(E1000_CTRL, ctrl_reg); | 1550 | wr32(E1000_CTRL, ctrl_reg); |
@@ -1563,11 +1552,10 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter) | |||
1563 | /* Disable the receiver on the PHY so when a cable is plugged in, the | 1552 | /* Disable the receiver on the PHY so when a cable is plugged in, the |
1564 | * PHY does not begin to autoneg when a cable is reconnected to the NIC. | 1553 | * PHY does not begin to autoneg when a cable is reconnected to the NIC. |
1565 | */ | 1554 | */ |
1566 | if ((hw->phy.type == e1000_phy_m88) || (hw->phy.type == e1000_phy_i210)) | 1555 | if (hw->phy.type == e1000_phy_m88) |
1567 | igb_phy_disable_receiver(adapter); | 1556 | igb_phy_disable_receiver(adapter); |
1568 | 1557 | ||
1569 | udelay(500); | 1558 | mdelay(500); |
1570 | |||
1571 | return 0; | 1559 | return 0; |
1572 | } | 1560 | } |
1573 | 1561 | ||
@@ -1827,13 +1815,6 @@ static int igb_loopback_test(struct igb_adapter *adapter, u64 *data) | |||
1827 | *data = 0; | 1815 | *data = 0; |
1828 | goto out; | 1816 | goto out; |
1829 | } | 1817 | } |
1830 | if ((adapter->hw.mac.type == e1000_i210) | ||
1831 | || (adapter->hw.mac.type == e1000_i211)) { | ||
1832 | dev_err(&adapter->pdev->dev, | ||
1833 | "Loopback test not supported on this part at this time.\n"); | ||
1834 | *data = 0; | ||
1835 | goto out; | ||
1836 | } | ||
1837 | *data = igb_setup_desc_rings(adapter); | 1818 | *data = igb_setup_desc_rings(adapter); |
1838 | if (*data) | 1819 | if (*data) |
1839 | goto out; | 1820 | goto out; |