mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] net: phy: micrel: fix too late link up
Date: Thu, 12 Apr 2018 09:34:28 +0200	[thread overview]
Message-ID: <20180412073428.21094-1-s.hauer@pengutronix.de> (raw)

From: Christian Hemp <c.hemp@phytec.de>

Since commit a4cee7207a1 ("net: phy: micrel: Add workaround for bad
autoneg") by Philipp Zabel <p.zabel@pengutronix.de>:

    Based on kernel commit d2fd719bcb0e ("net/phy: micrel: Add workaround
    for bad autoneg") by Nathan Sullivan <nathan.sullivan@ni.com>:

        Very rarely, the KSZ9031 will appear to complete autonegotiation, but
        will drop all traffic afterwards.  When this happens, the idle error
        count will read 0xFF after autonegotiation completes. Reset the PHY
        when in that state.

is it possible that we get the link to late and  barebox reports "Network is
down". The problem is that ksz9031_config_init is called again in an
error case. In this case autoneg will restart but waiting for finish is
missing.

Signed-off-by: Christian Hemp <c.hemp@phytec.de>
Tested-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
---
 drivers/net/phy/micrel.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 0ca359b0ba..fe71bfd1a6 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -293,6 +293,7 @@ static int ksz9031_read_status(struct phy_device *phydev)
 	if ((regval & 0xff) == 0xff) {
 		phy_init_hw(phydev);
 		phydev->link = 0;
+		phy_wait_aneg_done(phydev);
 	}
 
 	return 0;
-- 
2.16.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

                 reply	other threads:[~2018-04-12  7:34 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=20180412073428.21094-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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