Devicetree
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/2] net: stmmac: dwmac-socfpga: Add Agilex5 TSN GMAC support
@ 2026-12-03  5:08 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
  0 siblings, 2 replies; 6+ messages in thread
From: muhammad.nazim.amirul.nazle.asmade @ 2026-12-03  5:08 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Maxime Chevallier, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Dinh Nguyen, Maxime Coquelin, Alexandre Torgue, netdev,
	devicetree, linux-stm32, linux-arm-kernel, linux-kernel

From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>

This series adds support for the gmac1 TSN port on the Intel SoCFPGA
Agilex5 SoCDK TSN Config2 board.

The TSN port (gmac1) connects to its PHY through a GMII-to-RGMII converter
implemented as FPGA soft IP. The converter presents GMII to the MAC and
adds both RGMII TX/RX delays, so the MAC interface selector must be set to
GMII and "rgmii-id" is the only valid RGMII phy-mode for this port.

Patch 1 documents the altr,socfpga-stmmac-agilex5-tsn compatible. Patch 2
adds dedicated match .data ops for the required interface setup.

The board-level binding and DTS patches will be sent separately to the
SoCFPGA tree.

v3:
  - Patch 2: address the netdev AI review forwarded by Jakub Kicinski [1].
    Only apply the converter setup for RGMII phy-modes, use
    has_internal_tx_delay/has_internal_rx_delay so that RGMII modes
    other than "rgmii-id" are rejected at probe time, and rename
    socfpga_get_plat_phymode() to socfpga_get_mac_interface().
  - Patch 1: add Reviewed-by from Rob Herring.
  - Rebase on current net-next.

v2: https://lore.kernel.org/all/20261104040320.18077-1-muhammad.nazim.amirul.nazle.asmade@altera.com/
  - Extend the interrupt/interrupt-names/dma-coherent allOf conditional in
    the net binding to match altr,socfpga-stmmac-agilex5-tsn, per Jakub
    Kicinski / the netdev review bot [2].

These two patches were previously posted as patches 3 and 4 of the
"Add Agilex5 SoCDK TSN Config2 board support" series (up to v6), then
reposted as a standalone net-next series per Jakub Kicinski's request.
History from the board series:

v6:
  - Put altr,socfpga-stmmac-agilex5-tsn in the same compatible enum as
    altr,socfpga-stmmac-agilex5 in the net binding, per Krzysztof Kozlowski.

v5:
  - Replace of_device_is_compatible() probe check with dedicated
    socfpga_agilex5_tsn_gmac_ops via match .data, per Krzysztof Kozlowski
    and Dinh Nguyen.
  - Drop altr,socfpga-stmmac-agilex5 fallback from the TSN compatible list
    and rewrite the net binding commit message to explain the hardware
    difference, per Krzysztof Kozlowski.

v4:
  - Add Reviewed-by from Andrew Lunn on the driver patch.

v2 (board series):
  - Replace mac-mode DT property with compatible string-based detection per
    Andrew Lunn's feedback.
  - Use phy-mode = "rgmii-id" to correctly reflect MAC-side delay handling.
  - Rename compatible string to altr,socfpga-stmmac-agilex5-tsn for
    consistency with existing altr,socfpga-stmmac-* compatibles.
  - Add DT binding documentation for new net compatible string (new patch).

[1] https://lore.kernel.org/all/20261110200844.2190972-1-kuba@kernel.org/
[2] https://lore.kernel.org/all/20260928184340.51da489c@kernel.org/

Nazim Amirul (2):
  dt-bindings: net: altr,socfpga-stmmac: Add
    altr,socfpga-stmmac-agilex5-tsn compatible
  net: stmmac: dwmac-socfpga: Add support for Agilex5 TSN GMAC with FPGA
    converter

 .../bindings/net/altr,socfpga-stmmac.yaml     |  9 +++-
 .../ethernet/stmicro/stmmac/dwmac-socfpga.c   | 49 ++++++++++++++-----
 2 files changed, 45 insertions(+), 13 deletions(-)

