Skip to content

Commit 86e5813

Browse files
Russell Kingdavem330
authored andcommitted
net: phylink: add phylink_init_eee() helper
Provide phylink_init_eee() to allow MAC drivers to initialise PHY EEE from within the ethtool set_eee() method. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0946cf1 commit 86e5813

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

drivers/net/phy/phylink.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,6 +1271,24 @@ int phylink_get_eee_err(struct phylink *pl)
12711271
}
12721272
EXPORT_SYMBOL_GPL(phylink_get_eee_err);
12731273

1274+
/**
1275+
* phylink_init_eee() - init and check the EEE features
1276+
* @pl: a pointer to a &struct phylink returned from phylink_create()
1277+
* @clk_stop_enable: allow PHY to stop receive clock
1278+
*
1279+
* Must be called either with RTNL held or within mac_link_up()
1280+
*/
1281+
int phylink_init_eee(struct phylink *pl, bool clk_stop_enable)
1282+
{
1283+
int ret = -EOPNOTSUPP;
1284+
1285+
if (pl->phydev)
1286+
ret = phy_init_eee(pl->phydev, clk_stop_enable);
1287+
1288+
return ret;
1289+
}
1290+
EXPORT_SYMBOL_GPL(phylink_init_eee);
1291+
12741292
/**
12751293
* phylink_ethtool_get_eee() - read the energy efficient ethernet parameters
12761294
* @pl: a pointer to a &struct phylink returned from phylink_create()

include/linux/phylink.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ void phylink_ethtool_get_pauseparam(struct phylink *,
220220
int phylink_ethtool_set_pauseparam(struct phylink *,
221221
struct ethtool_pauseparam *);
222222
int phylink_get_eee_err(struct phylink *);
223+
int phylink_init_eee(struct phylink *, bool);
223224
int phylink_ethtool_get_eee(struct phylink *, struct ethtool_eee *);
224225
int phylink_ethtool_set_eee(struct phylink *, struct ethtool_eee *);
225226
int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);

0 commit comments

Comments
 (0)