Re: [net-next PATCH v10 5/9] mfd: an8855: Add support for Airoha AN8855 Switch MFD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Dec 08, 2024 at 04:09:25PM +0100, Christophe JAILLET wrote:
> Le 08/12/2024 à 01:20, Christian Marangi a écrit :
> > Add support for Airoha AN8855 Switch MFD that provide support for a DSA
> > switch and a NVMEM provider. Also provide support for a virtual MDIO
> > passthrough as the PHYs address for the switch are shared with the switch
> > address
> > 
> > Signed-off-by: Christian Marangi <ansuelsmth-Re5JQEeQqe8AvxtiuMwx3w@xxxxxxxxxxxxxxxx>
> > ---
> >   MAINTAINERS                           |   1 +
> >   drivers/mfd/Kconfig                   |   9 +
> >   drivers/mfd/Makefile                  |   1 +
> >   drivers/mfd/airoha-an8855.c           | 279 ++++++++++++++++++++++++++
> >   include/linux/mfd/airoha-an8855-mfd.h |  41 ++++
> >   5 files changed, 331 insertions(+)
> >   create mode 100644 drivers/mfd/airoha-an8855.c
> >   create mode 100644 include/linux/mfd/airoha-an8855-mfd.h
> > 
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index f3e3f6938824..7f4d7c48b6e1 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -721,6 +721,7 @@ F:	Documentation/devicetree/bindings/mfd/airoha,an8855-mfd.yaml
> >   F:	Documentation/devicetree/bindings/net/airoha,an8855-mdio.yaml
> >   F:	Documentation/devicetree/bindings/net/dsa/airoha,an8855-switch.yaml
> >   F:	Documentation/devicetree/bindings/nvmem/airoha,an8855-efuse.yaml
> > +F:	drivers/mfd/airoha-an8855.c
> >   AIROHA ETHERNET DRIVER
> >   M:	Lorenzo Bianconi <lorenzo-DgEjT+Ai2ygdnm+yROfE0A@xxxxxxxxxxxxxxxx>
> > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > index ae23b317a64e..a83db24336d9 100644
> > --- a/drivers/mfd/Kconfig
> > +++ b/drivers/mfd/Kconfig
> > @@ -53,6 +53,15 @@ config MFD_ALTERA_SYSMGR
> >   	  using regmap_mmio accesses for ARM32 parts and SMC calls to
> >   	  EL3 for ARM64 parts.
> > +config MFD_AIROHA_AN8855
> > +	bool "Airoha AN8855 Switch MFD"
> > +	depends on MDIO && OF
> > +	select MFD_CORE
> > +	help
> > +	  Support for the Airoha AN8855 Switch MFD. This is a SoC Switch
> > +	  that provide various peripherals. Currently it provides a
> 
> provides?
> 
> > +	  DSA switch and a NVMEM provider.
> > +
> >   config MFD_ACT8945A
> >   	tristate "Active-semi ACT8945A"
> >   	select MFD_CORE
> 
> ...
> 
> > +static int an8855_mfd_probe(struct mdio_device *mdiodev)
> > +{
> > +	struct an8855_mfd_priv *priv;
> > +	struct regmap *regmap;
> > +
> > +	priv = devm_kzalloc(&mdiodev->dev, sizeof(*priv), GFP_KERNEL);
> > +	if (!priv)
> > +		return -ENOMEM;
> > +
> > +	priv->bus = mdiodev->bus;
> > +	priv->dev = &mdiodev->dev;
> > +	priv->switch_addr = mdiodev->addr;
> > +	/* no DMA for mdiobus, mute warning for DMA mask not set */
> > +	priv->dev->dma_mask = &priv->dev->coherent_dma_mask;
> > +
> > +	regmap = devm_regmap_init(priv->dev, NULL, priv,
> > +				  &an8855_regmap_config);
> > +	if (IS_ERR(regmap)) {
> > +		dev_err(priv->dev, "regmap initialization failed");
> 
> Nitpick: Missing ending \n.
> Also, return dev_err_probe() could be used.
>

Can regmap PROBE_DEFER? Or it's just common practice?

> > +		return PTR_ERR(priv->dev);
> > +	}
> > +
> > +	dev_set_drvdata(&mdiodev->dev, priv);
> 
> Is it needed?
> There is no dev_get_drvdata() in this patch
> 

Yes it is, MFD child makes use of dev_get_drv_data(dev->parent) to
access the bug and current_page.

> > +
> > +	return devm_mfd_add_devices(priv->dev, PLATFORM_DEVID_AUTO, an8855_mfd_devs,
> > +				    ARRAY_SIZE(an8855_mfd_devs), NULL, 0,
> > +				    NULL);
> > +}
> 
> ...
> 
> CJ

-- 
	Ansuel




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux