From: Joakim Zhang <qiangqing.zhang@nxp.com>
To: peppe.cavallaro@st.com, alexandre.torgue@st.com,
joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org,
f.fainelli@gmail.com, andrew@lunn.ch
Cc: netdev@vger.kernel.org, linux-imx@nxp.com, Jisheng.Zhang@synaptics.com
Subject: [PATCH net] net: stmmac: fix MAC WoL unwork if PHY doesn't support WoL
Date: Wed, 7 Apr 2021 18:44:04 +0800 [thread overview]
Message-ID: <20210407104404.5781-1-qiangqing.zhang@nxp.com> (raw)
Both get and set WoL will check device_can_wakeup(), if MAC supports
PMT, it will set device wakeup capability. After commit 1d8e5b0f3f2c ("net:
stmmac: Support WOL with phy"), device wakeup capability will be
overwrite in stmmac_init_phy() according to phy's Wol feature. If phy
doesn't support WoL, then MAC will lose wakeup capability. To fix this
issue, only overwrite device wakeup capability when MAC doesn't support
PMT.
Fixes: commit 1d8e5b0f3f2c ("net: stmmac: Support WOL with phy")
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 208cae344ffa..f46d9c69168f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1103,7 +1103,9 @@ static int stmmac_init_phy(struct net_device *dev)
}
phylink_ethtool_get_wol(priv->phylink, &wol);
- device_set_wakeup_capable(priv->device, !!wol.supported);
+
+ if (!priv->plat->pmt)
+ device_set_wakeup_capable(priv->device, !!wol.supported);
return ret;
}
--
2.17.1
next reply other threads:[~2021-04-07 10:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-07 10:44 Joakim Zhang [this message]
2021-04-07 12:35 ` [PATCH net] net: stmmac: fix MAC WoL unwork if PHY doesn't support WoL Andrew Lunn
2021-04-09 8:19 ` Joakim Zhang
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=20210407104404.5781-1-qiangqing.zhang@nxp.com \
--to=qiangqing.zhang@nxp.com \
--cc=Jisheng.Zhang@synaptics.com \
--cc=alexandre.torgue@st.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=linux-imx@nxp.com \
--cc=netdev@vger.kernel.org \
--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).