From: Clark Wang <xiaoning.wang@nxp.com>
To: linux@armlinux.org.uk, 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
Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] net: stmmac: synchronize status with phylink via flag during suspend/resume
Date: Wed, 30 Nov 2022 19:11:48 +0800 [thread overview]
Message-ID: <20221130111148.1064475-3-xiaoning.wang@nxp.com> (raw)
In-Reply-To: <20221130111148.1064475-1-xiaoning.wang@nxp.com>
On some platforms, mac cannot work after resumed from the suspend with WoL
enabled.
We found the stmmac_hw_setup() when system resumes will called after the
stmmac_mac_link_up(). So the correct values set in stmmac_mac_link_up()
are overwritten by stmmac_core_init() in phylink_resolve().
So use the flag added in phylink to keep phylink_resolve() is executed
after the stmmac_hw_setup().
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 18c7ca29da2c..4f89061cc537 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7432,6 +7432,7 @@ int stmmac_suspend(struct device *dev)
phylink_speed_down(priv->phylink, false);
phylink_suspend(priv->phylink, false);
}
+ phylink_clear_mac_ready(priv->phylink);
rtnl_unlock();
if (priv->dma_cap.fpesel) {
@@ -7545,6 +7546,7 @@ int stmmac_resume(struct device *dev)
stmmac_clear_descriptors(priv, &priv->dma_conf);
stmmac_hw_setup(ndev, false);
+ phylink_set_mac_ready(priv->phylink);
stmmac_init_coalesce(priv);
stmmac_set_rx_mode(ndev);
--
2.34.1
prev parent reply other threads:[~2022-11-30 11:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 11:11 [PATCH 0/2] fix mac not working after system resumed with WoL enabled Clark Wang
2022-11-30 11:11 ` [PATCH 1/2] net: phylink: add sync flag mac_ready to fix resume issue " Clark Wang
2022-11-30 11:23 ` Russell King (Oracle)
2022-11-30 11:32 ` Clark Wang
2022-11-30 11:50 ` Russell King (Oracle)
2022-11-30 12:00 ` Clark Wang
2022-11-30 11:32 ` Russell King (Oracle)
2022-11-30 11:38 ` Clark Wang
2022-11-30 11:40 ` Clark Wang
2022-11-30 11:11 ` Clark Wang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221130111148.1064475-3-xiaoning.wang@nxp.com \
--to=xiaoning.wang@nxp.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux@armlinux.org.uk \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).