mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-04 04:02:26 +00:00
net: fec: Move fec_enet_eee_mode_set() and helper earlier
FEC is about to get its EEE code re-written. To allow this, move fec_enet_eee_mode_set() before fec_enet_adjust_link() which will need to call it. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Wei Fang <wei.fang@nxp.com> Link: https://lore.kernel.org/r/20240302195306.3207716-7-o.rempel@pengutronix.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
49168d1980
commit
aff1b8c84b
@ -2017,6 +2017,44 @@ static int fec_get_mac(struct net_device *ndev)
|
||||
/*
|
||||
* Phy section
|
||||
*/
|
||||
|
||||
/* LPI Sleep Ts count base on tx clk (clk_ref).
|
||||
* The lpi sleep cnt value = X us / (cycle_ns).
|
||||
*/
|
||||
static int fec_enet_us_to_tx_cycle(struct net_device *ndev, int us)
|
||||
{
|
||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||
|
||||
return us * (fep->clk_ref_rate / 1000) / 1000;
|
||||
}
|
||||
|
||||
static int fec_enet_eee_mode_set(struct net_device *ndev, bool enable)
|
||||
{
|
||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||
struct ethtool_keee *p = &fep->eee;
|
||||
unsigned int sleep_cycle, wake_cycle;
|
||||
int ret = 0;
|
||||
|
||||
if (enable) {
|
||||
ret = phy_init_eee(ndev->phydev, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
sleep_cycle = fec_enet_us_to_tx_cycle(ndev, p->tx_lpi_timer);
|
||||
wake_cycle = sleep_cycle;
|
||||
} else {
|
||||
sleep_cycle = 0;
|
||||
wake_cycle = 0;
|
||||
}
|
||||
|
||||
p->tx_lpi_enabled = enable;
|
||||
|
||||
writel(sleep_cycle, fep->hwp + FEC_LPI_SLEEP);
|
||||
writel(wake_cycle, fep->hwp + FEC_LPI_WAKE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void fec_enet_adjust_link(struct net_device *ndev)
|
||||
{
|
||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||
@ -3121,43 +3159,6 @@ static int fec_enet_set_coalesce(struct net_device *ndev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* LPI Sleep Ts count base on tx clk (clk_ref).
|
||||
* The lpi sleep cnt value = X us / (cycle_ns).
|
||||
*/
|
||||
static int fec_enet_us_to_tx_cycle(struct net_device *ndev, int us)
|
||||
{
|
||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||
|
||||
return us * (fep->clk_ref_rate / 1000) / 1000;
|
||||
}
|
||||
|
||||
static int fec_enet_eee_mode_set(struct net_device *ndev, bool enable)
|
||||
{
|
||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||
struct ethtool_keee *p = &fep->eee;
|
||||
unsigned int sleep_cycle, wake_cycle;
|
||||
int ret = 0;
|
||||
|
||||
if (enable) {
|
||||
ret = phy_init_eee(ndev->phydev, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
sleep_cycle = fec_enet_us_to_tx_cycle(ndev, p->tx_lpi_timer);
|
||||
wake_cycle = sleep_cycle;
|
||||
} else {
|
||||
sleep_cycle = 0;
|
||||
wake_cycle = 0;
|
||||
}
|
||||
|
||||
p->tx_lpi_enabled = enable;
|
||||
|
||||
writel(sleep_cycle, fep->hwp + FEC_LPI_SLEEP);
|
||||
writel(wake_cycle, fep->hwp + FEC_LPI_WAKE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
fec_enet_get_eee(struct net_device *ndev, struct ethtool_keee *edata)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user