diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2019-12-17 16:39:26 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-12-19 23:52:34 +0300 |
commit | 98f92831c561e43e8d4dafa7165e996af4dc8ac3 (patch) | |
tree | ab93911107650e26b0ac00a4c23696eb310e5856 /drivers/net/phy/marvell.c | |
parent | fcf1f59afc67dc8c214a1b085527ed1fc513c3a2 (diff) | |
download | linux-98f92831c561e43e8d4dafa7165e996af4dc8ac3.tar.xz |
net: phy: marvell: initialise link partner state earlier
Move the initialisation of the link partner state earlier, inside
marvell_read_status_page(), so we don't have the same initialisation
scattered amongst the other files. This is in a similar place to
the genphy implementation, so would result in the same behaviour if
a PHY read error occurs.
This allows us to get rid of marvell_read_status_page_fixed(), which
became a pointless wrapper around genphy_read_status_fixed().
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/marvell.c')
-rw-r--r-- | drivers/net/phy/marvell.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index ac9c21b4e6c9..b50c8a4710b4 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -1354,8 +1354,6 @@ static int marvell_read_status_page_an(struct phy_device *phydev, if (err < 0) return err; - phydev->pause = 0; - phydev->asym_pause = 0; phy_resolve_aneg_pause(phydev); } else { lpa = phy_read(phydev, MII_LPA); @@ -1365,8 +1363,6 @@ static int marvell_read_status_page_an(struct phy_device *phydev, /* The fiber link is only 1000M capable */ fiber_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, lpa); - phydev->pause = 0; - phydev->asym_pause = 0; if (phydev->duplex == DUPLEX_FULL) { if (!(lpa & LPA_PAUSE_FIBER)) { phydev->pause = 0; @@ -1403,21 +1399,6 @@ static int marvell_read_status_page_an(struct phy_device *phydev, return 0; } -static int marvell_read_status_page_fixed(struct phy_device *phydev) -{ - int err; - - err = genphy_read_status_fixed(phydev); - if (err < 0) - return err; - - phydev->pause = 0; - phydev->asym_pause = 0; - linkmode_zero(phydev->lp_advertising); - - return 0; -} - /* marvell_read_status_page * * Description: @@ -1443,10 +1424,14 @@ static int marvell_read_status_page(struct phy_device *phydev, int page) if (err) return err; + linkmode_zero(phydev->lp_advertising); + phydev->pause = 0; + phydev->asym_pause = 0; + if (phydev->autoneg == AUTONEG_ENABLE) err = marvell_read_status_page_an(phydev, fiber); else - err = marvell_read_status_page_fixed(phydev); + err = genphy_read_status_fixed(phydev); return err; } |