Linux Serial subsystem development
 help / color / mirror / Atom feed
* Add support for SUNIX multi I/O board
@ 2021-04-26  9:38 Moriis Ku
  2021-04-26  9:48 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Moriis Ku @ 2021-04-26  9:38 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial, Morris Ku

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 --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>
 	 */
-- 
2.20.1


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

* Re: Add support for SUNIX multi I/O board
  2021-04-26  9:38 Add support for SUNIX multi I/O board Moriis Ku
@ 2021-04-26  9:48 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2021-04-26  9:48 UTC (permalink / raw)
  To: Moriis Ku; +Cc: linux-serial

On Mon, Apr 26, 2021 at 05:38:28PM +0800, Moriis Ku wrote:
> 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>

Can you make your subject line look like:
	[PATCH] serial: 8250_pci: add support for...

to match up the other patches for this driver?

> ---
>  tty/serial/8250/8250_pci.c | 36 +++++++++++++++++++++++++++++++++++-
>  1 file changed, 35 insertions(+), 1 deletion(-)
> 
> 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,

Move this to be all on one line please.

> +		const struct pciserial_board *board,
> +		struct uart_8250_port *port, int idx)

Line up with the "(" or checkpatch will complain.

> +{
> +	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;
> +	}

So if idx is > 4, bar is unknown?  That feels like a huge bug :(

> +
> +	return setup_port(priv, port, bar, offset, 0);

Same for offset, looks like it could be used uninitialized as well.

The compiler didn't complain about this?

thanks,

greg k-h

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

end of thread, other threads:[~2021-04-26  9:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-26  9:38 Add support for SUNIX multi I/O board Moriis Ku
2021-04-26  9:48 ` Greg KH

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