diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2019-12-17 13:39:16 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-12-19 12:52:34 -0800 |
commit | 0efc286a923874f0c243e5766cce54e9429ed949 (patch) | |
tree | 82a953da6d4437afab352eef145a5f95fc9e0f7e /drivers/net/phy/lxt.c | |
parent | 2a10ab043ac5a658225ee77852db7942de9ac4c5 (diff) |
net: phy: provide and use genphy_read_status_fixed()
There are two drivers and generic code which contain exactly the same
code to read the status of a PHY operating without autonegotiation
enabled. Rather than duplicate this code, provide a helper to read
this information.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/lxt.c')
-rw-r--r-- | drivers/net/phy/lxt.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/net/phy/lxt.c b/drivers/net/phy/lxt.c index 30172852e36e..fec58ad69e02 100644 --- a/drivers/net/phy/lxt.c +++ b/drivers/net/phy/lxt.c @@ -192,22 +192,9 @@ static int lxt973a2_read_status(struct phy_device *phydev) phy_resolve_aneg_pause(phydev); } else { - int bmcr = phy_read(phydev, MII_BMCR); - - if (bmcr < 0) - return bmcr; - - if (bmcr & BMCR_FULLDPLX) - phydev->duplex = DUPLEX_FULL; - else - phydev->duplex = DUPLEX_HALF; - - if (bmcr & BMCR_SPEED1000) - phydev->speed = SPEED_1000; - else if (bmcr & BMCR_SPEED100) - phydev->speed = SPEED_100; - else - phydev->speed = SPEED_10; + err = genphy_read_status_fixed(phydev); + if (err < 0) + return err; phydev->pause = phydev->asym_pause = 0; linkmode_zero(phydev->lp_advertising); |