public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Arthur Jones <ajones@riverbed.com>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: netdev@vger.kernel.org
Subject: [PATCH] e1000e: workaround missing power down mii control bit on 82571
Date: Thu, 16 Dec 2010 10:28:47 -0800	[thread overview]
Message-ID: <20101216182847.GA14985@ajones-laptop.nbttech.com> (raw)

Hi Jeff,  Re-sending w/ proper netdev email
address.  Sorry about that...

Arthur

---

On 82571 only, AFAICT, the PHY does not seem to
store the MII control register 0 bit 11 (power
down PHY).  So that when we power down the PHY
on dev_close() and then run ethtool on the closed
dev, we end up turning the PHY back on even though
the interface is down.  This pretty easy to repro:

$ ethtool -s eth0 wol d
$ ifconfig eth0 up
$ mii-tool eth0
eth0: negotiated 100baseTx-FD, link ok
$ ifconfig eth0 down
$ mii-tool eth0
eth0: no link
$ ethtool -s eth0 autoneg on  (doesn't really matter what we do here)
$ mii-tool eth0
eth0: negotiated 100baseTx-FD, link ok (this should be: eth0: no link)

We fix this by tracking the power down bit that we
write to the PHY control register and re-inserting
it when we read it.

Signed-off-by: Arthur Jones <ajones@riverbed.com>
---
 drivers/net/e1000e/hw.h     |    1 +
 drivers/net/e1000e/netdev.c |    1 +
 drivers/net/e1000e/phy.c    |    9 +++++++++
 3 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
index ba302a5..34974f2 100644
--- a/drivers/net/e1000e/hw.h
+++ b/drivers/net/e1000e/hw.h
@@ -875,6 +875,7 @@ struct e1000_phy_info {
 	u16 cable_length;
 	u16 max_cable_length;
 	u16 min_cable_length;
+	u16 control_power_down;
 
 	u8 mdix;
 
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index c4ca162..ac81596 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -5781,6 +5781,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
 	hw->mac.ops.get_bus_info(&adapter->hw);
 
 	adapter->hw.phy.autoneg_wait_to_complete = 0;
+	adapter->hw.phy.control_power_down = 0;
 
 	/* Copper options */
 	if (adapter->hw.phy.media_type == e1000_media_type_copper) {
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 3d3dc0c..55b9f78 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -224,6 +224,11 @@ s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
 		e_dbg("MDI Error\n");
 		return -E1000_ERR_PHY;
 	}
+
+	/* 82571 does not seem to store the power down bit (bit 11) */
+	if (offset == PHY_CONTROL && phy->type == e1000_phy_igp_2)
+		mdic |= phy->control_power_down;
+
 	*data = (u16) mdic;
 
 	return 0;
@@ -247,6 +252,10 @@ s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
 		return -E1000_ERR_PARAM;
 	}
 
+	/* 82571 does not seem to store the power down bit (bit 11) */
+	if (offset == PHY_CONTROL && phy->type == e1000_phy_igp_2)
+		phy->control_power_down = data & MII_CR_POWER_DOWN;
+
 	/*
 	 * Set up Op-code, Phy Address, and register offset in the MDI
 	 * Control register.  The MAC will take care of interfacing with the
-- 
1.7.1

             reply	other threads:[~2010-12-16 18:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-16 18:28 Arthur Jones [this message]
2010-12-16 18:56 ` [PATCH] e1000e: workaround missing power down mii control bit on 82571 Ben Hutchings
2010-12-16 19:04   ` Allan, Bruce W
2010-12-16 19:28     ` Allan, Bruce W
2010-12-16 20:04       ` Arthur Jones
2010-12-16 22:14         ` Arthur Jones
2010-12-17  1:46           ` Allan, Bruce W
2010-12-17 14:04             ` Arthur Jones
2010-12-17 15:53               ` Allan, Bruce W
2010-12-20 15:33                 ` Arthur Jones
2010-12-22 20:25                   ` Allan, Bruce W

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=20101216182847.GA14985@ajones-laptop.nbttech.com \
    --to=ajones@riverbed.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=netdev@vger.kernel.org \
    /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