lkml.org 
[lkml]   [2022]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 1/2] net: phylink: add sync flag mac_ready to fix resume issue with WoL enabled
Date
Hi Russell,

> -----Original Message-----
> From: Russell King <linux@armlinux.org.uk>
> Sent: 2022年11月30日 19:24
> To: Clark Wang <xiaoning.wang@nxp.com>
> Cc: peppe.cavallaro@st.com; alexandre.torgue@foss.st.com;
> joabreu@synopsys.com; davem@davemloft.net; edumazet@google.com;
> kuba@kernel.org; pabeni@redhat.com; mcoquelin.stm32@gmail.com;
> andrew@lunn.ch; hkallweit1@gmail.com; netdev@vger.kernel.org;
> linux-stm32@st-md-mailman.stormreply.com;
> linux-arm-kernel@lists.infradead.org; linux-kernel@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().

Thanks again!
Clark Wang

>
> --
> RMK's Patch system:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.ar
> mlinux.org.uk%2Fdeveloper%2Fpatches%2F&amp;data=05%7C01%7Cxiaoning.
> wang%40nxp.com%7C5b2cf0060616410813ca08dad2c55a11%7C686ea1d3bc2
> b4c6fa92cd99c5c301635%7C0%7C0%7C638054042306464657%7CUnknown%
> 7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwi
> LCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=CPhQpnvoV95ch%2FUc
> M4Rb2HvY0r24I0FsVSKM9hO13FI%3D&amp;reserved=0
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
\
 
 \ /
  Last update: 2022-11-30 12:34    [W:1.718 / U:1.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site