Skip to contentSkip to conversation

phy: call adjust_link in attach if using fixed-link

PATCH In review Clément Leger 2 participants 2 messages Oct 15, 2018 – Oct 16, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: call adjust_link in attach if using fixed-link

Normally, phy_update_status is in charge of reporting a change in link status when phy is updated. When using fixed-link, speed and duplex are initialized directly after registering the phy and there is no driver. Hence when phy_update_status is called, the check for new values fails and returns directly. Since update_link call is mandatory for some network devices to work, call it directly when using fixed link in phy_device_attach to force update of link.

---
 drivers/net/phy/phy.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/phy/phy.c +4 -0
index 42dcad906..63f249fcf 100644
@@ -398,6 +398,10 @@ static int phy_device_attach(struct phy_device *phy, struct eth_device *edev,
 
 	phy->adjust_link = adjust_link;
 
+	/* If the phy is a fixed-link, then call adjust_link directly */
+	if (!phy->bus && adjust_link)
+		adjust_link(edev);
+
 	return 0;
 }
 
Signature · 6 lines
2.15.0.276.g89ea799

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 8 lines · Clément Leger

Normally, phy_update_status is in charge of reporting a change in link status when phy is updated. When using fixed-link, speed and duplex are initialized directly after registering the phy and there is no driver. Hence when phy_update_status is called, the check for new values fails and returns directly. Since update_link call is mandatory for some network devices to work, call it directly when using fixed link in phy_device_attach to force update of link.

Quoted 4 lines
---
 drivers/net/phy/phy.c | 4 ++++
 1 file changed, 4 insertions(+)

Indeed, sounds logical. Applied, thanks

Sascha

Quoted 24 lines
drivers/net/phy/phy.c +4 -0
index 42dcad906..63f249fcf 100644
@@ -398,6 +398,10 @@ static int phy_device_attach(struct phy_device *phy, struct eth_device *edev,
 
 	phy->adjust_link = adjust_link;
 
+	/* If the phy is a fixed-link, then call adjust_link directly */
+	if (!phy->bus && adjust_link)
+		adjust_link(edev);
+
 	return 0;
 }
 
Signature · 6 lines
2.15.0.276.g89ea799

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox