* [PATCH 3/7] mdio: Check MDIO_STAT1_FAULT in mdio45_links_ok()
@ 2009-08-26 18:16 Ben Hutchings
2009-08-27 1:04 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2009-08-26 18:16 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
Some PHYs will report that the link is up even though there is a fault
condition. Therefore, check the fault flag too. We must also read
STAT2 to reset this flag.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/mdio.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/net/mdio.c b/drivers/net/mdio.c
index 6851bdb..7d2e610 100644
--- a/drivers/net/mdio.c
+++ b/drivers/net/mdio.c
@@ -109,13 +109,20 @@ int mdio45_links_ok(const struct mdio_if_info *mdio, u32 mmd_mask)
if (mmd_mask & (1 << devad)) {
mmd_mask &= ~(1 << devad);
- /* Read twice because link state is latched and a
- * read moves the current state into the register */
+ /* Reset the latched status and fault flags */
mdio->mdio_read(mdio->dev, mdio->prtad,
devad, MDIO_STAT1);
+ if (devad == MDIO_MMD_PMAPMD || devad == MDIO_MMD_PCS ||
+ devad == MDIO_MMD_PHYXS || devad == MDIO_MMD_DTEXS)
+ mdio->mdio_read(mdio->dev, mdio->prtad,
+ devad, MDIO_STAT2);
+
+ /* Check the current status and fault flags */
reg = mdio->mdio_read(mdio->dev, mdio->prtad,
devad, MDIO_STAT1);
- if (reg < 0 || !(reg & MDIO_STAT1_LSTATUS))
+ if (reg < 0 ||
+ (reg & (MDIO_STAT1_FAULT | MDIO_STAT1_LSTATUS)) !=
+ MDIO_STAT1_LSTATUS)
return false;
}
}
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 3/7] mdio: Check MDIO_STAT1_FAULT in mdio45_links_ok()
2009-08-26 18:16 [PATCH 3/7] mdio: Check MDIO_STAT1_FAULT in mdio45_links_ok() Ben Hutchings
@ 2009-08-27 1:04 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-08-27 1:04 UTC (permalink / raw)
To: bhutchings; +Cc: netdev, linux-net-drivers
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Wed, 26 Aug 2009 19:16:58 +0100
> Some PHYs will report that the link is up even though there is a fault
> condition. Therefore, check the fault flag too. We must also read
> STAT2 to reset this flag.
>
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-08-27 1:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-26 18:16 [PATCH 3/7] mdio: Check MDIO_STAT1_FAULT in mdio45_links_ok() Ben Hutchings
2009-08-27 1:04 ` David Miller
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).