The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <stable@xxxxxxxxxxxxxxx>. Possible dependencies: ae9dcb91c606 ("net: stmmac: add aux timestamps fifo clearance wait") f4da56529da6 ("net: stmmac: Add support for external trigger timestamping") 8532f613bc78 ("net: stmmac: introduce MSI Interrupt routines for mac, safety, RX & TX") 7e1c520c0d20 ("net: stmmac: introduce DMA interrupt status masking per traffic direction") 341f67e424e5 ("net: stmmac: Add hardware supported cross-timestamp") 76da35dc99af ("stmmac: intel: Add PSE and PCH PTP clock source selection") b4d45aee6635 ("net: stmmac: add platform level clocks management") 5ec55823438e ("net: stmmac: add clocks management for gmac driver") 7310fe538ea5 ("stmmac: intel: add pcs-xpcs for Intel mGbE controller") 20e07e2c3cf3 ("net: stmmac: Add PCI bus info to ethtool driver query output") 7cfc4486e7ea ("stmmac: intel: Configure EHL PSE0 GbE and PSE1 GbE to 32 bits DMA addressing") bff6f1db91e3 ("stmmac: intel: change all EHL/TGL to auto detect phy addr") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From ae9dcb91c6069e20b3b9505d79cbc89fd6e086f5 Mon Sep 17 00:00:00 2001 From: Noor Azura Ahmad Tarmizi <noor.azura.ahmad.tarmizi@xxxxxxxxx> Date: Wed, 11 Jan 2023 13:02:00 +0800 Subject: [PATCH] net: stmmac: add aux timestamps fifo clearance wait Add timeout polling wait for auxiliary timestamps snapshot FIFO clear bit (ATSFC) to clear. This is to ensure no residue fifo value is being read erroneously. Fixes: f4da56529da6 ("net: stmmac: Add support for external trigger timestamping") Cc: <stable@xxxxxxxxxxxxxxx> # 5.10.x Signed-off-by: Noor Azura Ahmad Tarmizi <noor.azura.ahmad.tarmizi@xxxxxxxxx> Link: https://lore.kernel.org/r/20230111050200.2130-1-noor.azura.ahmad.tarmizi@xxxxxxxxx Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c index fc06ddeac0d5..b4388ca8d211 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c @@ -210,7 +210,10 @@ static int stmmac_enable(struct ptp_clock_info *ptp, } writel(acr_value, ptpaddr + PTP_ACR); mutex_unlock(&priv->aux_ts_lock); - ret = 0; + /* wait for auxts fifo clear to finish */ + ret = readl_poll_timeout(ptpaddr + PTP_ACR, acr_value, + !(acr_value & PTP_ACR_ATSFC), + 10, 10000); break; default: