浏览代码

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>
Shaohui Xie 10 年之前
父节点
当前提交
94724d102c
共有 1 个文件被更改,包括 9 次插入2 次删除
  1. 9 2
      drivers/net/phy/teranetics.c

+ 9 - 2
drivers/net/phy/teranetics.c

@@ -51,8 +51,15 @@ static int teranetics_aneg_done(struct phy_device *phydev)
 {
 {
 	int reg;
 	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)
 static int teranetics_config_aneg(struct phy_device *phydev)