* [PATCH net-next v2 0/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA
@ 2026-12-05 8:50 James Clark
2026-12-05 8:50 ` [PATCH net-next v2 1/2] dt-bindings: net: altr,socfpga-stmmac: add altr,f2h-ptp-aux-trig James Clark
2026-12-05 8:50 ` [PATCH net-next v2 2/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA James Clark
0 siblings, 2 replies; 3+ messages in thread
From: James Clark @ 2026-12-05 8:50 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.
Changes in v2:
- Patch 2: set the bit in a set_phy_mode() for Agilex 5 (Maxime Chevallier)
- Patch 2: note in the message that fpgaintf_en_3 was disabled during
the test
- Link to v1: https://lore.kernel.org/netdev/cover.1796106489.git.jjc@jclark.com/
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 +++++++++
.../ethernet/stmicro/stmmac/dwmac-socfpga.c | 21 ++++++++++++++++++-
2 files changed, 30 insertions(+), 1 deletion(-)
base-commit: 62ae6527877e8012d85942763a8f3e9a66839e3e
--
2.56.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH net-next v2 1/2] dt-bindings: net: altr,socfpga-stmmac: add altr,f2h-ptp-aux-trig
2026-12-05 8:50 [PATCH net-next v2 0/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA James Clark
@ 2026-12-05 8:50 ` James Clark
2026-12-05 8:50 ` [PATCH net-next v2 2/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA James Clark
1 sibling, 0 replies; 3+ messages in thread
From: James Clark @ 2026-12-05 8:50 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] 3+ messages in thread
* [PATCH net-next v2 2/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA
2026-12-05 8:50 [PATCH net-next v2 0/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA James Clark
2026-12-05 8:50 ` [PATCH net-next v2 1/2] dt-bindings: net: altr,socfpga-stmmac: add altr,f2h-ptp-aux-trig James Clark
@ 2026-12-05 8:50 ` James Clark
1 sibling, 0 replies; 3+ messages in thread
From: James Clark @ 2026-12-05 8:50 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.
Add a set_phy_mode() for Agilex 5 that sets ppstrig_sel when the device
tree has altr,f2h-ptp-aux-trig, clears it otherwise, and then calls the
gen10 set_phy_mode().
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.
The EMAC's FPGA interface (fpgaintf_en_3) was disabled during the test.
Signed-off-by: James Clark <jjc@jclark.com>
---
.../ethernet/stmicro/stmmac/dwmac-socfpga.c | 21 ++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 76922cbc4526..921ba831edfd 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
@@ -69,6 +70,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 +156,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) {
@@ -493,6 +497,21 @@ static int socfpga_gen10_set_phy_mode(struct socfpga_dwmac *dwmac,
return 0;
}
+static int socfpga_agilex5_set_phy_mode(struct socfpga_dwmac *dwmac,
+ struct device *dev)
+{
+ /* Take the trigger of auxiliary snapshot 1 from the FPGA fabric, or
+ * from the HPS I/O pin multiplexer. This must be set before the EMAC
+ * leaves reset, which socfpga_gen10_set_phy_mode() does last.
+ */
+ regmap_update_bits(dwmac->sys_mgr_base_addr, dwmac->reg_offset,
+ SYSMGR_AGILEX5_TSN_PPSTRIG_SEL,
+ dwmac->f2h_ptp_aux_trig ?
+ SYSMGR_AGILEX5_TSN_PPSTRIG_SEL : 0);
+
+ return socfpga_gen10_set_phy_mode(dwmac, dev);
+}
+
static int socfpga_dwmac_pcs_init(struct stmmac_priv *priv)
{
struct socfpga_dwmac *dwmac = priv->plat->bsp_priv;
@@ -703,7 +722,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,
+ .set_phy_mode = socfpga_agilex5_set_phy_mode,
.setup_plat_dat = socfpga_agilex5_setup_plat_dat,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-12-05 8:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 8:50 [PATCH net-next v2 0/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA James Clark
2026-12-05 8:50 ` [PATCH net-next v2 1/2] dt-bindings: net: altr,socfpga-stmmac: add altr,f2h-ptp-aux-trig James Clark
2026-12-05 8:50 ` [PATCH net-next v2 2/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA James Clark
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox