summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
authorRussell King2017-06-05 13:22:55 +0200
committerDavid S. Miller2017-06-07 03:14:13 +0200
commit41408ad519f7a2a1c5229e61f2a97f4df1b61adc (patch)
tree18ada5b43daa45ddaefd02d22bcc6ba0aba705f3 /drivers/net/phy/phy.c
parentnet: phy: add 802.3 clause 45 support to phylib (diff)
downloadkernel-qcow2-linux-41408ad519f7a2a1c5229e61f2a97f4df1b61adc.tar.gz
kernel-qcow2-linux-41408ad519f7a2a1c5229e61f2a97f4df1b61adc.tar.xz
kernel-qcow2-linux-41408ad519f7a2a1c5229e61f2a97f4df1b61adc.zip
net: phy: avoid genphy_aneg_done() for PHYs without clause 22 support
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>
Diffstat (limited to 'drivers/net/phy/phy.c')
-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 40f4c6a2ef6c..c232ee04754b 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -163,6 +163,12 @@ int phy_aneg_done(struct phy_device *phydev)
if (phydev->drv && 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);
}
EXPORT_SYMBOL(phy_aneg_done);