[PATCH 1/2] net: phylink: add sync flag mac_ready to fix resume issue with WoL enabled

Russell King (Oracle) linux at armlinux.org.uk
Wed Nov 30 03:50:50 PST 2022


On Wed, Nov 30, 2022 at 11:32:09AM +0000, Clark Wang wrote:
> Hi Russell,
> 
> > -----Original Message-----
> > From: Russell King <linux at armlinux.org.uk>
> > Sent: 2022年11月30日 19:24
> > To: Clark Wang <xiaoning.wang at nxp.com>
> > Cc: peppe.cavallaro at st.com; alexandre.torgue at foss.st.com;
> > joabreu at synopsys.com; davem at davemloft.net; edumazet at google.com;
> > kuba at kernel.org; pabeni at redhat.com; mcoquelin.stm32 at gmail.com;
> > andrew at lunn.ch; hkallweit1 at gmail.com; netdev at vger.kernel.org;
> > linux-stm32 at st-md-mailman.stormreply.com;
> > linux-arm-kernel at lists.infradead.org; linux-kernel at vger.kernel.org
> > Subject: Re: [PATCH 1/2] net: phylink: add sync flag mac_ready to fix resume
> > issue with WoL enabled
> > 
> > On Wed, Nov 30, 2022 at 07:11:47PM +0800, Clark Wang wrote:
> > > Issue we met:
> > > On some platforms, mac cannot work after resumed from the suspend with
> > > WoL enabled.
> > >
> > > The cause of the issue:
> > > 1. phylink_resolve() is in a workqueue which will not be executed immediately.
> > >    This is the call sequence:
> > >        phylink_resolve()->phylink_link_up()->pl->mac_ops->mac_link_up()
> > >    For stmmac driver, mac_link_up() will set the correct speed/duplex...
> > >    values which are from link_state.
> > > 2. In stmmac_resume(), it will call stmmac_hw_setup() after called the
> > >    phylink_resume(). stmmac_core_init() is called in function
> > > stmmac_hw_setup(),
> > 
> > ... and that is where the problem is. Don't call phylink_resume() before your
> > hardware is ready to see a link-up event.
> 
> Thank you very much for your reply!
> 
> You are right.
> 
> However, stmmac requires RXC to have a clock input when performing a reset(in stmmac_hw_setup()). On our board, RXC is provided by the phy.
> 
> In WoL mode, this is not a problem, because the phy will not be down when suspend. RXC will keep output. But in normal suspend(without WoL), the phy will be down, which does not guarantee the output of the RXC of the phy. Therefore, the previous code will call phylink_resume() before stmmac_hw_setup().

I think we need phylink_phy_resume() which stmmac can use to resume the
PHY without resuming phylink, assuming that will output the RXC. Which
PHY driver(s) are used with stmmac?

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



More information about the linux-arm-kernel mailing list