]> git.baikalelectronics.ru Git - kernel.git/commit
net: stmmac: add to set device wake up flag when stmmac init phy
authorRongguang Wei <weirongguang@kylinos.cn>
Thu, 2 Mar 2023 06:21:43 +0000 (14:21 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:50:25 +0000 (08:50 +0100)
commitbdbdcf01c91c6cdb183d5794721f767fb7706eaa
treec2c55cab1f4d03980ec741beba96c7a1bd503176
parentb7d2a93db0d74791d62426f96aa78b32129eb36e
net: stmmac: add to set device wake up flag when stmmac init phy

[ Upstream commit 51814ce267d5c687ab9d3264b928b34a1c2d1f94 ]

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.

v2: add a Fixes tag.

Fixes: cd554d33c29a ("net: stmmac: Support WOL with phy")
Signed-off-by: Rongguang Wei <weirongguang@kylinos.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c