From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: James Clark <jjc@jclark.com>, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Richard Cochran <richardcochran@gmail.com>
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next v2 2/2] net: stmmac: dwmac-socfpga: route the auxiliary snapshot trigger from the FPGA
Date: Sun, 6 Dec 2026 08:27:28 +0100 [thread overview]
Message-ID: <35a6a1f4-bb6c-4d7d-baf2-874a1ec43fa5@bootlin.com> (raw)
In-Reply-To: <367360b84b5f2ab80a55da37c9f59428e680a019.1796460469.git.jjc@jclark.com>
Hi James,
On 12/5/26 09:50, James Clark wrote:
> 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>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Thanks,
Maxime
> ---
> .../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,
> };
>
prev parent reply other threads:[~2026-12-06 7:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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
2026-12-06 7:27 ` Maxime Chevallier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=35a6a1f4-bb6c-4d7d-baf2-874a1ec43fa5@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@kernel.org \
--cc=jjc@jclark.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox