Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72a3c0e4 authored by Sergej Pupykin's avatar Sergej Pupykin Committed by Greg Kroah-Hartman
Browse files

tty: Add support for the WCH384 4S multi-IO card



WCH384 4S board is a PCI-E card with 4 DB9 COM ports detected as
Serial controller: Device 1c00:3470 (rev 10) (prog-if 05 [16850])

Signed-off-by: default avatarSergej Pupykin <ml@sergej.pp.ru>
Acked-by: default avatarZany Yan <sirlight@cox.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 68ed7e1c
Loading
Loading
Loading
Loading
+26 −3
Original line number Diff line number Diff line
@@ -1815,7 +1815,7 @@ pci_wch_ch353_setup(struct serial_private *priv,
}

static int
pci_wch_ch382_setup(struct serial_private *priv,
pci_wch_ch38x_setup(struct serial_private *priv,
                    const struct pciserial_board *board,
                    struct uart_8250_port *port, int idx)
{
@@ -1880,6 +1880,7 @@ pci_wch_ch382_setup(struct serial_private *priv,

#define PCIE_VENDOR_ID_WCH		0x1c00
#define PCIE_DEVICE_ID_WCH_CH382_2S1P	0x3250
#define PCIE_DEVICE_ID_WCH_CH384_4S	0x3470

/* Unknown vendors/cards - this should not be in linux/pci_ids.h */
#define PCI_SUBDEVICE_ID_UNKNOWN_0x1584	0x1584
@@ -2571,13 +2572,21 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
		.subdevice	= PCI_ANY_ID,
		.setup		= pci_wch_ch353_setup,
	},
	/* WCH CH382 2S1P card (16750 clone) */
	/* WCH CH382 2S1P card (16850 clone) */
	{
		.vendor         = PCIE_VENDOR_ID_WCH,
		.device         = PCIE_DEVICE_ID_WCH_CH382_2S1P,
		.subvendor      = PCI_ANY_ID,
		.subdevice      = PCI_ANY_ID,
		.setup          = pci_wch_ch382_setup,
		.setup          = pci_wch_ch38x_setup,
	},
	/* WCH CH384 4S card (16850 clone) */
	{
		.vendor         = PCIE_VENDOR_ID_WCH,
		.device         = PCIE_DEVICE_ID_WCH_CH384_4S,
		.subvendor      = PCI_ANY_ID,
		.subdevice      = PCI_ANY_ID,
		.setup          = pci_wch_ch38x_setup,
	},
	/*
	 * ASIX devices with FIFO bug
@@ -2876,6 +2885,7 @@ enum pci_board_num_t {
	pbn_fintek_4,
	pbn_fintek_8,
	pbn_fintek_12,
	pbn_wch384_4,
};

/*
@@ -3675,6 +3685,14 @@ static struct pciserial_board pci_boards[] = {
		.base_baud	= 115200,
		.first_offset	= 0x40,
	},

	[pbn_wch384_4] = {
		.flags		= FL_BASE0,
		.num_ports	= 4,
		.base_baud      = 115200,
		.uart_offset    = 8,
		.first_offset   = 0xC0,
	},
};

static const struct pci_device_id blacklist[] = {
@@ -3687,6 +3705,7 @@ static const struct pci_device_id blacklist[] = {
	{ PCI_DEVICE(0x4348, 0x7053), }, /* WCH CH353 2S1P */
	{ PCI_DEVICE(0x4348, 0x5053), }, /* WCH CH353 1S1P */
	{ PCI_DEVICE(0x1c00, 0x3250), }, /* WCH CH382 2S1P */
	{ PCI_DEVICE(0x1c00, 0x3470), }, /* WCH CH384 4S */
};

/*
@@ -5400,6 +5419,10 @@ static struct pci_device_id serial_pci_tbl[] = {
		PCI_ANY_ID, PCI_ANY_ID,
		0, 0, pbn_b0_bt_2_115200 },

	{	PCIE_VENDOR_ID_WCH, PCIE_DEVICE_ID_WCH_CH384_4S,
		PCI_ANY_ID, PCI_ANY_ID,
		0, 0, pbn_wch384_4 },

	/*
	 * Commtech, Inc. Fastcom adapters
	 */