[PATCH net-next v5 0/2] net: stmmac: dwxgmac2: timestamp interrupt support + Agilex5 fix

From: Zxyan Zhu

Date: Thu Sep 10 2026 - 04:13:49 EST


This series adds auxiliary snapshot (EXTTS) interrupt support to
DWXGMAC2/DWXLGMAC2 and fixes a stale TSIS race on the Agilex5
cross-timestamp path that the new handler would otherwise expose.

Patch 1 makes smtg_crosststamp() complete on the persistent ATSNS count
instead of the transient TSIS bit, waits for the ATSFC FIFO clear to
complete before arming, and derives the pop count from the poll result,
so the completion condition is immune to the destructive reads of
XGMAC_TIMESTAMP_STATUS performed by the DWXGMAC2 timestamp interrupt
handler and the TX timestamp completion path.

Patch 2 wires up a dedicated DWXGMAC2 timestamp interrupt handler.
Before this change the XGMAC hwif entries used the generic stmmac_ptp
ops, whose timestamp_interrupt callback read the dwmac4 offset
GMAC_TIMESTAMP_STATUS (0xb20) instead of the XGMAC register at 0xd20,
and XGMAC_TSIE was never enabled, so auxiliary snapshot events were
never reported on XGMAC platforms.

Because v5 changes the completion mechanism, the previous Tested-by for
the mask approach no longer applies; Patch 1 needs re-verification on
Agilex5 hardware.

v1: https://lore.kernel.org/netdev/20260806-dwxgmac2-timestamp-irq-v1-1-c051c79c9d90@xxxxxxxxx/
v2: https://lore.kernel.org/netdev/20260810100221.9166-1-zxyan0222@xxxxxxxxx/
v3: https://lore.kernel.org/netdev/20260818132722.1852876-1-zxyan0222@xxxxxxxxx/
v4: https://lore.kernel.org/netdev/20260902131441.322167-1-zxyan0222@xxxxxxxxx/
v5:
- Replace the XGMAC_TSIE masking approach with completing the
cross-timestamp on the persistent ATSNS count, and reorder the series
so it is bisect-safe.
- Wait for the ATSFC FIFO clear to complete before arming, so a stale
ATSNS count from a previous snapshot cannot be observed.

Zxyan Zhu (2):
net: stmmac: dwmac-socfpga: complete cross-timestamp on ATSNS
net: stmmac: dwxgmac2: add XGMAC timestamp interrupt support

.../ethernet/stmicro/stmmac/dwmac-socfpga.c | 29 ++++++++++---
.../net/ethernet/stmicro/stmmac/dwxgmac2.h | 2 +-
.../ethernet/stmicro/stmmac/dwxgmac2_core.c | 43 +++++++++++++++++++
drivers/net/ethernet/stmicro/stmmac/hwif.c | 4 +-
drivers/net/ethernet/stmicro/stmmac/hwif.h | 1 +
.../ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 12 ++++++
.../net/ethernet/stmicro/stmmac/stmmac_ptp.h | 1 +
7 files changed, 84 insertions(+), 8 deletions(-)

--
2.34.1