[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DB8PR04MB6795C37D718096E7CA1AA72DE6CE9@DB8PR04MB6795.eurprd04.prod.outlook.com>
Date: Thu, 2 Sep 2021 11:15:43 +0000
From: Joakim Zhang <qiangqing.zhang@....com>
To: Russell King <linux@...linux.org.uk>,
"andrew@...n.ch" <andrew@...n.ch>
CC: Vladimir Oltean <olteanv@...il.com>,
"peppe.cavallaro@...com" <peppe.cavallaro@...com>,
"alexandre.torgue@...s.st.com" <alexandre.torgue@...s.st.com>,
"joabreu@...opsys.com" <joabreu@...opsys.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"mcoquelin.stm32@...il.com" <mcoquelin.stm32@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"f.fainelli@...il.com" <f.fainelli@...il.com>,
"hkallweit1@...il.com" <hkallweit1@...il.com>,
dl-linux-imx <linux-imx@....com>
Subject: RE: [PATCH] net: stmmac: fix MAC not working when system resume back
with WoL enabled
Hi Russell,
> -----Original Message-----
> From: Russell King <linux@...linux.org.uk>
> Sent: 2021年9月2日 18:50
> To: Joakim Zhang <qiangqing.zhang@....com>
> Cc: Vladimir Oltean <olteanv@...il.com>; peppe.cavallaro@...com;
> alexandre.torgue@...s.st.com; joabreu@...opsys.com;
> davem@...emloft.net; kuba@...nel.org; mcoquelin.stm32@...il.com;
> netdev@...r.kernel.org; andrew@...n.ch; f.fainelli@...il.com;
> hkallweit1@...il.com; dl-linux-imx <linux-imx@....com>
> Subject: Re: [PATCH] net: stmmac: fix MAC not working when system resume
> back with WoL enabled
>
> On Thu, Sep 02, 2021 at 10:26:13AM +0000, Joakim Zhang wrote:
> >
> > Hi Russell,
> >
> > Thanks a lot!
> >
> > > -----Original Message-----
> > > From: Russell King <linux@...linux.org.uk>
> > > Sent: 2021年9月2日 16:32
> > > To: Joakim Zhang <qiangqing.zhang@....com>
> > > Cc: Vladimir Oltean <olteanv@...il.com>; peppe.cavallaro@...com;
> > > alexandre.torgue@...s.st.com; joabreu@...opsys.com;
> > > davem@...emloft.net; kuba@...nel.org; mcoquelin.stm32@...il.com;
> > > netdev@...r.kernel.org; andrew@...n.ch; f.fainelli@...il.com;
> > > hkallweit1@...il.com; dl-linux-imx <linux-imx@....com>
> > > Subject: Re: [PATCH] net: stmmac: fix MAC not working when system
> > > resume back with WoL enabled
> > >
> > > On Thu, Sep 02, 2021 at 07:28:44AM +0000, Joakim Zhang wrote:
> > > >
> > > > Hi Russell,
> > > >
> > > > > -----Original Message-----
> > > > > From: Russell King <linux@...linux.org.uk>
> > > > > Sent: 2021年9月1日 21:26
> > > > > To: Joakim Zhang <qiangqing.zhang@....com>
> > > > > Cc: Vladimir Oltean <olteanv@...il.com>; peppe.cavallaro@...com;
> > > > > alexandre.torgue@...s.st.com; joabreu@...opsys.com;
> > > > > davem@...emloft.net; kuba@...nel.org;
> mcoquelin.stm32@...il.com;
> > > > > netdev@...r.kernel.org; andrew@...n.ch; f.fainelli@...il.com;
> > > > > hkallweit1@...il.com; dl-linux-imx <linux-imx@....com>
> > > > > Subject: Re: [PATCH] net: stmmac: fix MAC not working when
> > > > > system resume back with WoL enabled
> > > > >
> > > > > This means you need to have the phy <-> mac link up during
> > > > > suspend, and in that case, yes, you do not want to call
> > > > > phylink_stop() or phylink_start().
> > > >
> > > > I have a question here, why need to have the phy<->mac link up
> > > > during
> > > suspend?
> > >
> > > You need the link up because I think from reading the code, it is
> > > _not_ the PHY that is triggering the wakeup in the configuration you are
> using, but the MAC.
> > >
> > > If the link is down, the PHY can't pass the received packet to the
> > > MAC, and the MAC can't recognise the magic packet.
> >
> > Per my understanding, if use PHY-based wakeup, PHY should be active,
> > and MAC can be totally suspended. When PHY receive the magic packets,
> > it will generate a signal via wakeup PIN (PHY seems all have such PIN) to
> inform SoC, we can use this to wake up the system.
> > Please correct me if I misunderstand.
>
> Correct.
>
> > > FEC doesn't have this. FEC relies purely on the PHY detecting the
> > > magic packet, which is much more power efficient, because it means
> > > the MAC doesn't need to be powered up and operational while the rest of
> the system is suspended.
> >
> > AFAIK, FEC also use the MAC-based wakeup, when enable FEC WoL feature,
> > it will keep MAC receive logic active, PHY pass the received packets
> > to MAC, if MAC detects the magic packets, it will generate an interrupt to
> wake up the system.
>
> You're right.
>
> However, as the PHY is not configured for WoL with FEC, and
> fec_suspend() unconditionally calls phy_stop() which will place the PHY into
> suspend mode.
No, phylib has much logic to avoid putting PHY into suspended state if either MAC or
PHY WoL active. Such as in phy_suspend(),
if (wol.wolopts || (netdev && netdev->wol_enabled))
return -EBUSY;
Or in mdio_bus_phy_may_suspend()...
> Maybe the PHY driver there has a NULL phydrv->suspend
> method? However, I see that at803x has suspend methods (which I believe is
> the PHY that gets used with i.MX products) which will power down the PHY.
Yes, we have many boards use AR8031 PHY, and all support MAC-based wakeup feature.
> So, how does this work with FEC - because right now I can't see it working, but
> you say it does.
>
> I think we need to understand how FEC is working here, and we need a deeper
> understanding why stmmac isn't working.
Emm, @andrew@...n.ch, Andrew is much familiar with FEC, and PHY maintainers,
Could you please help put insights here if possible?
> I don't have any iMX systems that support WoL, so this isn't something I can
> test. (SolidRun's i.MX platforms do not support any kind of system power down,
> so suspend isn't supported.)
Understood, thanks.
Best Regards,
Joakim Zhang
Powered by blists - more mailing lists