netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Carolyn Wyborny <carolyn.wyborny@intel.com>,
	netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 08/13] igb: Add loopback test support for i210.
Date: Thu, 23 Aug 2012 02:56:48 -0700	[thread overview]
Message-ID: <1345715813-20757-9-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1345715813-20757-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Carolyn Wyborny <carolyn.wyborny@intel.com>

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>
---
 drivers/net/ethernet/intel/igb/igb_ethtool.c | 51 +++++++++-------------------
 1 file 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 be02168..c4def55 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)
 {
 	struct e1000_hw *hw = &adapter->hw;
 	u32 ctrl_reg = 0;
-	u16 phy_reg = 0;
 
 	hw->mac.autoneg = false;
 
-	switch (hw->phy.type) {
-	case e1000_phy_m88:
-		/* Auto-MDI/MDIX Off */
-		igb_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, 0x0808);
-		/* reset to update Auto-MDI/MDIX */
-		igb_write_phy_reg(hw, PHY_CONTROL, 0x9140);
-		/* autoneg off */
-		igb_write_phy_reg(hw, PHY_CONTROL, 0x8140);
-		break;
-	case e1000_phy_82580:
-		/* enable MII loopback */
-		igb_write_phy_reg(hw, I82580_PHY_LBK_CTRL, 0x8041);
-		break;
-	case e1000_phy_i210:
-		/* set loopback speed in PHY */
-		igb_read_phy_reg(hw, (GS40G_PAGE_SELECT & GS40G_PAGE_2),
-					&phy_reg);
-		phy_reg |= GS40G_MAC_SPEED_1G;
-		igb_write_phy_reg(hw, (GS40G_PAGE_SELECT & GS40G_PAGE_2),
-					phy_reg);
-		ctrl_reg = rd32(E1000_CTRL_EXT);
-	default:
-		break;
+	if (hw->phy.type == e1000_phy_m88) {
+		if (hw->phy.id != I210_I_PHY_ID) {
+			/* Auto-MDI/MDIX Off */
+			igb_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, 0x0808);
+			/* reset to update Auto-MDI/MDIX */
+			igb_write_phy_reg(hw, PHY_CONTROL, 0x9140);
+			/* autoneg off */
+			igb_write_phy_reg(hw, PHY_CONTROL, 0x8140);
+		} else {
+			/* force 1000, set loopback  */
+			igb_write_phy_reg(hw, I347AT4_PAGE_SELECT, 0);
+			igb_write_phy_reg(hw, PHY_CONTROL, 0x4140);
+		}
 	}
 
 	/* add small delay to avoid loopback test failure */
@@ -1555,7 +1544,7 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter)
 		     E1000_CTRL_FD |	 /* Force Duplex to FULL */
 		     E1000_CTRL_SLU);	 /* Set link up enable bit */
 
-	if ((hw->phy.type == e1000_phy_m88) || (hw->phy.type == e1000_phy_i210))
+	if (hw->phy.type == e1000_phy_m88)
 		ctrl_reg |= E1000_CTRL_ILOS; /* Invert Loss of Signal */
 
 	wr32(E1000_CTRL, ctrl_reg);
@@ -1563,11 +1552,10 @@ static int igb_integrated_phy_loopback(struct igb_adapter *adapter)
 	/* Disable the receiver on the PHY so when a cable is plugged in, the
 	 * PHY does not begin to autoneg when a cable is reconnected to the NIC.
 	 */
-	if ((hw->phy.type == e1000_phy_m88) || (hw->phy.type == e1000_phy_i210))
+	if (hw->phy.type == e1000_phy_m88)
 		igb_phy_disable_receiver(adapter);
 
-	udelay(500);
-
+	mdelay(500);
 	return 0;
 }
 
@@ -1827,13 +1815,6 @@ static int igb_loopback_test(struct igb_adapter *adapter, u64 *data)
 		*data = 0;
 		goto out;
 	}
-	if ((adapter->hw.mac.type == e1000_i210)
-		|| (adapter->hw.mac.type == e1000_i211)) {
-		dev_err(&adapter->pdev->dev,
-			"Loopback test not supported on this part at this time.\n");
-		*data = 0;
-		goto out;
-	}
 	*data = igb_setup_desc_rings(adapter);
 	if (*data)
 		goto out;
-- 
1.7.11.4

  parent reply	other threads:[~2012-08-23  9:57 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-23  9:56 [net-next 00/13][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2012-08-23  9:56 ` [net-next 01/13] e1000e: use correct type for read of 32-bit register Jeff Kirsher
2012-08-23  9:56 ` [net-next 02/13] e1000e: cleanup strict checkpatch check Jeff Kirsher
2012-08-23  9:56 ` [net-next 03/13] e1000e: cleanup - remove inapplicable comment Jeff Kirsher
2012-08-23  9:56 ` [net-next 04/13] e1000e: cleanup checkpatch PREFER_PR_LEVEL warning Jeff Kirsher
2012-08-23 14:01   ` Joe Perches
2012-08-24 18:02     ` Joe Perches
2012-08-24 21:19       ` Jeff Kirsher
2012-08-24 22:43         ` Joe Perches
2012-08-23  9:56 ` [net-next 05/13] e1000e: cleanup - remove unnecessary variable Jeff Kirsher
2012-08-23  9:56 ` [net-next 06/13] e1000e: update driver version number Jeff Kirsher
2012-08-23  9:56 ` [net-next 07/13] e1000e: cleanup strict checkpatch MEMORY_BARRIER checks Jeff Kirsher
2012-08-23  9:56 ` Jeff Kirsher [this message]
2012-08-23  9:56 ` [net-next 09/13] igb: reduce Rx header size Jeff Kirsher
2012-08-23  9:56 ` [net-next 10/13] igb: Tidy up wrapping for CONFIG_IGB_PTP Jeff Kirsher
2012-08-23 11:03   ` Richard Cochran
2012-08-23 16:09     ` Vick, Matthew
2012-08-23 17:29       ` Richard Cochran
2012-08-23 17:40         ` Vick, Matthew
2012-08-23 18:03           ` Richard Cochran
2012-08-23 18:03         ` Keller, Jacob E
2012-08-23 18:40           ` Vick, Matthew
2012-08-24  7:04             ` Richard Cochran
2012-08-24 10:10             ` Richard Cochran
2012-08-24 16:51               ` Ben Hutchings
2012-08-24 19:38                 ` Keller, Jacob E
2012-08-25  6:20                   ` Richard Cochran
2012-08-26  1:33                     ` Keller, Jacob E
2012-08-26 13:01                       ` Richard Cochran
2012-08-23 11:28   ` Richard Cochran
2012-08-23 16:27     ` Vick, Matthew
2012-08-23  9:56 ` [net-next 11/13] igb: Update PTP function names/variables and locations Jeff Kirsher
2012-08-23 11:16   ` Richard Cochran
2012-08-23 16:22     ` Vick, Matthew
2012-08-23 17:53       ` Richard Cochran
2012-08-23 18:00         ` Keller, Jacob E
2012-08-23 18:11           ` Richard Cochran
2012-08-23 18:44             ` Vick, Matthew
2012-08-24  6:55               ` Richard Cochran
2012-08-24 15:52                 ` Vick, Matthew
2012-08-25  5:48                   ` Richard Cochran
2012-08-27 15:23                     ` Vick, Matthew
2012-08-27 16:44                       ` Richard Cochran
2012-08-27 17:39                         ` Vick, Matthew
2012-08-23 18:35         ` Vick, Matthew
2012-08-23 18:48           ` Keller, Jacob E
2012-08-23 18:58             ` Vick, Matthew
2012-08-24  3:02         ` Joe Perches
2012-08-24  6:32           ` Richard Cochran
2012-08-24  9:22             ` Joe Perches
2012-08-24 15:12               ` David Miller
2012-08-24 17:56                 ` Joe Perches
2012-08-23  9:56 ` [net-next 12/13] igb: Correct PTP support query from ethtool Jeff Kirsher
2012-08-23 11:24   ` Richard Cochran
2012-08-23 16:38     ` Vick, Matthew
2012-08-23  9:56 ` [net-next 13/13] igb: Store the MAC address in the name in the PTP struct Jeff Kirsher
2012-08-23 10:45   ` Richard Cochran
2012-08-23 16:05     ` Vick, Matthew
2012-08-23 21:35     ` Ben Hutchings
2012-08-24  6:19       ` Richard Cochran
2012-09-06 23:04         ` Keller, Jacob E

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1345715813-20757-9-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=carolyn.wyborny@intel.com \
    --cc=davem@davemloft.net \
    --cc=gospo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).