[PATCH] net: ti: am65-cpsw-nuss: invoke phy_config() in driver's .start callback

Siddharth Vadapalli s-vadapalli at ti.com
Wed Apr 16 14:56:43 CEST 2025


Currently, the phy_config() API is invoked by the driver only once since it
has been probed. While this works in general, it doesn't allow the driver
to bring the PHY back to its default reset state. As a result, the driver
might not be able to recover the PHY from a bad state. To address this,
move phy_config() into the driver's start callback (am65_cpsw_start()).

Apart from providing the means to recover the PHY in the event of failure,
the implementation is in line with the idea of "reset and configure" that
is already followed by am65_cpsw_start() when it comes to programming the
CPSW MAC.

Signed-off-by: Siddharth Vadapalli <s-vadapalli at ti.com>
---

Hello,

This patch is based on commit
f892a7f397a Revert "Merge patch series "pxe: Precursor series for supporting read_all() in extlinux / PXE""
of the next branch of U-Boot.

Regards,
Siddharth.

 drivers/net/ti/am65-cpsw-nuss.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ti/am65-cpsw-nuss.c b/drivers/net/ti/am65-cpsw-nuss.c
index 3c62fc0b428..9b69f36d04d 100644
--- a/drivers/net/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ti/am65-cpsw-nuss.c
@@ -438,6 +438,12 @@ static int am65_cpsw_start(struct udevice *dev)
 		       port->port_sgmii_base + AM65_CPSW_SGMII_CONTROL_REG);
 	}
 
+	ret = phy_config(priv->phydev);
+	if (ret < 0) {
+		dev_err(dev, "phy_config failed: %d", ret);
+		goto err_dis_rx;
+	}
+
 	ret = phy_startup(priv->phydev);
 	if (ret) {
 		dev_err(dev, "phy_startup failed\n");
@@ -639,9 +645,6 @@ static int am65_cpsw_phy_init(struct udevice *dev)
 	phydev->advertising = phydev->supported;
 
 	priv->phydev = phydev;
-	ret = phy_config(phydev);
-	if (ret < 0)
-		dev_err(dev, "phy_config() failed: %d", ret);
 
 	return ret;
 }
-- 
2.34.1



More information about the U-Boot mailing list