From: Guillermo Rodriguez Garcia <guille.rodriguez@gmail.com>
To: barebox@lists.infradead.org
Cc: Philipp Zabel <pza@pengutronix.de>,
grodriguez <guille.rodriguez@gmail.com>,
Trent Piepho <tpiepho@kymetacorp.com>
Subject: [PATCH] Fix genphy_restart_aneg() for Micrel's ksz9031.
Date: Mon, 13 Jun 2016 19:29:15 +0200 [thread overview]
Message-ID: <1465838955-24515-1-git-send-email-guille.rodriguez@gmail.com> (raw)
In-Reply-To: <20160504074331.GM19714@pengutronix.de>
From: grodriguez <guille.rodriguez@gmail.com>
Commit da89ee8f2e04 ("Center FLP timing at 16ms") breaks
genphy_restart_aneg() for Micrel's ksz9031. According to the
datasheet, the ksz9031 requires a wait of 1ms after clearing
the PDOWN bit and before read/write access to any PHY registers.
---
drivers/net/phy/phy.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 73176fb..ed69d9b 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -561,7 +561,7 @@ int phy_wait_aneg_done(struct phy_device *phydev)
*/
int genphy_restart_aneg(struct phy_device *phydev)
{
- int ctl;
+ int ctl, pdown;
ctl = phy_read(phydev, MII_BMCR);
@@ -574,6 +574,7 @@ int genphy_restart_aneg(struct phy_device *phydev)
ctl &= ~(BMCR_ISOLATE);
/* Clear powerdown bit which eventually is set on some phys */
+ pdown = ctl & BMCR_PDOWN;
ctl &= ~BMCR_PDOWN;
ctl = phy_write(phydev, MII_BMCR, ctl);
@@ -581,6 +582,12 @@ int genphy_restart_aneg(struct phy_device *phydev)
if (ctl < 0)
return ctl;
+ /* Micrel's ksz9031 (and perhaps others?): Changing the PDOWN bit
+ * from '1' to '0' generates an internal reset. Must wait a minimum
+ * of 1ms before read/write access to the PHY registers. */
+ if (pdown)
+ mdelay(1);
+
return 0;
}
--
1.7.9.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2016-06-13 17:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CABDcavZr1PCpFrHVJFFayRQZ6vninf-xFS0H9QKSdA8u53OkDg@mail.gmail.com>
2016-04-18 14:49 ` Fwd: Micrel KSZ9031RN PHY problem Guillermo Rodriguez Garcia
2016-04-19 7:11 ` Sascha Hauer
2016-04-20 15:58 ` Guillermo Rodriguez Garcia
2016-04-21 7:32 ` Sascha Hauer
2016-04-21 11:04 ` Guillermo Rodriguez Garcia
2016-04-26 9:55 ` Guillermo Rodriguez Garcia
2016-04-26 11:10 ` Guillermo Rodriguez Garcia
2016-04-27 5:59 ` Sascha Hauer
2016-04-28 9:51 ` Guillermo Rodriguez Garcia
2016-04-28 21:09 ` Trent Piepho
2016-04-29 11:00 ` Guillermo Rodriguez Garcia
2016-04-29 18:18 ` Trent Piepho
2016-05-03 14:40 ` Guillermo Rodriguez Garcia
2016-05-04 7:43 ` Sascha Hauer
2016-05-04 10:39 ` Guillermo Rodriguez Garcia
2016-06-13 17:29 ` Guillermo Rodriguez Garcia [this message]
2016-06-14 6:39 ` [PATCH] Fix genphy_restart_aneg() for Micrel's ksz9031 Sascha Hauer
2016-06-14 7:39 ` Guillermo Rodriguez Garcia
2016-06-15 5:49 ` Sascha Hauer
2016-06-15 7:44 ` Guillermo Rodriguez Garcia
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=1465838955-24515-1-git-send-email-guille.rodriguez@gmail.com \
--to=guille.rodriguez@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=pza@pengutronix.de \
--cc=tpiepho@kymetacorp.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