mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: designware_eqos: leave the MAC alone while the link is down
@ 2026-11-08 20:16 Ahmad Fatoum
  2026-11-09  9:00 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-11-08 20:16 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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




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

* Re: [PATCH] net: designware_eqos: leave the MAC alone while the link is down
  2026-11-08 20:16 [PATCH] net: designware_eqos: leave the MAC alone while the link is down Ahmad Fatoum
@ 2026-11-09  9:00 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2026-11-09  9:00 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Sun, 08 Nov 2026 21:16:12 +0100, Ahmad Fatoum wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] net: designware_eqos: leave the MAC alone while the link is down
      https://git.pengutronix.de/cgit/barebox/commit/?id=5f286bb04508 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2026-11-09  9:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08 20:16 [PATCH] net: designware_eqos: leave the MAC alone while the link is down Ahmad Fatoum
2026-11-09  9:00 ` Sascha Hauer

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