net: bcmgenet: use genphy_c45_eee_is_active directly, instead of phy_init_eee
Subsystems (3)
PATCH 1/1 net: bcmgenet: use genphy_c45_eee_is_active directly, instead of phy_init_eee
Use genphy_c45_eee_is_active directly instead of phy_init_eee, this prepares for removing phy_init_eee. With the second argument being Null, phy_init_eee doesn't initialize anything.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 3 ++- drivers/net/ethernet/broadcom/genet/bcmmii.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +2 -1
@@ -1350,7 +1350,8 @@ static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_keee *e)if (!p->eee_enabled) {bcmgenet_eee_enable_set (dev, false, false); }else { - active =phy_init_eee (dev->phydev, false) >=0 ; + active = dev->phydev->drv && +genphy_c45_eee_is_active (dev->phydev,NULL ) >0 ;bcmgenet_umac_writel (priv, e->tx_lpi_timer,UMAC_EEE_LPI_TIMER );bcmgenet_eee_enable_set (dev, active, e->tx_lpi_enabled); }
drivers/net/ethernet/broadcom/genet/bcmmii.c +1 -1
@@ -91,7 +91,7 @@ static void bcmgenet_mac_config(struct net_device *dev)bcmgenet_umac_writel (priv, reg,UMAC_CMD );spin_unlock_bh (&priv->reg_lock); - active =phy_init_eee (phydev,0 ) >=0 ; + active = phydev->drv &&genphy_c45_eee_is_active (phydev,NULL ) >0 ;bcmgenet_eee_enable_set (dev, priv->eee.eee_enabled && active, priv->eee.tx_lpi_enabled);
Signature · 1 line
2.48.1
Quoted 3 lines · Heiner Kallweit
Use
genphy_c45_eee_is_activedirectly instead ofphy_init_eee, this prepares for removingphy_init_eee. With the second argument being Null,phy_init_eeedoesn't initialize anything.
bcmgenet_set_eee() is an example where EEE is done wrong. EEE is negotiated, so you cannot configure the MAC until autoneg has completed. So phy_init_eee() should only be called from the adjust link callback. In this driver, it is only being called in the ethtool .set_ee op, which is wrong. So all this patch does is replace one broken things with another broken thing.
Please consider my old patch:
https://github.com/lunn/linux/commit/c226f4dbe9aa9c51c1308561aba64c722dab04fb
It will need updating, but this is how i think this should be solved.
Andrew
Florian Fainelli
maintainerQuoted 12 lines · Andrew Lunn
Quoted 3 lines · Heiner Kallweit
Use
genphy_c45_eee_is_activedirectly instead ofphy_init_eee, this prepares for removingphy_init_eee. With the second argument being Null,phy_init_eeedoesn't initialize anything.
bcmgenet_set_eee()is an example where EEE is done wrong. EEE is negotiated, so you cannot configure the MAC until autoneg has completed. Sophy_init_eee()should only be called from the adjust link callback. In this driver, it is only being called in the ethtool .set_ee op, which is wrong. So all this patch does is replace one broken things with another broken thing.
Quoted 5 lines
Please consider my old patch:
https://github.com/lunn/linux/commit/c226f4dbe9aa9c51c1308561aba64c722dab04fb
It will need updating, but this is how i think this should be solved.
Your old patch was tested and had regressions, and I did not see a follow up to it. The Raspberry Pi 4 systems use this Ethernet controller and the PHY does have EEE available, so it should not be too hard to get
a platform to test on.
Signature · 1 line
Florian