aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/phy/phy_device.c27
-rw-r--r--include/linux/phy.h1
2 files changed, 23 insertions, 5 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index c2d778d06405..7c21b8214bb9 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -540,11 +540,7 @@ int phy_init_hw(struct phy_device *phydev)
540 if (!phydev->drv || !phydev->drv->config_init) 540 if (!phydev->drv || !phydev->drv->config_init)
541 return 0; 541 return 0;
542 542
543 ret = phy_write(phydev, MII_BMCR, BMCR_RESET); 543 ret = genphy_soft_reset(phydev);
544 if (ret < 0)
545 return ret;
546
547 ret = phy_poll_reset(phydev);
548 if (ret < 0) 544 if (ret < 0)
549 return ret; 545 return ret;
550 546
@@ -1045,6 +1041,27 @@ static int gen10g_read_status(struct phy_device *phydev)
1045 return 0; 1041 return 0;
1046} 1042}
1047 1043
1044/**
1045 * genphy_soft_reset - software reset the PHY via BMCR_RESET bit
1046 * @phydev: target phy_device struct
1047 *
1048 * Description: Perform a software PHY reset using the standard
1049 * BMCR_RESET bit and poll for the reset bit to be cleared.
1050 *
1051 * Returns: 0 on success, < 0 on failure
1052 */
1053int genphy_soft_reset(struct phy_device *phydev)
1054{
1055 int ret;
1056
1057 ret = phy_write(phydev, MII_BMCR, BMCR_RESET);
1058 if (ret < 0)
1059 return ret;
1060
1061 return phy_poll_reset(phydev);
1062}
1063EXPORT_SYMBOL(genphy_soft_reset);
1064
1048static int genphy_config_init(struct phy_device *phydev) 1065static int genphy_config_init(struct phy_device *phydev)
1049{ 1066{
1050 int val; 1067 int val;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index f7fe54628424..bffe0ec1604f 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -666,6 +666,7 @@ int genphy_update_link(struct phy_device *phydev);
666int genphy_read_status(struct phy_device *phydev); 666int genphy_read_status(struct phy_device *phydev);
667int genphy_suspend(struct phy_device *phydev); 667int genphy_suspend(struct phy_device *phydev);
668int genphy_resume(struct phy_device *phydev); 668int genphy_resume(struct phy_device *phydev);
669int genphy_soft_reset(struct phy_device *phydev);
669void phy_driver_unregister(struct phy_driver *drv); 670void phy_driver_unregister(struct phy_driver *drv);
670void phy_drivers_unregister(struct phy_driver *drv, int n); 671void phy_drivers_unregister(struct phy_driver *drv, int n);
671int phy_driver_register(struct phy_driver *new_driver); 672int phy_driver_register(struct phy_driver *new_driver);