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] net: designware_eqos: leave the MAC alone while the link is down
Date: Sun,  8 Nov 2026 21:16:12 +0100	[thread overview]
Message-ID: <20261108201613.1401590-1-a.fatoum@barebox.org> (raw)

The PHY core calls adjust_link on a link loss as well, with whatever
speed and duplex the PHY driver falls back to, 10 Mbit/s half duplex
for genphy, and eqos_adjust_link() programs the MAC for that.

On the Amlogic A9 (DWMAC 5.30 behind the G12A glue, which isn't in
barebox yet), the detour over 10 Mbit/s every so often leaves the RGMII
transmit path dead until the next speed change. On a BY401, that was
about every other ifdown/ifup.

Let's configure the MAC only while the link is up, as Linux does. 20
ifdown/ifup cycles in a row work with that.

Assisted-by: Claude:opus-5.5
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 drivers/net/designware_eqos.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/designware_eqos.c b/drivers/net/designware_eqos.c
index 763e52f3d70f..68394bf3df17 100644
--- a/drivers/net/designware_eqos.c
+++ b/drivers/net/designware_eqos.c
@@ -317,6 +317,10 @@ void eqos_adjust_link(struct eth_device *edev)
 	struct eqos *eqos = edev->priv;
 	unsigned speed = edev->phydev->speed;
 
+	/* Like Linux, leave the MAC alone while the link is down */
+	if (!edev->phydev->link)
+		return;
+
 	if (edev->phydev->duplex)
 		eqos_set_full_duplex(eqos);
 	else
-- 
2.47.3




             reply	other threads:[~2026-11-08 20:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-08 20:16 Ahmad Fatoum [this message]
2026-11-09  9:00 ` 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=20261108201613.1401590-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