* [PATCH net-next 0/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA
@ 2026-12-01 8:29 James Clark
2026-12-01 8:29 ` [PATCH net-next 1/2] dt-bindings: net: altr,socfpga-stmmac: add altr,f2h-ptp-aux-trig James Clark
2026-12-01 8:29 ` [PATCH net-next 2/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA James Clark
0 siblings, 2 replies; 5+ messages in thread
From: James Clark @ 2026-12-01 8:29 UTC (permalink / raw)
To: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Maxime Coquelin, Alexandre Torgue, Richard Cochran
Cc: netdev, devicetree, linux-stm32, linux-arm-kernel
On Agilex 5, an external timestamp trigger driven by the FPGA design
never reaches the EMAC. The EMAC's trigger input takes its signal from
an HPS pin unless a bit in the System Manager selects the FPGA fabric.
Nothing in the kernel sets that bit.
Patch 1 adds a boolean device tree property for an EMAC whose trigger
is driven by the FPGA design. Patch 2 makes dwmac-socfpga set the bit
from it.
Tested on a Terasic DE25-Nano, where the trigger can only come from the
FPGA. External timestamp events on XGMAC cores also need a separate
series, which will follow.
I used an LLM coding assistant to help prepare these patches.
James Clark (2):
dt-bindings: net: altr,socfpga-stmmac: add altr,f2h-ptp-aux-trig
net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from
the FPGA
.../bindings/net/altr,socfpga-stmmac.yaml | 10 ++++++++++
.../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 17 +++++++++++++++++
2 files changed, 27 insertions(+)
base-commit: d35a725a7c96504f7deece4dfaa83bee6a98fe0e
--
2.56.1
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH net-next 1/2] dt-bindings: net: altr,socfpga-stmmac: add altr,f2h-ptp-aux-trig 2026-12-01 8:29 [PATCH net-next 0/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA James Clark @ 2026-12-01 8:29 ` James Clark 2026-12-01 8:29 ` [PATCH net-next 2/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA James Clark 1 sibling, 0 replies; 5+ messages in thread From: James Clark @ 2026-12-01 8:29 UTC (permalink / raw) To: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin, Alexandre Torgue, Richard Cochran Cc: netdev, devicetree, linux-stm32, linux-arm-kernel On Agilex 5, the trigger input that an EMAC uses for external timestamps, auxiliary snapshot trigger input 1, comes either from an HPS pin or from the FPGA fabric. The ppstrig_sel bit of the EMAC's tsn register in the System Manager selects which. Which one is right depends on the board's FPGA design. On the Terasic DE25-Nano, the trigger can only come from the FPGA. Add a boolean property for an EMAC whose trigger input 1 is driven by the FPGA design. As the FPGA design is often loaded at run time, the property will usually be set by the overlay that goes with the design, which has to be applied before the EMAC is probed. Signed-off-by: James Clark <jjc@jclark.com> --- .../devicetree/bindings/net/altr,socfpga-stmmac.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/net/altr,socfpga-stmmac.yaml b/Documentation/devicetree/bindings/net/altr,socfpga-stmmac.yaml index ce1bd5f2c470..d634920469e4 100644 --- a/Documentation/devicetree/bindings/net/altr,socfpga-stmmac.yaml +++ b/Documentation/devicetree/bindings/net/altr,socfpga-stmmac.yaml @@ -130,6 +130,14 @@ properties: Should be the phandle to the emac splitter soft IP node if DWMAC controller is connected an emac splitter. + altr,f2h-ptp-aux-trig: + type: boolean + description: + If present, indicates that the FPGA design drives auxiliary snapshot + trigger input 1 of the EMAC (ptp_aux_ts_trig_i[1], used for external + timestamps). Otherwise, the input is taken from the HPS I/O pin + multiplexer. + altr,f2h_ptp_ref_clk: $ref: /schemas/types.yaml#/definitions/phandle description: @@ -196,6 +204,8 @@ allOf: interrupt-names: maxItems: 1 + altr,f2h-ptp-aux-trig: false + dma-coherent: false unevaluatedProperties: false -- 2.56.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 2/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA 2026-12-01 8:29 [PATCH net-next 0/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA James Clark 2026-12-01 8:29 ` [PATCH net-next 1/2] dt-bindings: net: altr,socfpga-stmmac: add altr,f2h-ptp-aux-trig James Clark @ 2026-12-01 8:29 ` James Clark 2026-12-03 8:29 ` netdev-bot+sashiko 1 sibling, 1 reply; 5+ messages in thread From: James Clark @ 2026-12-01 8:29 UTC (permalink / raw) To: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin, Alexandre Torgue, Richard Cochran Cc: netdev, devicetree, linux-stm32, linux-arm-kernel On Agilex 5, an external timestamp trigger driven by the FPGA design never reaches the EMAC. The EMAC's trigger input takes its signal from an HPS pin unless the ppstrig_sel bit (bit 4) of the EMAC's tsn register in the System Manager selects the FPGA fabric. Nothing in the kernel sets that bit. Set the bit when the device tree has altr,f2h-ptp-aux-trig, and clear it otherwise. It has to be written while the EMAC is in reset, which is where the PHY mode is written to the same register. Tested on a Terasic DE25-Nano, with a separate series that makes external timestamps work on XGMAC: with the property, external timestamp channel 1 reports one event per pulse from a header pin. Signed-off-by: James Clark <jjc@jclark.com> --- .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 4e0187ffe0d3..0a706624d285 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -28,6 +28,7 @@ #define SYSMGR_EMACGRP_CTRL_PHYSEL_MASK 0x00000003 #define SYSMGR_EMACGRP_CTRL_PTP_REF_CLK_MASK 0x00000010 #define SYSMGR_GEN10_EMACGRP_CTRL_PTP_REF_CLK_MASK 0x00000100 +#define SYSMGR_AGILEX5_TSN_PPSTRIG_SEL BIT(4) #define SYSMGR_FPGAGRP_MODULE_REG 0x00000028 #define SYSMGR_FPGAGRP_MODULE_EMAC 0x00000004 @@ -56,6 +57,8 @@ struct socfpga_dwmac_ops { int (*set_phy_mode)(struct socfpga_dwmac *dwmac_priv, struct device *dev); void (*setup_plat_dat)(struct socfpga_dwmac *dwmac_priv); + /* The control register has the ppstrig_sel bit */ + bool has_ppstrig_sel; }; struct socfpga_dwmac { @@ -69,6 +72,7 @@ struct socfpga_dwmac { void __iomem *tse_pcs_base; void __iomem *sgmii_adapter_base; bool f2h_ptp_ref_clk; + bool f2h_ptp_aux_trig; const struct socfpga_dwmac_ops *ops; }; @@ -154,6 +158,8 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device * } dwmac->f2h_ptp_ref_clk = of_property_read_bool(np, "altr,f2h_ptp_ref_clk"); + dwmac->f2h_ptp_aux_trig = + of_property_read_bool(np, "altr,f2h-ptp-aux-trig"); np_splitter = of_parse_phandle(np, "altr,emac-splitter", 0); if (np_splitter) { @@ -481,6 +487,16 @@ static int socfpga_gen10_set_phy_mode(struct socfpga_dwmac *dwmac, ctrl &= ~SYSMGR_GEN10_EMACGRP_CTRL_PTP_REF_CLK_MASK; } + /* Take the trigger of auxiliary snapshot 1 from the FPGA fabric, or + * from the HPS I/O pin multiplexer + */ + if (dwmac->ops->has_ppstrig_sel) { + if (dwmac->f2h_ptp_aux_trig) + ctrl |= SYSMGR_AGILEX5_TSN_PPSTRIG_SEL; + else + ctrl &= ~SYSMGR_AGILEX5_TSN_PPSTRIG_SEL; + } + regmap_write(sys_mgr_base_addr, reg_offset, ctrl); /* Deassert reset for the phy configuration to be sampled by @@ -702,6 +718,7 @@ static const struct socfpga_dwmac_ops socfpga_gen10_ops = { static const struct socfpga_dwmac_ops socfpga_agilex5_ops = { .set_phy_mode = socfpga_gen10_set_phy_mode, .setup_plat_dat = socfpga_agilex5_setup_plat_dat, + .has_ppstrig_sel = true, }; static const struct of_device_id socfpga_dwmac_match[] = { -- 2.56.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 2/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA 2026-12-01 8:29 ` [PATCH net-next 2/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA James Clark @ 2026-12-03 8:29 ` netdev-bot+sashiko 2026-12-03 8:48 ` James Clark 0 siblings, 1 reply; 5+ messages in thread From: netdev-bot+sashiko @ 2026-12-03 8:29 UTC (permalink / raw) To: jjc Cc: maxime.chevallier, andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt, mcoquelin.stm32, alexandre.torgue, richardcochran, netdev, devicetree, linux-stm32, linux-arm-kernel Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] In socfpga_gen10_set_phy_mode() (drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c), the new… -- net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA On Agilex 5, this sets the ppstrig_sel bit in the EMAC's System Manager tsn register when the device tree has altr,f2h-ptp-aux-trig, and clears it otherwise. When the bit is set, auxiliary snapshot 1 is triggered from the FPGA fabric instead of an HPS pin. The bit is written while the EMAC is held in reset, in the same place the PHY mode is written. > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c > index 4e0187ffe0d32..0a706624d2856 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c [ ... ] > @@ -481,6 +487,16 @@ static int socfpga_gen10_set_phy_mode(struct socfpga_dwmac *dwmac, > ctrl &= ~SYSMGR_GEN10_EMACGRP_CTRL_PTP_REF_CLK_MASK; > } > > + /* Take the trigger of auxiliary snapshot 1 from the FPGA fabric, or > + * from the HPS I/O pin multiplexer > + */ > + if (dwmac->ops->has_ppstrig_sel) { > + if (dwmac->f2h_ptp_aux_trig) > + ctrl |= SYSMGR_AGILEX5_TSN_PPSTRIG_SEL; [Severity: Medium] Does the FPGA-to-EMAC interface gate also need to be opened when f2h_ptp_aux_trig is set? Earlier in socfpga_gen10_set_phy_mode(), only this block writes the per-EMAC bit in SYSMGR_FPGAINTF_EMAC_REG: if (dwmac->f2h_ptp_ref_clk || phymode == PHY_INTERFACE_MODE_MII || phymode == PHY_INTERFACE_MODE_GMII || phymode == PHY_INTERFACE_MODE_SGMII) { ctrl |= SYSMGR_GEN10_EMACGRP_CTRL_PTP_REF_CLK_MASK; regmap_read(sys_mgr_base_addr, SYSMGR_FPGAINTF_EMAC_REG, &module); module |= (SYSMGR_FPGAINTF_EMAC_BIT << reg_shift); regmap_write(sys_mgr_base_addr, SYSMGR_FPGAINTF_EMAC_REG, module); } else { The altr,socfpga-stmmac.yaml binding describes the altr,sysmgr-syscon shift on Arria10/Stratix10/Agilex as the bit that "enable/disable signals from the FPGA fabric to the EMAC modules". A trigger driven by the fabric looks like one of those signals. Take an Agilex 5 board with an RGMII or RMII PHY, no altr,f2h_ptp_ref_clk, and altr,f2h-ptp-aux-trig set. The else branch would run, so the gate is never opened. The trigger mux would still be pointed at the FPGA. Would external timestamp channel 1 then see no events, with no error reported, unless the firmware had already opened the gate? The f2h_ptp_ref_clk path always pairs the FPGA-sourced signal with opening this gate. Should f2h_ptp_aux_trig be added to that condition as well? I can't tell from the source whether the aux trigger line actually goes through this gate. The DE25-Nano test may have passed because U-Boot or ATF had already set the bit, so it doesn't settle the question either way. > + else > + ctrl &= ~SYSMGR_AGILEX5_TSN_PPSTRIG_SEL; > + } > + > regmap_write(sys_mgr_base_addr, reg_offset, ctrl); [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1796106489.git.jjc%40jclark.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 2/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA 2026-12-03 8:29 ` netdev-bot+sashiko @ 2026-12-03 8:48 ` James Clark 0 siblings, 0 replies; 5+ messages in thread From: James Clark @ 2026-12-03 8:48 UTC (permalink / raw) To: netdev-bot+sashiko Cc: maxime.chevallier, andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt, conor+dt, mcoquelin.stm32, alexandre.torgue, richardcochran, netdev, devicetree, linux-stm32, linux-arm-kernel On Thu, 03 Dec 2026 08:29:33 +0000, netdev-bot+sashiko@kernel.org wrote: > Does the FPGA-to-EMAC interface gate also need to be opened when > f2h_ptp_aux_trig is set? [...] > Take an Agilex 5 board with an RGMII or RMII PHY, no > altr,f2h_ptp_ref_clk, and altr,f2h-ptp-aux-trig set. The DE25-Nano is such a board. There fpgaintf_en_3 reads 0 through /dev/mem, and events from the fabric still arrive. So no, fpgaintf_en_3 does not need to be set. James ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-12-03 8:48 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-12-01 8:29 [PATCH net-next 0/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA James Clark 2026-12-01 8:29 ` [PATCH net-next 1/2] dt-bindings: net: altr,socfpga-stmmac: add altr,f2h-ptp-aux-trig James Clark 2026-12-01 8:29 ` [PATCH net-next 2/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA James Clark 2026-12-03 8:29 ` netdev-bot+sashiko 2026-12-03 8:48 ` James Clark
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox