[PATCH 08/10] net: phy: genphy: always write MII_CTRL1000 when available

Sascha Hauer s.hauer at pengutronix.de
Wed May 21 05:18:58 PDT 2014


the phydev->supported field does not necessarily match the hardware
capabilities, it could be limited by the board to force the phy
to a lower speed. In this case make sure the gigabit advertise bits
are cleared on a gigabit phy.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/net/phy/phy.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index b0e0c1e..e214c13 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -390,7 +390,7 @@ out:
 int genphy_config_advert(struct phy_device *phydev)
 {
 	u32 advertise;
-	int oldadv, adv;
+	int oldadv, adv, bmsr;
 	int err, changed = 0;
 
 	/* Only allow advertising what
@@ -417,8 +417,11 @@ int genphy_config_advert(struct phy_device *phydev)
 	}
 
 	/* Configure gigabit if it's supported */
-	if (phydev->supported & (SUPPORTED_1000baseT_Half |
-				SUPPORTED_1000baseT_Full)) {
+	bmsr = phy_read(phydev, MII_BMSR);
+	if (bmsr < 0)
+		return bmsr;
+
+	if (bmsr & BMSR_ESTATEN) {
 		oldadv = adv = phy_read(phydev, MII_CTRL1000);
 
 		if (adv < 0)
-- 
2.0.0.rc0




More information about the barebox mailing list