-- 
2.43.7


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net-next v3 1/2] dt-bindings: net: altr,socfpga-stmmac: Add altr,socfpga-stmmac-agilex5-tsn compatible
  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 ` 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
  1 sibling, 0 replies; 6+ messages in thread
From: muhammad.nazim.amirul.nazle.asmade @ 2026-12-03  5:08 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Maxime Chevallier, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Dinh Nguyen, Maxime Coquelin, Alexandre Torgue, netdev,
	devicetree, linux-stm32, linux-arm-kernel, linux-kernel

From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>

The Agilex5 SoCDK TSN Config2 gmac1 path includes an FPGA soft-IP
GMII-to-RGMII converter between the DWXGMAC and the PHY. The converter
provides the RGMII TX/RX delays and presents GMII toward the MAC, unlike
a plain altr,socfpga-stmmac-agilex5 port with no such converter.

Add altr,socfpga-stmmac-agilex5-tsn for that integration in the same
compatible items entry as altr,socfpga-stmmac-agilex5 (shared
snps,dwxgmac-2.10). Do not use altr,socfpga-stmmac-agilex5 as a DT
fallback for the TSN port; the converter presents GMII to the MAC and
supplies the RGMII delays, unlike a plain Agilex5 GMAC port.

The TSN port uses the same DWXGMAC-2.10 core as the plain Agilex5 port,
so extend the interrupt/interrupt-names/dma-coherent conditional to
match the new compatible as well; otherwise a TSN node would incorrectly
fall into the single-interrupt, non-coherent else branch.

Signed-off-by: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
---
Previously patch 3 of the v6 board series; split out for net-next.

v3: Add Reviewed-by from Rob Herring. No other changes.
v2: Extend the interrupt/interrupt-names/dma-coherent allOf conditional to
    match altr,socfpga-stmmac-agilex5-tsn, per Jakub Kicinski / netdev bot.
v6: Put altr,socfpga-stmmac-agilex5-tsn in the same enum as
    altr,socfpga-stmmac-agilex5, per Krzysztof Kozlowski.
v5: Drop altr,socfpga-stmmac-agilex5 fallback and rewrite commit message
    to explain hardware incompatibility, per Krzysztof Kozlowski.

 .../devicetree/bindings/net/altr,socfpga-stmmac.yaml     | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/altr,socfpga-stmmac.yaml b/Documentation/devicetree/bindings/net/altr,socfpga-stmmac.yaml
index ce1bd5f2c470..a6ffd7b98c1d 100644
--- a/Documentation/devicetree/bindings/net/altr,socfpga-stmmac.yaml
+++ b/Documentation/devicetree/bindings/net/altr,socfpga-stmmac.yaml
@@ -22,6 +22,7 @@ select:
           - altr,socfpga-stmmac
           - altr,socfpga-stmmac-a10-s10
           - altr,socfpga-stmmac-agilex5
+          - altr,socfpga-stmmac-agilex5-tsn
 
   required:
     - compatible
@@ -42,7 +43,9 @@ properties:
           - const: snps,dwmac-3.74a
           - const: snps,dwmac
       - items:
-          - const: altr,socfpga-stmmac-agilex5
+          - enum:
+              - altr,socfpga-stmmac-agilex5
+              - altr,socfpga-stmmac-agilex5-tsn
           - const: snps,dwxgmac-2.10
 
   clocks:
@@ -178,7 +181,9 @@ allOf:
       properties:
         compatible:
           contains:
-            const: altr,socfpga-stmmac-agilex5
+            enum:
+              - altr,socfpga-stmmac-agilex5
+              - altr,socfpga-stmmac-agilex5-tsn
     then:
       properties:
         interrupts:
-- 
2.43.7


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next v3 2/2] net: stmmac: dwmac-socfpga: Add support for Agilex5 TSN GMAC with FPGA converter
  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 ` muhammad.nazim.amirul.nazle.asmade
  2026-12-03 12:54   ` Andrew Lunn
  2026-12-04  5:09   ` sashiko-bot
  1 sibling, 2 replies; 6+ messages in thread
From: muhammad.nazim.amirul.nazle.asmade @ 2026-12-03  5:09 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: Maxime Chevallier, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Dinh Nguyen, Maxime Coquelin, Alexandre Torgue, netdev,
	devicetree, linux-stm32, linux-arm-kernel, linux-kernel

From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>

The Agilex5 SoCDK TSN Config2 board uses a GMII-to-RGMII converter
implemented as FPGA soft IP between gmac1 and its PHY. The converter
presents GMII to the MAC and adds both the RGMII TX and RX delays, so
"rgmii-id" is the only RGMII phy-mode that describes this board.

