The UltraRISC DP1000 GMAC is based on a Synopsys DesignWare MAC. Allow its SoC-specific compatible in the common DWMAC compatible list. Signed-off-by: Jia Wang --- Documentation/devicetree/bindings/net/snps,dwmac.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml index 2449311c6d28..2ed4564ae99d 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -119,6 +119,7 @@ properties: - starfive,jh7110-dwmac - tesla,fsd-ethqos - thead,th1520-gmac + - ultrarisc,dp1000-gmac reg: minItems: 1 -- 2.34.1 The 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. Signed-off-by: Jia Wang --- .../bindings/net/ultrarisc,dp1000-gmac.yaml | 74 ++++++++++++++++++++++ MAINTAINERS | 5 ++ 2 files changed, 79 insertions(+) diff --git a/Documentation/devicetree/bindings/net/ultrarisc,dp1000-gmac.yaml b/Documentation/devicetree/bindings/net/ultrarisc,dp1000-gmac.yaml new file mode 100644 index 000000000000..13029302877b --- /dev/null +++ b/Documentation/devicetree/bindings/net/ultrarisc,dp1000-gmac.yaml @@ -0,0 +1,74 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/ultrarisc,dp1000-gmac.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: UltraRISC DP1000 DWMAC Ethernet controller + +maintainers: + - Jia Wang + +description: + The DP1000 integrates a Synopsys DesignWare GMAC controller from the + 5.20 series. The SoC integration adds fixed RGMII TX and RX clock delays + which cannot be disabled. Consequently, a functional RGMII link requires + a PCB without TX or RX clock delays, represented by "rgmii-id". + +select: + properties: + compatible: + contains: + const: ultrarisc,dp1000-gmac + required: + - compatible + +properties: + compatible: + items: + - const: ultrarisc,dp1000-gmac + - const: snps,dwmac-5.20 + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + const: stmmaceth + + interrupts: + maxItems: 1 + + interrupt-names: + const: macirq + + phy-mode: + const: rgmii-id + +required: + - compatible + - reg + - clocks + - clock-names + - interrupts + - interrupt-names + - phy-mode + +allOf: + - $ref: snps,dwmac.yaml# + +unevaluatedProperties: false + +examples: + - | + ethernet@38000000 { + compatible = "ultrarisc,dp1000-gmac", "snps,dwmac-5.20"; + reg = <0x38000000 0x1000000>; + clocks = <&clk 0>; + clock-names = "stmmaceth"; + interrupts = <84>; + interrupt-names = "macirq"; + phy-mode = "rgmii-id"; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 3a19da74d00c..3b96ff0734e6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -28004,6 +28004,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 +S: Maintained +F: Documentation/devicetree/bindings/net/ultrarisc,dp1000-gmac.yaml + ULTRARISC DP1000 PINCTRL DRIVER M: Jia Wang L: linux-gpio@vger.kernel.org -- 2.34.1 The DP1000 GMAC integration provides fixed TX and RX RGMII clock delays that cannot be disabled. For boards without PCB delays, "rgmii-id" describes the link, but passing that mode unchanged to the PHY would enable a second set of delays. Use phy_fix_phy_mode_for_mac_delays() to translate "rgmii-id" to "rgmii" before attaching the PHY. Reject other RGMII modes because the fixed MAC delays cannot be combined with them without duplicating or omitting a delay. Signed-off-by: Jia Wang --- MAINTAINERS | 1 + drivers/net/ethernet/stmicro/stmmac/Kconfig | 11 +++++ drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../net/ethernet/stmicro/stmmac/dwmac-ultrarisc.c | 54 ++++++++++++++++++++++ 4 files changed, 67 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3b96ff0734e6..aacbab369b51 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -28008,6 +28008,7 @@ ULTRARISC DP1000 DWMAC GLUE LAYER M: Jia Wang 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 diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index e3dd5adda5ac..ab3c4cf96423 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig @@ -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 diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile index a1cea2f57252..b16a456b730e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Makefile +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile @@ -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 diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ultrarisc.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ultrarisc.c new file mode 100644 index 000000000000..4bdda2665338 --- /dev/null +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ultrarisc.c @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * UltraRISC DWMAC platform driver + * + * Copyright (C) 2026 UltraRISC Technology (Shanghai) Co., Ltd. + */ + +#include +#include +#include + +#include "stmmac_platform.h" + +static int ultrarisc_dwmac_probe(struct platform_device *pdev) +{ + struct plat_stmmacenet_data *plat_dat; + struct stmmac_resources stmmac_res; + struct device *dev = &pdev->dev; + int ret; + + ret = stmmac_get_platform_resources(pdev, &stmmac_res); + if (ret) + return dev_err_probe(dev, ret, "failed to get resources\n"); + + plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); + if (IS_ERR(plat_dat)) + return dev_err_probe(dev, PTR_ERR(plat_dat), "failed to parse DT parameters\n"); + + plat_dat->phy_interface = + phy_fix_phy_mode_for_mac_delays(plat_dat->phy_interface, true, true); + if (plat_dat->phy_interface == PHY_INTERFACE_MODE_NA) + return dev_err_probe(dev, -EINVAL, "unsupported phy interface mode\n"); + + return devm_stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res); +} + +static const struct of_device_id ultrarisc_dwmac_match[] = { + { .compatible = "ultrarisc,dp1000-gmac" }, + { } +}; +MODULE_DEVICE_TABLE(of, ultrarisc_dwmac_match); + +static struct platform_driver ultrarisc_dwmac_driver = { + .probe = ultrarisc_dwmac_probe, + .driver = { + .name = "ultrarisc-dwmac", + .pm = &stmmac_pltfr_pm_ops, + .of_match_table = ultrarisc_dwmac_match, + }, +}; +module_platform_driver(ultrarisc_dwmac_driver); + +MODULE_DESCRIPTION("UltraRISC DWMAC platform driver"); +MODULE_LICENSE("GPL"); -- 2.34.1