From nobody Thu Apr 9 15:03:55 2026 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E798337B037 for ; Tue, 3 Mar 2026 06:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772518739; cv=none; b=Ze6Audg9Ei+64yURy2dPMWzSrphiMO+TRl0scNXnCuMvOhsCt+oR3wSGgJp5GgkmTvT7OVqJEhDVJw6Fi74KHHENSoJpJe2rRRI3rP8s/VTq3mXqF5oMc6Aa7sHh+U3FSEMgyuqLgYhtt+KjMixL1BxiIECfbPtkrShwXar5PT8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772518739; c=relaxed/simple; bh=kUO36wk5pPguO6tcCuK/zq59tvHDlqCO07lvN7eozaY=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=DLjIib0WwHu6vRYaGOmAlXf7yQJrakOudnBMQmi+zZ3tKcPxwutpjEjj1x4Emb32w3+po7KeBUO70qweqm1WNGDyLsQ1IDGzF9OO9ZmtAqUSrty6998l9jHeOrMQA5BFVE8wMKhKAMqKKvXVzitI3a+c3h2WdoxqSOE+NaVOY8o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realsil.com.cn; spf=pass smtp.mailfrom=realsil.com.cn; dkim=pass (2048-bit key) header.d=realsil.com.cn header.i=@realsil.com.cn header.b=V60qGWRh; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realsil.com.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realsil.com.cn Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=realsil.com.cn header.i=@realsil.com.cn header.b="V60qGWRh" X-SpamFilter-By: ArmorX SpamTrap 5.80 with qID 6236IiqqE604809, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realsil.com.cn; s=dkim; t=1772518724; bh=AyE9mwS9wSQowZkapOfCuRTIlHs9yIJt+kNT1eWAxzI=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:Content-Type; b=V60qGWRhWuLR3gN6RtQnWCCPzCogD3ep+EX8YF3F4z2s2yevq4CwC2ZVoBknz0b71 zHAygIDq1J9iQjPl7rQyAUWMPnTv8BKHxOBVPbrAcdK4LvFopI6no5IghzBunL+yVd n1E1E9/ZqkwZPEI7kmvRI2guH6VHs6vM1Yfid2DUPFZ91qVSy6jSMVRe+jcfLqwV1W PF/cjqetYttrTU3DzE+bvUEz+38xesLNh3EeaDnq9qQ5tqaaEYNIIB8Wg9Skrcv6Wh JW6vOwjwzYqt7NcNUk5zU0YPK3Bn07e9F0/o/X/OC2DHTv6a44iyahS3CuI4zAGANH mLoCre3/mYOHQ== Received: from RS-EX-MBS4.realsil.com.cn ([172.29.17.104]) by rtits2.realtek.com.tw (8.15.2/3.21/5.94) with ESMTPS id 6236IiqqE604809 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 3 Mar 2026 14:18:44 +0800 Received: from RS-EX-MBS1.realsil.com.cn (172.29.17.101) by RS-EX-MBS4.realsil.com.cn (172.29.17.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.39; Tue, 3 Mar 2026 14:18:44 +0800 Received: from 172.29.37.154 (172.29.37.152) by RS-EX-MBS1.realsil.com.cn (172.29.17.101) with Microsoft SMTP Server id 15.2.1748.39 via Frontend Transport; Tue, 3 Mar 2026 14:18:44 +0800 From: javen To: , CC: , Javen Xu Subject: [PATCH v2] rtl_pci: add support for Realtek management device Date: Tue, 3 Mar 2026 14:18:41 +0800 Message-ID: <20260303061841.1431-1-javen_xu@realsil.com.cn> X-Mailer: git-send-email 2.50.1.windows.1 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 Content-Type: text/plain; charset="utf-8" From: Javen Xu This is not the standard ethernet driver. It specially handles the management function. I tried to submitted to linux/net-next before, but they said these class didn't belong there. So I came here, and I'm wondering if these unknown classes used for management functions should be submitted here. Thanks, Javen Xu Signed-off-by: Javen Xu --- v2: Drop unused linux/version.h include as noticed by 0day bot. --- drivers/misc/Kconfig | 12 +++++++ drivers/misc/Makefile | 1 + drivers/misc/rtl_pci.c | 77 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 drivers/misc/rtl_pci.c diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 5cc79d1517af..e3c572bd1e34 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -643,6 +643,18 @@ config MCHP_LAN966X_PCI - lan966x-miim (MDIO_MSCC_MIIM) - lan966x-switch (LAN966X_SWITCH) =20 +config RTL_PCI + tristate "Realtek Management Interface Support" + depends on PCI + help + This enables support for the Realtek nic PCIe Management device. + + Please note that this is NOT the standard Ethernet driver for network + traffic. It specifically handles the management function. + + To compile this driver as a module, choose M here: the module + will be called rtl_pci.o. + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig" diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index b32a2597d246..b937a25707c8 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -75,3 +75,4 @@ obj-$(CONFIG_MCHP_LAN966X_PCI) +=3D lan966x-pci.o obj-y +=3D keba/ obj-y +=3D amd-sbi/ obj-$(CONFIG_MISC_RP1) +=3D rp1/ +obj-$(CONFIG_RTL_PCI) +=3D rtl_pci.o diff --git a/drivers/misc/rtl_pci.c b/drivers/misc/rtl_pci.c new file mode 100644 index 000000000000..64db86ecc08d --- /dev/null +++ b/drivers/misc/rtl_pci.c @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * This module handles PCI endpoint functions exposed by Realtek + * management controllers (e.g. RTL8111x series). It manages device + * probing for virtual devices. + * + * Copyright(c) 2026 Realtek Semiconductor Corp. + */ + +#include +#include +#include + +#define PCI_DEVICE_ID_REALTEK_PTOU 0x8164 +#define PCI_DEVICE_ID_REALTEK_COM1 0x816a +#define PCI_DEVICE_ID_REALTEK_COM2 0x816b +#define PCI_DEVICE_ID_REALTEK_IPMI 0x816c +#define PCI_DEVICE_ID_REALTEK_BMC 0x816e +#define PCI_DEVICE_ID_REALTEK_PCIBR 0x9151 + +static struct pci_device_id rtl_pci_tbl[] =3D { + { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_PTOU), }, + { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_COM1), }, + { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_COM2), }, + { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_IPMI), }, + { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_BMC), }, + { PCI_VDEVICE(REALTEK, PCI_DEVICE_ID_REALTEK_PCIBR), .class_mask =3D 0xff= 00 }, + { } +}; + +MODULE_DEVICE_TABLE(pci, rtl_pci_tbl); + +static int rtl_probe(struct pci_dev *pdev, + const struct pci_device_id *ent) +{ + int rc; + + /* enable device (incl. PCI PM wakeup and hotplug setup) */ + rc =3D pcim_enable_device(pdev); + if (rc < 0) + return dev_err_probe(&pdev->dev, rc, "enable failure\n"); + + dev_info(&pdev->dev, "enable device\n"); + + return rc; +} + +static void rtl_remove(struct pci_dev *pdev) {} + +static int rtl_pm_suspend(struct device *device) +{ + return 0; +} + +static int rtl_pm_resume(struct device *device) +{ + return 0; +} + +static const struct dev_pm_ops rtl_pm_ops =3D { + SYSTEM_SLEEP_PM_OPS(rtl_pm_suspend, rtl_pm_resume) +}; + +static struct pci_driver rtl_pci_driver =3D { + .name =3D "rtl_pci", + .id_table =3D rtl_pci_tbl, + .probe =3D rtl_probe, + .remove =3D rtl_remove, +#ifdef CONFIG_PM + .driver.pm =3D pm_ptr(&rtl_pm_ops), +#endif +}; + +module_pci_driver(rtl_pci_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("RealTek pci driver"); --=20 2.43.0