Re: [PATCH net-next v5 5/6] net: usb: lan78xx: Integrate EEE support with phylink LPI API

From: Rengarajan.S
Date: Tue Mar 25 2025 - 13:52:00 EST


Hi Oleksij,

On Wed, 2025-03-19 at 09:49 +0100, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> Refactor Energy-Efficient Ethernet (EEE) support in the LAN78xx
> driver to
> fully integrate with the phylink Low Power Idle (LPI) API. This
> includes:
>
> - Replacing direct calls to `phy_ethtool_get_eee` and
> `phy_ethtool_set_eee`
> with `phylink_ethtool_get_eee` and `phylink_ethtool_set_eee`.
> - Implementing `.mac_enable_tx_lpi` and `.mac_disable_tx_lpi` to
> control
> LPI transitions via phylink.
> - Configuring `lpi_timer_default` to align with recommended values
> from
> LAN7800 documentation.
> - ensure EEE is disabled on controller reset
>
> Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
> ---
> changes v5:
> - remove redundant error prints
> changes v2:
> - use latest PHYlink TX_LPI API
> ---
> drivers/net/usb/lan78xx.c | 111 +++++++++++++++++++++++-------------
> --
> 1 file changed, 67 insertions(+), 44 deletions(-)
>
> diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
> index 9ff8e7850e1e..074ac4d1cbcb 100644
> --- a/drivers/net/usb/lan78xx.c
> +++ b/drivers/net/usb/lan78xx.c
>
> +static int lan78xx_mac_eee_enable(struct lan78xx_net *dev, bool
> enable)
> +{
> + u32 mac_cr = 0;
> +
> + if (enable)
> + mac_cr |= MAC_CR_EEE_EN_;
> +
> + /* make sure TXEN and RXEN are disabled before reconfiguring
> MAC */
> + return lan78xx_update_reg(dev, MAC_CR, MAC_CR_EEE_EN_,
> mac_cr);

Is it possible to add a check to make sure TXEN and RXEN are disabled
before updating the MAC. Is it taken care by phylink itself?

> --
> 2.39.5
>