diff mbox series

[v5,net-next,07/13] net: dsa: felix: add support for MFD configurations

Message ID 20230127193559.1001051-8-colin.foster@in-advantage.com (mailing list archive)
State Accepted
Commit dc454fa4b764ab75038e822dfc9a1b2526757a63
Delegated to: Netdev Maintainers
Headers show
Series add support for the the vsc7512 internal copper phys | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 13 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Colin Foster Jan. 27, 2023, 7:35 p.m. UTC
The architecture around the VSC7512 differs from existing felix drivers. In
order to add support for all the chip's features (pinctrl, MDIO, gpio) the
device had to be laid out as a multi-function device (MFD).

One difference between an MFD and a standard platform device is that the
regmaps are allocated to the parent device before the child devices are
probed. As such, there is no need for felix to initialize new regmaps in
these configurations, they can simply be requested from the parent device.

Add support for MFD configurations by performing this request from the
parent device.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
---

v5
    * No changes

v4
    * New patch

---
 drivers/net/dsa/ocelot/felix.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Florian Fainelli Jan. 27, 2023, 7:40 p.m. UTC | #1
On 1/27/2023 11:35 AM, Colin Foster wrote:
> The architecture around the VSC7512 differs from existing felix drivers. In
> order to add support for all the chip's features (pinctrl, MDIO, gpio) the
> device had to be laid out as a multi-function device (MFD).
> 
> One difference between an MFD and a standard platform device is that the
> regmaps are allocated to the parent device before the child devices are
> probed. As such, there is no need for felix to initialize new regmaps in
> these configurations, they can simply be requested from the parent device.
> 
> Add support for MFD configurations by performing this request from the
> parent device.
> 
> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
diff mbox series

Patch

diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 462a1a683996..d3ff6e8a82e9 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -1315,6 +1315,13 @@  static struct regmap *felix_request_regmap_by_name(struct felix *felix,
 	struct resource res;
 	int i;
 
+	/* In an MFD configuration, regmaps are registered directly to the
+	 * parent device before the child devices are probed, so there is no
+	 * need to initialize a new one.
+	 */
+	if (!felix->info->resources)
+		return dev_get_regmap(ocelot->dev->parent, resource_name);
+
 	for (i = 0; i < felix->info->num_resources; i++) {
 		if (strcmp(resource_name, felix->info->resources[i].name))
 			continue;