summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJia Wang <wangjia@ultrarisc.com>2026-09-07 15:46:54 +0800
committerPaolo Abeni <pabeni@redhat.com>2026-09-10 10:38:02 +0200
commitc6ff098cb63a5d2ac491be0a307d6058876292f5 (patch)
treecb28ecfe28434d449c6290619484cbddd0013a9a
parent8dbfb46c233abe2a3482cca0ff58ade39a95f8c6 (diff)
downloadlinux-next-c6ff098cb63a5d2ac491be0a307d6058876292f5.tar.gz
linux-next-c6ff098cb63a5d2ac491be0a307d6058876292f5.zip
net: stmmac: Add UltraRISC DP1000 GMAC support
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 <wangjia@ultrarisc.com> Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Link: https://patch.msgid.link/20260907-dwmac-ultrarisc-v2-5-9a39bf8db313@ultrarisc.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r--MAINTAINERS1
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/Kconfig11
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/Makefile1
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-ultrarisc.c52
4 files changed, 65 insertions, 0 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 17679f5c911d..878ecf1fdf27 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -28001,6 +28001,7 @@ ULTRARISC DP1000 DWMAC GLUE LAYER
M: Jia Wang <wangjia@ultrarisc.com>
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 <wangjia@ultrarisc.com>
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..0b62a75b782a
--- /dev/null
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ultrarisc.c
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * UltraRISC DWMAC platform driver
+ *
+ * Copyright (C) 2026 UltraRISC Technology (Shanghai) Co., Ltd.
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+#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->has_internal_tx_delay = true;
+ plat_dat->has_internal_rx_delay = true;
+
+ 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");