Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: stmmac: xgmac: fix disabling flexible PPS output
@ 2026-12-05  9:27 James Clark
  0 siblings, 0 replies; only message in thread
From: James Clark @ 2026-12-05  9:27 UTC (permalink / raw)
  To: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Maxime Coquelin, Alexandre Torgue, Jose Abreu, netdev,
	linux-stm32, linux-arm-kernel

On a Terasic DE25-Nano (Agilex 5, XGMAC core 3.10), disabling PPS
output 0 with PTP_PEROUT_REQUEST leaves about 15 pulses a second on the
pin instead of stopping it.

In the XGMAC register MAC_PPS_CONTROL, bit PPSEN0 selects what bits 3:0
mean. When PPSEN0 is set, they are PPSCMD0, a command to the flexible
PPS logic. When it is clear, they are PPSCTRL0, the frequency of output
0 in fixed PPS mode. The disable path in dwxgmac2_flex_pps_config()
clears PPSEN0 and then writes the stop command (0x5). The MAC reads
this as PPSCTRL0 = 5, so output 0 switches to fixed mode at that
frequency setting.

Set PPSENx when disabling, as the enable path does. Commit 520cf6002147
("net: stmmac: fix disabling flexible PPS output") made the same fix
for dwmac5 after the XGMAC code was copied from it.

Fix tested on the DE25-Nano.

Fixes: 95eaf3cd0a90 ("net: stmmac: dwxgmac: Add Flexible PPS support")
Signed-off-by: James Clark <jjc@jclark.com>
---
I used an LLM coding assistant to help prepare this patch.

This can be tested on the DE25-Nano using the FPGA design at
https://github.com/jclark/de25-nano-debian, which connects periodic
output channel 0 to pin 6 of JP1.

 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
index 6b2bfc241109..c43e8c597a09 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
@@ -1171,6 +1171,7 @@ static int dwxgmac2_flex_pps_config(void __iomem *ioaddr, int index,
 
 	if (!enable) {
 		val |= XGMAC_PPSCMDx(index, XGMAC_PPSCMD_STOP);
+		val |= XGMAC_PPSENx(index);
 		writel(val, ioaddr + XGMAC_PPS_CONTROL);
 		return 0;
 	}
-- 
2.56.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-05  9:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05  9:27 [PATCH net] net: stmmac: xgmac: fix disabling flexible PPS output James Clark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox