Skip to content

Commit

Permalink
net: phy: prevent PHYs w/o Clause 22 regs from calling genphy_config_…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Camelia Groza authored and David S. Miller committed Jul 25, 2018
1 parent 7e50b2a commit 3478600
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/net/phy/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 3478600

Please sign in to comment.