From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>, netdev@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 04/15] net: mdio: add generic driver for NXP SJA1110 100BASE-TX embedded PHYs
Date: Thu, 20 Nov 2025 18:55:56 +0100 [thread overview]
Message-ID: <c1e5871d-2954-4595-b879-e51766b7bf48@bootlin.com> (raw)
In-Reply-To: <20251118190530.580267-5-vladimir.oltean@nxp.com>
Hi Vladimir,
On 18/11/2025 20:05, Vladimir Oltean wrote:
> This is the standalone variant of drivers/net/dsa/sja1105/sja1105_mdio.c.
> Same kind of differences between this driver and the embedded DSA one
> apply: regmap is being used for register access, and addresses are
> multiplied by 4 with regmap.
>
> In fact this is so generic that there is nothing NXP SJA1110 specific
> about it at all, and just instantiates mdio-regmap. I decided to name it
> mdio-regmap-simple.c in the style of drivers/mfd/simple-mfd-i2c.c which
> has support for various vendor compatible strings.
>
> Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
> MAINTAINERS | 1 +
> drivers/net/mdio/Kconfig | 14 +++--
> drivers/net/mdio/Makefile | 1 +
> drivers/net/mdio/mdio-regmap-simple.c | 77 +++++++++++++++++++++++++++
> 4 files changed, 90 insertions(+), 3 deletions(-)
> create mode 100644 drivers/net/mdio/mdio-regmap-simple.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index c41b9d86c144..81c3dba6acd0 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -15473,6 +15473,7 @@ M: Maxime Chevallier <maxime.chevallier@bootlin.com>
> L: netdev@vger.kernel.org
> S: Maintained
> F: drivers/net/mdio/mdio-regmap.c
> +F: drivers/net/mdio/mdio-regmap-simple.c
> F: include/linux/mdio/mdio-regmap.h
>
> MEASUREMENT COMPUTING CIO-DAC IIO DRIVER
> diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig
> index 9819d1dc18de..2f86a438a2a7 100644
> --- a/drivers/net/mdio/Kconfig
> +++ b/drivers/net/mdio/Kconfig
> @@ -179,14 +179,22 @@ config MDIO_REALTEK_RTL9300
> config MDIO_REGMAP
> tristate
> help
> - This driver allows using MDIO devices that are not sitting on a
> - regular MDIO bus, but still exposes the standard 802.3 register
> + This support module allows using MDIO devices that are not sitting on
> + a regular MDIO bus, but still exposes the standard 802.3 register
> layout. It's regmap-based so that it can be used on integrated,
> memory-mapped PHYs, SPI PHYs and so on. A new virtual MDIO bus is
> created, and its read/write operations are mapped to the underlying
> - regmap. Users willing to use this driver must explicitly select
> + regmap. Users willing to use this module must explicitly select
> REGMAP.
Thans for fixing these mistakes
>
> +config MDIO_REGMAP_SIMPLE
> + tristate
> + help
> + Generic platform driver for MDIO buses with a linear address space
> + that can be directly accessed using the MDIO_REGMAP support code and
> + need no special handling. The regmap is provided by the parent
> + device.
> +
It would probably make sense to add "select MDIO_REGMAP" here
> config MDIO_THUNDER
> tristate "ThunderX SOCs MDIO buses"
> depends on 64BIT
> diff --git a/drivers/net/mdio/Makefile b/drivers/net/mdio/Makefile
> index 9abf20d1b030..95f201b73a7d 100644
> --- a/drivers/net/mdio/Makefile
> +++ b/drivers/net/mdio/Makefile
> @@ -22,6 +22,7 @@ obj-$(CONFIG_MDIO_MVUSB) += mdio-mvusb.o
> obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o
> obj-$(CONFIG_MDIO_REALTEK_RTL9300) += mdio-realtek-rtl9300.o
> obj-$(CONFIG_MDIO_REGMAP) += mdio-regmap.o
> +obj-$(CONFIG_MDIO_REGMAP_SIMPLE) += mdio-regmap-simple.o
> obj-$(CONFIG_MDIO_SJA1110_CBT1) += mdio-sja1110-cbt1.o
> obj-$(CONFIG_MDIO_SUN4I) += mdio-sun4i.o
> obj-$(CONFIG_MDIO_THUNDER) += mdio-thunder.o
> diff --git a/drivers/net/mdio/mdio-regmap-simple.c b/drivers/net/mdio/mdio-regmap-simple.c
> new file mode 100644
> index 000000000000..6ac390ec759b
> --- /dev/null
> +++ b/drivers/net/mdio/mdio-regmap-simple.c
> @@ -0,0 +1,77 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright 2025 NXP
> + *
> + * Generic MDIO bus driver for simple regmap-based MDIO devices
> + *
> + * This driver creates MDIO buses for devices that expose their internal
> + * PHYs or PCS through a regmap interface. It's intended to be a simple,
> + * generic driver similar to simple-mfd-i2c.c.
> + */
> +#include <linux/module.h>
> +#include <linux/of_mdio.h>
> +#include <linux/phy.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +#include <linux/mdio/mdio-regmap.h>
> +
> +struct mdio_regmap_simple_data {
> + u8 valid_addr;
> + bool autoscan;
> +};
> +
> +static const struct mdio_regmap_simple_data nxp_sja1110_base_tx = {
> + .valid_addr = 0,
> + .autoscan = false,
> +};
> +
> +static int mdio_regmap_simple_probe(struct platform_device *pdev)
> +{
> + const struct mdio_regmap_simple_data *data;
> + struct mdio_regmap_config config = {};
> + struct device *dev = &pdev->dev;
> + struct regmap *regmap;
> + struct mii_bus *bus;
> +
> + if (!dev->of_node || !dev->parent)
> + return -ENODEV;
> +
> + regmap = dev_get_regmap(dev->parent, NULL);
> + if (!regmap)
> + return -ENODEV;
> +
> + data = device_get_match_data(dev);
> +
> + config.regmap = regmap;
> + config.parent = dev;
> + config.name = dev_name(dev);
> + config.resource = platform_get_resource(pdev, IORESOURCE_REG, 0);
Just to clarify, a small comment to say that it's OK of
platform_get_resource() returns NULL maybe ?
> + if (data) {
> + config.valid_addr = data->valid_addr;
> + config.autoscan = data->autoscan;
> + }
> +
> + return PTR_ERR_OR_ZERO(devm_mdio_regmap_register(dev, &config));
> +}
> +
> +static const struct of_device_id mdio_regmap_simple_match[] = {
> + {
> + .compatible = "nxp,sja1110-base-tx-mdio",
> + .data = &nxp_sja1110_base_tx,
> + },
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, mdio_regmap_simple_match);
> +
> +static struct platform_driver mdio_regmap_simple_driver = {
> + .probe = mdio_regmap_simple_probe,
> + .driver = {
> + .name = "mdio-regmap-simple",
> + .of_match_table = mdio_regmap_simple_match,
> + },
> +};
> +
> +module_platform_driver(mdio_regmap_simple_driver);
> +
> +MODULE_DESCRIPTION("Generic MDIO bus driver for simple regmap-based devices");
> +MODULE_AUTHOR("Vladimir Oltean <vladimir.oltean@nxp.com>");
> +MODULE_LICENSE("GPL");
Thanks for this,
Maxime
next prev parent reply other threads:[~2025-11-20 17:56 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 19:05 [PATCH net-next 00/15] Probe SJA1105 DSA children using MFD and dynamic OF nodes Vladimir Oltean
2025-11-18 19:05 ` [PATCH net-next 01/15] net: dsa: sja1105: let phylink help with the replay of link callbacks Vladimir Oltean
2025-11-18 19:05 ` [PATCH net-next 02/15] net: mdio-regmap: permit working with non-MMIO regmaps Vladimir Oltean
2025-11-20 14:35 ` Maxime Chevallier
2025-11-18 19:05 ` [PATCH net-next 03/15] net: mdio: add driver for NXP SJA1110 100BASE-T1 embedded PHYs Vladimir Oltean
2025-11-18 19:05 ` [PATCH net-next 04/15] net: mdio: add generic driver for NXP SJA1110 100BASE-TX " Vladimir Oltean
2025-11-20 17:55 ` Maxime Chevallier [this message]
2025-11-20 18:49 ` Vladimir Oltean
2025-11-18 19:05 ` [PATCH net-next 05/15] net: dsa: sja1105: prepare regmap for passing to child devices Vladimir Oltean
2025-11-18 19:05 ` [PATCH net-next 06/15] net: dsa: sja1105: include spi.h from sja1105.h Vladimir Oltean
2025-11-18 19:05 ` [PATCH net-next 07/15] mfd: core: add ability for cells to probe on a custom parent OF node Vladimir Oltean
2025-11-20 14:41 ` Lee Jones
2025-11-20 15:36 ` Vladimir Oltean
2025-11-21 12:06 ` Lee Jones
2025-11-21 17:03 ` Vladimir Oltean
2025-11-26 10:20 ` Lee Jones
2025-12-15 15:50 ` Lee Jones
2025-12-16 0:29 ` Vladimir Oltean
2025-12-16 9:18 ` Lee Jones
2025-12-16 16:24 ` Vladimir Oltean
2026-01-09 10:31 ` Lee Jones
2026-01-09 12:14 ` Vladimir Oltean
2026-01-15 9:35 ` Vladimir Oltean
2026-01-15 15:18 ` Lee Jones
2026-01-15 16:14 ` Lee Jones
2026-01-15 18:57 ` Vladimir Oltean
2026-01-16 8:40 ` Lee Jones
2026-01-16 11:38 ` Vladimir Oltean
2026-01-16 13:23 ` Lee Jones
2026-01-16 14:02 ` Vladimir Oltean
2026-01-16 14:22 ` Vladimir Oltean
2025-12-17 9:31 ` Andrew Lunn
2026-01-09 9:58 ` Lee Jones
2025-11-18 19:05 ` [PATCH net-next 08/15] net: dsa: sja1105: transition OF-based MDIO drivers to standalone Vladimir Oltean
2025-11-20 14:40 ` Lee Jones
2025-11-20 15:14 ` Vladimir Oltean
2025-11-20 16:36 ` Lee Jones
2025-11-20 19:59 ` Vladimir Oltean
2025-11-21 12:00 ` Lee Jones
2025-11-18 19:05 ` [PATCH net-next 09/15] net: dsa: sja1105: remove sja1105_mdio_private Vladimir Oltean
2025-11-18 19:05 ` [PATCH net-next 10/15] net: pcs: xpcs: introduce xpcs_create_pcs_fwnode() Vladimir Oltean
2025-11-18 19:05 ` [PATCH net-next 11/15] net: pcs: xpcs-plat: convert to regmap Vladimir Oltean
2025-11-18 19:05 ` [PATCH net-next 12/15] dt-bindings: net: dsa: sja1105: document the PCS nodes Vladimir Oltean
2025-11-20 17:30 ` Rob Herring
2025-11-18 19:05 ` [PATCH net-next 13/15] net: pcs: xpcs-plat: add NXP SJA1105/SJA1110 support Vladimir Oltean
2025-11-18 19:05 ` [PATCH net-next 14/15] net: dsa: sja1105: replace mdiobus-pcs with xpcs-plat driver Vladimir Oltean
2025-11-19 0:41 ` Jakub Kicinski
2025-11-19 9:59 ` Vladimir Oltean
2025-11-19 10:31 ` Andy Shevchenko
2025-11-19 11:25 ` Vladimir Oltean
2025-11-19 16:11 ` Jakub Kicinski
2025-11-19 16:17 ` Andy Shevchenko
2025-11-19 17:23 ` Russell King (Oracle)
2025-11-19 17:39 ` Andy Shevchenko
2025-11-19 18:35 ` Jakub Kicinski
2025-11-19 19:33 ` Andy Shevchenko
2025-11-20 12:32 ` Russell King (Oracle)
2025-11-20 15:00 ` Jakub Kicinski
2025-11-19 11:19 ` kernel test robot
2025-11-19 12:01 ` Vladimir Oltean
2025-11-19 12:03 ` Russell King (Oracle)
2025-11-19 12:05 ` Russell King (Oracle)
2025-11-19 13:28 ` Vladimir Oltean
2025-11-19 12:01 ` kernel test robot
2025-11-20 0:01 ` kernel test robot
2025-11-18 19:05 ` [PATCH net-next 15/15] net: dsa: sja1105: permit finding the XPCS via pcs-handle Vladimir Oltean
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c1e5871d-2954-4595-b879-e51766b7bf48@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome