diff mbox series

[RFC,v5,net-next,07/13] mfd: ocelot: enable the external switch interface

Message ID 20211218214954.109755-8-colin.foster@in-advantage.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series add support for VSC75XX control over SPI | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/apply fail Patch does not apply to net-next

Commit Message

Colin Foster Dec. 18, 2021, 9:49 p.m. UTC
Add the ocelot-ext child device to the MFD. This will enable device-tree
configuration of the MFD to include the external switch, if desired.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
---
 drivers/mfd/ocelot-core.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

Comments

Lee Jones Dec. 29, 2021, 3:24 p.m. UTC | #1
On Sat, 18 Dec 2021, Colin Foster wrote:

> Add the ocelot-ext child device to the MFD. This will enable device-tree
> configuration of the MFD to include the external switch, if desired.
> 
> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> ---
>  drivers/mfd/ocelot-core.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)

Please squash this into the driver creation patch.

> diff --git a/drivers/mfd/ocelot-core.c b/drivers/mfd/ocelot-core.c
> index 09132ea52760..52aa7b824d02 100644
> --- a/drivers/mfd/ocelot-core.c
> +++ b/drivers/mfd/ocelot-core.c
> @@ -6,6 +6,7 @@
>  #include <asm/byteorder.h>
>  #include <linux/spi/spi.h>
>  #include <linux/kconfig.h>
> +#include <linux/mfd/core.h>
>  #include <linux/module.h>
>  #include <linux/regmap.h>
>  
> @@ -103,6 +104,13 @@ struct regmap *ocelot_mfd_get_regmap_from_resource(struct device *dev,
>  }
>  EXPORT_SYMBOL(ocelot_mfd_get_regmap_from_resource);
>  
> +static const struct mfd_cell vsc7512_devs[] = {
> +	{
> +		.name = "ocelot-ext-switch",
> +		.of_compatible = "mscc,vsc7512-ext-switch",
> +	},
> +};
> +
>  int ocelot_mfd_init(struct ocelot_mfd_config *config)
>  {
>  	struct device *dev = config->dev;
> @@ -139,7 +147,10 @@ int ocelot_mfd_init(struct ocelot_mfd_config *config)
>  		return ret;
>  	}
>  
> -	/* Create and loop over all child devices here */
> +	ret = mfd_add_devices(dev, PLATFORM_DEVID_NONE, vsc7512_devs,
> +			      ARRAY_SIZE(vsc7512_devs), NULL, 0, NULL);
> +
> +	dev_info(dev, "ocelot mfd core setup complete\n");
>  
>  	return 0;
>  }
> @@ -147,7 +158,7 @@ EXPORT_SYMBOL(ocelot_mfd_init);
>  
>  int ocelot_mfd_remove(struct ocelot_mfd_config *config)
>  {
> -	/* Loop over all children and remove them */
> +	mfd_remove_devices(config->dev);
>  
>  	return 0;
>  }
diff mbox series

Patch

diff --git a/drivers/mfd/ocelot-core.c b/drivers/mfd/ocelot-core.c
index 09132ea52760..52aa7b824d02 100644
--- a/drivers/mfd/ocelot-core.c
+++ b/drivers/mfd/ocelot-core.c
@@ -6,6 +6,7 @@ 
 #include <asm/byteorder.h>
 #include <linux/spi/spi.h>
 #include <linux/kconfig.h>
+#include <linux/mfd/core.h>
 #include <linux/module.h>
 #include <linux/regmap.h>
 
@@ -103,6 +104,13 @@  struct regmap *ocelot_mfd_get_regmap_from_resource(struct device *dev,
 }
 EXPORT_SYMBOL(ocelot_mfd_get_regmap_from_resource);
 
+static const struct mfd_cell vsc7512_devs[] = {
+	{
+		.name = "ocelot-ext-switch",
+		.of_compatible = "mscc,vsc7512-ext-switch",
+	},
+};
+
 int ocelot_mfd_init(struct ocelot_mfd_config *config)
 {
 	struct device *dev = config->dev;
@@ -139,7 +147,10 @@  int ocelot_mfd_init(struct ocelot_mfd_config *config)
 		return ret;
 	}
 
-	/* Create and loop over all child devices here */
+	ret = mfd_add_devices(dev, PLATFORM_DEVID_NONE, vsc7512_devs,
+			      ARRAY_SIZE(vsc7512_devs), NULL, 0, NULL);
+
+	dev_info(dev, "ocelot mfd core setup complete\n");
 
 	return 0;
 }
@@ -147,7 +158,7 @@  EXPORT_SYMBOL(ocelot_mfd_init);
 
 int ocelot_mfd_remove(struct ocelot_mfd_config *config)
 {
-	/* Loop over all children and remove them */
+	mfd_remove_devices(config->dev);
 
 	return 0;
 }