Skip to contentSkip to conversation

net: designware_eqos: leave the MAC alone while the link is down

PATCH Applied Ahmad Fatoum 2 participants 2 messages Nov 8 – Nov 9 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: designware_eqos: leave the MAC alone while the link is down

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
---
 drivers/net/designware_eqos.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/designware_eqos.c +4 -0
index 763e52f3d70f..68394bf3df17 100644
@@ -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
Signature · 1 line
2.47.3
Applied
#1 lore raw
Quoted 10 lines · 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.

[...]

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,

Signature · 1 line
Sascha Hauer <[email protected]>