devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Add MxL Ethernet driver & devicetree binding
@ 2025-08-22  9:08 Jack Ping CHNG
  2025-08-22  9:08 ` [PATCH net-next 1/2] net: maxlinear: Add build support for MxL SoC Jack Ping CHNG
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jack Ping CHNG @ 2025-08-22  9:08 UTC (permalink / raw)
  To: netdev, devicetree
  Cc: davem, andrew+netdev, edumazet, kuba, pabeni, robh, krzk+dt,
	conor+dt, yzhu, sureshnagaraj, Jack Ping CHNG

Hello netdev maintainers,

This patch series adds support for the MaxLinear LGM SoC's Ethernet
controller, including:

Patch 1: Adds build infrastructure and the main driver for the MaxLinear LGM
SoC Ethernet controller.
Patch 2: Introduces the devicetree binding documentation for the MaxLinear LGM
Network Processor.

The driver supports multi-port operation and is integrated with standard Linux
network device driver framework. The devicetree binding documents the required
properties for the hardware description.

Please review and let me know if any changes are required.

Jack Ping CHNG (2):
  net: maxlinear: Add build support for MxL SoC
  dt-bindings: net: mxl: Add MxL LGM Network Processor SoC

 .../devicetree/bindings/net/mxl,lgm-eth.yaml  |  59 +++++
 .../device_drivers/ethernet/index.rst         |   1 +
 .../device_drivers/ethernet/maxlinear/mxl.rst |  72 ++++++
 MAINTAINERS                                   |   7 +
 drivers/net/ethernet/Kconfig                  |   1 +
 drivers/net/ethernet/Makefile                 |   1 +
 drivers/net/ethernet/maxlinear/Kconfig        |  15 ++
 drivers/net/ethernet/maxlinear/Makefile       |   6 +
 drivers/net/ethernet/maxlinear/mxl_eth.c      | 205 ++++++++++++++++++
 9 files changed, 367 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml
 create mode 100644 Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst
 create mode 100644 drivers/net/ethernet/maxlinear/Kconfig
 create mode 100644 drivers/net/ethernet/maxlinear/Makefile
 create mode 100644 drivers/net/ethernet/maxlinear/mxl_eth.c

-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net-next 1/2] net: maxlinear: Add build support for MxL SoC
  2025-08-22  9:08 [PATCH net-next 0/2] Add MxL Ethernet driver & devicetree binding Jack Ping CHNG
@ 2025-08-22  9:08 ` Jack Ping CHNG
  2025-08-22  9:42   ` Krzysztof Kozlowski
  2025-08-22 14:58   ` Andrew Lunn
  2025-08-22  9:08 ` [PATCH net-next 2/2] dt-bindings: net: mxl: Add MxL LGM Network Processor SoC Jack Ping CHNG
  2025-08-22 15:06 ` [PATCH net-next 0/2] Add MxL Ethernet driver & devicetree binding Andrew Lunn
  2 siblings, 2 replies; 8+ messages in thread
From: Jack Ping CHNG @ 2025-08-22  9:08 UTC (permalink / raw)
  To: netdev, devicetree
  Cc: davem, andrew+netdev, edumazet, kuba, pabeni, robh, krzk+dt,
	conor+dt, yzhu, sureshnagaraj, Jack Ping CHNG

Add build infrastructure for MxL network driver.
Ethernet driver to initialize and create network devices.

Signed-off-by: Jack Ping CHNG <jchng@maxlinear.com>
---
 .../device_drivers/ethernet/index.rst         |   1 +
 .../device_drivers/ethernet/maxlinear/mxl.rst |  72 ++++++
 MAINTAINERS                                   |   7 +
 drivers/net/ethernet/Kconfig                  |   1 +
 drivers/net/ethernet/Makefile                 |   1 +
 drivers/net/ethernet/maxlinear/Kconfig        |  15 ++
 drivers/net/ethernet/maxlinear/Makefile       |   6 +
 drivers/net/ethernet/maxlinear/mxl_eth.c      | 205 ++++++++++++++++++
 8 files changed, 308 insertions(+)
 create mode 100644 Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst
 create mode 100644 drivers/net/ethernet/maxlinear/Kconfig
 create mode 100644 drivers/net/ethernet/maxlinear/Makefile
 create mode 100644 drivers/net/ethernet/maxlinear/mxl_eth.c

