* [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; 5+ 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 [flat|nested] 5+ 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
1 sibling, 1 reply; 5+ 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 [flat|nested] 5+ messages in thread