From nobody Sat Oct 4 00:33:09 2025 Received: from 5.mo534.mail-out.ovh.net (5.mo534.mail-out.ovh.net [54.36.140.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FDF4303CBE; Fri, 22 Aug 2025 13:58:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=54.36.140.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755871128; cv=none; b=fKhZg03kbmkqdxUSM2MtgsKbzX2qUVB8ZawgcWpvi+6wwVWJL0EeXVvcO0WFByntegj1kRKy2StMAheCiT6mriW2S4MqEADwxE3Q/9ddqbf6NeCc9chrFBbJqF9zEdeoofYb2/SncfjRYXL51ETKwagIw64cWUg2g6Lodu7Rr7I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755871128; c=relaxed/simple; bh=1nFot461mH2AXNOy+OXg4eZ75foA2HBvx3TjV+cwST4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=d6hv+8YfIMR4FqwPK5gsPGcKzRLmyW8jop4gIojd4CclzPRxL8x2qKdF9VrwHWK/AOZ9Ldk68/KIaiotje+tKmdp9gL72fMK6SarU5zxDmGY2PM4kXc6E0jgiHWcI0J4zY0qIKRC9+uVeRRzeZVZcDawesbshUa5lIyOP603Pmw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=orca.pet; spf=pass smtp.mailfrom=orca.pet; dkim=pass (2048-bit key) header.d=orca.pet header.i=@orca.pet header.b=U7uMZGgh; arc=none smtp.client-ip=54.36.140.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=orca.pet Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=orca.pet Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=orca.pet header.i=@orca.pet header.b="U7uMZGgh" Received: from director4.derp.mail-out.ovh.net (director4.derp.mail-out.ovh.net [79.137.60.37]) by mo534.mail-out.ovh.net (Postfix) with ESMTPS id 4c7hcM1W1rz6D5x; Fri, 22 Aug 2025 13:58:43 +0000 (UTC) Received: from director4.derp.mail-out.ovh.net (director4.derp.mail-out.ovh.net. [127.0.0.1]) by director4.derp.mail-out.ovh.net (inspect_sender_mail_agent) with SMTP for ; Fri, 22 Aug 2025 13:58:43 +0000 (UTC) Received: from mta2.priv.ovhmail-u1.ea.mail.ovh.net (unknown [10.110.168.168]) by director4.derp.mail-out.ovh.net (Postfix) with ESMTPS id 4c7hcM0F12z1yGZ; Fri, 22 Aug 2025 13:58:43 +0000 (UTC) Received: from orca.pet (unknown [10.1.6.4]) by mta2.priv.ovhmail-u1.ea.mail.ovh.net (Postfix) with ESMTPSA id 1AEDF3E32D0; Fri, 22 Aug 2025 13:58:42 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-95G0016ef2d7ab-2360-4703-861c-5b60f28993d5, ADC0680FE15BB91110492B9A34CE42AA242C155A) smtp.auth=marcos@orca.pet X-OVh-ClientIp: 147.156.42.5 From: Marcos Del Sol Vives To: linux-kernel@vger.kernel.org Cc: Marcos Del Sol Vives , Linus Walleij , Bartosz Golaszewski , Michael Walle , Lee Jones , Bjorn Helgaas , linux-gpio@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v4 3/3] mfd: vortex: implement new driver for Vortex southbridges Date: Fri, 22 Aug 2025 15:58:13 +0200 Message-Id: <20250822135816.739582-4-marcos@orca.pet> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250822135816.739582-1-marcos@orca.pet> References: <20250822135816.739582-1-marcos@orca.pet> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 8616230514139223654 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduieefleegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrrhgtohhsucffvghlucfuohhlucggihhvvghsuceomhgrrhgtohhssehorhgtrgdrphgvtheqnecuggftrfgrthhtvghrnhepudffudeutdejudeffeeugeehveevgfefiefgueejueejheevtefgtdffvddukeelnecukfhppeduvdejrddtrddtrddupddugeejrdduheeirdegvddrheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepmhgrrhgtohhssehorhgtrgdrphgvthdpnhgspghrtghpthhtohepledprhgtphhtthhopegsrhhglhessghguggvvhdrphhlpdhrtghpthhtohepsghhvghlghgrrghssehgohhoghhlvgdrtghomhdprhgtphhtthhopehlvggvsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehmfigrlhhlvgeskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhushdrfigrlhhlvghijheslhhinhgrrhhordhorhhgpdhrtghpthhtohepmhgrrhgtohhssehorhgtrgdrphgvthdprhgtphhtthhopehlihhnuhigqdhgphhiohesvhhgvghrrdhkvghrnhgvlhdroh hrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhptghisehvghgvrhdrkhgvrhhnvghlrdhorhhg DKIM-Signature: a=rsa-sha256; bh=qUWhGzunPuC1HDyNVxUC9O9rEFAp/6tcqWTBpQ5k3nI=; c=relaxed/relaxed; d=orca.pet; h=From; s=ovhmo-selector-1; t=1755871123; v=1; b=U7uMZGghJg4ldSfCih9aDGX5RIqWjR0vS1G13sbYsAyHSwTAaR16gVZU0QT4isByk+vpXPKH cmL0Salw29gSHg6sHfvEPbi1tBZrFg7Ga/XnG8hxnjQKppsMDSIbgFFFlcbXxpWV3Ej07r/XtfV ERLinKufx77j4bgjqy1gx6LnlgPnQ+ObmgPqZ/GJcLly3R/O8w30FDUb0cTUeCOZZFansMrbqIh xLKVUDWzddwilTgv48OmHexde26VfAM/vG/yztggoeJyqQjYiVhsIGkMVsduFjJjHmcn4XlWzWa JB79lGhxkmIIq1c2lnuTFMahQwov4XIvOzpRwDlR82p2A== Content-Type: text/plain; charset="utf-8" This new driver loads resources related to southbridges available in DM&P Vortex devices, currently only the GPIO pins. Signed-off-by: Marcos Del Sol Vives --- MAINTAINERS | 1 + drivers/mfd/Kconfig | 9 +++ drivers/mfd/Makefile | 1 + drivers/mfd/vortex-sb.c | 135 ++++++++++++++++++++++++++++++++++++++++ include/linux/pci_ids.h | 3 + 5 files changed, 149 insertions(+) create mode 100644 drivers/mfd/vortex-sb.c diff --git a/MAINTAINERS b/MAINTAINERS index afa88f446630..63e410e23e95 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -26957,6 +26957,7 @@ VORTEX HARDWARE SUPPORT R: Marcos Del Sol Vives S: Maintained F: drivers/gpio/gpio-vortex.c +F: drivers/mfd/vortex-sb.c =20 VRF M: David Ahern diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 425c5fba6cb1..fe54bb22687d 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -2008,6 +2008,15 @@ config MFD_VX855 VIA VX855/VX875 south bridge. You will need to enable the vx855_spi and/or vx855_gpio drivers for this to do anything useful. =20 +config MFD_VORTEX_SB + tristate "Vortex southbridge" + select MFD_CORE + depends on PCI + help + Say yes here if you want to have support for the southbridge + present on Vortex SoCs. You will need to enable the vortex-gpio + driver for this to do anything useful. + config MFD_ARIZONA select REGMAP select REGMAP_IRQ diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index f7bdedd5a66d..2504ba311f1a 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -202,6 +202,7 @@ obj-$(CONFIG_MFD_JANZ_CMODIO) +=3D janz-cmodio.o obj-$(CONFIG_MFD_TPS6586X) +=3D tps6586x.o obj-$(CONFIG_MFD_VX855) +=3D vx855.o obj-$(CONFIG_MFD_WL1273_CORE) +=3D wl1273-core.o +obj-$(CONFIG_MFD_VORTEX_SB) +=3D vortex-sb.o =20 si476x-core-y :=3D si476x-cmd.o si476x-prop.o si476x-i2c.o obj-$(CONFIG_MFD_SI476X_CORE) +=3D si476x-core.o diff --git a/drivers/mfd/vortex-sb.c b/drivers/mfd/vortex-sb.c new file mode 100644 index 000000000000..141fa19773e2 --- /dev/null +++ b/drivers/mfd/vortex-sb.c @@ -0,0 +1,135 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * MFD southbridge driver for Vortex SoCs + * + * Author: Marcos Del Sol Vives + * + * Based on the RDC321x MFD driver by Florian Fainelli and Bernhard Loos + */ + +#include +#include +#include +#include +#include + +struct vortex_southbridge { + const struct mfd_cell *cells; + int n_cells; +}; + +/* Layout for Vortex86DX/MX */ +static const struct resource vortex_dx_gpio_resources[] =3D { + { + .name =3D "dat1", + .start =3D 0x78, + .end =3D 0x7C, + .flags =3D IORESOURCE_IO, + }, { + .name =3D "dir1", + .start =3D 0x98, + .end =3D 0x9C, + .flags =3D IORESOURCE_IO, + } +}; + +static const struct mfd_cell vortex_dx_sb_cells[] =3D { + { + .name =3D "vortex-gpio", + .resources =3D vortex_dx_gpio_resources, + .num_resources =3D ARRAY_SIZE(vortex_dx_gpio_resources), + }, +}; + +static const struct vortex_southbridge vortex_dx_sb =3D { + .cells =3D vortex_dx_sb_cells, + .n_cells =3D ARRAY_SIZE(vortex_dx_sb_cells), +}; + +/* Layout for Vortex86DX2/DX3 */ +static const struct resource vortex_dx2_gpio_resources[] =3D { + { + .name =3D "dat1", + .start =3D 0x78, + .end =3D 0x7C, + .flags =3D IORESOURCE_IO, + }, { + .name =3D "dat2", + .start =3D 0x100, + .end =3D 0x105, + .flags =3D IORESOURCE_IO, + }, { + .name =3D "dir1", + .start =3D 0x98, + .end =3D 0x9D, + .flags =3D IORESOURCE_IO, + }, { + .name =3D "dir2", + .start =3D 0x93, + .end =3D 0x97, + .flags =3D IORESOURCE_IO, + } +}; + +static const struct mfd_cell vortex_dx2_sb_cells[] =3D { + { + .name =3D "vortex-gpio", + .resources =3D vortex_dx2_gpio_resources, + .num_resources =3D ARRAY_SIZE(vortex_dx2_gpio_resources), + }, +}; + +static const struct vortex_southbridge vortex_dx2_sb =3D { + .cells =3D vortex_dx2_sb_cells, + .n_cells =3D ARRAY_SIZE(vortex_dx2_sb_cells), +}; + +static int vortex_sb_probe(struct pci_dev *pdev, + const struct pci_device_id *ent) +{ + struct vortex_southbridge *priv =3D (struct vortex_southbridge *) ent->dr= iver_data; + int err; + + /* + * In the Vortex86DX3, the southbridge appears twice (on both 00:07.0 + * and 00:07.1). Register only once for .0. + * + * Other Vortex boards (eg Vortex86MX+) have the southbridge exposed + * only once, also at 00:07.0. + */ + if (PCI_FUNC(pdev->devfn) !=3D 0) + return -ENODEV; + + err =3D pci_enable_device(pdev); + if (err) { + dev_err(&pdev->dev, "failed to enable device\n"); + return err; + } + + return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, + priv->cells, priv->n_cells, + NULL, 0, NULL); +} + +static const struct pci_device_id vortex_sb_table[] =3D { + /* Vortex86DX */ + { PCI_DEVICE_DATA(RDC, R6031, &vortex_dx_sb) }, + /* Vortex86DX2/DX3 */ + { PCI_DEVICE_DATA(RDC, R6035, &vortex_dx2_sb) }, + /* Vortex86MX */ + { PCI_DEVICE_DATA(RDC, R6036, &vortex_dx_sb) }, + {} +}; +MODULE_DEVICE_TABLE(pci, vortex_sb_table); + +static struct pci_driver vortex_sb_driver =3D { + .name =3D "vortex-sb", + .id_table =3D vortex_sb_table, + .probe =3D vortex_sb_probe, +}; + +module_pci_driver(vortex_sb_driver); + +MODULE_AUTHOR("Marcos Del Sol Vives "); +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Vortex MFD southbridge driver"); diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 92ffc4373f6d..2c7afebd94ea 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -2412,6 +2412,9 @@ #define PCI_VENDOR_ID_RDC 0x17f3 #define PCI_DEVICE_ID_RDC_R6020 0x6020 #define PCI_DEVICE_ID_RDC_R6030 0x6030 +#define PCI_DEVICE_ID_RDC_R6031 0x6031 +#define PCI_DEVICE_ID_RDC_R6035 0x6035 +#define PCI_DEVICE_ID_RDC_R6036 0x6036 #define PCI_DEVICE_ID_RDC_R6040 0x6040 #define PCI_DEVICE_ID_RDC_R6060 0x6060 #define PCI_DEVICE_ID_RDC_R6061 0x6061 --=20 2.34.1