diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-05-21 12:53:11 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-05-23 15:40:51 +0200 |
commit | e2eb6e50f45ef078a6bda48acb3aea4b63e49237 (patch) | |
tree | 3c2750ea60e9ef27582b7eb4acf69efdbd1c4474 /drivers/net/phy/phy.c | |
parent | 75635f6926d2a3dcadd9b9c026aa21a16e113ee3 (diff) | |
download | barebox-e2eb6e50f45ef078a6bda48acb3aea4b63e49237.tar.gz barebox-e2eb6e50f45ef078a6bda48acb3aea4b63e49237.tar.xz |
net: phy: genphy: always write MII_CTRL1000 when available
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@pengutronix.de>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r-- | drivers/net/phy/phy.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index b0e0c1e369..e214c13210 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) |