[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241219173805.503900-1-alexander.sverdlin@siemens.com>
Date: Thu, 19 Dec 2024 18:38:01 +0100
From: "A. Sverdlin" <alexander.sverdlin@...mens.com>
To: netdev@...r.kernel.org
Cc: Alexander Sverdlin <alexander.sverdlin@...mens.com>,
Andrew Lunn <andrew@...n.ch>,
Vladimir Oltean <olteanv@...il.com>
Subject: [PATCH net-next] net: dsa: honor "max-speed" for implicit PHYs on user ports
From: Alexander Sverdlin <alexander.sverdlin@...mens.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@...mens.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
Powered by blists - more mailing lists