Skip to content

Commit 5fde7ed

Browse files
committed
Merge branch 'net-add-and-use-phy_disable_eee'
Heiner Kallweit says: ==================== net: add and use phy_disable_eee If a MAC driver doesn't support EEE, then the PHY shouldn't advertise it. Add phy_disable_eee() for this purpose, and use it in cpsw driver. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents e8f3323 + c9f5a5d commit 5fde7ed

File tree

6 files changed

+21
-15
lines changed

6 files changed

+21
-15
lines changed

drivers/net/ethernet/ti/cpsw.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,8 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
635635

636636
slave->phy = phy;
637637

638+
phy_disable_eee(slave->phy);
639+
638640
phy_attached_info(slave->phy);
639641

640642
phy_start(slave->phy);
@@ -1225,7 +1227,6 @@ static const struct ethtool_ops cpsw_ethtool_ops = {
12251227
.get_link_ksettings = cpsw_get_link_ksettings,
12261228
.set_link_ksettings = cpsw_set_link_ksettings,
12271229
.get_eee = cpsw_get_eee,
1228-
.set_eee = cpsw_set_eee,
12291230
.nway_reset = cpsw_nway_reset,
12301231
.get_ringparam = cpsw_get_ringparam,
12311232
.set_ringparam = cpsw_set_ringparam,

drivers/net/ethernet/ti/cpsw_ethtool.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -434,18 +434,6 @@ int cpsw_get_eee(struct net_device *ndev, struct ethtool_keee *edata)
434434
return -EOPNOTSUPP;
435435
}
436436

437-
int cpsw_set_eee(struct net_device *ndev, struct ethtool_keee *edata)
438-
{
439-
struct cpsw_priv *priv = netdev_priv(ndev);
440-
struct cpsw_common *cpsw = priv->cpsw;
441-
int slave_no = cpsw_slave_index(cpsw, priv);
442-
443-
if (cpsw->slaves[slave_no].phy)
444-
return phy_ethtool_set_eee(cpsw->slaves[slave_no].phy, edata);
445-
else
446-
return -EOPNOTSUPP;
447-
}
448-
449437
int cpsw_nway_reset(struct net_device *ndev)
450438
{
451439
struct cpsw_priv *priv = netdev_priv(ndev);

drivers/net/ethernet/ti/cpsw_new.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,8 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
778778

779779
slave->phy = phy;
780780

781+
phy_disable_eee(slave->phy);
782+
781783
phy_attached_info(slave->phy);
782784

783785
phy_start(slave->phy);
@@ -1209,7 +1211,6 @@ static const struct ethtool_ops cpsw_ethtool_ops = {
12091211
.get_link_ksettings = cpsw_get_link_ksettings,
12101212
.set_link_ksettings = cpsw_set_link_ksettings,
12111213
.get_eee = cpsw_get_eee,
1212-
.set_eee = cpsw_set_eee,
12131214
.nway_reset = cpsw_nway_reset,
12141215
.get_ringparam = cpsw_get_ringparam,
12151216
.set_ringparam = cpsw_set_ringparam,

drivers/net/ethernet/ti/cpsw_priv.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,6 @@ int cpsw_get_link_ksettings(struct net_device *ndev,
497497
int cpsw_set_link_ksettings(struct net_device *ndev,
498498
const struct ethtool_link_ksettings *ecmd);
499499
int cpsw_get_eee(struct net_device *ndev, struct ethtool_keee *edata);
500-
int cpsw_set_eee(struct net_device *ndev, struct ethtool_keee *edata);
501500
int cpsw_nway_reset(struct net_device *ndev);
502501
void cpsw_get_ringparam(struct net_device *ndev,
503502
struct ethtool_ringparam *ering,

drivers/net/phy/phy_device.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3003,6 +3003,22 @@ void phy_support_eee(struct phy_device *phydev)
30033003
}
30043004
EXPORT_SYMBOL(phy_support_eee);
30053005

3006+
/**
3007+
* phy_disable_eee - Disable EEE for the PHY
3008+
* @phydev: Target phy_device struct
3009+
*
3010+
* This function is used by MAC drivers for MAC's which don't support EEE.
3011+
* It disables EEE on the PHY layer.
3012+
*/
3013+
void phy_disable_eee(struct phy_device *phydev)
3014+
{
3015+
linkmode_zero(phydev->supported_eee);
3016+
linkmode_zero(phydev->advertising_eee);
3017+
phydev->eee_cfg.tx_lpi_enabled = false;
3018+
phydev->eee_cfg.eee_enabled = false;
3019+
}
3020+
EXPORT_SYMBOL_GPL(phy_disable_eee);
3021+
30063022
/**
30073023
* phy_support_sym_pause - Enable support of symmetrical pause
30083024
* @phydev: target phy_device struct

include/linux/phy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,6 +2071,7 @@ void phy_advertise_eee_all(struct phy_device *phydev);
20712071
void phy_support_sym_pause(struct phy_device *phydev);
20722072
void phy_support_asym_pause(struct phy_device *phydev);
20732073
void phy_support_eee(struct phy_device *phydev);
2074+
void phy_disable_eee(struct phy_device *phydev);
20742075
void phy_set_sym_pause(struct phy_device *phydev, bool rx, bool tx,
20752076
bool autoneg);
20762077
void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx);

0 commit comments

Comments
 (0)