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, Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH net-next 02/15] net: mdio-regmap: permit working with non-MMIO regmaps
Date: Thu, 20 Nov 2025 15:35:07 +0100 [thread overview]
Message-ID: <942f62f9-4c79-4c35-ad03-40bf7c6111b4@bootlin.com> (raw)
In-Reply-To: <20251118190530.580267-3-vladimir.oltean@nxp.com>
Hi Vladimir,
On 18/11/2025 20:05, Vladimir Oltean wrote:
> The regmap world is seemingly split into two groups which attempt to
> solve different problems. Effectively, this means that not all regmap
> providers are compatible with all regmap consumers.
>
> First, we have the group where the current mdio-regmap users fit:
> altera_tse_main.c and dwmac-socfpga.c use devm_regmap_init_mmio() to
> ioremap their pcs_base and obtain a regmap where address zero is the
> first PCS register.
>
> Second, we have the group where MFD parent drivers call
> mfd_add_devices(), having previously initialized a non-MMIO (SPI, I2C)
> regmap and added it to their devres list, and MFD child drivers use
> dev_get_regmap(dev->parent, NULL) in their probe function, to find the
> first (and single) regmap of the MFD parent. The address zero of this
> regmap is global to the entire parent, so the children need to be
> parent-aware and add their own offsets for the registers that they
> should manage.
>
> This is essentially because MFD is seemingly coming from a world where
> peripheral registers are all entangled with each other, but what I'm
> trying to support via MFD are potentially multiple instances of the same
> kind of device, at well separated address space regions.
>
> To use MFD but provide isolated regmaps for each child device would
> essentially mean to fight against the system. The problem that needs to
> be now solved is that each child device needs to find the correct
> regmap, which means that "dev_get_regmap(dev->parent, NULL)" transforms
> either in:
> - dev_get_regmap(dev, NULL): search in the child device's devres list,
> not in the parent's. But MFD does not give us a hook in between
> platform_device_alloc() and platform_device_add() where we could make
> the devm_regmap_init_spi() call for the child device. We have to make
> it for the parent.
> - dev_get_regmap(dev->parent, "unique-regmap-name"): now the child
> device needs to know, in case there are multiple instances of it,
> which one is it, to ask for the right one. I've seen
> drivers/mfd/ocelot-core.c work around this rather elegantly, providing
> a resource to the child, and then the child uses resource->name to
> find the regmap of the same name in the parent. But then I also
> stumbled upon drivers/net/pcs/pcs-xpcs-plat.c which I need to support
> as an MFD child, and that superimposes its own naming scheme for the
> resources: "direct" or "indirect" - scheme which is obviously
> incompatible with namespacing per instance.
>
> So a MFD parent needs to decide whether it is in the boat that provides
> one isolated regmap for each child, or one big regmap for all. The "one
> big regmap" is the lowest common denominator when considering children
> like pcs-xpcs-plat.c.
>
> This means that from mdio-regmap's perspective, it needs to deal with
> regmaps coming from both kinds of providers, as neither of them is going
> away.
>
> Users who provide a big regmap but want to access only a window into it
> should provide as a struct mdio_regmap_config field a resource that
> describes the start and end of that window. Currently we only use the
> start as an offset into the regmap, and hope that MDIO reads and writes
> won't go past the end.
>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
That sounds good to me ! Thanks for expanding this driver :) I agree
with keeping the entire resource instead of just 'start'.
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Maxime
next prev parent reply other threads:[~2025-11-20 14:35 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 [this message]
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
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=942f62f9-4c79-4c35-ad03-40bf7c6111b4@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=andrew@lunn.ch \
--cc=broonie@kernel.org \
--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
all inboxes | Powered by JetHome®