netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phy: fix auto negotiation checking for teranetics
@ 2015-07-24 11:26 shh.xie
  2015-07-27  8:04 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: shh.xie @ 2015-07-24 11:26 UTC (permalink / raw)
  To: netdev, davem; +Cc: Shaohui Xie

From: Shaohui Xie <Shaohui.Xie@freescale.com>

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>
---
 drivers/net/phy/teranetics.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/teranetics.c b/drivers/net/phy/teranetics.c
index 7dcb5aa..91e1bec 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)
-- 
2.1.0.27.g96db324

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: phy: fix auto negotiation checking for teranetics
  2015-07-24 11:26 [PATCH] net: phy: fix auto negotiation checking for teranetics shh.xie
@ 2015-07-27  8:04 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-07-27  8:04 UTC (permalink / raw)
  To: shh.xie; +Cc: netdev, Shaohui.Xie

From: <shh.xie@gmail.com>
Date: Fri, 24 Jul 2015 19:26:02 +0800

> From: Shaohui Xie <Shaohui.Xie@freescale.com>
> 
> 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>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-27  8:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-24 11:26 [PATCH] net: phy: fix auto negotiation checking for teranetics shh.xie
2015-07-27  8: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).