net: phy: disable EEE on TI PHYs
Subsystems (3)
Russell King (Oracle)
reviewerv2 cover net: phy: disable EEE on TI PHYs
Hi,
Towards the end of October, we discussed EEE on TI PHYs which seems to cause problems with the stmmac hardware. This problem was never fully diagnosed, but it was identified that TI PHYs do not support LPI signalling, but report that EEE is supported, and they implement the advertisement registers and that functionality.
This series allows PHY drivers to disable EEE support.
v2:
- integrate Oleksij Rempel's review comments, and merge update into patch 2 to allow EEE on non-1G variants.
drivers/net/phy/dp83867.c | 1 + drivers/net/phy/dp83869.c | 1 + drivers/net/phy/phy-core.c | 2 -- drivers/net/phy/phy_device.c | 32 +++++++++++++++++++++++++++++--- include/linux/phy.h | 1 + 5 files changed, 32 insertions(+), 5 deletions(-)
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
PATCH v2 1/2 net: phy: allow drivers to disable EEE support via .get_features()
Allow PHY drivers to hook the .get_features() method to disable EEE support. This is useful for TI PHYs, where we have a statement that none of their gigabit products support EEE, yet at least DP83867 reports EEE capabilties and implements EEE negotiation.
--- drivers/net/phy/phy-core.c | 2 -- drivers/net/phy/phy_device.c | 32 +++++++++++++++++++++++++++++--- include/linux/phy.h | 1 + 3 files changed, 30 insertions(+), 5 deletions(-)
drivers/net/phy/phy-core.c +0 -2
@@ -207,8 +207,6 @@ void of_set_phy_eee_broken(struct phy_device *phydev)if (!IS_ENABLED (CONFIG_OF_MDIO ) || !node)return ; -linkmode_zero (modes); -if (of_property_read_bool (node,"eee-broken-100tx" ))linkmode_set_bit (ETHTOOL_LINK_MODE_100baseT_Full_BIT, modes);if (of_property_read_bool (node,"eee-broken-1000t" ))
drivers/net/phy/phy_device.c +29 -3
@@ -3397,6 +3397,34 @@ struct fwnode_handle *fwnode_get_phy_node(const struct fwnode_handle *fwnode) }EXPORT_SYMBOL_GPL (fwnode_get_phy_node); +static int phy_get_features (struct phy_device *phydev) +{ +int err; + +if (phydev->is_c45) + err =genphy_c45_pma_read_abilities (phydev); +else + err =genphy_read_abilities (phydev); + +return err; +} + +/** +* phy_get_features_no_eee - read the PHY features, disabling all EEE +* @phydev: phy_device structure to be added to the MDIO bus +* +* Read the PHY features, and fill the @phydev->eee_disabled_modes to +* prevent EEE being used. This is intended to be used for PHY .get_feature +* methods where a PHY reports incorrect capabilities. +*/ +int phy_get_features_no_eee (struct phy_device *phydev) +{ +linkmode_fill (phydev->eee_disabled_modes); + +return phy_get_features (phydev); +} +EXPORT_SYMBOL_GPL (phy_get_features_no_eee); +/** * phy_probe - probe and init a PHY device * @dev: device to probe and init
@@ -3442,10 +3470,8 @@ static int phy_probe(struct device *dev) }else if (phydrv->get_features) err = phydrv->get_features (phydev); -else if (phydev->is_c45) - err =genphy_c45_pma_read_abilities (phydev);else - err =genphy_read_abilities (phydev); + err =phy_get_features (phydev);if (err) goto out;
include/linux/phy.h +1 -0
@@ -2299,6 +2299,7 @@ void phy_support_sym_pause(struct phy_device *phydev);void phy_support_asym_pause (struct phy_device *phydev);void phy_support_eee (struct phy_device *phydev);void phy_disable_eee (struct phy_device *phydev); +int phy_get_features_no_eee (struct phy_device *phydev);void phy_set_sym_pause (struct phy_device *phydev,bool rx,bool tx,bool autoneg);void phy_set_asym_pause (struct phy_device *phydev,bool rx,bool tx);
Signature · 1 line
2.47.3
PATCH v2 2/2 net: phy: TI PHYs use phy_get_features_no_eee()
In reply to Russell King (Oracle)As TI Gigabit PHYs do not support EEE, use the newly introduced phy_get_features_no_eee() to read the features but mark EEE as disabled.
--- drivers/net/phy/dp83867.c | 1 + drivers/net/phy/dp83869.c | 1 + 2 files changed, 2 insertions(+)
drivers/net/phy/dp83867.c +1 -0
@@ -1124,6 +1124,7 @@ static struct phy_driver dp83867_driver[] = {/* PHY_GBIT_FEATURES */ .probe = dp83867_probe, + .get_features = phy_get_features_no_eee, .config_init = dp83867_config_init, .soft_reset = dp83867_phy_reset,
drivers/net/phy/dp83869.c +1 -0
@@ -906,6 +906,7 @@ static int dp83869_phy_reset(struct phy_device *phydev)PHY_ID_MATCH_MODEL (_id), \ .name = (_name), \ .probe = dp83869_probe, \ + .get_features = phy_get_features_no_eee, \ .config_init = dp83869_config_init, \ .soft_reset = dp83869_phy_reset, \ .config_intr = dp83869_config_intr, \
Signature · 1 line
2.47.3
Heiner Kallweit
maintainerQuoted 14 lines · Russell King (Oracle)
Hi,
Towards the end of October, we discussed EEE on TI PHYs which seems to cause problems with the stmmac hardware. This problem was never fully diagnosed, but it was identified that TI PHYs do not support LPI signalling, but report that EEE is supported, and they implement the advertisement registers and that functionality.
This series allows PHY drivers to disable EEE support.
v2:
- integrate Oleksij Rempel's review comments, and merge update into patch 2 to allow EEE on non-1G variants.
Quoted 7 lines
drivers/net/phy/dp83867.c | 1 + drivers/net/phy/dp83869.c | 1 + drivers/net/phy/phy-core.c | 2 -- drivers/net/phy/phy_device.c | 32 +++++++++++++++++++++++++++++--- include/linux/phy.h | 1 + 5 files changed, 32 insertions(+), 5 deletions(-)
Alternatively the PHY driver could call phy_disable_eee() in its config_init. Then we wouldn't have to touch core code.
Russell King (Oracle)
reviewerQuoted 23 lines · Heiner Kallweit
Quoted 14 lines · Russell King (Oracle)
Hi,
Towards the end of October, we discussed EEE on TI PHYs which seems to cause problems with the stmmac hardware. This problem was never fully diagnosed, but it was identified that TI PHYs do not support LPI signalling, but report that EEE is supported, and they implement the advertisement registers and that functionality.
This series allows PHY drivers to disable EEE support.
v2:
- integrate Oleksij Rempel's review comments, and merge update into patch 2 to allow EEE on non-1G variants.Quoted 7 lines
drivers/net/phy/dp83867.c | 1 + drivers/net/phy/dp83869.c | 1 + drivers/net/phy/phy-core.c | 2 -- drivers/net/phy/phy_device.c | 32 +++++++++++++++++++++++++++++--- include/linux/phy.h | 1 + 5 files changed, 32 insertions(+), 5 deletions(-)
Quoted 2 lines
Alternatively the PHY driver could call
phy_disable_eee()in itsconfig_init. Then we wouldn't have to touch core code.
If that's what you intend, then please update the kerneldoc for phy_disable_eee() so that it doesn't state that it's for MAC use (because that implies it's not for PHY drivers.)
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!