All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: muhammad.nazim.amirul.nazle.asmade@altera.com
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next v3 2/2] net: stmmac: dwmac-socfpga: Add support for Agilex5 TSN GMAC with FPGA converter
Date: Fri, 04 Dec 2026 05:09:23 +0000	[thread overview]
Message-ID: <sashiko-outbox-249112@kernel.org> (raw)
In-Reply-To: <20261203050900.32211-3-muhammad.nazim.amirul.nazle.asmade@altera.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: stmmac: GMII mode unconditionally selects FPGA PTP clock
  in gen10
--

commit 6ae7fdd0a14695eb719a64e613323133b44c5648
Author: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>

net: stmmac: dwmac-socfpga: Add support for Agilex5 TSN GMAC with FPGA converter

This patch adds the "altr,socfpga-stmmac-agilex5-tsn" compatible for
Agilex5 TSN GMAC ports behind an FPGA GMII-to-RGMII converter.  For RGMII
phy-modes it tracks a separate GMII MAC-side interface and enables the
stmmac internal TX and RX delay flags.

> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> index 4e0187ffe0d32..273ff8b08c769 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c

[ ... ]

> @@ -704,10 +707,34 @@ static const struct socfpga_dwmac_ops socfpga_agilex5_ops = {
>  	.setup_plat_dat = socfpga_agilex5_setup_plat_dat,
>  };
>  
> +static void socfpga_agilex5_tsn_gmac_setup_plat_dat(struct socfpga_dwmac *dwmac)
> +{
> +	struct plat_stmmacenet_data *plat_dat = dwmac->plat_dat;
> +
> +	socfpga_agilex5_setup_plat_dat(dwmac);
> +
> +	/* The FPGA GMII-to-RGMII converter is only in the RGMII path. It
> +	 * presents GMII to the MAC and adds both RGMII delays, so only
> +	 * phy-mode "rgmii-id" describes the board correctly.
> +	 */
> +	if (!phy_interface_mode_is_rgmii(plat_dat->phy_interface))
> +		return;
> +
> +	dwmac->mac_interface = PHY_INTERFACE_MODE_GMII;
> +	plat_dat->has_internal_tx_delay = true;
> +	plat_dat->has_internal_rx_delay = true;
> +}
> +
> +static const struct socfpga_dwmac_ops socfpga_agilex5_tsn_gmac_ops = {
> +	.set_phy_mode = socfpga_gen10_set_phy_mode,
> +	.setup_plat_dat = socfpga_agilex5_tsn_gmac_setup_plat_dat,
> +};

[Severity: Medium]
Does setting dwmac->mac_interface to PHY_INTERFACE_MODE_GMII cause
socfpga_gen10_set_phy_mode() to route the EMAC PTP reference clock to
the FPGA even when altr,f2h_ptp_ref_clk is not set?

drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c:socfpga_gen10_set_phy_mode() {
	...
	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);
	...
}

On Agilex5, gmac1 uses the HPS clock AGILEX5_EMAC_PTP_CLK as ptp_ref
without altr,f2h_ptp_ref_clk, so switching the PTP reference clock mux
to the FPGA breaks PTP/TSN hardware timestamping unless the FPGA
bitstream also supplies a PTP reference clock.

socfpga_gen5_set_phy_mode() was updated in 15ce30609d1e ("net: stmmac:
fix enabling socfpga's ptp_ref_clock") to gate the PTP_REF_CLK mux bit
solely on dwmac->f2h_ptp_ref_clk; should socfpga_gen10_set_phy_mode()
do the same?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203050900.32211-1-muhammad.nazim.amirul.nazle.asmade@altera.com?part=2

      parent reply	other threads:[~2026-12-04  5:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  5:08 [PATCH net-next v3 0/2] net: stmmac: dwmac-socfpga: Add Agilex5 TSN GMAC support muhammad.nazim.amirul.nazle.asmade
2026-12-03  5:08 ` [PATCH net-next v3 1/2] dt-bindings: net: altr,socfpga-stmmac: Add altr,socfpga-stmmac-agilex5-tsn compatible muhammad.nazim.amirul.nazle.asmade
2026-12-03  5:09 ` [PATCH net-next v3 2/2] net: stmmac: dwmac-socfpga: Add support for Agilex5 TSN GMAC with FPGA converter muhammad.nazim.amirul.nazle.asmade
2026-12-03 12:54   ` Andrew Lunn
2026-12-03 13:02     ` Andrew Lunn
2026-12-04  5:09   ` sashiko-bot [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=sashiko-outbox-249112@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=muhammad.nazim.amirul.nazle.asmade@altera.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.