diff --git a/Documentation/networking/device_drivers/ethernet/index.rst b/Documentation/networking/device_drivers/ethernet/index.rst
index 0b0a3eef6aae..91820ddc6e7b 100644
--- a/Documentation/networking/device_drivers/ethernet/index.rst
+++ b/Documentation/networking/device_drivers/ethernet/index.rst
@@ -44,6 +44,7 @@ Contents:
    marvell/octeontx2
    marvell/octeon_ep
    marvell/octeon_ep_vf
+   maxlinear/mxl
    mellanox/mlx5/index
    meta/fbnic
    microsoft/netvsc
diff --git a/Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst b/Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst
new file mode 100644
index 000000000000..7d1a8e415a4a
--- /dev/null
+++ b/Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst
@@ -0,0 +1,72 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+===============================================
+MaxLinear Multi-MAC Network Processor (NP)
+===============================================
+
+Copyright(c) 2025 MaxLinear, Inc.
+
+Overview
+========
+
+This document describes the Linux driver for the MaxLinear Network Processor
+(NP), a high-performance controller supporting multiple MACs and
+advanced packet processing capabilities.
+
+The MaxLinear Network processor integrates programmable hardware accelerators
+for tasks such as Layer 2, 3, 4 forwarding, flow steering, and traffic shaping.
+It is designed to operate in high-throughput applications, including data
+center switching, virtualized environments, and telco infrastructure.
+
+Key Features
+============
+
+- Support for up to 4 independent 10 Gbit/s MAC interfaces
+- Full-duplex 10G operation
+- Multiqueue support for parallel RX/TX paths (per MAC)
+
+Supported Devices
+=================
+
+The driver supports the following MaxLinear NPU family devices:
+- MaxLinear LGM
+
+Each device supports multiple MACs and high-performance data pipelines managed
+through internal firmware and programmable engines.
+
+Driver Location
+===============
+
+The driver source code is located in the kernel tree at:
+  drivers/net/ethernet/maxlinear/
+
+Interfaces are created as standard Linux `net_device` interfaces:
+
+- eth0, eth1 (up to 2)
+- Multiqueue support (e.g., eth0 has multiple TX/RX queues)
+
+Kernel Configuration
+====================
+
+The driver is located in the menu structure at:
+
+  -> Device Drivers
+    -> Network device support
+      -> Ethernet driver support
+        -> MaxLinear NPU Ethernet driver
+
+Or set in your kernel config:
+  CONFIG_NET_VENDOR_MAXLINEAR=y
+  CONFIG_MAXLINEAR_ETH=y
+
+Maintainers
+===========
+
+See the MAINTAINERS file:
+
+    MAXLINEAR ETHERNET DRIVER
+    M: Jack Ping Chng <jchng@maxlinear.com>
+    L: netdev@vger.kernel.org
+    S: Supported
+    F: drivers/net/ethernet/maxlinear/
+
diff --git a/MAINTAINERS b/MAINTAINERS
index bce96dd254b8..9164ba07a9c3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15101,6 +15101,13 @@ W:	https://linuxtv.org
 T:	git git://linuxtv.org/media.git
 F:	drivers/media/radio/radio-maxiradio*
 
+MAXLINEAR ETHERNET DRIVER
+M:	Jack Ping Chng <jchng@maxlinear.com>
+L:	netdev@vger.kernel.org
+S:	Maintained
+F:	Documentation/networking/device_drivers/ethernet/maxlinear/*
+F:	drivers/net/ethernet/maxlinear/
+
 MAXLINEAR ETHERNET PHY DRIVER
 M:	Xu Liang <lxu@maxlinear.com>
 L:	netdev@vger.kernel.org
diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig
index f86d4557d8d7..94d0bb98351a 100644
--- a/drivers/net/ethernet/Kconfig
+++ b/drivers/net/ethernet/Kconfig
@@ -33,6 +33,7 @@ source "drivers/net/ethernet/aquantia/Kconfig"
 source "drivers/net/ethernet/arc/Kconfig"
 source "drivers/net/ethernet/asix/Kconfig"
 source "drivers/net/ethernet/atheros/Kconfig"
+source "drivers/net/ethernet/maxlinear/Kconfig"
 
 config CX_ECAT
 	tristate "Beckhoff CX5020 EtherCAT master support"
diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile
index 67182339469a..760d598df197 100644
--- a/drivers/net/ethernet/Makefile
+++ b/drivers/net/ethernet/Makefile
@@ -58,6 +58,7 @@ obj-$(CONFIG_LANTIQ_ETOP) += lantiq_etop.o
 obj-$(CONFIG_LANTIQ_XRX200) += lantiq_xrx200.o
 obj-$(CONFIG_NET_VENDOR_LITEX) += litex/
 obj-$(CONFIG_NET_VENDOR_MARVELL) += marvell/
+obj-$(CONFIG_NET_VENDOR_MAXLINEAR) += maxlinear/
 obj-$(CONFIG_NET_VENDOR_MEDIATEK) += mediatek/
 obj-$(CONFIG_NET_VENDOR_MELLANOX) += mellanox/
 obj-$(CONFIG_NET_VENDOR_META) += meta/
diff --git a/drivers/net/ethernet/maxlinear/Kconfig b/drivers/net/ethernet/maxlinear/Kconfig
new file mode 100644
index 000000000000..b88cdd9675fb
--- /dev/null
+++ b/drivers/net/ethernet/maxlinear/Kconfig
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config NET_VENDOR_MAXLINEAR
+	bool "MaxLinear devices"
+	help
+	  If you have a MaxLinear SoC with ethernet, say Y.
+
+if NET_VENDOR_MAXLINEAR
+
+config MXL_NPU
+	tristate "MaxLinear NPU Ethernet driver"
+	help
+	  This driver supports the MaxLinear NPU Ethernet.
+
+endif #NET_VENDOR_MAXLINEAR
+
diff --git a/drivers/net/ethernet/maxlinear/Makefile b/drivers/net/ethernet/maxlinear/Makefile
new file mode 100644
index 000000000000..0577b325494c
--- /dev/null
+++ b/drivers/net/ethernet/maxlinear/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Makefile for the MaxLinear network device drivers.
+#
+
+obj-$(CONFIG_MXL_NPU) += mxl_eth.o
diff --git a/drivers/net/ethernet/maxlinear/mxl_eth.c b/drivers/net/ethernet/maxlinear/mxl_eth.c
new file mode 100644
index 000000000000..48ba1bff923d
--- /dev/null
+++ b/drivers/net/ethernet/maxlinear/mxl_eth.c
@@ -0,0 +1,205 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2025  MaxLinear, Inc.
+ */
+#include <linux/clk.h>
+#include <linux/etherdevice.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/netdevice.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/reset.h>
+
+#define ETH_TX_TIMEOUT		(10 * HZ)
+#define MXL_NUM_TX_RING		8
+#define MXL_NUM_RX_RING		8
+#define MXL_NUM_PORT		2
+
+static const char * const clk_names = "ethif";
+
+struct mxl_eth_drvdata {
+	struct net_device *ndevs[MXL_NUM_PORT];
+	struct clk *clks;
+};
+
+struct eth_priv {
+	struct platform_device *pdev;
+	struct device_node *np;
+};
+
+static int mxl_eth_open(struct net_device *ndev)
+{
+	netif_carrier_on(ndev);
+	netif_start_queue(ndev);
+	return 0;
+}
+
+static int mxl_eth_stop(struct net_device *ndev)
+{
+	netif_stop_queue(ndev);
+	netif_carrier_off(ndev);
+	return 0;
+}
+
+static int mxl_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
+{
+	dev_kfree_skb(skb);
+	return NETDEV_TX_OK;
+}
+
+static const struct net_device_ops mxl_eth_netdev_ops = {
+	.ndo_open       = mxl_eth_open,
+	.ndo_stop       = mxl_eth_stop,
+	.ndo_start_xmit = mxl_eth_start_xmit,
+};
+
+static int mxl_eth_create_ndev(struct platform_device *pdev,
+			       struct device_node *np,
+			       struct net_device **ndev_out)
+{
+	struct net_device *ndev;
+	struct eth_priv *priv;
+	int ret;
+
+	ndev = devm_alloc_etherdev_mqs(&pdev->dev, sizeof(struct eth_priv),
+				       MXL_NUM_TX_RING, MXL_NUM_RX_RING);
+	if (!ndev) {
+		dev_err(&pdev->dev, "alloc_etherdev_mq failed\n");
+		return -ENOMEM;
+	}
+
+	snprintf(ndev->name, IFNAMSIZ, "eth%%d");
+	ndev->netdev_ops = &mxl_eth_netdev_ops;
+	ndev->watchdog_timeo = ETH_TX_TIMEOUT;
+	ndev->max_mtu = ETH_FRAME_LEN;
+	ndev->min_mtu = ETH_MIN_MTU;
+	SET_NETDEV_DEV(ndev, &pdev->dev);
+
+	priv = netdev_priv(ndev);
+	priv->pdev = pdev;
+	priv->np = np;
+
+	ret = register_netdev(ndev);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to register net device\n");
+		return ret;
+	}
+
+	*ndev_out = ndev;
+	return 0;
+}
+
+static void mxl_eth_cleanup(struct mxl_eth_drvdata *pdata)
+{
+	int i;
+
+	for (i = 0; i < MXL_NUM_PORT && pdata->ndevs[i]; i++) {
+		unregister_netdev(pdata->ndevs[i]);
+		pdata->ndevs[i] = NULL;
+	}
+
+	if (!IS_ERR(pdata->clks))
+		clk_disable_unprepare(pdata->clks);
+}
+
+static int mxl_eth_probe(struct platform_device *pdev)
+{
+	struct mxl_eth_drvdata *pdata;
+	struct reset_control *rst;
+	struct net_device *ndev;
+	struct device_node *np;
+	int ret, i;
+
+	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		return -ENOMEM;
+
+	pdata->clks = devm_clk_get(&pdev->dev, clk_names);
+	if (IS_ERR(pdata->clks)) {
+		dev_err(&pdev->dev, "failed to get %s\n", clk_names);
+		return PTR_ERR(pdata->clks);
+	}
+
+	ret = clk_prepare_enable(pdata->clks);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to enable %s\n", clk_names);
+		return ret;
+	}
+
+	rst = devm_reset_control_get_optional(&pdev->dev, NULL);
+	if (IS_ERR(rst)) {
+		dev_err(&pdev->dev,
+			"failed to get optional reset control: %ld\n",
+			PTR_ERR(rst));
+		ret = PTR_ERR(rst);
+		goto err_cleanup;
+	}
+
+	if (rst) {
+		ret = reset_control_assert(rst);
+		if (ret)
+			goto err_cleanup;
+
+		udelay(1);
+
+		ret = reset_control_deassert(rst);
+		if (ret)
+			goto err_cleanup;
+	}
+
+	platform_set_drvdata(pdev, pdata);
+
+	i = 0;
+	for_each_available_child_of_node(pdev->dev.of_node, np) {
+		if (!of_device_is_compatible(np, "mxl,eth-mac"))
+			continue;
+
+		if (!of_device_is_available(np))
+			continue;
+
+		ret = mxl_eth_create_ndev(pdev, np, &ndev);
+		if (ret)
+			goto err_cleanup;
+
+		pdata->ndevs[i++] = ndev;
+		if (i >= MXL_NUM_PORT)
+			break;
+	}
+
+	return 0;
+
+err_cleanup:
+	mxl_eth_cleanup(pdata);
+	return ret;
+}
+
+static void mxl_eth_remove(struct platform_device *pdev)
+{
+	struct mxl_eth_drvdata *pdata = platform_get_drvdata(pdev);
+
+	mxl_eth_cleanup(pdata);
+}
+
+/* Device Tree match table */
+static const struct of_device_id mxl_eth_of_match[] = {
+	{ .compatible = "mxl,lgm-eth" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, mxl_eth_of_match);
+
+/* Platform driver struct */
+static struct platform_driver mxl_eth_drv = {
+	.probe    = mxl_eth_probe,
+	.remove   = mxl_eth_remove,
+	.driver = {
+		.name = KBUILD_MODNAME,
+		.of_match_table = mxl_eth_of_match,
+	},
+};
+
+module_platform_driver(mxl_eth_drv);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Ethernet driver for MxL SoC");
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net-next 2/2] dt-bindings: net: mxl: Add MxL LGM Network Processor SoC
  2025-08-22  9:08 [PATCH net-next 0/2] Add MxL Ethernet driver & devicetree binding Jack Ping CHNG
  2025-08-22  9:08 ` [PATCH net-next 1/2] net: maxlinear: Add build support for MxL SoC Jack Ping CHNG
@ 2025-08-22  9:08 ` Jack Ping CHNG
  2025-08-22  9:39   ` Krzysztof Kozlowski
  2025-08-22 12:58   ` Rob Herring (Arm)
  2025-08-22 15:06 ` [PATCH net-next 0/2] Add MxL Ethernet driver & devicetree binding Andrew Lunn
  2 siblings, 2 replies; 8+ messages in thread
From: Jack Ping CHNG @ 2025-08-22  9:08 UTC (permalink / raw)
  To: netdev, devicetree
  Cc: davem, andrew+netdev, edumazet, kuba, pabeni, robh, krzk+dt,
	conor+dt, yzhu, sureshnagaraj, Jack Ping CHNG

Introduce device-tree binding documentation for
MaxLinear LGM Network Processor

Signed-off-by: Jack Ping CHNG <jchng@maxlinear.com>
---
 .../devicetree/bindings/net/mxl,lgm-eth.yaml  | 59 +++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml

diff --git a/Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml b/Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml
new file mode 100644
index 000000000000..3d5b32b5b650
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/net/mxl,lgm-eth.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: MaxLinear LGM Ethernet Controller
+
+maintainers:
+  - Jack Ping Chng <jchng@maxlinear.com>
+
+description:
+  Binding for MaxLinear LGM Ethernet controller
+
+properties:
+  compatible:
+    enum:
+      - mxl,lgm-eth
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    items:
+      - const: ethif
+
+  resets:
+    maxItems: 1
+
+patternProperties:
+  "^interface$":
+    type: object
+    properties:
+      compatible:
+        enum:
+          - mxl,lgm-mac
+    required:
+      - compatible
+    additionalProperties: false
+
+required:
+  - compatible
+  - clocks
+  - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+    eth {
+      compatible = "mxl,lgm-eth";
+      clocks = <&cgu0 32>;
+      clock-names = "ethif";
+      resets = <&rcu0 0x70 8>;
+
+      interface {
+          compatible = "mxl,lgm-mac";
+      };
+    };
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next 2/2] dt-bindings: net: mxl: Add MxL LGM Network Processor SoC
  2025-08-22  9:08 ` [PATCH net-next 2/2] dt-bindings: net: mxl: Add MxL LGM Network Processor SoC Jack Ping CHNG
@ 2025-08-22  9:39   ` Krzysztof Kozlowski
  2025-08-22 12:58   ` Rob Herring (Arm)
  1 sibling, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-22  9:39 UTC (permalink / raw)
  To: Jack Ping CHNG, netdev, devicetree
  Cc: davem, andrew+netdev, edumazet, kuba, pabeni, robh, krzk+dt,
	conor+dt, yzhu, sureshnagaraj

On 22/08/2025 11:08, Jack Ping CHNG wrote:
> Introduce device-tree binding documentation for
> MaxLinear LGM Network Processor

Please wrap commit message according to Linux coding style / submission
process (neither too early nor over the limit):
https://elixir.bootlin.com/linux/v6.4-rc1/source/Documentation/process/submitting-patches.rst#L597

Bindings go before the user (see submitting bindings in DT dir).

> 
> Signed-off-by: Jack Ping CHNG <jchng@maxlinear.com>
> ---
>  .../devicetree/bindings/net/mxl,lgm-eth.yaml  | 59 +++++++++++++++++++
>  1 file changed, 59 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml b/Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml
> new file mode 100644
> index 000000000000..3d5b32b5b650
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml
> @@ -0,0 +1,59 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: "http://devicetree.org/schemas/net/mxl,lgm-eth.yaml#"

You never tested it, did you?

> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"

Nope. Please point me to any example if such syntax.

I will finish the review here. I am sorry, but I think you really did
not put enough of effort into this. There are so many basic mistakes
here. Please watch my OSSE session explaining basics of bindings (or
read the slides - they are already published).


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next 1/2] net: maxlinear: Add build support for MxL SoC
  2025-08-22  9:08 ` [PATCH net-next 1/2] net: maxlinear: Add build support for MxL SoC Jack Ping CHNG
@ 2025-08-22  9:42   ` Krzysztof Kozlowski
  2025-08-22 14:58   ` Andrew Lunn
  1 sibling, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-22  9:42 UTC (permalink / raw)
  To: Jack Ping CHNG, netdev, devicetree
  Cc: davem, andrew+netdev, edumazet, kuba, pabeni, robh, krzk+dt,
	conor+dt, yzhu, sureshnagaraj

On 22/08/2025 11:08, Jack Ping CHNG wrote:
> Add build infrastructure for MxL network driver.
> Ethernet driver to initialize and create network devices.

Please wrap commit message according to Linux coding style / submission
process (neither too early nor over the limit):
https://elixir.bootlin.com/linux/v6.4-rc1/source/Documentation/process/submitting-patches.rst#L597

What is a "build support for a driver/soc"? Confusing.


...

> + */
> +#include <linux/clk.h>
> +#include <linux/etherdevice.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/netdevice.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/reset.h>
> +
> +#define ETH_TX_TIMEOUT		(10 * HZ)
> +#define MXL_NUM_TX_RING		8
> +#define MXL_NUM_RX_RING		8
> +#define MXL_NUM_PORT		2
> +
> +static const char * const clk_names = "ethif";

Drop, pretty useless.

...

> +
> +static void mxl_eth_cleanup(struct mxl_eth_drvdata *pdata)
> +{
> +	int i;
> +
> +	for (i = 0; i < MXL_NUM_PORT && pdata->ndevs[i]; i++) {
> +		unregister_netdev(pdata->ndevs[i]);
> +		pdata->ndevs[i] = NULL;
> +	}
> +
> +	if (!IS_ERR(pdata->clks))

Hm? Why?

> +		clk_disable_unprepare(pdata->clks);
> +}
> +
> +static int mxl_eth_probe(struct platform_device *pdev)
> +{
> +	struct mxl_eth_drvdata *pdata;
> +	struct reset_control *rst;
> +	struct net_device *ndev;
> +	struct device_node *np;
> +	int ret, i;
> +
> +	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> +	if (!pdata)
> +		return -ENOMEM;
> +
> +	pdata->clks = devm_clk_get(&pdev->dev, clk_names);
> +	if (IS_ERR(pdata->clks)) {
> +		dev_err(&pdev->dev, "failed to get %s\n", clk_names);

You are sending us some 10 year old coding style. This is supposed to be
dev_err_probe and devm_get_clk_enabled.

I think my second talk for OSSE 25 about static analyzers is also
suitable...

> +		return PTR_ERR(pdata->clks);
> +	}
> +
> +	ret = clk_prepare_enable(pdata->clks);

> +	if (ret) {
> +		dev_err(&pdev->dev, "failed to enable %s\n", clk_names);
> +		return ret;
> +	}
> +
> +	rst = devm_reset_control_get_optional(&pdev->dev, NULL);
> +	if (IS_ERR(rst)) {
> +		dev_err(&pdev->dev,
> +			"failed to get optional reset control: %ld\n",
> +			PTR_ERR(rst));
> +		ret = PTR_ERR(rst);
> +		goto err_cleanup;
> +	}
> +
> +	if (rst) {
> +		ret = reset_control_assert(rst);
> +		if (ret)
> +			goto err_cleanup;
> +
> +		udelay(1);
> +
> +		ret = reset_control_deassert(rst);
> +		if (ret)
> +			goto err_cleanup;
> +	}
> +
> +	platform_set_drvdata(pdev, pdata);
> +
> +	i = 0;
> +	for_each_available_child_of_node(pdev->dev.of_node, np) {
> +		if (!of_device_is_compatible(np, "mxl,eth-mac"))
> +			continue;
> +
> +		if (!of_device_is_available(np))

Redundant.


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next 2/2] dt-bindings: net: mxl: Add MxL LGM Network Processor SoC
  2025-08-22  9:08 ` [PATCH net-next 2/2] dt-bindings: net: mxl: Add MxL LGM Network Processor SoC Jack Ping CHNG
  2025-08-22  9:39   ` Krzysztof Kozlowski
@ 2025-08-22 12:58   ` Rob Herring (Arm)
  1 sibling, 0 replies; 8+ messages in thread
From: Rob Herring (Arm) @ 2025-08-22 12:58 UTC (permalink / raw)
  To: Jack Ping CHNG
  Cc: krzk+dt, andrew+netdev, pabeni, devicetree, netdev, kuba, davem,
	conor+dt, sureshnagaraj, edumazet, yzhu


On Fri, 22 Aug 2025 17:08:09 +0800, Jack Ping CHNG wrote:
> Introduce device-tree binding documentation for
> MaxLinear LGM Network Processor
> 
> Signed-off-by: Jack Ping CHNG <jchng@maxlinear.com>
> ---
>  .../devicetree/bindings/net/mxl,lgm-eth.yaml  | 59 +++++++++++++++++++
>  1 file changed, 59 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:
./Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml:5:10: [error] string value is redundantly quoted with any quotes (quoted-strings)

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml: patternProperties: '^interface$' should not be valid under {'pattern': '^\\^[a-zA-Z0-9,\\-._#@]+\\$$'}
	hint: Fixed strings belong in 'properties', not 'patternProperties'
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250822090809.1464232-3-jchng@maxlinear.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next 1/2] net: maxlinear: Add build support for MxL SoC
  2025-08-22  9:08 ` [PATCH net-next 1/2] net: maxlinear: Add build support for MxL SoC Jack Ping CHNG
  2025-08-22  9:42   ` Krzysztof Kozlowski
@ 2025-08-22 14:58   ` Andrew Lunn
  1 sibling, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2025-08-22 14:58 UTC (permalink / raw)
  To: Jack Ping CHNG
  Cc: netdev, devicetree, davem, andrew+netdev, edumazet, kuba, pabeni,
	robh, krzk+dt, conor+dt, yzhu, sureshnagaraj

> +Driver Location
> +===============
> +
> +The driver source code is located in the kernel tree at:
> +  drivers/net/ethernet/maxlinear/
> +
> +Interfaces are created as standard Linux `net_device` interfaces:

Pointless comment. Anything else would be NACKed.

> +
> +- eth0, eth1 (up to 2)

This is also questionable. Yes, the kernel will give them names like
this, but systemd will then rename them.

> +- Multiqueue support (e.g., eth0 has multiple TX/RX queues)
> +
> +Kernel Configuration
> +====================
> +
> +The driver is located in the menu structure at:
> +
> +  -> Device Drivers
> +    -> Network device support
> +      -> Ethernet driver support
> +        -> MaxLinear NPU Ethernet driver
> +
> +Or set in your kernel config:
> +  CONFIG_NET_VENDOR_MAXLINEAR=y
> +  CONFIG_MAXLINEAR_ETH=y
> +
> +Maintainers
> +===========
> +
> +See the MAINTAINERS file:
> +
> +    MAXLINEAR ETHERNET DRIVER
> +    M: Jack Ping Chng <jchng@maxlinear.com>
> +    L: netdev@vger.kernel.org
> +    S: Supported
> +    F: drivers/net/ethernet/maxlinear/
> +
> diff --git a/MAINTAINERS b/MAINTAINERS
> index bce96dd254b8..9164ba07a9c3 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -15101,6 +15101,13 @@ W:	https://linuxtv.org
>  T:	git git://linuxtv.org/media.git
>  F:	drivers/media/radio/radio-maxiradio*
>  
> +MAXLINEAR ETHERNET DRIVER
> +M:	Jack Ping Chng <jchng@maxlinear.com>
> +L:	netdev@vger.kernel.org
> +S:	Maintained
> +F:	Documentation/networking/device_drivers/ethernet/maxlinear/*
> +F:	drivers/net/ethernet/maxlinear/
> +
>  MAXLINEAR ETHERNET PHY DRIVER
>  M:	Xu Liang <lxu@maxlinear.com>
>  L:	netdev@vger.kernel.org
> diff --git a/drivers/net/ethernet/Kconfig b/drivers/net/ethernet/Kconfig
> index f86d4557d8d7..94d0bb98351a 100644
> --- a/drivers/net/ethernet/Kconfig
> +++ b/drivers/net/ethernet/Kconfig
> @@ -33,6 +33,7 @@ source "drivers/net/ethernet/aquantia/Kconfig"
>  source "drivers/net/ethernet/arc/Kconfig"
>  source "drivers/net/ethernet/asix/Kconfig"
>  source "drivers/net/ethernet/atheros/Kconfig"
> +source "drivers/net/ethernet/maxlinear/Kconfig"

This file is sorted. Please insert in the correct location. Please
check all your other insertions.

> +
> +	snprintf(ndev->name, IFNAMSIZ, "eth%%d");

The core does that.

> +static int mxl_eth_probe(struct platform_device *pdev)
> +{
> +	struct mxl_eth_drvdata *pdata;

Historically, pdata has been used for platform_data. With the adoption
of DT, platform_data is not used much any more, but to greybeards like
me, i still read it as platform_data. More normal would be priv, or
maybe in this case drvdata, since the structure is called
mxl_eth_drvdata.

	Andrew

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next 0/2] Add MxL Ethernet driver & devicetree binding
  2025-08-22  9:08 [PATCH net-next 0/2] Add MxL Ethernet driver & devicetree binding Jack Ping CHNG
  2025-08-22  9:08 ` [PATCH net-next 1/2] net: maxlinear: Add build support for MxL SoC Jack Ping CHNG
  2025-08-22  9:08 ` [PATCH net-next 2/2] dt-bindings: net: mxl: Add MxL LGM Network Processor SoC Jack Ping CHNG
@ 2025-08-22 15:06 ` Andrew Lunn
  2 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2025-08-22 15:06 UTC (permalink / raw)
  To: Jack Ping CHNG
  Cc: netdev, devicetree, davem, andrew+netdev, edumazet, kuba, pabeni,
	robh, krzk+dt, conor+dt, yzhu, sureshnagaraj

