public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: honor "max-speed" for implicit PHYs on user ports
@ 2024-12-19 17:38 A. Sverdlin
  2024-12-19 17:46 ` Vladimir Oltean
  2024-12-19 17:46 ` Andrew Lunn
  0 siblings, 2 replies; 9+ messages in thread
From: A. Sverdlin @ 2024-12-19 17:38 UTC (permalink / raw)
  To: netdev; +Cc: Alexander Sverdlin, Andrew Lunn, Vladimir Oltean

From: Alexander Sverdlin <alexander.sverdlin@siemens.com>

If the PHYs on user ports are not specified explicitly, but a common
user_mii_bus is being registered and scanned there is no way to limit
Auto Negotiation options currently. If a gigabit switch is deployed in a
way that the ports cannot support gigabit rates (4-wire PCB/magnetics,
for instance), there is no way to limit ports' AN not to advertise gigabit
options. Some PHYs take considerably longer time to AutoNegotiate in such
cases.

Provide a way to limit AN advertisement options by examining "max-speed"
property in the DT node of the corresponding user port and call
phy_set_max_speed() right before attaching the PHY to he port netdevice.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
---
 net/dsa/user.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/dsa/user.c b/net/dsa/user.c
index 4a8de48a6f24..9e3f5b0f9af3 100644
--- a/net/dsa/user.c
+++ b/net/dsa/user.c
@@ -2625,6 +2625,13 @@ static int dsa_user_phy_connect(struct net_device *user_dev, int addr,
 
 	user_dev->phydev->dev_flags |= flags;
 
+	if (dp->dn) {
+		u32 max_speed;
+
+		if (!of_property_read_u32(dp->dn, "max-speed", &max_speed))
+			phy_set_max_speed(user_dev->phydev, max_speed);
+	}
+
 	return phylink_connect_phy(dp->pl, user_dev->phydev);
 }
 
-- 
2.47.1


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

end of thread, other threads:[~2024-12-20 10:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-19 17:38 [PATCH net-next] net: dsa: honor "max-speed" for implicit PHYs on user ports A. Sverdlin
2024-12-19 17:46 ` Vladimir Oltean
2024-12-19 18:50   ` Sverdlin, Alexander
2024-12-19 19:36     ` Vladimir Oltean
2024-12-20  7:17       ` Sverdlin, Alexander
2024-12-20  7:30         ` Sverdlin, Alexander
2024-12-20  8:28           ` Andrew Lunn
2024-12-20 10:15         ` Vladimir Oltean
2024-12-19 17:46 ` Andrew Lunn

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