[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6755b761.050a0220.223761.2b14@mx.google.com>
Date: Sun, 8 Dec 2024 16:12:28 +0100
From: Christian Marangi <ansuelsmth@...il.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: Lee Jones <lee@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Vladimir Oltean <olteanv@...il.com>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
Matthias Brugger <matthias.bgg@...il.com>,
"AngeloGioacchino Del Regno," <angelogioacchino.delregno@...labora.com>,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
upstream@...oha.com
Subject: Re: [net-next PATCH v10 5/9] mfd: an8855: Add support for Airoha
AN8855 Switch MFD
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@...lic.gmane.org>
> > ---
> > 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@...lic.gmane.org>
> > 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
Powered by blists - more mailing lists