Add MxL Ethernet driver & devicetree binding
Subsystems (4)
v2 cover Add MxL Ethernet driver & devicetree binding
Hello netdev maintainers,
This patch series adds support for the MaxLinear LGM SoC's Ethernet controller, including:
Patch 1: Introduces the devicetree binding documentation for the MaxLinear LGM Network Processor.
Patch 2: Adds build infrastructure and the main driver for the MaxLinear LGM SoC Ethernet controller.
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.
Changelog:
v1 -> v2:
- Moved devicetree bindings to the first patch in the series
- Verified bindings with 'make dt_binding_check DT_SCHEMA_FILES=mxl,lgm-eth.yaml'
- Reformatted commit messages to follow Linux kernel submission guidelines.
- Removed redundant code and addressed all reviewer comments.
links:
v1: https://lore.kernel.org/netdev/[email protected]/
Jack Ping CHNG (2):
dt-bindings: net: mxl: Add MxL LGM Network Processor SoC
net: maxlinear: Add support for MxL LGM SoC
.../devicetree/bindings/net/mxl,lgm-eth.yaml | 73 +++++++ .../device_drivers/ethernet/index.rst | 1 + .../device_drivers/ethernet/maxlinear/mxl.rst | 61 ++++++ MAINTAINERS | 8 + 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 | 189 ++++++++++++++++++ 9 files changed, 355 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
Signature · 1 line
2.34.1
PATCH v2 1/2 dt-bindings: net: mxl: Add MxL LGM Network Processor SoC
Introduce device-tree binding documentation for MaxLinear LGM Network Processor
--- .../devicetree/bindings/net/mxl,lgm-eth.yaml | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml
Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml new file +73 -0
@@ -0,0 +1,73 @@ +# 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 <[email protected]> + +description: + Binding for MaxLinear LGM Ethernet controller + +properties: + compatible: + enum: + - mxl,lgm-eth + + clocks: + maxItems: 1 + + clock-names: + items: + - const: ethif + + resets: + maxItems: 1 + + '#address-cells': + const: 1 + '#size-cells': + const: 0 + +patternProperties: + "^interface@[1-4]$": + type: object + properties: + compatible: + const: mxl,lgm-mac + + reg: + minimum: 1 + maximum: 4 + + required: + - compatible + - reg + +required: + - compatible + - clocks + - clock-names + - '#address-cells' + - '#size-cells' + +additionalProperties: false + +examples: + - | + eth { + compatible = "mxl,lgm-eth"; + clocks = <&cgu0 32>; + clock-names = "ethif"; + resets = <&rcu0 0x70 8>; + #address-cells = <1>; + #size-cells = <0>; + + mac: interface@1 { + compatible = "mxl,eth-mac"; + reg = <1>; + }; + };
Signature · 1 line
2.34.1
Re: [PATCH net-next v2 1/2] dt-bindings: net: mxl: Add MxL LGM Network Processor SoC
Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml line 40
Quoted 6 lines
Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml new file +6
-0+patternProperties: + "^interface@[1-4]$": + type: object + properties: + compatible: + const: mxl,lgm-mac
Shouldn't you be referencing Documentation/devicetree/bindings/net/ethernet-controller.yaml here?
How do you specify the MAC address? Link to the PHY, indicate there is an SFP, describe LEDs?
Andrew
Rob Herring (Arm)
maintainerRe: [PATCH net-next v2 1/2] dt-bindings: net: mxl: Add MxL LGM Network Processor SoC
In reply to Jack Ping CHNGQuoted 9 lines · Jack Ping CHNG
Introduce device-tree binding documentation for MaxLinear LGM Network Processor
Signed-off-by Jack Ping CHNG <[email protected]>--- .../devicetree/bindings/net/mxl,lgm-eth.yaml | 73 +++++++++++++++++++ 1 file changed, 73 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:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/mxl,lgm-eth.example.dtb: eth (mxl,lgm-eth): interface@1:compatible:0: 'mxl,lgm-mac' was expected
from schema $id: http://devicetree.org/schemas/net/mxl,lgm-eth.yaml#Documentation/devicetree/bindings/net/mxl,lgm-eth.example.dtb: /example-0/eth/interface@1: failed to match any schema with compatible: ['mxl,eth-mac']
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
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.
Re: [PATCH net-next v2 1/2] dt-bindings: net: mxl: Add MxL LGM Network Processor SoC
In reply to Jack Ping CHNGDocumentation/devicetree/bindings/net/mxl,lgm-eth.yaml line 18
Quoted 10 lines · Jack Ping CHNG
Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml new file +10
-0+maintainers: + - Jack Ping Chng <[email protected]> + +description: + Binding for MaxLinear LGM Ethernet controller + +properties: + compatible: + enum: + - mxl,lgm-eth
No such vendor prefix.
Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml line 31
Quoted 13 lines
Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml new file +13
-0+ + clocks: + maxItems: 1 + + clock-names: + items: + - const: ethif + + resets: + maxItems: 1 + + '#address-cells': + const: 1
Blank line
Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml line 36
Quoted 5 lines
Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml new file +5
-0+ '#size-cells': + const: 0 + +patternProperties: + "^interface@[1-4]$":
Use consistent quotes, either ' or "
I don't quite get what's this node is for.
Quoted 15 lines
Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml new file +15
-0+ type: object + properties: + compatible: + const: mxl,lgm-mac + + reg: + minimum: 1 + maximum: 4 + + required: + - compatible + - reg + +required: + - compatible
Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml line 61
Quoted 10 lines
Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml new file +10
-0+ - clocks + - clock-names + - '#address-cells' + - '#size-cells' + +additionalProperties: false + +examples: + - | + eth {
ethernet? How is it called everywhere else?
Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml line 71
Quoted 10 lines
Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml new file +10
-0+ compatible = "mxl,lgm-eth"; + clocks = <&cgu0 32>; + clock-names = "ethif"; + resets = <&rcu0 0x70 8>; + #address-cells = <1>; + #size-cells = <0>; + + mac: interface@1 { + compatible = "mxl,eth-mac"; + reg = <1>;
No resources here, so this is not really a subnode... unless you wanted to reference something from ethernet controllers.
This looks pretty incomplete.
Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml line 73
Quoted 2 lines
Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml new file +2
-0+ }; + };
Best regards,
Krzysztof
PATCH v2 2/2 net: maxlinear: Add support for MxL LGM SoC
In reply to Jack Ping CHNGIntroduce the build system integration and initial implementation for the MaxLinear LGM SoC Ethernet driver. This patch adds Kconfig and Makefile entries, the main driver source file, and documentation.
--- .../device_drivers/ethernet/index.rst | 1 + .../device_drivers/ethernet/maxlinear/mxl.rst | 61 ++++++ MAINTAINERS | 8 + 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 | 189 ++++++++++++++++++ 8 files changed, 282 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
Documentation/networking/device_drivers/ethernet/index.rst +1 -0
@@ -44,6 +44,7 @@ Contents: marvell/octeontx2 marvell/octeon_ep marvell/octeon_ep_vf + maxlinear/mxl mellanox/mlx5/index meta/fbnic microsoft/netvsc
Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst new file +61 -0
61 lines not on this page · raw message
MAINTAINERS +8 -0
@@ -15102,6 +15102,14 @@ W: https://linuxtv.org T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-maxiradio* +MAXLINEAR ETHERNET DRIVER +M: Jack Ping Chng <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml +F: Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst +F: drivers/net/ethernet/maxlinear/mxl_eth.c + MAXLINEAR ETHERNET PHY DRIVER M: Xu Liang <[email protected]> L: [email protected]
drivers/net/ethernet/Kconfig +1 -0
@@ -121,6 +121,7 @@ config LANTIQ_XRX200 source "drivers/net/ethernet/adi/Kconfig" source "drivers/net/ethernet/litex/Kconfig" source "drivers/net/ethernet/marvell/Kconfig" +source "drivers/net/ethernet/maxlinear/Kconfig" source "drivers/net/ethernet/mediatek/Kconfig" source "drivers/net/ethernet/mellanox/Kconfig" source "drivers/net/ethernet/meta/Kconfig"
drivers/net/ethernet/Makefile +1 -0
@@ -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/
drivers/net/ethernet/maxlinear/Kconfig new file +15 -0
@@ -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 +
drivers/net/ethernet/maxlinear/Makefile new file +6 -0
@@ -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
drivers/net/ethernet/maxlinear/mxl_eth.c new file +189 -0
189 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH net-next v2 2/2] net: maxlinear: Add support for MxL LGM SoC
Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst line 60
Quoted 10 lines
Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst new file +10
-0+Maintainers +=========== + +See the MAINTAINERS file: + + MAXLINEAR ETHERNET DRIVER + M: Jack Ping Chng <[email protected]> + L: [email protected] + S: Supported + F: drivers/net/ethernet/maxlinear/
Please don't duplicate what is in MAINTAINERs. We have scripts which monitor how active Maintainers are, and update the file, removing inactive Maintainers. This duplication will not be updated.
Quoted 6 lines
(quoted diff) +1
-0+MAINTAINERS +0
-0
MAINTAINERS W: https://linuxtv.org · line 15111
Quoted 10 lines
MAINTAINERS +7
-0@@ -15102,6 +15102,14 @@ W: https://linuxtv.org T: git git://linuxtv.org/media.git F: drivers/media/radio/radio-maxiradio* +MAXLINEAR ETHERNET DRIVER +M: Jack Ping Chng <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/net/mxl,lgm-eth.yaml +F: Documentation/networking/device_drivers/ethernet/maxlinear/mxl.rst +F: drivers/net/ethernet/maxlinear/mxl_eth.c
It is probably better to just use drivers/net/ethernet/maxlinear/ so all files in that directory are covered, like the Makefile, Kconfig etc.
Quoted 8 lines
MAINTAINERS +8
-0+static int mxl_eth_probe(struct platform_device *pdev) +{ + struct mxl_eth_drvdata *drvdata; + struct reset_control *rst; + struct net_device *ndev; + struct device_node *np; + int ret, i; +
MAINTAINERS W: https://linuxtv.org
Quoted 10 lines
MAINTAINERS +10
-0+ drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) + return -ENOMEM; + + drvdata->clks = devm_clk_get_enabled(&pdev->dev, "ethif"); + if (IS_ERR(drvdata->clks)) + return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->clks), + "failed to get/enable clock\n"); + + rst = devm_reset_control_get_optional(&pdev->dev, NULL);
Why is this optional? Are there some variants which don't have a reset?
MAINTAINERS
Quoted 4 lines
MAINTAINERS +4
-0+ i = 0; + for_each_available_child_of_node(pdev->dev.of_node, np) { + if (!of_device_is_compatible(np, "mxl,eth-mac")) + continue;
Are there going to be other devices here, with different compatibles?
MAINTAINERS
Quoted 2 lines
MAINTAINERS +2
-0+ + ret = mxl_eth_create_ndev(pdev, np, &ndev);
Shouldn't you validate reg before creating the device?
Andrew
RE: [PATCH net-next v2 2/2] net: maxlinear: Add support for MxL LGM SoC
Hi Andrew,
Quoted 4 lines · On Tue, 26 Aug 2025 15:03:08 +0200 Andrew Lunn <[email protected]> wrote:
Quoted 1 line
+ rst =
devm_reset_control_get_optional(&pdev->dev, NULL);Why is this optional? Are there some variants which don't have a reset?
Thanks for the review.
Will change to devm_reset_control_get()
Quoted 6 lines
drivers/net/ethernet/maxlinear/mxl_eth.c line 144
Quoted 4 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +4
-0+ i =0 ; +for_each_available_child_of_node (pdev->dev.of_node, np) { +if (!of_device_is_compatible (np,"mxl,eth-mac" )) +continue ;Are there going to be other devices here, with different compatibles?
Yes, other devices will be added in the next patch series.
Quoted 4 lines
drivers/net/ethernet/maxlinear/mxl_eth.c line 146
Quoted 2 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +2
-0+ + ret =mxl_eth_create_ndev (pdev, np, &ndev);Shouldn't you validate reg before creating the device?
Will add of_address_to_resource()
Jack
Re: [PATCH net-next v2 2/2] net: maxlinear: Add support for MxL LGM SoC
Quoted 8 lines
Quoted 6 lines
drivers/net/ethernet/maxlinear/mxl_eth.c line 144
Quoted 4 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +4
-0+ i =0 ; +for_each_available_child_of_node (pdev->dev.of_node, np) { +if (!of_device_is_compatible (np,"mxl,eth-mac" )) +continue ;Are there going to be other devices here, with different compatibles?
Yes, other devices will be added in the next patch series.
DT describes the hardware. The hardware is not going to change, so you might want to add the full DT binding now to describe it. That will also help justify this compatible, which is a bit odd.
Andrew
Jakub Kicinski
maintainerRe: [PATCH net-next v2 2/2] net: maxlinear: Add support for MxL LGM SoC
In reply to Jack Ping CHNGdrivers/net/ethernet/maxlinear/mxl_eth.c line 153
Quoted 12 lines · On Tue, 26 Aug 2025 11:10:44 +0800 Jack Ping CHNG wrote:
drivers/net/ethernet/maxlinear/mxl_eth.c new file +12
-0+for_each_available_child_of_node (pdev->dev.of_node, np) { +if (!of_device_is_compatible (np,"mxl,eth-mac" )) +continue ; + + ret =mxl_eth_create_ndev (pdev, np, &ndev); +if (ret) + goto err_cleanup; + + drvdata->ndevs[i++] = ndev; +if (i >=MXL_NUM_PORT ) +break ; + }
You need a of_node_put(np) before the goto and the break;
Signature · 1 line
pw-bot: cr
Re: [PATCH net-next v2 2/2] net: maxlinear: Add support for MxL LGM SoC
In reply to Jack Ping CHNGQuoted 1 line · Jack Ping CHNG
Introduce the build system integration and initial implementation for the
Nothing improved - do not describe how kernel works, builds. We all know Kconfig.
Describe the driver and hardware.
Quoted 1 line
MaxLinear LGM SoC Ethernet driver. This patch adds
KconfigandMakefile
Please do not use "This commit/patch/change", but imperative mood. See longer explanation here:
https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95
...
Quoted 6 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +6
-0+ +static int mxl_eth_probe (struct platform_device *pdev) +{ +struct mxl_eth_drvdata *drvdata; +struct reset_control *rst; +struct net_device *ndev;
drivers/net/ethernet/maxlinear/mxl_eth.c line 115
Quoted 10 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +10
-0+struct device_node *np; +int ret, i; + + drvdata =devm_kzalloc (&pdev->dev,sizeof (*drvdata),GFP_KERNEL ); +if (!drvdata) +return -ENOMEM ; + + drvdata->clks =devm_clk_get_enabled (&pdev->dev,"ethif" ); +if (IS_ERR (drvdata->clks)) + return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->clks),
That's correct...
drivers/net/ethernet/maxlinear/mxl_eth.c line 122
Quoted 7 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +7
-0+ "failed to get/enable clock\n"); + + 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));
But here nothing improved.
Please look how ALL DRIVERS do it? What syntax they use?
Do your homework and really work on this driver. If I pointed issue on clocks, YOU MUST fix it everywhere, not just clocks.
Quoted 16 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +16
-0+ 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; + } +
drivers/net/ethernet/maxlinear/mxl_eth.c line 148
Quoted 10 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +10
-0+platform_set_drvdata (pdev, drvdata); + + i =0 ; +for_each_available_child_of_node (pdev->dev.of_node, np) { +if (!of_device_is_compatible (np,"mxl,eth-mac" )) +continue ; + + ret =mxl_eth_create_ndev (pdev, np, &ndev); +if (ret) + goto err_cleanup;
You leak of node. Use scoped loop.
Quoted 31 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +31
-0+ + drvdata->ndevs[i++] = ndev; +if (i >=MXL_NUM_PORT ) +break ; + } + +return 0 ; + +err_cleanup: +mxl_eth_cleanup (drvdata); +return ret; +} + +static void mxl_eth_remove (struct platform_device *pdev) +{ +struct mxl_eth_drvdata *drvdata =platform_get_drvdata (pdev); + +mxl_eth_cleanup (drvdata); +} + +/* 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,
drivers/net/ethernet/maxlinear/mxl_eth.c line 189
Quoted 10 lines
drivers/net/ethernet/maxlinear/mxl_eth.c new file +10
-0+ .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" );
Best regards,
Krzysztof