Merge branch 'net-phy-smaller-phylib-improvements'

Heiner Kallweit says:

====================
net: phy: smaller phylib improvements

Series with smaller improvements for suspend and soft-reset handling.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2020-04-24 16:47:51 -07:00
commit 993e8ec975
6 changed files with 14 additions and 11 deletions

View File

@ -82,7 +82,6 @@ static struct phy_driver cortina_driver[] = {
.features = PHY_10GBIT_FEATURES,
.config_aneg = gen10g_config_aneg,
.read_status = cortina_read_status,
.soft_reset = genphy_no_soft_reset,
.probe = cortina_probe,
},
};

View File

@ -727,7 +727,6 @@ static struct phy_driver mv3310_drivers[] = {
.phy_id_mask = MARVELL_PHY_ID_MASK,
.name = "mv88x3310",
.get_features = mv3310_get_features,
.soft_reset = genphy_no_soft_reset,
.config_init = mv3310_config_init,
.probe = mv3310_probe,
.suspend = mv3310_suspend,
@ -745,7 +744,6 @@ static struct phy_driver mv3310_drivers[] = {
.probe = mv3310_probe,
.suspend = mv3310_suspend,
.resume = mv3310_resume,
.soft_reset = genphy_no_soft_reset,
.config_init = mv3310_config_init,
.config_aneg = mv3310_config_aneg,
.aneg_done = mv3310_aneg_done,

View File

@ -564,6 +564,5 @@ struct phy_driver genphy_c45_driver = {
.phy_id = 0xffffffff,
.phy_id_mask = 0xffffffff,
.name = "Generic Clause 45 PHY",
.soft_reset = genphy_no_soft_reset,
.read_status = genphy_c45_read_status,
};

View File

@ -1082,8 +1082,12 @@ int phy_init_hw(struct phy_device *phydev)
if (!phydev->drv)
return 0;
if (phydev->drv->soft_reset)
if (phydev->drv->soft_reset) {
ret = phydev->drv->soft_reset(phydev);
/* see comment in genphy_soft_reset for an explanation */
if (!ret)
phydev->suspended = 0;
}
if (ret < 0)
return ret;
@ -1524,6 +1528,9 @@ int phy_suspend(struct phy_device *phydev)
struct phy_driver *phydrv = phydev->drv;
int ret;
if (phydev->suspended)
return 0;
/* If the device has WOL enabled, we cannot suspend the PHY */
phy_ethtool_get_wol(phydev, &wol);
if (wol.wolopts || (netdev && netdev->wol_enabled))
@ -2154,6 +2161,12 @@ int genphy_soft_reset(struct phy_device *phydev)
if (ret < 0)
return ret;
/* Clause 22 states that setting bit BMCR_RESET sets control registers
* to their default value. Therefore the POWER DOWN bit is supposed to
* be cleared after soft reset.
*/
phydev->suspended = 0;
ret = phy_poll_reset(phydev);
if (ret)
return ret;
@ -2627,7 +2640,6 @@ static struct phy_driver genphy_driver = {
.phy_id = 0xffffffff,
.phy_id_mask = 0xffffffff,
.name = "Generic PHY",
.soft_reset = genphy_no_soft_reset,
.get_features = genphy_read_abilities,
.suspend = genphy_suspend,
.resume = genphy_resume,

View File

@ -78,7 +78,6 @@ static struct phy_driver teranetics_driver[] = {
.phy_id_mask = 0xffffffff,
.name = "Teranetics TN2020",
.features = PHY_10GBIT_FEATURES,
.soft_reset = genphy_no_soft_reset,
.aneg_done = teranetics_aneg_done,
.config_aneg = gen10g_config_aneg,
.read_status = teranetics_read_status,

View File

@ -1251,10 +1251,6 @@ static inline int genphy_config_aneg(struct phy_device *phydev)
return __genphy_config_aneg(phydev, false);
}
static inline int genphy_no_soft_reset(struct phy_device *phydev)
{
return 0;
}
static inline int genphy_no_ack_interrupt(struct phy_device *phydev)
{
return 0;