diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-08-26 08:16:58 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-26 17:38:53 -0700 |
commit | 771046d7b1def64c00a5a47ca48526cbbacd7fe3 (patch) | |
tree | 84c534da35aaf759c9186157b54386daa36f21ba /drivers/net/mdio.c | |
parent | d4ec09acdb15cdb5afdb5cd03f6bceb5c3c690a5 (diff) | |
download | linux-771046d7b1def64c00a5a47ca48526cbbacd7fe3.tar.gz linux-771046d7b1def64c00a5a47ca48526cbbacd7fe3.tar.bz2 linux-771046d7b1def64c00a5a47ca48526cbbacd7fe3.zip |
mdio: Check MDIO_STAT1_FAULT in mdio45_links_ok()
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/mdio.c')
-rw-r--r-- | 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 6851bdb2ce29..7d2e610f14ff 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; } } |