提交 8c90b795 编写于 作者: H Heiner Kallweit 提交者: David S. Miller

net: phy: improve genphy_soft_reset

PHY's behave differently when being reset. Some reset registers to
defaults, some don't. Some trigger an autoneg restart, some don't.

So let's also set the autoneg restart bit when resetting. Then PHY
behavior should be more consistent. Clearing BMCR_ISOLATE serves the
same purpose and is borrowed from genphy_restart_aneg.

BMCR holds the speed / duplex settings in fixed mode. Therefore
we may have an issue if a soft reset resets BMCR to its default.
So better call genphy_setup_forced() afterwards in fixed mode.
We've seen no related complaint in the last >10 yrs, so let's
treat it as an improvement.
Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f7abc061
......@@ -1815,13 +1815,25 @@ EXPORT_SYMBOL(genphy_read_status);
*/
int genphy_soft_reset(struct phy_device *phydev)
{
u16 res = BMCR_RESET;
int ret;
ret = phy_set_bits(phydev, MII_BMCR, BMCR_RESET);
if (phydev->autoneg == AUTONEG_ENABLE)
res |= BMCR_ANRESTART;
ret = phy_modify(phydev, MII_BMCR, BMCR_ISOLATE, res);
if (ret < 0)
return ret;
return phy_poll_reset(phydev);
ret = phy_poll_reset(phydev);
if (ret)
return ret;
/* BMCR may be reset to defaults */
if (phydev->autoneg == AUTONEG_DISABLE)
ret = genphy_setup_forced(phydev);
return ret;
}
EXPORT_SYMBOL(genphy_soft_reset);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册