Skip to content

Commit

Permalink
net: phy: remove disabled EEE modes from advertising_eee in phy_probe
Browse files Browse the repository at this point in the history
A PHY driver may populate eee_disabled_modes in its probe or get_features
callback, therefore filter the EEE advertisement read from the PHY.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/493f3e2e-9cfc-445d-adbe-58d9c117a489@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Heiner Kallweit authored and Jakub Kicinski committed Feb 19, 2025
1 parent a9b6a86 commit 7f33fea
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions drivers/net/phy/phy_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -3580,22 +3580,21 @@ static int phy_probe(struct device *dev)
if (err)
goto out;

/* There is no "enabled" flag. If PHY is advertising, assume it is
* kind of enabled.
*/
phydev->eee_cfg.eee_enabled = !linkmode_empty(phydev->advertising_eee);
/* Get the EEE modes we want to prohibit. */
of_set_phy_eee_broken(phydev);

/* Some PHYs may advertise, by default, not support EEE modes. So,
* we need to clean them.
* we need to clean them. In addition remove all disabled EEE modes.
*/
if (phydev->eee_cfg.eee_enabled)
linkmode_and(phydev->advertising_eee, phydev->supported_eee,
phydev->advertising_eee);
linkmode_and(phydev->advertising_eee, phydev->supported_eee,
phydev->advertising_eee);
linkmode_andnot(phydev->advertising_eee, phydev->advertising_eee,
phydev->eee_disabled_modes);

/* Get the EEE modes we want to prohibit. We will ask
* the PHY stop advertising these mode later on
/* There is no "enabled" flag. If PHY is advertising, assume it is
* kind of enabled.
*/
of_set_phy_eee_broken(phydev);
phydev->eee_cfg.eee_enabled = !linkmode_empty(phydev->advertising_eee);

/* Get master/slave strap overrides */
of_set_phy_timing_role(phydev);
Expand Down

0 comments on commit 7f33fea

Please sign in to comment.