Skip to content

Commit dd1c55e

Browse files
Russell Kinggregkh
Russell King
authored andcommitted
net: phy: avoid genphy_aneg_done() for PHYs without clause 22 support
[ Upstream commit 41408ad519f7a2a1c5229e61f2a97f4df1b61adc ] Avoid calling genphy_aneg_done() for PHYs that do not implement the Clause 22 register set. Clause 45 PHYs may implement the Clause 22 register set along with the Clause 22 extension MMD. Hence, we can't simply block access to the Clause 22 functions based on the PHY being a Clause 45 PHY. Signed-off-by: Russell King <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 99e6a55 commit dd1c55e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/net/phy/phy.c

+6
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ static inline int phy_aneg_done(struct phy_device *phydev)
123123
if (phydev->drv->aneg_done)
124124
return phydev->drv->aneg_done(phydev);
125125

126+
/* Avoid genphy_aneg_done() if the Clause 45 PHY does not
127+
* implement Clause 22 registers
128+
*/
129+
if (phydev->is_c45 && !(phydev->c45_ids.devices_in_package & BIT(0)))
130+
return -EINVAL;
131+
126132
return genphy_aneg_done(phydev);
127133
}
128134

0 commit comments

Comments
 (0)