mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-28 00:35:00 -04:00
net: phy: c45: add genphy_c45_pma_soft_reset()
Add a generic Clause 45 software reset helper. The helper sets the reset bit in the PMA/PMD control register and waits until the bit is cleared by hardware. Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de> Signed-off-by: Javen Xu <javen_xu@realsil.com.cn> Link: https://patch.msgid.link/20260728073106.1515-2-javen_xu@realsil.com.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -384,6 +384,28 @@ int genphy_c45_check_and_restart_aneg(struct phy_device *phydev, bool restart)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(genphy_c45_check_and_restart_aneg);
|
||||
|
||||
/**
|
||||
* genphy_c45_pma_soft_reset - software reset the PHY via Clause 45 PMA/PMD control register
|
||||
* @phydev: target phy_device struct
|
||||
*
|
||||
* Return: 0 on success, negative errno on failure.
|
||||
*/
|
||||
int genphy_c45_pma_soft_reset(struct phy_device *phydev)
|
||||
{
|
||||
int ret, val;
|
||||
|
||||
ret = phy_set_bits_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1,
|
||||
MDIO_CTRL1_RESET);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return phy_read_mmd_poll_timeout(phydev, MDIO_MMD_PMAPMD,
|
||||
MDIO_CTRL1, val,
|
||||
!(val & MDIO_CTRL1_RESET),
|
||||
5000, 600000, true);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(genphy_c45_pma_soft_reset);
|
||||
|
||||
/**
|
||||
* genphy_c45_aneg_done - return auto-negotiation complete status
|
||||
* @phydev: target phy_device struct
|
||||
|
||||
@@ -2317,6 +2317,7 @@ int genphy_c37_read_status(struct phy_device *phydev, bool *changed);
|
||||
/* Clause 45 PHY */
|
||||
int genphy_c45_restart_aneg(struct phy_device *phydev);
|
||||
int genphy_c45_check_and_restart_aneg(struct phy_device *phydev, bool restart);
|
||||
int genphy_c45_pma_soft_reset(struct phy_device *phydev);
|
||||
int genphy_c45_aneg_done(struct phy_device *phydev);
|
||||
int genphy_c45_read_link(struct phy_device *phydev);
|
||||
int genphy_c45_read_lpa(struct phy_device *phydev);
|
||||
|
||||
Reference in New Issue
Block a user