diff options
author | Shaohui Xie <Shaohui.Xie@freescale.com> | 2015-07-24 13:26:02 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-07-27 10:04:30 +0200 |
commit | 94724d102c829d9f2105b1cb6e831c99174cd49d (patch) | |
tree | 6d93c49323a6070d57744f763b3fb8674e844997 | |
parent | lwtunnel: change prototype of lwtunnel_state_get() (diff) | |
download | linux-94724d102c829d9f2105b1cb6e831c99174cd49d.tar.xz linux-94724d102c829d9f2105b1cb6e831c99174cd49d.zip |
net: phy: fix auto negotiation checking for teranetics
When using fiber port, the phy cannot report it's auto negotiation state,
driver should always report auto negotiation is done when using fiber port.
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/phy/teranetics.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/net/phy/teranetics.c b/drivers/net/phy/teranetics.c index 7dcb5aada1c4..91e1bec6079f 100644 --- a/drivers/net/phy/teranetics.c +++ b/drivers/net/phy/teranetics.c @@ -51,8 +51,15 @@ static int teranetics_aneg_done(struct phy_device *phydev) { int reg; - reg = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1); - return (reg < 0) ? reg : (reg & BMSR_ANEGCOMPLETE); + /* auto negotiation state can only be checked when using copper + * port, if using fiber port, just lie it's done. + */ + if (!phy_read_mmd(phydev, MDIO_MMD_VEND1, 93)) { + reg = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1); + return (reg < 0) ? reg : (reg & BMSR_ANEGCOMPLETE); + } + + return 1; } static int teranetics_config_aneg(struct phy_device *phydev) |