On Fri, Aug 22, 2025 at 05:08:07PM +0800, Jack Ping CHNG wrote:
> Hello netdev maintainers,
> 
> This patch series adds support for the MaxLinear LGM SoC's Ethernet
> controller, including:
> 
> Patch 1: Adds build infrastructure and the main driver for the MaxLinear LGM
> SoC Ethernet controller.
> Patch 2: Introduces the devicetree binding documentation for the MaxLinear LGM
> Network Processor.
> 
> The driver supports multi-port operation and is integrated with standard Linux
> network device driver framework. The devicetree binding documents the required
> properties for the hardware description.
> 
> Please review and let me know if any changes are required.

"if any changes are required"

ROFL. Have you ever seen a new network driver where v1 got accepted?

Anyway, thanks for starting small. But there is still a way to go
before this will be accepted.

FYI: DT patches go first in the series.

I suggest you subscribe to the netdev list, and spend 15-30 minutes a
day reading patches and reviews. You can learn a lot that way, and
avoid repeating mistakes others have made.

    Andrew

---
pw-bot: cr

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-08-22 15:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-22  9:08 [PATCH net-next 0/2] Add MxL Ethernet driver & devicetree binding Jack Ping CHNG
2025-08-22  9:08 ` [PATCH net-next 1/2] net: maxlinear: Add build support for MxL SoC Jack Ping CHNG
2025-08-22  9:42   ` Krzysztof Kozlowski
2025-08-22 14:58   ` Andrew Lunn
2025-08-22  9:08 ` [PATCH net-next 2/2] dt-bindings: net: mxl: Add MxL LGM Network Processor SoC Jack Ping CHNG
2025-08-22  9:39   ` Krzysztof Kozlowski
2025-08-22 12:58   ` Rob Herring (Arm)
2025-08-22 15:06 ` [PATCH net-next 0/2] Add MxL Ethernet driver & devicetree binding Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).