Skip to contentSkip to conversation

net: of_mdio: fix of_set_phy_supported after driver probing

PATCH In review Florian Fainelli 2 participants 2 messages Feb 13, 2014 – Feb 14, 2014

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

PATCH 1/1 net: of_mdio: fix of_set_phy_supported after driver probing

Commit 8fdade4 ("net: of_mdio: parse "max-speed" property to set PHY supported features") introduced a typo in of_set_phy_supported for the first assignment of phydev->supported which will not effectively limit the PHY device supported features bits if the PHY driver contains "higher" features (e.g: max-speed = <100> and PHY driver has PHY_GBIT_FEATURES set).

Fix this by making sure that the very first thing is to reset to sane defaults (PHY_BASIC_FEATURES) and then progressively add speed features as we parse them.

---
 drivers/of/of_mdio.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/of/of_mdio.c +5 -1
index 875b7b6..495facc 100644
@@ -24,7 +24,11 @@ MODULE_LICENSE("GPL");
 
 static void of_set_phy_supported(struct phy_device *phydev, u32 max_speed)
 {
-	phydev->supported |= PHY_DEFAULT_FEATURES;
+	/* The default values for phydev->supported are provided by the PHY
+	 * driver "features" member, we want to reset to sane defaults fist
+	 * before supporting higher speeds.
+	 */
+	phydev->supported &= PHY_DEFAULT_FEATURES;
 
 	switch (max_speed) {
 	default:
Signature · 1 line
1.8.3.2
maintainer
#1 lore raw

From: Florian Fainelli <[email protected]>
Date: Thu, 13 Feb 2014 13:14:48 -0800

Quoted 7 lines

Commit 8fdade4 ("net: of_mdio: parse "max-speed" property to set PHY supported features") introduced a typo in of_set_phy_supported for the first assignment of phydev->supported which will not effectively limit the PHY device supported features bits if the PHY driver contains "higher" features (e.g: max-speed = <100> and PHY driver has PHY_GBIT_FEATURES set).

Quoted 5 lines

Fix this by making sure that the very first thing is to reset to sane defaults (PHY_BASIC_FEATURES) and then progressively add speed features as we parse them.

Applied and queued up for -stable, thanks.