linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Christian Marangi <ansuelsmth@gmail.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Lee Jones <lee@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno,"
	<angelogioacchino.delregno@collabora.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	upstream@airoha.com
Subject: Re: [net-next PATCH v10 5/9] mfd: an8855: Add support for Airoha AN8855 Switch MFD
Date: Sun, 8 Dec 2024 16:12:28 +0100	[thread overview]
Message-ID: <6755b761.050a0220.223761.2b14@mx.google.com> (raw)
In-Reply-To: <8e9cf879-b188-4bfe-8200-f6a6ae285cb5@wanadoo.fr>

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@public.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@public.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


  reply	other threads:[~2024-12-08 15:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-08  0:20 [net-next PATCH v10 0/9] net: dsa: Add Airoha AN8855 support Christian Marangi
2024-12-08  0:20 ` [net-next PATCH v10 1/9] dt-bindings: nvmem: Document support for Airoha AN8855 Switch EFUSE Christian Marangi
2024-12-08  0:20 ` [net-next PATCH v10 2/9] dt-bindings: net: Document support for Airoha AN8855 Switch Virtual MDIO Christian Marangi
2024-12-08 16:02   ` Andrew Lunn
2024-12-08  0:20 ` [net-next PATCH v10 3/9] dt-bindings: net: dsa: Document support for Airoha AN8855 DSA Switch Christian Marangi
2024-12-08  0:20 ` [net-next PATCH v10 4/9] dt-bindings: mfd: Document support for Airoha AN8855 Switch SoC Christian Marangi
2024-12-08  1:47   ` Rob Herring (Arm)
2024-12-08  0:20 ` [net-next PATCH v10 5/9] mfd: an8855: Add support for Airoha AN8855 Switch MFD Christian Marangi
2024-12-08 15:09   ` Christophe JAILLET
2024-12-08 15:12     ` Christian Marangi [this message]
2024-12-08 15:38       ` Christophe JAILLET
2024-12-08  0:20 ` [net-next PATCH v10 6/9] net: mdio: Add Airoha AN8855 Switch MDIO Passtrough Christian Marangi
2024-12-08 15:13   ` Christophe JAILLET
2024-12-08  0:20 ` [net-next PATCH v10 7/9] nvmem: an8855: Add support for Airoha AN8855 Switch EFUSE Christian Marangi
2024-12-08 15:17   ` Christophe JAILLET
2024-12-08  0:20 ` [net-next PATCH v10 8/9] net: dsa: Add Airoha AN8855 5-Port Gigabit DSA Switch driver Christian Marangi
2024-12-08 15:26   ` Christophe JAILLET
2024-12-09  4:38   ` kernel test robot
2024-12-09  4:42   ` kernel test robot
2024-12-08  0:20 ` [net-next PATCH v10 9/9] net: phy: Add Airoha AN8855 Internal Switch Gigabit PHY Christian Marangi
2024-12-09  4:39   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6755b761.050a0220.223761.2b14@mx.google.com \
    --to=ansuelsmth@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=matthias.bgg@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=upstream@airoha.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).