From nobody Thu Apr 9 15:03:56 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 593C3375F96 for ; Tue, 3 Mar 2026 03:01:20 +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=1772506883; cv=none; b=S7YLZ4IGziTlgSrzstG84fUAS6comit4eFLUK53QPQPuHUXmZU8GAFENtnFdeoIjiM7DspTL/5PI4SVyYjDUU/uLLsoRHVijTteL1eqoaPIjUd6PkNT6scpz1RjoyUaIRxL73xpUuLeWRg7q0MBsF1ZbvZfLH+MNmZN0s0cgVi4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772506883; c=relaxed/simple; bh=61hqjtZHLK5kZhtazfd5TR/YppVylJfPUF2+Bp3t7KE=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Q009tNd5lGdPPjQY3N7406j4/wKUaOtjEREHSDTNeGUMe5FAyvwvDQOtHuV1HJzcDZgukPDzrJkhojbd+Q5dNAzn8agPqXlfjWOXC+7khneIy/mOrWidzY8y85aIu10TkpED7zXkUC4qG1yuVtBzIdVNNohDgaQkgl/h/OhSrbw= 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=IWoW3yYX; 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="IWoW3yYX" X-SpamFilter-By: ArmorX SpamTrap 5.80 with qID 623319lV4288146, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realsil.com.cn; s=dkim; t=1772506869; bh=2+ZEg6OWRu2AGGgqU7O8AVQXmdvyYfpv3P07y4ToPaU=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:Content-Type; b=IWoW3yYXVOiL8I6LkLYnZSJ4j4jb8oS1LEgGVdErjO9nTHrc1OZiiY0qQq6MNyvx/ 0IJP19cC0bquTIgPmH2+ep+phxfJ4Zmd5XKPfBdCEaOHucHEMH2JURVvM23fQSVY1+ Ze3sqB9QLqRaRFAGEWtdDvi2RQpp3+ityakYMPfrxtAd6h9U6aM2qN/n4HicF6Zj+i 04TPBZgA88fLE02cv5kX9JnbYuIvd6m6plKJoxyZvSZjziu89xh2IFph3VjuLeZitM 8WbeGl7adpqpu2mrEDR194CsuLpXlW+s9DLzlu5shNslmi6GD150KUzHMAzMk06lna mIrPcYlfDVQfw== Received: from RS-EX-MBS2.realsil.com.cn ([172.29.17.102]) by rtits2.realtek.com.tw (8.15.2/3.21/5.94) with ESMTPS id 623319lV4288146 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 3 Mar 2026 11:01:09 +0800 Received: from RS-EX-MBS1.realsil.com.cn (172.29.17.101) by RS-EX-MBS2.realsil.com.cn (172.29.17.102) 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 11:01:09 +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 11:01:09 +0800 From: javen To: , CC: , Javen Xu Subject: [PATCH v1] rtl_pci: add support for Realtek management device Date: Tue, 3 Mar 2026 11:01:06 +0800 Message-ID: <20260303030106.1335-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 --- drivers/misc/Kconfig | 12 +++++++ drivers/misc/Makefile | 1 + drivers/misc/rtl_pci.c | 78 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 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..148acb192b33 --- /dev/null +++ b/drivers/misc/rtl_pci.c @@ -0,0 +1,78 @@ +// 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 +#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