Add the "altr,socfpga-stmmac-agilex5-tsn" compatible with dedicated
match .data ops that extend the standard Agilex5 setup. For RGMII
phy-modes, select GMII for the MAC interface and set
has_internal_tx_delay and has_internal_rx_delay. The stmmac core then
passes "rgmii" to the PHY for "rgmii-id", and rejects "rgmii",
"rgmii-txid" and "rgmii-rxid" at probe time. Other phy-modes do not go
through the converter and keep the standard Agilex5 behaviour.

Store the MAC-side mode in a new mac_interface field, and rename
socfpga_get_plat_phymode() to socfpga_get_mac_interface() to match.

Signed-off-by: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade@altera.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
Previously patch 4 of the v6 board series; split out for net-next.

v3: Address the netdev AI review on v2, forwarded by Jakub Kicinski:
    - Only apply the converter setup for RGMII phy-modes, so SGMII and
      1000base-x keep the standard Agilex5 behaviour.
    - Set has_internal_tx_delay and has_internal_rx_delay instead of
      rewriting phy_interface. "rgmii-id" is now the only accepted RGMII
      phy-mode; "rgmii", "rgmii-txid" and "rgmii-rxid" are rejected at
      probe time. This replaces the v2 behaviour of silently rewriting
      every RGMII mode to "rgmii".
    - Rename socfpga_get_plat_phymode() to socfpga_get_mac_interface()
      and update the splitter comments to match.
    - Rebase on current net-next.
v2: No driver changes.
v6: No changes from v5.
v5: Replace of_device_is_compatible() probe check with dedicated
    socfpga_agilex5_tsn_gmac_ops via match .data, per Krzysztof
    Kozlowski and Dinh Nguyen.
v4: Add Reviewed-by from Andrew Lunn.

 .../ethernet/stmicro/stmmac/dwmac-socfpga.c   | 49 ++++++++++++++-----
 1 file changed, 38 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 4e0187ffe0d3..273ff8b08c76 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -69,12 +69,13 @@ struct socfpga_dwmac {
 	void __iomem *tse_pcs_base;
 	void __iomem *sgmii_adapter_base;
 	bool f2h_ptp_ref_clk;
+	phy_interface_t mac_interface;
 	const struct socfpga_dwmac_ops *ops;
 };
 
-static phy_interface_t socfpga_get_plat_phymode(struct socfpga_dwmac *dwmac)
+static phy_interface_t socfpga_get_mac_interface(struct socfpga_dwmac *dwmac)
 {
-	return dwmac->plat_dat->phy_interface;
+	return dwmac->mac_interface;
 }
 
 static void socfpga_sgmii_config(struct socfpga_dwmac *dwmac, bool enable)
