Article View: linux.kernel.netdev
Article #26902Re: [PATCH net-next v5 7/9] mfd: soce: Add SWIP core driver
From: Vasilij Strassheim
Date: Fri, 04 Dec 2026 11:17
Date: Fri, 04 Dec 2026 11:17
179 lines
16096 bytes
16096 bytes
On Wed, 2026-12-02 at 17:20 +0000, Lee Jones wrote:
> On Fri, 20 Nov 2026, Vasilij Strassheim wrote:
>
> > Add an MFD parent driver for SoC-e SWIP FPGA IP cores.
> >
> > Validate the core version before populating the addressed switch, MDIO,
> > and MDIO mux child devices from Device Tree.
> >
> > Signed-off-by: Vasilij Strassheim <v.strassheim@linutronix.de>
> > ---
> > drivers/mfd/Kconfig | 9 ++++++
> > drivers/mfd/Makefile | 2 ++
> > drivers/mfd/soce-swip-core.c | 76 ++++++++++++++++++++++++++++++++++++++++++++
> > 3 files changed, 87 insertions(+)
> >
> > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > index 87ed55c155f0..ff3378e928fd 100644
> > --- a/drivers/mfd/Kconfig
> > +++ b/drivers/mfd/Kconfig
> > @@ -1291,6 +1291,15 @@ config MFD_QCOM_RPM
> > Say M here if you want to include support for the Qualcomm RPM as a
> > module. This will build a module called "qcom_rpm".
> >
> > +config MFD_SOCE_SWIP
> > + tristate
> > + depends on OF
> > + help
> > + Support for memory-mapped SoC-e Ethernet switch IP cores implemented
> > + in FPGAs. These devices integrate an Ethernet
> > + switch, an MDIO controller, and an MDIO bus selector.
> > + This is selected if Ethernet switch functionality is configured.
> > +
> > config MFD_SPACEMIT_P1
> > tristate "SpacemiT P1 PMIC"
> > depends on ARCH_SPACEMIT || COMPILE_TEST
> > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> > index f8101d2a9ce9..9f4d2ccc3a24 100644
> > --- a/drivers/mfd/Makefile
> > +++ b/drivers/mfd/Makefile
> > @@ -302,6 +302,8 @@ obj-$(CONFIG_MFD_QNAP_MCU) += qnap-mcu.o
> > obj-$(CONFIG_MFD_RSMU_I2C) += rsmu_i2c.o rsmu_core.o
> > obj-$(CONFIG_MFD_RSMU_SPI) += rsmu_spi.o rsmu_core.o
> >
> > +obj-$(CONFIG_MFD_SOCE_SWIP) += soce-swip-core.o
> > +
> > obj-$(CONFIG_MFD_UPBOARD_FPGA) += upboard-fpga.o
> >
> > obj-$(CONFIG_MFD_LOONGSON_SE) += loongson-se.o
> > diff --git a/drivers/mfd/soce-swip-core.c b/drivers/mfd/soce-swip-core.c
> > new file mode 100644
> > index 000000000000..2f7d966eeab2
> > --- /dev/null
> > +++ b/drivers/mfd/soce-swip-core.c
> > @@ -0,0 +1,76 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +
> > +#include <linux/bitfield.h>
> > +#include <linux/io.h>
> > +#include <linux/module.h>
> > +#include <linux/of_platform.h>
> > +#include <linux/platform_device.h>
> > +
> > +#define SWIP_CORE_VERSION_OFFSET 0x0000
> > +#define SWIP_CORE_VERSION_VERSION_MASK GENMASK(31, 24)
> > +#define SWIP_CORE_VERSION_SUBVERSION_MASK GENMASK(23, 16)
> > +#define SWIP_CORE_VERSION_REVISION_MASK GENMASK(15, 0)
> > +#define SWIP_MIN_CORE_VERSION 0x24
> > +#define SWIP_MIN_CORE_SUBVERSION 0x01
> > +
> > +static int swip_check_version(struct device *dev, void __iomem *base)
> > +{
> > + u8 subversion;
> > + u16 revision;
> > + u8 version;
> > + u32 regval;
> > +
> > + regval = readl(base + SWIP_CORE_VERSION_OFFSET);
> > + version = FIELD_GET(SWIP_CORE_VERSION_VERSION_MASK, regval);
> > + subversion = FIELD_GET(SWIP_CORE_VERSION_SUBVERSION_MASK, regval);
> > + revision = FIELD_GET(SWIP_CORE_VERSION_REVISION_MASK, regval);
> > + if (version < SWIP_MIN_CORE_VERSION ||
> > + (version == SWIP_MIN_CORE_VERSION &&
> > + subversion < SWIP_MIN_CORE_SUBVERSION))
> > + return dev_err_probe(dev, -ENODEV,
> > + "unsupported core version %02x.%02x.%04x\n",
> > + version, subversion, revision);
> > +
> > + dev_info(dev, "SoC-e IP core version %02x.%02x.%04x detected\n",
> > + version, subversion, revision);
>
> Please remove this noise. Only log errors and warnings.
Ok.
>
> > +
> > + return 0;
> > +}
> > +
> > +static int swip_probe(struct platform_device *pdev)
> > +{
> > + struct device *dev = &pdev->dev;
> > + struct resource *res;
> > + void __iomem *base;
> > + int ret;
> > +
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + if (!res || resource_size(res) < sizeof(u32))
> > + return -EINVAL;
> > + base = devm_ioremap(dev, res->start, sizeof(u32));
>
> This driver doesn't actually do anything.
>
> Have you investigated 'simple-mfd'?
>
> Doesn't of_default_bus_match_table already do what you need?
>
> Alternatively, since the DSA switch is the primary function of this IP
> block the switch node can simply be the top-level device and either call
> devm_of_platform_populate() itself, or have the MDIO and mux sub-blocks
> sit alongside it under a 'simple-mfd' parent.
>
This revision intentionally covers only a subset of the switch IPs
features and variants to keep the implementation and review manageable.
I chose a dedicated MFD parent to support independently usable
functions, such as an I2C controller alongside the switch and MDIO.
Which functions are present and usable depends on the variant, the
bitstream and hardware licensing.
If the parent needs to read the configuration registers to determine
which children to instantiate, simple-mfd alone is not sufficient.
The writing-bindings.rst also advise against using simple-mfd for
non-trivial devices whose children depend on parent resources.
Thankfully, Bene has explained our reasoning in more detail in the
parallel discussion on the DT binding patch [1].
[1] https://lore.kernel.org/netdev/20261203142727.00b19361@mitra/
> > + if (!base)
> > + return -ENOMEM;
> > + ret = swip_check_version(dev, base);
> > + if (ret)
> > + return ret;
> > +
> > + return devm_of_platform_populate(dev);
> > +}
> > +
> > +static const struct of_device_id swip_of_match[] = {
> > + { .compatible = "soce,swip" },
> > + { }
> > +};
> > +MODULE_DEVICE_TABLE(of, swip_of_match);
> > +
> > +static struct platform_driver swip_driver = {
> > + .probe = swip_probe,
> > + .driver = {
> > + .name = "soce-swip",
> > + .of_match_table = swip_of_match,
> > + },
> > +};
> > +module_platform_driver(swip_driver);
> > +
> > +MODULE_DESCRIPTION("SoC-e multifunction switch IP device driver");
> > +MODULE_LICENSE("GPL");
> >
> > --
> > 2.39.5
> >
>
Thanks,
Vasilij
Technical Details
Message-ID:
<30d6ab17651e1d08b19aeee41b146a8cd1c6c201.camel@linutronix.de>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mi.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377299-linux-kernel-netdev=dewy.ruReferences:
<20261120-devel-vstrassheim-soce-dsa-ml-v5-0-5de9225715e6@linutronix.de> <20261120-devel-vstrassheim-soce-dsa-ml-v5-7-5de9225715e6@linutronix.de> <20261202172021.GC98551@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mi.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377299-linux-kernel-netdev=dewy.ru From: v.strassheim@linutronix.de (Vasilij Strassheim) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v5 7/9] mfd: soce: Add SWIP core driver Date: Fri, 04 Dec 2026 12:17:59 +0100 Organization: Usenet Network Message-ID: <30d6ab17651e1d08b19aeee41b146a8cd1c6c201.camel@linutronix.de> References: <20261120-devel-vstrassheim-soce-dsa-ml-v5-0-5de9225715e6@linutronix.de> <20261120-devel-vstrassheim-soce-dsa-ml-v5-7-5de9225715e6@linutronix.de> <20261202172021.GC98551@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="2749452"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:A8/ksh6cuxy9flCUpVORyh5be+c= sha256:LIgCRMV2A+JcQwvMTlUYI6qqJUlT+jG5rBUiLhiDa3Y= sha1:MrOTkkrHWj+MIxYDaZA3k3YD6Wc= sha256:7iaVjRd9s++c06Urxj98f/fLpwluDZ9eTK+smuJ2/6A= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id B697A117BC5; Fri, 4 Dec 2026 14:18:33 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.299 X-Spam-Status: No, score=-3.299 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=linutronix.de header.b=FcIZ5kyt; dkim=neutral reason="invalid (unsupported algorithm ed25519-sha256)" header.d=linutronix.de header.b=PBQDz91w X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fHxr2avx3Pde; Fri, 4 Dec 2026 14:18:29 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377299-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linutronix.de X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 4F358117AF9; Fri, 4 Dec 2026 14:18:16 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id D59DB36675; Fri, 4 Dec 2026 11:18:07 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796383085; b=IbXUXwqs/1/x3AWTnpGy565d69H4zfTrzjErN5PcGJbJ7Rku35VgNcf0m5I4r7bpX37F tEGbhWpCT9G71rNAGDDnoawGH1/ZTrUtC5qbLKl2ojjyGtsjx4c+R5ygWG4kNUHbNpsul NZkCswEHt7cvMOCjAjqHRpq6s+yX3Mkyo82b7nt2/IzAQqKhtBDxsIrOo9LSg4I8MWJek cEFKKbDnzLOxHpPFYHV6xp1qasY9OjSN2D6VuwvtL/F6nVLwLnOO9S6r3Z9oMf31U/JfZ 1BYLMyvo7yAxm5UV2UDmTdGizdYvoqkzQ+FMz49r9rm+krNIl2B53Ohnuen0MgRUAwA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383085; h=X-Original-To:Received:DMARC-Filter:Message-ID:DKIM-Signature: DKIM-Signature:Subject:From:To:Cc:Date:In-Reply-To:References: Organization:Content-Type:Content-Transfer-Encoding:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version; bh=SRECUwSc/EwHtzEoVs6La+lb+8XYLv5fC76QrKncJu8=; b=ydNbSUOHYafIebhA368+zYzKqRDjsINAoXdwrvYPpavwWPIYRQw5CobHm3n0O7NQXora rc4+CMxo6Nm4gJJz+myKEGxymnKTGPg+EKPkoGYcMJ3EXjd1BjzVFiXHuF6HpCYWB1X2c NH54+UFNM150Tg/ItKI7AVvFYoY21rPP3W/nWY/7Zm43NWzWycly+4iNiHZORPoMGxxNS 3SrmTFGHegzIPr/Dlg1JLFZePp9Rb189ND0fsCxBG+e0N01gPCDnA/QnzmYIT8Q5sHjzB 6LSVqaTEm4bKnY7N0jubd8BLbiMBg84goSRbbK+9MmGdRyX0uAGy46r3x64E/66fYdA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=FcIZ5kyt; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=PBQDz91w; dmarc=pass header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3AC97606A681; Fri, 4 Dec 2026 11:18:05 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=FcIZ5kyt; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=PBQDz91w X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=193.142.43.55 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796383084; b=RWtkb+AdQwr+hIeggCNw20QHBltO/ROzakEEqUoh09Ny2qzERhgynwp7d/8ar68ktH8U tb1mqboqBltsDqy74v0OkNjoUCkh8S/hLphspRltxullJlhUCrBD/BGQDKiq92Yqwr6fe FWXoH7yAVLJQTESiTM2IZXJ1KSgBW5xvG1syrfLSClvBQvkRflkrp5mFiXo/0rv37Us9X +v9yG+FrILc/pSs1yPVJqFAydK1w5Ro2ZEciv5OVxD3RlzRY1luUrLPBCmwZXJ6KkHVjh nrgMP+oCiitjtaryLAERGLlYXWPH7y4H6kYEyxTa7swCEnsuFDRCpGygtpXmvMF3E3Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383084; h=DMARC-Filter:Message-ID:DKIM-Signature:DKIM-Signature:Subject:From: To:Cc:Date:In-Reply-To:References:Organization:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=SRECUwSc/EwHtzEoVs6La+lb+8XYLv5fC76QrKncJu8=; b=CTwTzJCs+rPvH175Ddy0y85i4Mc5L/bJf2BWgu9u9qKqPIFN5JV1PdGwdRUvaw3ceU8O gEUImyWV1aKzKqDuEGXyCYYUeCXLu2aE7cpya93zjwgR1NIgxF4AAh+PJmlysHuylopUd DNG987i68RGRcXLFfVLaKyZtC7DXhm2ETBVkfURomYkPswh24VWB5VqFTnASxRD+MagRk K7wJ5apxCpWJa0hs5ZwnxX0WF1Niw3/Ulg29rwxiu0JppfvPem3/MzYw7qiT1qi1wK/vi mifLdKdxXvTDFuGPYSBhAZMKIm/YVQzrRZs2kWzhm0BhLdfNr86rSw8mMuIkxNmEd4Q== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=FcIZ5kyt; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=PBQDz91w; arc=none smtp.remote-ip=193.142.43.55 X-Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2716606A334; Fri, 4 Dec 2026 11:18:02 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F2716606A334 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1796383080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SRECUwSc/EwHtzEoVs6La+lb+8XYLv5fC76QrKncJu8=; b=FcIZ5kytlkGDs7R/2nBrtcN5Ln4xR8NCLa2HL4v86G+UkNmx7KMkwcoLYTSuwNNjc0cLIK 8gq8/o5yXD+wcp1sCQu+nFlryoMzLy64d2h5FCDvkBuamBY6Hkjj9gr5RTpnhFwpZ7iLkS Yvi+B1qEnJMKm+xW4+r9vjZgai1EQDHh+xFpTX7UjEEuKCgEXsg/hnNv+sJYSzV9eju6PM CGfPwq4LorMiaWUa80Di5JQ8EXn5LaxML72Ds39dG60Y3OZvkXRtzgIOM/PPPBmlHp+VDj R6AqNc/p4uvFWnhoia6WYmA6wRhdI94DLvapCWn0z/zf+IlN6mO3JjfrVitc/A== X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1796383080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SRECUwSc/EwHtzEoVs6La+lb+8XYLv5fC76QrKncJu8=; b=PBQDz91wBlFoebvJJ8W8IfCsrZbmpygFU/q+dNy8Iz/QqprMmE2AkstwH0yTgXH8edjMJ3 sjUKXLrls4d63EAA== X-Cc: Rob Herring <robh@kernel.org>, Krzysztof Kozlowski <krzk+dt@kernel.org>, Conor Dooley <conor+dt@kernel.org>, Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>, "David S. Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, Russell King <linux@armlinux.org.uk>, Andrew Lunn <andrew+netdev@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, Eric Dumazet <edumazet@kernel.org>, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, mfd@lists.linux.dev, Martin Kaistra <martin.kaistra@linutronix.de>, Benedikt Spranger <b.spranger@linutronix.de> X-In-Reply-To: <20261202172021.GC98551@kernel.org> X-Organization: Linutronix GmbH X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list