diff options
author | Camelia Groza <camelia.groza@nxp.com> | 2018-07-23 18:06:15 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-07-25 13:02:37 -0700 |
commit | 34786005eca3b53cffa95d686bf3b7da1305867c (patch) | |
tree | c460b03b3f1d0e6fdccffeca0e3c68a8aeb05625 /drivers/net/phy | |
parent | 7e50b2a51d3c40558e4f3f56827e5909d7a723e6 (diff) | |
download | lwn-34786005eca3b53cffa95d686bf3b7da1305867c.tar.gz lwn-34786005eca3b53cffa95d686bf3b7da1305867c.zip |
net: phy: prevent PHYs w/o Clause 22 regs from calling genphy_config_aneg
genphy_config_aneg() should be called only by PHYs that implement
the Clause 22 register set. Prevent Clause 45 PHYs that don't implement
the register set from calling the genphy function.
Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/phy.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 914fe8e6ac86..04780db4c963 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -471,8 +471,14 @@ static int phy_config_aneg(struct phy_device *phydev) { if (phydev->drv->config_aneg) return phydev->drv->config_aneg(phydev); - else - return genphy_config_aneg(phydev); + + /* Clause 45 PHYs that don't implement Clause 22 registers are not + * allowed to call genphy_config_aneg() + */ + if (phydev->is_c45 && !(phydev->c45_ids.devices_in_package & BIT(0))) + return -EOPNOTSUPP; + + return genphy_config_aneg(phydev); } /** |