@@ -90,7 +91,7 @@ static void socfpga_dwmac_fix_mac_speed(void *bsp_priv,
 {
 	struct socfpga_dwmac *dwmac = (struct socfpga_dwmac *)bsp_priv;
 	void __iomem *sgmii_adapter_base = dwmac->sgmii_adapter_base;
-	phy_interface_t phymode = socfpga_get_plat_phymode(dwmac);
+	phy_interface_t phymode = socfpga_get_mac_interface(dwmac);
 	void __iomem *splitter_base = dwmac->splitter_base;
 	u32 val;
 
@@ -385,7 +386,7 @@ static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac,
 				     struct device *dev)
 {
 	struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr;
-	phy_interface_t phymode = socfpga_get_plat_phymode(dwmac);
+	phy_interface_t phymode = socfpga_get_mac_interface(dwmac);
 	u32 reg_offset = dwmac->reg_offset;
 	u32 reg_shift = dwmac->reg_shift;
 	u32 ctrl, val, module;
@@ -395,9 +396,9 @@ static int socfpga_gen5_set_phy_mode(struct socfpga_dwmac *dwmac,
 		return -EINVAL;
 	}
 
-	/* Overwrite val to GMII if splitter core is enabled. The phymode here
-	 * is the actual phy mode on phy hardware, but phy interface from
-	 * EMAC core is GMII.
+	/* Overwrite val to GMII if splitter core is enabled. The splitter
+	 * converts the GMII interface of the EMAC core to the mode given by
+	 * phy-mode.
 	 */
 	if (dwmac->splitter_base)
 		val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII;
@@ -444,7 +445,7 @@ static int socfpga_gen10_set_phy_mode(struct socfpga_dwmac *dwmac,
 				      struct device *dev)
 {
 	struct regmap *sys_mgr_base_addr = dwmac->sys_mgr_base_addr;
-	phy_interface_t phymode = socfpga_get_plat_phymode(dwmac);
+	phy_interface_t phymode = socfpga_get_mac_interface(dwmac);
 	u32 reg_offset = dwmac->reg_offset;
 	u32 reg_shift = dwmac->reg_shift;
 	u32 ctrl, val, module;
@@ -452,9 +453,9 @@ static int socfpga_gen10_set_phy_mode(struct socfpga_dwmac *dwmac,
 	if (socfpga_set_phy_mode_common(phymode, &val))
 		return -EINVAL;
 
-	/* Overwrite val to GMII if splitter core is enabled. The phymode here
-	 * is the actual phy mode on phy hardware, but phy interface from
-	 * EMAC core is GMII.
+	/* Overwrite val to GMII if splitter core is enabled. The splitter
+	 * converts the GMII interface of the EMAC core to the mode given by
+	 * phy-mode.
 	 */
 	if (dwmac->splitter_base)
 		val = SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII;
@@ -682,6 +683,8 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
 	plat_dat->pcs_exit = socfpga_dwmac_pcs_exit;
 	plat_dat->select_pcs = socfpga_dwmac_select_pcs;
 
+	dwmac->mac_interface = plat_dat->phy_interface;
+
 	ops->setup_plat_dat(dwmac);
 
 	socfpga_dwmac_setup_multi_irq(dev, plat_dat, &stmmac_res);
@@ -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,
+};
+
 static const struct of_device_id socfpga_dwmac_match[] = {
 	{ .compatible = "altr,socfpga-stmmac", .data = &socfpga_gen5_ops },
 	{ .compatible = "altr,socfpga-stmmac-a10-s10", .data = &socfpga_gen10_ops },
 	{ .compatible = "altr,socfpga-stmmac-agilex5", .data = &socfpga_agilex5_ops },
+	{ .compatible = "altr,socfpga-stmmac-agilex5-tsn", .data = &socfpga_agilex5_tsn_gmac_ops },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, socfpga_dwmac_match);
-- 
2.43.7


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next v3 2/2] net: stmmac: dwmac-socfpga: Add support for Agilex5 TSN GMAC with FPGA converter
  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
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2026-12-03 12:54 UTC (permalink / raw)
  To: muhammad.nazim.amirul.nazle.asmade
  Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Chevallier, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Dinh Nguyen, Maxime Coquelin, Alexandre Torgue,
	netdev, devicetree, linux-stm32, linux-arm-kernel, linux-kernel

> +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;

Maybe add another check here. If it is one of the four rgmii but not
RGMII_ID, you know it will not work, so can return EINVAL.

	Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next v3 2/2] net: stmmac: dwmac-socfpga: Add support for Agilex5 TSN GMAC with FPGA converter
  2026-12-03 12:54   ` Andrew Lunn
@ 2026-12-03 13:02     ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2026-12-03 13:02 UTC (permalink / raw)
  To: muhammad.nazim.amirul.nazle.asmade
  Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Chevallier, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Dinh Nguyen, Maxime Coquelin, Alexandre Torgue,
	netdev, devicetree, linux-stm32, linux-arm-kernel, linux-kernel

On Thu, Dec 03, 2026 at 01:54:14PM +0100, Andrew Lunn wrote:
> > +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;
> 
> Maybe add another check here. If it is one of the four rgmii but not
> RGMII_ID, you know it will not work, so can return EINVAL.

Ah, probably not needed. It looks like stmmac_pltfr_probe() will
probably do this for you.

	 Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next v3 2/2] net: stmmac: dwmac-socfpga: Add support for Agilex5 TSN GMAC with FPGA converter
  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-04  5:09   ` sashiko-bot
  1 sibling, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-12-04  5:09 UTC (permalink / raw)
  To: muhammad.nazim.amirul.nazle.asmade; +Cc: devicetree, robh, conor+dt

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-12-04  5:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox