[PATCH v2 1/5] mfd: ocelot: Define the VSC7512 cells with the MFD_CELL_* macros
From: Jens Emil Schulz Østergaard
Date: Fri Dec 04 2026 - 07:03:03 EST
Define the VSC7512 child devices with MFD_CELL_OF() and
MFD_CELL_OF_REG(), which also derive the number of resources from the
resource arrays.
No functional change.
Signed-off-by: Jens Emil Schulz Østergaard <jensemil.schulzostergaard@xxxxxxxxxxxxx>
---
Changes in v2:
- New patch
---
drivers/mfd/ocelot-core.c | 47 ++++++++++++-----------------------------------
1 file changed, 12 insertions(+), 35 deletions(-)
diff --git a/drivers/mfd/ocelot-core.c b/drivers/mfd/ocelot-core.c
index 41aff2708854..7adf357e8bbd 100644
--- a/drivers/mfd/ocelot-core.c
+++ b/drivers/mfd/ocelot-core.c
@@ -160,41 +160,18 @@ static const struct resource vsc7512_switch_resources[] = {
};
static const struct mfd_cell vsc7512_devs[] = {
- {
- .name = "ocelot-pinctrl",
- .of_compatible = "mscc,ocelot-pinctrl",
- .num_resources = ARRAY_SIZE(vsc7512_pinctrl_resources),
- .resources = vsc7512_pinctrl_resources,
- }, {
- .name = "ocelot-sgpio",
- .of_compatible = "mscc,ocelot-sgpio",
- .num_resources = ARRAY_SIZE(vsc7512_sgpio_resources),
- .resources = vsc7512_sgpio_resources,
- }, {
- .name = "ocelot-miim0",
- .of_compatible = "mscc,ocelot-miim",
- .of_reg = VSC7512_MIIM0_RES_START,
- .use_of_reg = true,
- .num_resources = ARRAY_SIZE(vsc7512_miim0_resources),
- .resources = vsc7512_miim0_resources,
- }, {
- .name = "ocelot-miim1",
- .of_compatible = "mscc,ocelot-miim",
- .of_reg = VSC7512_MIIM1_RES_START,
- .use_of_reg = true,
- .num_resources = ARRAY_SIZE(vsc7512_miim1_resources),
- .resources = vsc7512_miim1_resources,
- }, {
- .name = "ocelot-serdes",
- .of_compatible = "mscc,vsc7514-serdes",
- .num_resources = ARRAY_SIZE(vsc7512_serdes_resources),
- .resources = vsc7512_serdes_resources,
- }, {
- .name = "ocelot-ext-switch",
- .of_compatible = "mscc,vsc7512-switch",
- .num_resources = ARRAY_SIZE(vsc7512_switch_resources),
- .resources = vsc7512_switch_resources,
- },
+ MFD_CELL_OF("ocelot-pinctrl", vsc7512_pinctrl_resources, NULL, 0, 0,
+ "mscc,ocelot-pinctrl"),
+ MFD_CELL_OF("ocelot-sgpio", vsc7512_sgpio_resources, NULL, 0, 0,
+ "mscc,ocelot-sgpio"),
+ MFD_CELL_OF_REG("ocelot-miim0", vsc7512_miim0_resources, NULL, 0, 0,
+ "mscc,ocelot-miim", VSC7512_MIIM0_RES_START),
+ MFD_CELL_OF_REG("ocelot-miim1", vsc7512_miim1_resources, NULL, 0, 0,
+ "mscc,ocelot-miim", VSC7512_MIIM1_RES_START),
+ MFD_CELL_OF("ocelot-serdes", vsc7512_serdes_resources, NULL, 0, 0,
+ "mscc,vsc7514-serdes"),
+ MFD_CELL_OF("ocelot-ext-switch", vsc7512_switch_resources, NULL, 0, 0,
+ "mscc,vsc7512-switch"),
};
static void ocelot_core_try_add_regmap(struct device *dev,
--
2.52.0