mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH 1/2] net: designware: wait longer for the MAC reset and report a timeout
Date: Sun, 25 Oct 2026 10:35:34 +0100	[thread overview]
Message-ID: <20261025093538.2890451-1-a.fatoum@barebox.org> (raw)

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




             reply	other threads:[~2026-10-25  9:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-25  9:35 Ahmad Fatoum [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261025093538.2890451-1-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox