Thread (32 messages) flat view 32 messages, 5 authors, 2021-09-07

Re: [PATCH] net: stmmac: fix MAC not working when system resume back with WoL enabled

From: "Russell King (Oracle)" <linux@armlinux.org.uk>
Date: 2021-09-02 10:50:21

On Thu, Sep 02, 2021 at 10:26:13AM +0000, Joakim Zhang wrote:
Hi Russell,

Thanks a lot!
quoted
-----Original Message-----
From: Russell King <linux@armlinux.org.uk>
Sent: 2021年9月2日 16:32
To: Joakim Zhang <redacted>
Cc: Vladimir Oltean <olteanv@gmail.com>; peppe.cavallaro@st.com;
alexandre.torgue@foss.st.com; joabreu@synopsys.com;
davem@davemloft.net; kuba@kernel.org; mcoquelin.stm32@gmail.com;
netdev@vger.kernel.org; andrew@lunn.ch; f.fainelli@gmail.com;
hkallweit1@gmail.com; dl-linux-imx [off-list ref]
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:
quoted
Hi Russell,
quoted
-----Original Message-----
From: Russell King <linux@armlinux.org.uk>
Sent: 2021年9月1日 21:26
To: Joakim Zhang <redacted>
Cc: Vladimir Oltean <olteanv@gmail.com>; peppe.cavallaro@st.com;
alexandre.torgue@foss.st.com; joabreu@synopsys.com;
davem@davemloft.net; kuba@kernel.org; mcoquelin.stm32@gmail.com;
netdev@vger.kernel.org; andrew@lunn.ch; f.fainelli@gmail.com;
hkallweit1@gmail.com; dl-linux-imx [off-list ref]
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.
quoted
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. 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.

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.

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.)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help