From: Lee Jones <lee@kernel.org>
To: Vasilij Strassheim <v.strassheim@linutronix.de>
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>
Subject: Re: [PATCH net-next v5 7/9] mfd: soce: Add SWIP core driver
Date: Wed, 2 Dec 2026 17:20:21 +0000 [thread overview]
Message-ID: <20261202172021.GC98551@kernel.org> (raw)
In-Reply-To: <20261120-devel-vstrassheim-soce-dsa-ml-v5-7-5de9225715e6@linutronix.de>
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.
> +
> + 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.
> + 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
>
--
Lee Jones
next prev parent reply other threads:[~2026-12-02 17:20 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 14:52 [PATCH net-next v5 0/9] net: dsa: Add support for SoC-e Ethernet switch IP cores Vasilij Strassheim
2026-11-20 14:52 ` [PATCH net-next v5 1/9] dt-bindings: vendor-prefixes: Add soce Vasilij Strassheim
2026-11-20 14:52 ` [PATCH net-next v5 2/9] dt-bindings: net: Add SoC-e SWIP MDIO controller Vasilij Strassheim
2026-11-21 14:53 ` sashiko-bot
2026-11-24 12:04 ` Vasilij Strassheim
2026-11-20 14:52 ` [PATCH net-next v5 3/9] dt-bindings: net: dsa: Add SoC-e SWIP switch function Vasilij Strassheim
2026-11-21 14:53 ` sashiko-bot
2026-11-22 14:54 ` Krzysztof Kozlowski
2026-11-24 10:40 ` Vasilij Strassheim
2026-11-20 14:52 ` [PATCH net-next v5 4/9] dt-bindings: mfd: Add SoC-e SWIP parent Vasilij Strassheim
2026-11-21 10:19 ` Krzysztof Kozlowski
2026-11-23 17:59 ` Vasilij Strassheim
2026-12-01 22:48 ` Rob Herring
2026-12-02 10:26 ` Benedikt Spranger
2026-11-21 14:53 ` sashiko-bot
2026-11-20 14:52 ` [PATCH net-next v5 5/9] net: dsa: Add tag handling for SoC-e switches Vasilij Strassheim
2026-11-21 14:53 ` sashiko-bot
2026-11-25 16:06 ` Vasilij Strassheim
2026-11-20 14:52 ` [PATCH net-next v5 6/9] net: mdio: Add SoC-e SWIP MDIO controller driver Vasilij Strassheim
2026-11-20 14:52 ` [PATCH net-next v5 7/9] mfd: soce: Add SWIP core driver Vasilij Strassheim
2026-12-02 17:20 ` Lee Jones [this message]
2026-11-20 14:52 ` [PATCH net-next v5 8/9] net: dsa: soce: Add basic support for SoC-e SWIP switch Vasilij Strassheim
2026-11-20 14:52 ` [PATCH net-next v5 9/9] net: dsa: soce: Add VLAN membership table support Vasilij Strassheim
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=20261202172021.GC98551@kernel.org \
--to=lee@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=b.spranger@linutronix.de \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=martin.kaistra@linutronix.de \
--cc=mfd@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
--cc=v.strassheim@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.