Netdev List
 help / color / mirror / Atom feed
From: Greg Alexander <grefgs@galexander.org>
To: netdev@vger.kernel.org
Subject: BMC Tigon 3 (tg3) problem with powering down PHY (tentative PATCH)
Date: Tue, 9 Feb 2010 13:08:07 -0500	[thread overview]
Message-ID: <20100209180807.GG23446@goonies.be> (raw)

Hi all -

My new Lenovo U150 has a BMC57780 in it. It uses mdio with phylib to
access the PHY.  I am using x86-64 SMP kernel 2.6.32.7.

The device initializes successfully the first time but after ifconfig
down, it will not not re-initialize.  It looks like the phy layer is
attempting to autonegotiate while MII_BMCR is BMCR_PDOWN.

drivers/net/tg3.c:tg3_set_power_state() calls tg3_power_down_phy() which
sets BMCR_PDOWN directly.  But I could not find anything which is
responsible for powering it back up.  tg3_mdio_init() has a comment
indicating that it uses tg3_bmcr_reset() to turn the phy on.  So I
basically cut and pasted that code into tg3_set_power_state(),
conditional on using phylib (because I'm ignorant about other cases).

And that fixed my problem.  Hack-patch below. I'm ignorant as all get out
about this, so hopefully someone else can take this the rest of the way?

Red herrings: genphy_suspend()/genphy_resume() never get called,
(genphy_resume() does not work in this context even if called). Also, the
PHY_RESUMING state is never processed because the tg3.c code calls into
phy_start_aneg() setting it directly to PHY_AN...which also seems to be a
non-issue but maybe it matters to someone in some cases?

Anyways, thanks!  This chip is pretty new but it is already 99% supported
in Linux!  My hat's off to all of you!

- Greg

------------------patch--------------------------
--- tg3.c	2010/02/08 22:08:52
+++ tg3.c	2010/02/09 17:36:05
@@ -2432,6 +2432,12 @@
 		/* Switch out of Vaux if it is a NIC */
 		if (tp->tg3_flags2 & TG3_FLG2_IS_NIC)
 			tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl, 100);
+		if (tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB) {
+			u32 reg;
+			if (tg3_readphy(tp, MII_BMCR, &reg) || (reg & BMCR_PDOWN)) {
+				tg3_bmcr_reset(tp);
+			}
+		}
 
 		return 0;
 

                 reply	other threads:[~2010-02-09 18:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20100209180807.GG23446@goonies.be \
    --to=grefgs@galexander.org \
    --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