Thread (16 messages) flat view 16 messages, 4 authors, 24m ago

Re: [PATCH net-next 3/3] net: stmmac: Add UltraRISC DP1000 GMAC support

From: Jia Wang <wangjia@ultrarisc.com>
Date: 2026-09-03 07:47:51
Also in: linux-arm-kernel, linux-devicetree, lkml

On 2026-09-01 15:48 +0200, Andrew Lunn wrote:
quoted
--- /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 <linux/module.h>
+#include <linux/phy.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->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");
This looks to be 90% identical to dwmac-sophgo.c.

Do you expect any further changes to this driver? Is everything
supported? Are there more clocks? A GPIO for WoL?

I'm just wondering if the common code should be pulled out, or even
dwmac-sophgo.c made generic so it can handle all plain boring devices
which have RGMII delays and not a lot else.
The probe boilerplate is indeed largely similar because both drivers
use the common stmmac platform helpers. However, their platform-specific
requirements differ: Sophgo requires additional TX clock handling and
other configuration, while DP1000 requires fixed TX and RX delay
handling. ACPI support under development is also intended to use the
UltraRISC glue driver.
      Andrew
Best regards,
Jia Wang

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help