diff mbox series

Add support for SUNIX multi I/O board

Message ID 20210426093828.10348-1-saumah@gmail.com
State New
Headers show
Series Add support for SUNIX multi I/O board | expand

Commit Message

Moriis Ku April 26, 2021, 9:38 a.m. UTC
From: Morris Ku <saumah@gmail.com>

Sunix SDC Multi I/O board are different to Timedia's.

This patch adds proper support for Sunix SDC Multi I/O board.

Signed-off-by: Morris Ku<saumah@gmail.com>
---
 tty/serial/8250/8250_pci.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tty/serial/8250/8250_pci.c b/tty/serial/8250/8250_pci.c
index 8814ff38..5758a98b 100644
--- a/tty/serial/8250/8250_pci.c
+++ b/tty/serial/8250/8250_pci.c
@@ -1802,6 +1802,25 @@  pci_sunix_setup(struct serial_private *priv,
 	return setup_port(priv, port, bar, offset, 0);
 }
 
+static int
+pci_sunix_sdc_setup(struct serial_private *priv,
+		const struct pciserial_board *board,
+		struct uart_8250_port *port, int idx)
+{
+	int bar;
+	int offset;
+
+	port->port.flags |= UPF_FIXED_TYPE;
+	port->port.type = PORT_SUNIX;
+
+	if (idx < 4) {
+		bar = 1
+		offset = idx * board->uart_offset;
+	}
+
+	return setup_port(priv, port, bar, offset, 0);
+}
+
 static int
 pci_moxa_setup(struct serial_private *priv,
 		const struct pciserial_board *board,
@@ -2430,6 +2449,13 @@  static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
 		.subdevice	= PCI_ANY_ID,
 		.setup		= pci_sunix_setup,
 	},
+	{
+		.vendor		= PCI_VENDOR_ID_SUNIX,
+		.device		= PCI_DEVICE_ID_SUNIX_2000,
+		.subvendor	= PCI_VENDOR_ID_SUNIX,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= pci_sunix_sdc_setup,
+	},
 	/*
 	 * Xircom cards
 	 */
@@ -2924,6 +2950,7 @@  enum pci_board_num_t {
 	pbn_sunix_pci_4s,
 	pbn_sunix_pci_8s,
 	pbn_sunix_pci_16s,
+	pbn_sunix_sdc_pci_4s
 	pbn_moxa8250_2p,
 	pbn_moxa8250_4p,
 	pbn_moxa8250_8p,
@@ -3704,6 +3731,11 @@  static struct pciserial_board pci_boards[] = {
 		.base_baud      = 921600,
 		.uart_offset	= 0x8,
 	},
+	[pbn_sunix_sdc_pci_4s] = {
+		.num_ports	= 4,
+		.base_baud      = 921600,
+		.uart_offset	= 0x10,
+	},
 	[pbn_moxa8250_2p] = {
 		.flags		= FL_BASE1,
 		.num_ports      = 2,
@@ -4783,7 +4815,9 @@  static const struct pci_device_id serial_pci_tbl[] = {
 	{	PCI_VENDOR_ID_SUNIX, PCI_DEVICE_ID_SUNIX_1999,
 		PCI_VENDOR_ID_SUNIX, 0x0010, 0, 0,
 		pbn_sunix_pci_16s },
-
+	{	PCI_VENDOR_ID_SUNIX, PCI_DEVICE_ID_SUNIX_2000,
+		PCI_VENDOR_ID_SUNIX, 0x0001, 0, 0,
+		pbn_sunix_sdc_pci_4s },
 	/*
 	 * AFAVLAB serial card, from Harald Welte <laforge@gnumonks.org>
 	 */