Commit 34786005 authored by Camelia Groza's avatar Camelia Groza Committed by David S. Miller

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: default avatarCamelia Groza <camelia.groza@nxp.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7e50b2a5
...@@ -471,7 +471,13 @@ static int phy_config_aneg(struct phy_device *phydev) ...@@ -471,7 +471,13 @@ static int phy_config_aneg(struct phy_device *phydev)
{ {
if (phydev->drv->config_aneg) if (phydev->drv->config_aneg)
return phydev->drv->config_aneg(phydev); return phydev->drv->config_aneg(phydev);
else
/* 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); return genphy_config_aneg(phydev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment