* [PATCH v1] net: stmmac: add to set device wake up flag when stmmac init phy
@ 2023-03-01 7:47 Rongguang Wei
2023-03-02 4:29 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Rongguang Wei @ 2023-03-01 7:47 UTC (permalink / raw)
To: peppe.cavallaro, alexandre.torgue, xiaolinkui; +Cc: netdev, Rongguang Wei
From: Rongguang Wei <weirongguang@kylinos.cn>
When MAC is not support PMT, driver will check PHY's WoL capability
and set device wakeup capability in stmmac_init_phy(). We can enable
the WoL through ethtool, the driver would enable the device wake up
flag. Now the device_may_wakeup() return true.
But if there is a way which enable the PHY's WoL capability derectly,
like in BIOS. The driver would not know the enable thing and would not
set the device wake up flag. The phy_suspend may failed like this:
[ 32.409063] PM: dpm_run_callback(): mdio_bus_phy_suspend+0x0/0x50 returns -16
[ 32.409065] PM: Device stmmac-1:00 failed to suspend: error -16
[ 32.409067] PM: Some devices failed to suspend, or early wake event detected
Add to set the device wakeup enable flag according to the get_wol
function result in PHY can fix the error in this scene.
Signed-off-by: Rongguang Wei <weirongguang@kylinos.cn>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e4902a7bb61e..8f543c3ab5c5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1170,6 +1170,7 @@ static int stmmac_init_phy(struct net_device *dev)
phylink_ethtool_get_wol(priv->phylink, &wol);
device_set_wakeup_capable(priv->device, !!wol.supported);
+ device_set_wakeup_enable(priv->device, !!wol.wolopts);
}
return ret;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] net: stmmac: add to set device wake up flag when stmmac init phy
2023-03-01 7:47 [PATCH v1] net: stmmac: add to set device wake up flag when stmmac init phy Rongguang Wei
@ 2023-03-02 4:29 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2023-03-02 4:29 UTC (permalink / raw)
To: Rongguang Wei
Cc: peppe.cavallaro, alexandre.torgue, xiaolinkui, netdev, Rongguang Wei
On Wed, 1 Mar 2023 15:47:56 +0800 Rongguang Wei wrote:
> From: Rongguang Wei <weirongguang@kylinos.cn>
>
> When MAC is not support PMT, driver will check PHY's WoL capability
> and set device wakeup capability in stmmac_init_phy(). We can enable
> the WoL through ethtool, the driver would enable the device wake up
> flag. Now the device_may_wakeup() return true.
>
> But if there is a way which enable the PHY's WoL capability derectly,
> like in BIOS. The driver would not know the enable thing and would not
> set the device wake up flag. The phy_suspend may failed like this:
>
> [ 32.409063] PM: dpm_run_callback(): mdio_bus_phy_suspend+0x0/0x50 returns -16
> [ 32.409065] PM: Device stmmac-1:00 failed to suspend: error -16
> [ 32.409067] PM: Some devices failed to suspend, or early wake event detected
>
> Add to set the device wakeup enable flag according to the get_wol
> function result in PHY can fix the error in this scene.
Please add an appropriate Fixes tag and repost if you consider this
a bug fix, or repost next week with [PATCH net-next] for inclusion
in Linux 6.3 if you're okay with the patch being treated as enabling
the feature on more platforms (i.e. not a fix).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-02 4:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-01 7:47 [PATCH v1] net: stmmac: add to set device wake up flag when stmmac init phy Rongguang Wei
2023-03-02 4:29 ` Jakub Kicinski
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).