net: dwc_eth_xgmac: Move DMA reset and pad calibration after PHY init
Subsystems (2)
PATCH 1/2 net: dwc_eth_xgmac: Move DMA reset and pad calibration after PHY init
- 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.
--- drivers/net/dwc_eth_xgmac.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/net/dwc_eth_xgmac.c +14 -14
@@ -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 */
Signature · 1 line
2.43.7
PATCH 2/2 phy: micrel: ksz90x1: Issue PHY soft reset during configuration
- Add a call to phy_reset() in ksz9031_config() to ensure the PHY is properly reset during initialization.
- This clears the power-down bit and ensures the PHY recovers correctly after Linux reboot.
Tested on Agilex5 hardware with KSZ90X1 PHY.
--- drivers/net/phy/micrel_ksz90x1.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/phy/micrel_ksz90x1.c +3 -0
@@ -407,6 +407,9 @@ static int ksz9031_config(struct phy_device *phydev)if (ret)return ret; +/* soft reset */ +phy_reset (phydev); +ksz90x1_workaround_asymmetric_pause (phydev);/* add an option to disable the gigabit feature of this PHY */
Signature · 1 line
2.43.7
Jerome Forissier
AppliedRe: [PATCH v1 2/2] phy: micrel: ksz90x1: Issue PHY soft reset during configuration
Quoted 17 lines · Boon Khai Ng
- Add a call to
phy_reset()inksz9031_config()to ensure the PHY is properly reset during initialization.
- This clears the power-down bit and ensures the PHY recovers correctly after Linux reboot.Tested on Agilex5 hardware with KSZ90X1 PHY.
Signed-off-by Boon Khai Ng <[email protected]>--- drivers/net/phy/micrel_ksz90x1.c | 3 +++ 1 file changed, 3 insertions(+)drivers/net/phy/micrel_ksz90x1.c +0
-0
drivers/net/phy/micrel_ksz90x1.c static int ksz9031_config(struct phy_device *phydev) · line 415
Quoted 9 lines
drivers/net/phy/micrel_ksz90x1.c +3
-0@@ -407,6 +407,9 @@ static int ksz9031_config(struct phy_device *phydev)if (ret)return ret; +/* soft reset */ +phy_reset (phydev); +ksz90x1_workaround_asymmetric_pause (phydev);/* add an option to disable the gigabit feature of this PHY */
Queued for net-next, thanks!
Signature · 1 line
Jerome
Jerome Forissier
AppliedQuoted 49 lines · Boon Khai Ng
- 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 <[email protected]>--- drivers/net/dwc_eth_xgmac.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)drivers/net/dwc_eth_xgmac.c +7
-14@@ -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; + }
drivers/net/dwc_eth_xgmac.c static int xgmac_start(struct udevice *dev) · line 564
Quoted 10 lines
drivers/net/dwc_eth_xgmac.c +7
-0+ + 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 */
Queued for net-next, thanks!
Signature · 1 line
Jerome