]> www.infradead.org Git - users/dwmw2/linux.git/commit
net: stmmac: fix unbalanced ptp clock issue in suspend/resume flow
authorBiao Huang <biao.huang@mediatek.com>
Thu, 14 Jul 2022 06:00:14 +0000 (14:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Jul 2022 15:19:15 +0000 (17:19 +0200)
commitdd7b5ba44b67566ffde286f60a2f684a56c69e0d
tree385011ae308df5616623b9e8a56aa79bfcb30f5d
parentc61aede097d350d890fa1edc9521b0072e14a0b8
net: stmmac: fix unbalanced ptp clock issue in suspend/resume flow

[ Upstream commit f4c7d8948e866918d61493264dbbd67e45ef2bda ]

Current stmmac driver will prepare/enable ptp_ref clock in
stmmac_init_tstamp_counter().

The stmmac_pltfr_noirq_suspend will disable it once in suspend flow.

But in resume flow,
stmmac_pltfr_noirq_resume --> stmmac_init_tstamp_counter
stmmac_resume --> stmmac_hw_setup --> stmmac_init_ptp --> stmmac_init_tstamp_counter
ptp_ref clock reference counter increases twice, which leads to unbalance
ptp clock when resume back.

Move ptp_ref clock prepare/enable out of stmmac_init_tstamp_counter to fix it.

Fixes: 0735e639f129d ("net: stmmac: skip only stmmac_ptp_register when resume from suspend")
Signed-off-by: Biao Huang <biao.huang@mediatek.com>
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
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c