public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] serial: 8250_pci: skip WCH PCI serial devices
@ 2026-04-28  8:26 Jiawei liu
  2026-04-28  9:56 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Jiawei liu @ 2026-04-28  8:26 UTC (permalink / raw)
  To: linux-serial; +Cc: gregkh, jirislaby, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 344 bytes --]

    WCH PCI serial devices implement vendor-specific extensions
    beyond the standard 16C550 UART. These are not supported by
    the generic 8250 PCI driver, and binding them may lead to
    incorrect or suboptimal operation.

    Skip these devices during probe to avoid misbinding.

    Signed-off-by: Jiawei Liu <liujiawei4419@gmail.com>

[-- Attachment #1.2: Type: text/html, Size: 462 bytes --]

[-- Attachment #2: 0001-serial-8250-pci-skip-WCH-devices.patch --]
[-- Type: application/octet-stream, Size: 7464 bytes --]

From 5e4d65278bcd30f9f877fe7b7ffeaaaf9c840983 Mon Sep 17 00:00:00 2001
From: Jiawei Liu <liujiawei4419@gmail.com>
Date: Tue, 28 Apr 2026 15:12:27 +0800
Subject: [PATCH 1/2] serial: 8250: pci: skip WCH devices

WCH PCI serial devices implement vendor-specific extensions
beyond the standard 16C550 UART. These are not supported by
the generic 8250 PCI driver, and binding them may lead to
incorrect or suboptimal operation.

Skip these devices during probe to avoid misbinding.

Signed-off-by: Jiawei Liu <liujiawei4419@gmail.com>
---
 drivers/tty/serial/8250/8250_pci.c | 214 +----------------------------
 1 file changed, 2 insertions(+), 212 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index 2fbd8f2603b5f..2d6de1c33daa2 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -1900,85 +1900,6 @@ static int pci_eg20t_init(struct pci_dev *dev)
 #endif
 }
 
-static int
-pci_wch_ch353_setup(struct serial_private *priv,
-		    const struct pciserial_board *board,
-		    struct uart_8250_port *port, int idx)
-{
-	if (!IS_ENABLED(CONFIG_HAS_IOPORT))
-		return serial_8250_warn_need_ioport(priv->dev);
-
-	port->port.flags |= UPF_FIXED_TYPE;
-	port->port.type = PORT_16550A;
-	return pci_default_setup(priv, board, port, idx);
-}
-
-static int
-pci_wch_ch355_setup(struct serial_private *priv,
-		const struct pciserial_board *board,
-		struct uart_8250_port *port, int idx)
-{
-	if (!IS_ENABLED(CONFIG_HAS_IOPORT))
-		return serial_8250_warn_need_ioport(priv->dev);
-
-	port->port.flags |= UPF_FIXED_TYPE;
-	port->port.type = PORT_16550A;
-	return pci_default_setup(priv, board, port, idx);
-}
-
-static int
-pci_wch_ch38x_setup(struct serial_private *priv,
-		    const struct pciserial_board *board,
-		    struct uart_8250_port *port, int idx)
-{
-	if (!IS_ENABLED(CONFIG_HAS_IOPORT))
-		return serial_8250_warn_need_ioport(priv->dev);
-
-	port->port.flags |= UPF_FIXED_TYPE;
-	port->port.type = PORT_16850;
-	return pci_default_setup(priv, board, port, idx);
-}
-
-
-#define CH384_XINT_ENABLE_REG   0xEB
-#define CH384_XINT_ENABLE_BIT   0x02
-
-static int pci_wch_ch38x_init(struct pci_dev *dev)
-{
-	int max_port;
-	unsigned long iobase;
-
-	if (!IS_ENABLED(CONFIG_HAS_IOPORT))
-		return serial_8250_warn_need_ioport(dev);
-
-	switch (dev->device) {
-	case 0x3853: /* 8 ports */
-		max_port = 8;
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	iobase = pci_resource_start(dev, 0);
-	outb(CH384_XINT_ENABLE_BIT, iobase + CH384_XINT_ENABLE_REG);
-
-	return max_port;
-}
-
-static void pci_wch_ch38x_exit(struct pci_dev *dev)
-{
-	unsigned long iobase;
-
-	if (!IS_ENABLED(CONFIG_HAS_IOPORT)) {
-		serial_8250_warn_need_ioport(dev);
-		return;
-	}
-
-	iobase = pci_resource_start(dev, 0);
-	outb(0x0, iobase + CH384_XINT_ENABLE_REG);
-}
-
-
 static int
 pci_sunix_setup(struct serial_private *priv,
 		const struct pciserial_board *board,
@@ -2881,88 +2802,6 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
 		.subdevice	= PCI_ANY_ID,
 		.setup		= pci_omegapci_setup,
 	},
-	/* WCH CH353 1S1P card (16550 clone) */
-	{
-		.vendor         = PCI_VENDOR_ID_WCHCN,
-		.device         = PCI_DEVICE_ID_WCHCN_CH353_1S1P,
-		.subvendor      = PCI_ANY_ID,
-		.subdevice      = PCI_ANY_ID,
-		.setup          = pci_wch_ch353_setup,
-	},
-	/* WCH CH353 2S1P card (16550 clone) */
-	{
-		.vendor         = PCI_VENDOR_ID_WCHCN,
-		.device         = PCI_DEVICE_ID_WCHCN_CH353_2S1P,
-		.subvendor      = PCI_ANY_ID,
-		.subdevice      = PCI_ANY_ID,
-		.setup          = pci_wch_ch353_setup,
-	},
-	/* WCH CH353 4S card (16550 clone) */
-	{
-		.vendor         = PCI_VENDOR_ID_WCHCN,
-		.device         = PCI_DEVICE_ID_WCHCN_CH353_4S,
-		.subvendor      = PCI_ANY_ID,
-		.subdevice      = PCI_ANY_ID,
-		.setup          = pci_wch_ch353_setup,
-	},
-	/* WCH CH353 2S1PF card (16550 clone) */
-	{
-		.vendor         = PCI_VENDOR_ID_WCHCN,
-		.device         = PCI_DEVICE_ID_WCHCN_CH353_2S1PF,
-		.subvendor      = PCI_ANY_ID,
-		.subdevice      = PCI_ANY_ID,
-		.setup          = pci_wch_ch353_setup,
-	},
-	/* WCH CH352 2S card (16550 clone) */
-	{
-		.vendor		= PCI_VENDOR_ID_WCHCN,
-		.device		= PCI_DEVICE_ID_WCHCN_CH352_2S,
-		.subvendor	= PCI_ANY_ID,
-		.subdevice	= PCI_ANY_ID,
-		.setup		= pci_wch_ch353_setup,
-	},
-	/* WCH CH355 4S card (16550 clone) */
-	{
-		.vendor		= PCI_VENDOR_ID_WCHCN,
-		.device		= PCI_DEVICE_ID_WCHCN_CH355_4S,
-		.subvendor	= PCI_ANY_ID,
-		.subdevice	= PCI_ANY_ID,
-		.setup		= pci_wch_ch355_setup,
-	},
-	/* WCH CH382 2S card (16850 clone) */
-	{
-		.vendor         = PCI_VENDOR_ID_WCHIC,
-		.device         = PCI_DEVICE_ID_WCHIC_CH382_2S,
-		.subvendor      = PCI_ANY_ID,
-		.subdevice      = PCI_ANY_ID,
-		.setup          = pci_wch_ch38x_setup,
-	},
-	/* WCH CH382 2S1P card (16850 clone) */
-	{
-		.vendor         = PCI_VENDOR_ID_WCHIC,
-		.device         = PCI_DEVICE_ID_WCHIC_CH382_2S1P,
-		.subvendor      = PCI_ANY_ID,
-		.subdevice      = PCI_ANY_ID,
-		.setup          = pci_wch_ch38x_setup,
-	},
-	/* WCH CH384 4S card (16850 clone) */
-	{
-		.vendor         = PCI_VENDOR_ID_WCHIC,
-		.device         = PCI_DEVICE_ID_WCHIC_CH384_4S,
-		.subvendor      = PCI_ANY_ID,
-		.subdevice      = PCI_ANY_ID,
-		.setup          = pci_wch_ch38x_setup,
-	},
-	/* WCH CH384 8S card (16850 clone) */
-	{
-		.vendor         = PCI_VENDOR_ID_WCHIC,
-		.device         = PCI_DEVICE_ID_WCHIC_CH384_8S,
-		.subvendor      = PCI_ANY_ID,
-		.subdevice      = PCI_ANY_ID,
-		.init           = pci_wch_ch38x_init,
-		.exit		= pci_wch_ch38x_exit,
-		.setup          = pci_wch_ch38x_setup,
-	},
 	/*
 	 * Broadcom TruManage (NetXtreme)
 	 */
@@ -3214,9 +3053,7 @@ enum pci_board_num_t {
 	pbn_fintek_F81504A,
 	pbn_fintek_F81508A,
 	pbn_fintek_F81512A,
-	pbn_wch382_2,
-	pbn_wch384_4,
-	pbn_wch384_8,
+
 	pbn_sunix_pci_1s,
 	pbn_sunix_pci_2s,
 	pbn_sunix_pci_4s,
@@ -3932,27 +3769,7 @@ static struct pciserial_board pci_boards[] = {
 		.uart_offset	= 8,
 		.base_baud	= 115200,
 	},
-	[pbn_wch382_2] = {
-		.flags		= FL_BASE0,
-		.num_ports	= 2,
-		.base_baud	= 115200,
-		.uart_offset	= 8,
-		.first_offset	= 0xC0,
-	},
-	[pbn_wch384_4] = {
-		.flags		= FL_BASE0,
-		.num_ports	= 4,
-		.base_baud      = 115200,
-		.uart_offset    = 8,
-		.first_offset   = 0xC0,
-	},
-	[pbn_wch384_8] = {
-		.flags		= FL_BASE0,
-		.num_ports	= 8,
-		.base_baud      = 115200,
-		.uart_offset    = 8,
-		.first_offset   = 0x00,
-	},
+
 	[pbn_sunix_pci_1s] = {
 		.num_ports	= 1,
 		.base_baud      = 921600,
@@ -6179,33 +5996,6 @@ static const struct pci_device_id serial_pci_tbl[] = {
 		PCI_ANY_ID, PCI_ANY_ID,
 		0, 0, pbn_b0_bt_2_115200 },
 
-	/*
-	 * WCH CH353 series devices: The 2S1P is handled by parport_serial
-	 * so not listed here.
-	 */
-	{	PCI_VENDOR_ID_WCHCN, PCI_DEVICE_ID_WCHCN_CH353_4S,
-		PCI_ANY_ID, PCI_ANY_ID,
-		0, 0, pbn_b0_bt_4_115200 },
-
-	{	PCI_VENDOR_ID_WCHCN, PCI_DEVICE_ID_WCHCN_CH353_2S1PF,
-		PCI_ANY_ID, PCI_ANY_ID,
-		0, 0, pbn_b0_bt_2_115200 },
-
-	{	PCI_VENDOR_ID_WCHCN, PCI_DEVICE_ID_WCHCN_CH355_4S,
-		PCI_ANY_ID, PCI_ANY_ID,
-		0, 0, pbn_b0_bt_4_115200 },
-
-	{	PCI_VENDOR_ID_WCHIC, PCI_DEVICE_ID_WCHIC_CH382_2S,
-		PCI_ANY_ID, PCI_ANY_ID,
-		0, 0, pbn_wch382_2 },
-
-	{	PCI_VENDOR_ID_WCHIC, PCI_DEVICE_ID_WCHIC_CH384_4S,
-		PCI_ANY_ID, PCI_ANY_ID,
-		0, 0, pbn_wch384_4 },
-
-	{	PCI_VENDOR_ID_WCHIC, PCI_DEVICE_ID_WCHIC_CH384_8S,
-		PCI_ANY_ID, PCI_ANY_ID,
-		0, 0, pbn_wch384_8 },
 	/*
 	 * Realtek RealManage
 	 */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-28  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-28  8:26 [PATCH] serial: 8250_pci: skip WCH PCI serial devices Jiawei liu
2026-04-28  9:56 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox