mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] net: designware: wait longer for the MAC reset and report a timeout
@ 2026-10-25  9:35 Ahmad Fatoum
  2026-10-25  9:35 ` [PATCH 2/2] net: phy: mdio_bus: honour open-drain PHY reset GPIOs Ahmad Fatoum
  2026-10-26 13:01 ` [PATCH 1/2] net: designware: wait longer for the MAC reset and report a timeout Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2026-10-25  9:35 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The DMA soft reset completes only once the PHY supplies the RX clock,
which doesn't necessarily happen within 10 ms and indeed takes longer
on a Libre Computer Alta if eth_open_all() opens the interface right
after boot.

Let's wait 200 ms like Linux's dwmac_dma_reset() does since commit
56311a315da7 ("net: stmmac: dwmac_lib: enlarge dma reset timeout").

Also propagate the error through dwmac_ether_init(): so far, a possible
timeout while polling the bit was not propagated up to the probe.

Fixes: f0ae0c33f52c ("net: designware: Don't hang in reset with powered down phy")
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 drivers/net/designware.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index de7d3dcf1090..09d11b1d02a3 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -92,7 +92,7 @@ static int mac_reset(struct eth_device *dev)
 
 	start = get_time_ns();
 	while (readl(&dma_p->busmode) & DMAMAC_SRST) {
-		if (is_timeout(start, 10 * MSECOND)) {
+		if (is_timeout(start, 200 * MSECOND)) {
 			dev_err(&priv->netdev.dev, "MAC reset timeout\n");
 			return -EIO;
 		}
@@ -262,7 +262,9 @@ static int dwc_ether_open(struct eth_device *dev)
 	if (ret)
 		return ret;
 
-	dwc_ether_init(dev);
+	ret = dwc_ether_init(dev);
+	if (ret)
+		return ret;
 
 	descs_init(dev);
 
-- 
2.47.3




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-26 13:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-25  9:35 [PATCH 1/2] net: designware: wait longer for the MAC reset and report a timeout Ahmad Fatoum
2026-10-25  9:35 ` [PATCH 2/2] net: phy: mdio_bus: honour open-drain PHY reset GPIOs Ahmad Fatoum
2026-10-26 13:01 ` [PATCH 1/2] net: designware: wait longer for the MAC reset and report a timeout Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox