netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/5] net: stmmac: fix resume failures due to RX clock
@ 2025-02-27 14:37 Russell King (Oracle)
  2025-02-27 14:37 ` [PATCH RFC net-next 1/5] net: phylink: add config of PHY receive clock-stop in phylink_resume() Russell King (Oracle)
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Russell King (Oracle) @ 2025-02-27 14:37 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Jon Hunter, linux-arm-kernel, linux-stm32,
	Maxime Coquelin, netdev, Paolo Abeni, Thierry Reding

Hi,

This series is likely dependent on the "net: stmmac: cleanup transmit
clock setting" series which was submitted earlier today.

stmmac has a long history of failing to resume due to lack of receive
clock. NVidia have reported that as a result of the EEE changes, they
see a greater chance of resume failure with those patches applied than
before.

The issue is that the DesignWare core requires that the receive clock
is running in order to complete software reset, which causes
stmmac_reset() and stmmac_hw_setup() to fail.

There are several things that are wrong:

1. Calling phylink_start() early can result in a call to mac_link_up()
   which will set TE and RE bits before stmmac_hw_setup() has been
   called. This is evident in the debug logs that NVidia sent while
   debugging the problem.

   This is something I have pointed out in the past, but ithas been
   claimed to be necessary to do things this way to have the PHY
   receive clock running. Enabling RE before DMA is setup is against
   the DesignWare databook documentation.

2. Enabling LPI clock-stop at the PHY (as the driver has done prior
   to my patch set) allows the PHY to stop its receive clock when the
   link enters low-power mode. This means the completion of reset is
   dependent on the current EEE state, which is indeterminable, but
   is likely to be in low power mode on resume.

We solve (1) by moving the call to phylink_resume() later. This patch
on its own probably causes regressions as it may make it more likely
that the link will be in low power state, or maybe the PHY driver does
not respect the PHY_F_RXC_ALWAYS_ON flag - this needs to be tested on
as many different hardware setups that use this driver as possible,
and any issues addressed *without* moving phylink_resume() back.
If we need some way to resume the PHY early, then we need to work out
some way to do that with phylib without calling phy_start() early.

(2) is fixed by introducing phylink_prepare_resume(), which will
disable receive clock-stop in LPI mode at the PHY, and we will restore
the clock-stop setting in phylink_resume(). It is possible that this
solves some of the reason for the early placement of phylink_resume().

phylink_prepare_resume() also provides a convenient site should (1)
need further work.

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 27 +++++++--------
 drivers/net/phy/phylink.c                         | 40 ++++++++++++++++++++++-
 include/linux/phylink.h                           |  1 +
 3 files changed, 51 insertions(+), 17 deletions(-)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-03-06 15:44 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-27 14:37 [PATCH RFC 0/5] net: stmmac: fix resume failures due to RX clock Russell King (Oracle)
2025-02-27 14:37 ` [PATCH RFC net-next 1/5] net: phylink: add config of PHY receive clock-stop in phylink_resume() Russell King (Oracle)
2025-02-27 16:39   ` Andrew Lunn
2025-02-27 14:37 ` [PATCH RFC net-next 2/5] net: phylink: add phylink_prepare_resume() Russell King (Oracle)
2025-02-27 16:40   ` Andrew Lunn
2025-02-27 14:37 ` [PATCH RFC net-next 3/5] net: stmmac: simplify phylink_suspend() and phylink_resume() calls Russell King (Oracle)
2025-02-27 16:45   ` Andrew Lunn
2025-02-27 17:25     ` Russell King (Oracle)
2025-02-27 14:38 ` [PATCH RFC net-next 4/5] net: stmmac: move phylink_resume() after resume setup is complete Russell King (Oracle)
2025-02-27 16:46   ` Andrew Lunn
2025-02-27 14:38 ` [PATCH RFC net-next 5/5] net: stmmac: fix resume when media is in low-power mode Russell King (Oracle)
2025-02-27 16:47   ` Andrew Lunn
2025-03-06 11:30 ` [PATCH RFC 0/5] net: stmmac: fix resume failures due to RX clock Jon Hunter
2025-03-06 15:44   ` Russell King (Oracle)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).