net: stmmac: Add common RGMII delay handling and DP1000 support
Subsystems (7)
Jia Wang
maintainerv2 cover net: stmmac: Add common RGMII delay handling and DP1000 support
The UltraRISC DP1000 integrates a Synopsys DesignWare GMAC from the 5.20 series with fixed internal delays on both TX and RX RGMII clock paths.
For boards without PCB delays, "rgmii-id" describes the link. Passing this mode unchanged to the PHY would enable another pair of delays and break RGMII timing.
Add TX and RX internal-delay capability flags to the common stmmac platform data and adjust the PHY interface mode in stmmac_pltfr_probe(). Convert the Sophgo and EIC7700 glue drivers to this common handling, then add the DP1000 binding and glue driver. The DP1000 glue driver only declares both delay capabilities.
Tested with:
1. dt_binding_check and dtbs_check.
2. RISC-V build with CONFIG_DWMAC_ULTRARISC=m.
3. Runtime validation on Shenzhen Rongda M0 with a YT8531S PHY and Milk-V Titan with an RTL8211F PHY: ultrarisc-dwmac binds and establishes a 1000 Mb/s full-duplex link on both boards.
---
Changes in v2:
- Fold the snps,dwmac compatible-list update into the DP1000 binding patch.
- Add common stmmac capability flags for MAC-provided RGMII delays.
- Convert Sophgo and EIC7700 to the common RGMII delay handling.
- Simplify the DP1000 glue driver to declare its TX and RX delay
capabilities.
- Add Conor Dooley's Reviewed-by tag to the DP1000 binding patch.
- Link to v1: https://patch.msgid.link/[email protected]
To: Andrew Lunn <[email protected]>
To: "David S. Miller" <[email protected]>
To: Eric Dumazet <[email protected]>
To: Jakub Kicinski <[email protected]>
To: Paolo Abeni <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
To: Jia Wang <[email protected]>
To: Alexandre Torgue <[email protected]>
To: Giuseppe Cavallaro <[email protected]>
To: Jose Abreu <[email protected]>
To: Maxime Chevallier <[email protected]>
To: Maxime Coquelin <[email protected]>
To: Chen Wang <[email protected]>
To: Inochi Amaoto <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Jia Wang (5):
net: stmmac: Add common internal RGMII delay handling
net: stmmac: sophgo: Use common RGMII delay handling
net: stmmac: eic7700: Use common RGMII delay handling
dt-bindings: net: Add UltraRISC DP1000 GMAC
net: stmmac: Add UltraRISC DP1000 GMAC support
.../devicetree/bindings/net/snps,dwmac.yaml | 1 + .../bindings/net/ultrarisc,dp1000-gmac.yaml | 74 ++++++++++++++++++++++ MAINTAINERS | 6 ++ drivers/net/ethernet/stmicro/stmmac/Kconfig | 11 ++++ drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../net/ethernet/stmicro/stmmac/dwmac-eic7700.c | 13 +--- drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c | 12 ++-- .../net/ethernet/stmicro/stmmac/dwmac-ultrarisc.c | 52 +++++++++++++++ .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 11 ++++ include/linux/stmmac.h | 2 + 10 files changed, 164 insertions(+), 19 deletions(-)
---
base-commit: df2908090cda368b01ff43709f51890076c56157
change-id: 20260827-dwmac-ultrarisc-7c79f2f80fd1
Best regards,
Signature · 1 line
Jia Wang <[email protected]>
Jia Wang
maintainerPATCH v2 1/5 net: stmmac: Add common internal RGMII delay handling
Some DWMAC integrations add fixed RGMII clock delays internally. Glue drivers need to account for these delays before passing the interface mode to the PHY.
Add TX and RX delay capability flags to the common platform data. Apply phy_fix_phy_mode_for_mac_delays() in stmmac_pltfr_probe() when either capability is present.
This lets glue drivers describe the MAC capabilities without duplicating the interface-mode validation and conversion.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 11 +++++++++++ include/linux/stmmac.h | 2 ++ 2 files changed, 13 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +11 -0
@@ -16,6 +16,7 @@#include <linux/of.h> #include <linux/of_net.h> #include <linux/of_mdio.h> +#include <linux/phy.h> #include "stmmac.h" #include "stmmac_platform.h"
@@ -847,6 +848,16 @@ int stmmac_pltfr_probe(struct platform_device *pdev, struct plat_stmmacenet_data *plat, struct stmmac_resources *res) { +if (plat->has_internal_tx_delay || plat->has_internal_rx_delay) { + plat->phy_interface = +phy_fix_phy_mode_for_mac_delays (plat->phy_interface, + plat->has_internal_tx_delay, + plat->has_internal_rx_delay); +if (plat->phy_interface ==PHY_INTERFACE_MODE_NA ) +return dev_err_probe (&pdev->dev, -EINVAL , +"unsupported phy interface mode\n" ); + } +if (!plat->suspend && plat->exit) plat->suspend = stmmac_plat_suspend;if (!plat->resume && plat->init)
include/linux/stmmac.h +2 -0
@@ -242,6 +242,8 @@ struct plat_stmmacenet_data {* that phylink uses. */ phy_interface_t phy_interface; +bool has_internal_tx_delay; +bool has_internal_rx_delay;struct stmmac_mdio_bus_data *mdio_bus_data;struct device_node *phy_node;struct device_node *mdio_node;
Signature · 1 line
2.34.1
Re: [PATCH net-next v2 1/5] net: stmmac: Add common internal RGMII delay handling
Hi,
Quoted 33 lines · Jia Wang
Some DWMAC integrations add fixed RGMII clock delays internally. Glue drivers need to account for these delays before passing the interface mode to the PHY.
Add TX and RX delay capability flags to the common platform data. Apply
phy_fix_phy_mode_for_mac_delays()instmmac_pltfr_probe()when either capability is present.This lets glue drivers describe the MAC capabilities without duplicating the interface-mode validation and conversion.
Signed-off-by Jia Wang <[email protected]>--- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 11 +++++++++++ include/linux/stmmac.h | 2 ++ 2 files changed, 13 insertions(+)drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1
-0@@ -16,6 +16,7 @@#include <linux/of.h> #include <linux/of_net.h> #include <linux/of_mdio.h> +#include <linux/phy.h> #include "stmmac.h" #include "stmmac_platform.h" @@ -847,6 +848,16 @@ int stmmac_pltfr_probe(struct platform_device *pdev,struct plat_stmmacenet_data *plat, struct stmmac_resources *res) {
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c int stmmac_pltfr_probe(struct platform_device *pdev, · line 860
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +10
-0+if (plat->has_internal_tx_delay || plat->has_internal_rx_delay) { + plat->phy_interface = +phy_fix_phy_mode_for_mac_delays (plat->phy_interface, + plat->has_internal_tx_delay, + plat->has_internal_rx_delay); +if (plat->phy_interface ==PHY_INTERFACE_MODE_NA ) +return dev_err_probe (&pdev->dev, -EINVAL , +"unsupported phy interface mode\n" ); + } +
Seems good, the default values should be false hence this condition won't be taken,
Maxime
Jia Wang
maintainerPATCH v2 2/5 net: stmmac: sophgo: Use common RGMII delay handling
In reply to Jia WangDescribe the SG2042 internal RX delay through the common stmmac platform data and let stmmac_pltfr_probe() adjust the PHY interface mode.
This removes the duplicated mode conversion without changing the hardware behavior.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c +4 -8
@@ -55,14 +55,10 @@ static int sophgo_dwmac_probe(struct platform_device *pdev)return ret; data =device_get_match_data (&pdev->dev); -if (data && data->has_internal_rx_delay) { - plat_dat->phy_interface =phy_fix_phy_mode_for_mac_delays (plat_dat->phy_interface, - false, true); -if (plat_dat->phy_interface ==PHY_INTERFACE_MODE_NA ) -return -EINVAL ; - } - -return stmmac_dvr_probe (dev, plat_dat, &stmmac_res); +if (data) + plat_dat->has_internal_rx_delay = data->has_internal_rx_delay; + +return stmmac_pltfr_probe (pdev, plat_dat, &stmmac_res); }static const struct sophgo_dwmac_data sg2042_dwmac_data = {
Signature · 1 line
2.34.1
Re: [PATCH net-next v2 2/5] net: stmmac: sophgo: Use common RGMII delay handling
Hi,
Quoted 11 lines · Jia Wang
Describe the SG2042 internal RX delay through the common stmmac platform data and let
stmmac_pltfr_probe()adjust the PHY interface mode.This removes the duplicated mode conversion without changing the hardware behavior.
Signed-off-by Jia Wang <[email protected]>--- drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
Ah good :)
Maxime
Jia Wang
maintainerPATCH v2 3/5 net: stmmac: eic7700: Use common RGMII delay handling
In reply to Jia WangDescribe the EIC7700 inherent TX delay through the common stmmac platform data and let stmmac_pltfr_probe() adjust the PHY interface mode.
Keep the existing programmable TX and RX delay configuration in the EIC7700 glue driver.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-eic7700.c +2 -11
@@ -198,18 +198,9 @@ static int eic7700_dwmac_probe(struct platform_device *pdev)/* * The MAC silicon unconditionally adds ~2 ns TX delay; prevent * the PHY from also adding TX delay to avoid doubling it. -* -* DT specifies rgmii-id (TX from MAC silicon, RX from PHY); -* override to rgmii-rxid so the PHY only adds its RX delay. +* The common platform code adjusts the PHY interface accordingly. */ -if (data->has_internal_tx_delay) { - plat_dat->phy_interface = -phy_fix_phy_mode_for_mac_delays (plat_dat->phy_interface, - true, false); -if (plat_dat->phy_interface ==PHY_INTERFACE_MODE_NA ) -return dev_err_probe (&pdev->dev, -EINVAL , -"phy interface mode is NA\n" ); - } + plat_dat->has_internal_tx_delay = data->has_internal_tx_delay;/* Read rx-internal-delay-ps and update rx_clk delay */ if (!of_property_read_u32(pdev->dev.of_node,
Signature · 1 line
2.34.1
Re: [PATCH net-next v2 3/5] net: stmmac: eic7700: Use common RGMII delay handling
Hi,
Quoted 8 lines · Jia Wang
Describe the EIC7700 inherent TX delay through the common stmmac platform data and let
stmmac_pltfr_probe()adjust the PHY interface mode.Keep the existing programmable TX and RX delay configuration in the EIC7700 glue driver.
Signed-off-by Jia Wang <[email protected]>
Maxime
Jia Wang
maintainerPATCH v2 4/5 dt-bindings: net: Add UltraRISC DP1000 GMAC
In reply to Jia WangThe DP1000 integrates a Synopsys DesignWare GMAC from the 5.20 series with one MMIO register range, one clock and one interrupt.
It also provides fixed TX and RX RGMII clock delays that cannot be disabled. Board connections must therefore not add either delay in PCB traces, making "rgmii-id" the only supported phy-mode.
--- .../devicetree/bindings/net/snps,dwmac.yaml | 1 + .../bindings/net/ultrarisc,dp1000-gmac.yaml | 74 ++++++++++++++++++++++ MAINTAINERS | 5 ++ 3 files changed, 80 insertions(+)
Documentation/devicetree/bindings/net/snps,dwmac.yaml +1 -0
@@ -119,6 +119,7 @@ properties: - starfive,jh7110-dwmac - tesla,fsd-ethqos - thead,th1520-gmac + - ultrarisc,dp1000-gmac reg: minItems: 1
Documentation/devicetree/bindings/net/ultrarisc,dp1000-gmac.yaml new file +74 -0
74 lines not on this page · raw message
MAINTAINERS +5 -0
@@ -27995,6 +27995,11 @@ F: Documentation/devicetree/bindings/clock/ultrarisc,dp1000-clk.yaml F: drivers/clk/ultrarisc/* F: include/dt-bindings/clock/ultrarisc,dp1000-clk.h +ULTRARISC DP1000 DWMAC GLUE LAYER +M: Jia Wang <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/net/ultrarisc,dp1000-gmac.yaml + ULTRARISC DP1000 PINCTRL DRIVER M: Jia Wang <[email protected]> L: [email protected]
Signature · 1 line
2.34.1
Jia Wang
maintainerPATCH v2 5/5 net: stmmac: Add UltraRISC DP1000 GMAC support
In reply to Jia WangThe UltraRISC DP1000 GMAC provides fixed internal delays on both TX and RX RGMII clock paths.
Add a platform glue driver and describe both delay capabilities through the common stmmac platform data. This lets the common RGMII delay handling adjust the interface mode passed to the PHY and reject incompatible RGMII modes.
--- MAINTAINERS | 1 + drivers/net/ethernet/stmicro/stmmac/Kconfig | 11 +++++ drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../net/ethernet/stmicro/stmmac/dwmac-ultrarisc.c | 52 ++++++++++++++++++++++ 4 files changed, 65 insertions(+)
MAINTAINERS +1 -0
@@ -27999,6 +27999,7 @@ ULTRARISC DP1000 DWMAC GLUE LAYER M: Jia Wang <[email protected]> S: Maintained F: Documentation/devicetree/bindings/net/ultrarisc,dp1000-gmac.yaml +F: drivers/net/ethernet/stmicro/stmmac/dwmac-ultrarisc.c ULTRARISC DP1000 PINCTRL DRIVER M: Jia Wang <[email protected]>
drivers/net/ethernet/stmicro/stmmac/Kconfig +11 -0
@@ -319,6 +319,17 @@ config DWMAC_THEAD the stmmac device driver. This driver is used for T-HEAD TH1520 ethernet controller. +config DWMAC_ULTRARISC + tristate "UltraRISC DWMAC support" + default ARCH_ULTRARISC + depends on OF && (ARCH_ULTRARISC || COMPILE_TEST) + help + Support for the Ethernet controller on the UltraRISC DP1000 SoC. + + This selects the UltraRISC platform specific glue layer support + for the stmmac device driver. This driver is used for the DP1000 + GMAC Ethernet controller. + config DWMAC_IMX8 tristate "NXP IMX8 DWMAC support" default ARCH_MXC
drivers/net/ethernet/stmicro/stmmac/Makefile +1 -0
@@ -36,6 +36,7 @@ obj-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o obj-$(CONFIG_DWMAC_SUN8I) += dwmac-sun8i.o obj-$(CONFIG_DWMAC_SUN55I) += dwmac-sun55i.o obj-$(CONFIG_DWMAC_THEAD) += dwmac-thead.o +obj-$(CONFIG_DWMAC_ULTRARISC) += dwmac-ultrarisc.o obj-$(CONFIG_DWMAC_DWC_QOS_ETH) += dwmac-dwc-qos-eth.o obj-$(CONFIG_DWMAC_INTEL_PLAT) += dwmac-intel-plat.o obj-$(CONFIG_DWMAC_LOONGSON1) += dwmac-loongson1.o
drivers/net/ethernet/stmicro/stmmac/dwmac-ultrarisc.c new file +52 -0
52 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH net-next v2 5/5] net: stmmac: Add UltraRISC DP1000 GMAC support
Hi,
Quoted 9 lines · Jia Wang
The UltraRISC DP1000 GMAC provides fixed internal delays on both TX and RX RGMII clock paths.
Add a platform glue driver and describe both delay capabilities through the common stmmac platform data. This lets the common RGMII delay handling adjust the interface mode passed to the PHY and reject incompatible RGMII modes.
Signed-off-by Jia Wang <[email protected]>
Maxime
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 8 lines · On Mon, 07 Sep 2026 15:46:49 +0800 you wrote:
The UltraRISC DP1000 integrates a Synopsys DesignWare GMAC from the 5.20 series with fixed internal delays on both TX and RX RGMII clock paths.
For boards without PCB delays, "rgmii-id" describes the link. Passing this mode unchanged to the PHY would enable another pair of delays and break RGMII timing.
[...]
Here is the summary with links:
- [net-next,v2,1/5] net: stmmac: Add common internal RGMII delay handling
https://git.kernel.org/netdev/net-next/c/cc54f9667188 - [net-next,v2,2/5] net: stmmac: sophgo: Use common RGMII delay handling https://git.kernel.org/netdev/net-next/c/7d1cbb9ba933 - [net-next,v2,3/5] net: stmmac: eic7700: Use common RGMII delay handling https://git.kernel.org/netdev/net-next/c/345d78e30980 - [net-next,v2,4/5] dt-bindings: net: Add UltraRISC DP1000 GMAC https://git.kernel.org/netdev/net-next/c/8dbfb46c233a - [net-next,v2,5/5] net: stmmac: Add UltraRISC DP1000 GMAC support https://git.kernel.org/netdev/net-next/c/c6ff098cb63a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html