Skip to content

Commit

Permalink
net: phy: fix auto negotiation checking for teranetics
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shaohui Xie authored and David S. Miller committed Jul 27, 2015
1 parent 5a6228a commit 94724d1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions drivers/net/phy/teranetics.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 94724d1

Please sign in to comment.