From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796232028; b=5ag4n/6FjkUikQmfHQq1FvTULr3M6Ya5fiJi3hcFWAMyvPmJD06yhdU3kxzm/HOiXn52 DhWW6O0+3Z5VgKOqJ0e46Ag8lpgbEdQSne/zRNMj5DyWRNIX+xFtidavya3mQ+A/cw2CT rw+/undp8IJzwLCVuaQ006UdTA4dTLO/C5fVuuAIVpMqsLNGYpU3QVpZ4nNz6cVCT2RWj EQPt4llMce3tVTLg/EhfPj7/3FcCmQ9kgLBCxjSE7GHmjgBzS4Tply1FWw5ZAofsLP/1B eWv67nTVAopEBH74hJM3/xkcaj+cMfYhwUNZjA1DJ2HJvpLKBT3VjPcpjF8pTZV41CA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796232028; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=p8bx+AiwDblYvU85aKe1zBxuoKV3ozDq+HQkQM2ydag=; b=iWNSW+wHn2dKnTatbeGVttAfs38V76LVdqvE6BoXQDQvT4pYfE6VzP/LxiC2vyPp9qt3 JZSsDMSIvV0fpCbAIcJzKoJ1za0lJ7zUrATM1noEWT2YbkrvcZMk2VQTvMyPrbxkTg4h3 wz97PFJuoZ4oz/xrJVd7igI6awMiqp5xfXHU2R+g9A49BPGxCcnTUXE4KwfZJb34ltbmV qnxxO9lxuyrpXs4VIKmV/72qjlksNIPgsZ+xa6cO1u0bV0yJFa+Qab88DeZW2hHrej9pb 3GkFiVtSjgLBlHvP/RE/1f3nU9tJg5jMU/Hy6BDvAGbft9YZZM6sYsa1vjXv0341nqQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="gD/p4t66"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21049606A322; Wed, 2 Dec 2026 17:20:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gD/p4t66 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1617A1F000C1; Wed, 2 Dec 2026 17:20:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796232027; bh=p8bx+AiwDblYvU85aKe1zBxuoKV3ozDq+HQkQM2ydag=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=gD/p4t66xI+k5Pc8VuCw9miTBJLZ4yv0CYGvnrsdu+AS1Qxf2+to5mVVM6h25HSu6 gSV+rC+p9qOtwzLi/TNeaYn8j2++20+mLIwaa/qtnA6WCdjng63p9cPNJU4dVdhn9d V5EVyV5GwP+Jw3ouXPizRiRNJ49/EcUsjl06mG+5+LBJ3EdKxedhfXgI3Oj08wkmHO vaJrBIRkA19dsHsTCw+LgUK8apuqDz2q6p8rnu6JIdnQeDKBRrs19WjfR7CqZAdNlF JcOG7vQMtzKrCB5R5p5f1hwAtJzOK6buy0wzcQKNwaNercJmIzy4QQpQ6PF30hoeqO mIlVk/p19SxbQ== Date: Wed, 2 Dec 2026 17:20:21 +0000 From: Lee Jones To: Vasilij Strassheim Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Simon Horman , Russell King , Andrew Lunn , Heiner Kallweit , Eric Dumazet , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, mfd@lists.linux.dev, Martin Kaistra , Benedikt Spranger Subject: Re: [PATCH net-next v5 7/9] mfd: soce: Add SWIP core driver Message-ID: <20261202172021.GC98551@kernel.org> References: <20261120-devel-vstrassheim-soce-dsa-ml-v5-0-5de9225715e6@linutronix.de> <20261120-devel-vstrassheim-soce-dsa-ml-v5-7-5de9225715e6@linutronix.de> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > --- > 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 > +#include > +#include > +#include > +#include > + > +#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