summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2017-06-05 12:22:55 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-13 19:52:19 +0200
commitdd1c55ea4c42e941cca85b53ea5ec6d66107f306 (patch)
tree1fca6f547d103c1cfb94f100e0720edf7a894c49 /drivers
parent99e6a55fedd64fe163301611571fff71a657b1e0 (diff)
downloadlinux-stable-dd1c55ea4c42e941cca85b53ea5ec6d66107f306.tar.gz
linux-stable-dd1c55ea4c42e941cca85b53ea5ec6d66107f306.tar.bz2
linux-stable-dd1c55ea4c42e941cca85b53ea5ec6d66107f306.zip
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 <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/phy/phy.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 7ae062743bad..59a6973fe760 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -123,6 +123,12 @@ static inline int phy_aneg_done(struct phy_device *phydev)
if (phydev->drv->aneg_done)
return phydev->drv->aneg_done(phydev);
+ /* Avoid genphy_aneg_done() if the Clause 45 PHY does not
+ * implement Clause 22 registers
+ */
+ if (phydev->is_c45 && !(phydev->c45_ids.devices_in_package & BIT(0)))
+ return -EINVAL;
+
return genphy_aneg_done(phydev);
}