🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19847

[PATCH net-next v5 7/9] mfd: soce: Add SWIP core driver

#19847
From: Vasilij Strassheim
Date: Fri, 20 Nov 2026 14:52
131 lines
13427 bytes
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);
+
+	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));
+	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
Technical Details
Message-ID: <20261120-devel-vstrassheim-soce-dsa-ml-v5-7-5de9225715e6@linutronix.de>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367982-linux-kernel-netdev=dewy.ru
References: <20261120-devel-vstrassheim-soce-dsa-ml-v5-0-5de9225715e6@linutronix.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367982-linux-kernel-netdev=dewy.ru
From: v.strassheim@linutronix.de (Vasilij Strassheim)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v5 7/9] mfd: soce: Add SWIP core driver
Date: Fri, 20 Nov 2026 15:52:24 +0100
Organization: Usenet Network
Message-ID: <20261120-devel-vstrassheim-soce-dsa-ml-v5-7-5de9225715e6@linutronix.de>
References: <20261120-devel-vstrassheim-soce-dsa-ml-v5-0-5de9225715e6@linutronix.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3185514"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:aRhKjXVw82d6Ul1htlO+BT2VWLc= sha256:DGtUKkzbSD1a2+YxDIGgqQG8vuzhWcMRY57R6spAho0=
	sha1:E8hhlATm1GczmoeL6My6j+w5Dw4= sha256:JQLP/ch87zrGWE2t7pWXF5jXxgT10TjWqWYUw1t1kCk=
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 3F1AF1159D4; Fri, 20 Nov 2026 17:54:16 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 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.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=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=AwZ2MI3u; dkim=neutral
	reason="invalid (unsupported algorithm ed25519-sha256)"
	header.d=linutronix.de header.b=TCxsRz1y
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 SIe2Zm3FB6tQ;
	Fri, 20 Nov 2026 17:54:13 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-367982-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 F00B4115998; Fri, 20 Nov 2026 17:53:59 +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 EF8F7EBB31; Fri, 20 Nov 2026 14:53:24 +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=1795186396;
	b=TOKL1N/TiiHIZtOpioFIbl2tRdFedhlzBeZSGgCqskUAkIp3siq0jNFZMmmde49z7ZjR
	 lXgxSZmcgAPXs9yGsfP724v+1UctMmMRAoOSaGlBC20C0tGZ5AqgrO4bFLlU/AHHwGSve
	 uLyVNtJxogOSVMKNvCsXz09iGqprgA+kGY2hwWApw9i18/5f0ruoVcTr8FcFembiPuWck
	 tvWlwImUmCrwgipsG8JXN39fXAd0XrMwTvW1nvCz8I49g7cUjwJaiECTbHVCaSQyqeSx2
	 3Pn1LhkvstHNEhCXGjgrWcK/NILDDBLqdHxtlQtAq3reL/z25CEP/ZPSly2NigZYKGw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795186396;
	h=X-Original-To:Received:DMARC-Filter:From:DKIM-Signature:
	 DKIM-Signature:Date:Subject:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:
	 References:In-Reply-To:To:Cc;
	bh=gLHe0mN7pxYygtroa4+XzdYi7MLtdsV3ip56v/ac0JQ=;
	b=covx9yGqsoihzydJl8EOZ7bDXMM/Foc4/rP83/oJIurpviBvEeqDGOY6FXH6N8A5/aEr
	 wG4xNub2biRB9qjKfR6wH+pw6xQqTYlhIl3lcHS9lMISKVSNwSKBQWKWBb+PSUn49jXgo
	 4GCBIZrlewzO/dRxyTTmJhugxqyDzkfX+ojQDjA4o5iWSWkdsXwR2aagzAfs2UfWaKeam
	 Vdq2TGnzYQ9DZj9vMBLUVIqlXd2m8QFu7hICuoNlogflxdW/lakkkuL0D7A25vQwRTNXa
	 JQx+JLycmQmLPX24NUUo8toOTzLlwIjzZvjzEDOzBXfohbhzWEvJzhtJrdv88bHdR1w==
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=AwZ2MI3u;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=TCxsRz1y;
	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 312C5606A331;
	Fri, 20 Nov 2026 14:53:16 +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=AwZ2MI3u;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=TCxsRz1y
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=1795186395;
	b=LvkvAUkoixirMzCa9WGq4bfugD83Fha/kbT45j6aC0YRbzMmGcbe3A9K7PEVq0gGG9O3
	 KXoh2Hp3pKKhHVMFl5lP2o6DTALlRLeaADvdQnHbd8OVyIrQl1BH/QkkuFwngnqV5QClr
	 H0Uj+bS//6IDkh0vYDErKZnZ1Ee0ncNv833uZkFU070ujJhLuhIePE3ZwYQhVsqSE8pSR
	 0x6AIoVTLuKKLARdRaXXrF26cbekiTL+rzhfj43y8rm7cqqofAE8YeKqlk+cmusZeW/CZ
	 ddCc40PdTiA12S58xKoLgHB+d1iAdiN+9R3J7b32TSBzv1XdZi68n6r1ndcdEOdjDwg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795186395;
	h=DMARC-Filter:From:DKIM-Signature:DKIM-Signature:Date:Subject:
	 MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:
	 References:In-Reply-To:To:Cc;
	bh=gLHe0mN7pxYygtroa4+XzdYi7MLtdsV3ip56v/ac0JQ=;
	b=Sn20G/0o19HdRoS+4hRqvKmiiQHtZKAa4m+Y6sXncBA1zcdpXnuuiH8JY2cDQEIhXW3o
	 lHIzVe30q9GaCbaPEmfGbQoTA6//AvqQ9tiq73oaszhvVPad+p/hZ3By19ShXVwq4BWLe
	 V8JaSXbtHxYW2wtpRpLVcyMDXCnImXmd8GoQU13NffFfj4juuHp8WnqztenuM5m1yHzbC
	 Vmm9EKd8iTdYU8eVZItSMsROVK4wHZ+qZEgRREqZ5/KaN5r54J7XhGl+tAcyQQC1Knu3b
	 sZhXkjdDfWrf5QA12m/k4V9YrgTU4adHL/jTVgm59GqFUL8efpQs/9nkR6GRzDKFrkw==
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=AwZ2MI3u;
	dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=TCxsRz1y;
	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 DDA23606A332;
	Fri, 20 Nov 2026 14:53:14 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DDA23606A332
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=1795186393;
	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=gLHe0mN7pxYygtroa4+XzdYi7MLtdsV3ip56v/ac0JQ=;
	b=AwZ2MI3uPJ8QCnn5iAcPAt4TYIdeC9QGmcs/cFBczcxDjl26qgyjBDNdVzJ0tNRbl1BoAI
	qVhSFEXUDBL8Y59Ra9cAQmF9ci/OsrNnFtWpQ+XMgd4AQDE1+o0BMwqFtExYKdtxFQEe63
	xE1tG83tILuvD09YSc6CuQKXkUSrtANAmiJYY5arLuG4isSaeXxI4HKLPzwPVv8PSTXhfz
	pbEjnlZqFRUBv/ntzlkT3xz/VZcB2RUpKsIZ/4EChwawPSj8p4CVLNrMSmxxx2WA+jWSBW
	0h+WSBWxRAvigxpTb3oa0XyWEdBhOqlUhfHD1s3p6XbJrFl5/ZC897Ovus19UA==
X-DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de;
	s=2020e; t=1795186393;
	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=gLHe0mN7pxYygtroa4+XzdYi7MLtdsV3ip56v/ac0JQ=;
	b=TCxsRz1y21gq70/HIZ/iFy7OamrGMkHmOBpcdQu4VSNFfZC5/FvYFu1WeRH4Ph115SzV3z
	t7AVvcwOID9UnTAA==
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
X-In-Reply-To: <20261120-devel-vstrassheim-soce-dsa-ml-v5-0-5de9225715e6@linutronix.de>
X-Cc: Vasilij Strassheim <v.strassheim@linutronix.de>, 
 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>