[PATCH v1 1/2] net: dwc_eth_xgmac: Move DMA reset and pad calibration after PHY init

Boon Khai Ng boon.khai.ng at altera.com
Thu Mar 12 12:22:46 CET 2026


- Move DMA software reset and pad calibration in xgmac_start() to occur
  after the PHY is initialized and connected.
- This ensures the PHY is ready before performing these operations,
  which is necessary for proper recovery after reboot.

This change fixes issues where the PHY did not recover from power-down
state after a Linux reboot, for the board using Micrel KSZ90x1 PHY.

Signed-off-by: Boon Khai Ng <boon.khai.ng at altera.com>
---
 drivers/net/dwc_eth_xgmac.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/dwc_eth_xgmac.c b/drivers/net/dwc_eth_xgmac.c
index 458b87af7a2..2ab5ec5f0d9 100644
--- a/drivers/net/dwc_eth_xgmac.c
+++ b/drivers/net/dwc_eth_xgmac.c
@@ -497,20 +497,6 @@ static int xgmac_start(struct udevice *dev)
 
 	xgmac->reg_access_ok = true;
 
-	ret = wait_for_bit_le32(&xgmac->dma_regs->mode,
-				XGMAC_DMA_MODE_SWR, false,
-				xgmac->config->swr_wait, false);
-	if (ret) {
-		pr_err("%s XGMAC_DMA_MODE_SWR stuck: %d\n", dev->name, ret);
-		goto err_stop_resets;
-	}
-
-	ret = xgmac->config->ops->xgmac_calibrate_pads(dev);
-	if (ret < 0) {
-		pr_err("%s xgmac_calibrate_pads() failed: %d\n", dev->name, ret);
-		goto err_stop_resets;
-	}
-
 	/*
 	 * if PHY was already connected and configured,
 	 * don't need to reconnect/reconfigure again
@@ -559,6 +545,20 @@ static int xgmac_start(struct udevice *dev)
 		goto err_shutdown_phy;
 	}
 
+	ret = wait_for_bit_le32(&xgmac->dma_regs->mode,
+				XGMAC_DMA_MODE_SWR, false,
+				xgmac->config->swr_wait, false);
+	if (ret) {
+		pr_err("%s XGMAC_DMA_MODE_SWR stuck: %d\n", dev->name, ret);
+		goto err_stop_resets;
+	}
+
+	ret = xgmac->config->ops->xgmac_calibrate_pads(dev);
+	if (ret < 0) {
+		pr_err("%s xgmac_calibrate_pads() failed: %d\n", dev->name, ret);
+		goto err_stop_resets;
+	}
+
 	/* Configure MTL */
 
 	/* Enable Store and Forward mode for TX */
-- 
2.43.7



More information about the U-Boot mailing list