Skip to contentSkip to conversation

SIIG 8-port serial boards support

PATCH In review Andrey Panin 3 participants 12 messages Jan 24, 2006 – Feb 17, 2006 1 message not in the archive PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SIIG 8-port serial boards support

Hello,

This patch (against 2.6.16-rc1) adds support for SIIG 8 port serial boards. Please consider applying.

Best regards.

Signature · 2 lines
Andrey Panin		| Linux and UNIX system administrator
[email protected]		| PGP key: wwwkeys.pgp.net
 drivers/serial/8250_pci.c |   25 ++++++++++++++++++++++++-
 include/linux/pci_ids.h   |    3 +++
 2 files changed, 27 insertions(+), 1 deletion(-)
drivers/serial/8250_pci.c +24 -1
diff -urdpNX /usr/share/dontdiff linux-2.6.16-rc1.vanilla/drivers/serial/8250_pci.c linux-2.6.16-rc1/drivers/serial/8250_pci.c
@@ -439,6 +439,20 @@ static int pci_siig_init(struct pci_dev 
 	return -ENODEV;
 }
 
+static int pci_siig_setup(struct serial_private *priv,
+			  struct pciserial_board *board,
+			  struct uart_port *port, int idx)
+{
+	unsigned int bar = FL_GET_BASE(board->flags) + idx, offset = 0;
+
+	if (idx > 3) {
+		bar = 4;
+		offset = (idx - 4) * 8;
+	}
+
+	return setup_port(priv, port, bar, offset, 0);
+}
+
 /*
  * Timedia has an explosion of boards, and to avoid the PCI table from
  * growing *huge*, we use this function to collapse some 70 entries
@@ -748,7 +762,7 @@ static struct pci_serial_quirk pci_seria
 		.subvendor	= PCI_ANY_ID,
 		.subdevice	= PCI_ANY_ID,
 		.init		= pci_siig_init,
-		.setup		= pci_default_setup,
+		.setup		= pci_siig_setup,
 	},
 	/*
 	 * Titan cards
@@ -2134,6 +2148,15 @@ static struct pci_device_id serial_pci_t
 	{	PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_850,
 		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
 		pbn_b0_bt_4_921600 },
+	{	PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_550,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_b0_bt_8_921600 },
+	{	PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_650,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_b0_bt_8_921600 },
+	{	PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_850,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_b0_bt_8_921600 },
 
 	/*
 	 * Computone devices submitted by Doug McNash [email protected]
include/linux/pci_ids.h +3 -0
diff -urdpNX /usr/share/dontdiff linux-2.6.16-rc1.vanilla/include/linux/pci_ids.h linux-2.6.16-rc1/include/linux/pci_ids.h
@@ -1677,6 +1677,9 @@
 #define PCI_DEVICE_ID_SIIG_2S1P_20x_550	0x2060
 #define PCI_DEVICE_ID_SIIG_2S1P_20x_650	0x2061
 #define PCI_DEVICE_ID_SIIG_2S1P_20x_850	0x2062
+#define PCI_DEVICE_ID_SIIG_8S_20x_550	0x2080
+#define PCI_DEVICE_ID_SIIG_8S_20x_650	0x2081
+#define PCI_DEVICE_ID_SIIG_8S_20x_850	0x2082
 #define PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL	0x2050
 
 #define PCI_VENDOR_ID_RADISYS		0x1331
#1 lore raw
Quoted 2 lines · Andrey Panin

This patch (against 2.6.16-rc1) adds support for SIIG 8 port serial boards. Please consider applying.

Could you supply a sign-off (and a description) for this patch please - see Documentation/SubmittingPatches for more information.

Thanks.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#2 lore raw
Quoted 6 lines · Russell King
Quoted 2 lines · Andrey Panin

This patch (against 2.6.16-rc1) adds support for SIIG 8 port serial boards. Please consider applying.

Could you supply a sign-off (and a description) for this patch please - see Documentation/SubmittingPatches for more information.

Ping?

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#3 lore raw
Quoted 9 lines · Russell King
Quoted 6 lines · Russell King
Quoted 2 lines · Andrey Panin

This patch (against 2.6.16-rc1) adds support for SIIG 8 port serial boards. Please consider applying.

Could you supply a sign-off (and a description) for this patch please - see Documentation/SubmittingPatches for more information.

Ping?

Pong :) Please see below. Does it look better now ?

BTW I have a question for you. I'm trying to add support for Advantech serial cards into 8250_pci.c. These cards are based on Oxford Semiconductor 16C950 UARTs and some of then can work in RS485 mode. They use DTR to automatically control direction of the RS485 transiever buffer and so need to set bits 3 and 4 in the ACR register. Unfortunately there is currently no way to set different ACR value. Is it okay to use unused[] array in the struct uart_port to pass ACR value from 8250_pci.c to 8250.c ?

Signature · 2 lines
Andrey Panin		| Linux and UNIX system administrator
[email protected]		| PGP key: wwwkeys.pgp.net

This patch adds support for SIIG 8-port boards. These boards have 4 ports in separate bars and another 4 ports in the single bar. Because of this strange port arrangement these cards need special setup function. Fortunately no other SIIG cards have more than 4 port, so this setup function could be used for them too.

 drivers/serial/8250_pci.c |   25 ++++++++++++++++++++++++-
 include/linux/pci_ids.h   |    3 +++
 2 files changed, 27 insertions(+), 1 deletion(-)
drivers/serial/8250_pci.c +24 -1
diff -urdpNX /usr/share/dontdiff linux-2.6.16-rc1.vanilla/drivers/serial/8250_pci.c linux-2.6.16-rc1/drivers/serial/8250_pci.c
@@ -439,6 +439,20 @@ static int pci_siig_init(struct pci_dev 
 	return -ENODEV;
 }
 
+static int pci_siig_setup(struct serial_private *priv,
+			  struct pciserial_board *board,
+			  struct uart_port *port, int idx)
+{
+	unsigned int bar = FL_GET_BASE(board->flags) + idx, offset = 0;
+
+	if (idx > 3) {
+		bar = 4;
+		offset = (idx - 4) * 8;
+	}
+
+	return setup_port(priv, port, bar, offset, 0);
+}
+
 /*
  * Timedia has an explosion of boards, and to avoid the PCI table from
  * growing *huge*, we use this function to collapse some 70 entries
@@ -748,7 +762,7 @@ static struct pci_serial_quirk pci_seria
 		.subvendor	= PCI_ANY_ID,
 		.subdevice	= PCI_ANY_ID,
 		.init		= pci_siig_init,
-		.setup		= pci_default_setup,
+		.setup		= pci_siig_setup,
 	},
 	/*
 	 * Titan cards
@@ -2134,6 +2148,15 @@ static struct pci_device_id serial_pci_t
 	{	PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_4S_20x_850,
 		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
 		pbn_b0_bt_4_921600 },
+	{	PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_550,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_b0_bt_8_921600 },
+	{	PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_650,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_b0_bt_8_921600 },
+	{	PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_8S_20x_850,
+		PCI_ANY_ID, PCI_ANY_ID, 0, 0,
+		pbn_b0_bt_8_921600 },
 
 	/*
 	 * Computone devices submitted by Doug McNash [email protected]
include/linux/pci_ids.h +3 -0
diff -urdpNX /usr/share/dontdiff linux-2.6.16-rc1.vanilla/include/linux/pci_ids.h linux-2.6.16-rc1/include/linux/pci_ids.h
@@ -1677,6 +1677,9 @@
 #define PCI_DEVICE_ID_SIIG_2S1P_20x_550	0x2060
 #define PCI_DEVICE_ID_SIIG_2S1P_20x_650	0x2061
 #define PCI_DEVICE_ID_SIIG_2S1P_20x_850	0x2062
+#define PCI_DEVICE_ID_SIIG_8S_20x_550	0x2080
+#define PCI_DEVICE_ID_SIIG_8S_20x_650	0x2081
+#define PCI_DEVICE_ID_SIIG_8S_20x_850	0x2082
 #define PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL	0x2050
 
 #define PCI_VENDOR_ID_RADISYS		0x1331

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 13 lines · Russell King
Quoted 1 line · Andrey Panin

Pong :) Please see below. Does it look better now ?

Thanks, applied.

Quoted 7 lines

BTW I have a question for you. I'm trying to add support for Advantech serial cards into 8250_pci.c. These cards are based on Oxford Semiconductor 16C950 UARTs and some of then can work in RS485 mode. They use DTR to automatically control direction of the RS485 transiever buffer and so need to set bits 3 and 4 in the ACR register. Unfortunately there is currently no way to set different ACR value. Is it okay to use unused[] array in the struct uart_port to pass ACR value from 8250_pci.c to 8250.c ?

Quoted 3 lines

As I've said many a time, we need a generic way to set different hand- shaking modes. I've suggested using some spare bits in termios in the past, but nothing ever came of that - folk lose interest at that point.

IMHO there is no need to userspace visible changes to support RS485 on these cards, because some of them are RS485 only and some have jumpers for individual ports. There is nothing that userspace can configure. We only need to set two bits in ACR according to card type and jumper settings and UART will drive RS485 transiever transparently.

Actually any program which want to talk with RS485 network should implement some form of line discipline itself to prevent network collisions and kernel cannot help with it much.

Quoted 3 lines

So as far as I'm concerned, until folk start wanting to seriously discuss how to portably support different flow control methods, there's no real support for them.

For RS232 cace I agree, but for RS485 this is not needed IMHO.

Signature · 2 lines
Andrey Panin		| Linux and UNIX system administrator
[email protected]		| PGP key: wwwkeys.pgp.net
#6 lore raw
Quoted 10 lines · Andrey Panin
Quoted 3 lines · Russell King

As I've said many a time, we need a generic way to set different hand- shaking modes. I've suggested using some spare bits in termios in the past, but nothing ever came of that - folk lose interest at that point.

IMHO there is no need to userspace visible changes to support RS485 on these cards, because some of them are RS485 only and some have jumpers for individual ports. There is nothing that userspace can configure. We only need to set two bits in ACR according to card type and jumper settings and UART will drive RS485 transiever transparently.

In this particular case you may be right, but I'm looking at the bigger picture, where plain 16550's may be used for RS485.

There are drivers which want to implement their own private ioctl to enable RS485 mode. What I'm saying is that we should have one solution, not multiple solutions to this problem. When we have such a solution, your RS485 card will be able to fit into that model.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#7 lore raw
Quoted 5 lines · Russell King
Quoted 4 lines · Andrey Panin
Quoted 3 lines · Russell King

As I've said many a time, we need a generic way to set different hand- shaking modes. I've suggested using some spare bits in termios in the past, but nothing ever came of that - folk lose interest at that point.

No wonder they do. Extra bits are not a problem, but for 8250.c we need some way to glue subdrivers with serial8250_set_termios(). Callback in uart_port structure ?

Quoted 8 lines
Quoted 5 lines

IMHO there is no need to userspace visible changes to support RS485 on these cards, because some of them are RS485 only and some have jumpers for individual ports. There is nothing that userspace can configure. We only need to set two bits in ACR according to card type and jumper settings and UART will drive RS485 transiever transparently.

In this particular case you may be right, but I'm looking at the bigger picture, where plain 16550's may be used for RS485.

Common way to use plain 16550 for RS485 is to wire transiever to the RTS and force userspace to use RTS/CTS flow control. I doubt there are many other sane way to do it.

Quoted 4 lines

There are drivers which want to implement their own private ioctl to enable RS485 mode. What I'm saying is that we should have one solution, not multiple solutions to this problem. When we have such a solution, your RS485 card will be able to fit into that model.

But it will need a way to pass ACR value anyway :)

Signature · 2 lines
Andrey Panin		| Linux and UNIX system administrator
[email protected]		| PGP key: wwwkeys.pgp.net
#8 lore raw
Quoted 10 lines · Andrey Panin
Quoted 5 lines · Russell King
Quoted 4 lines · Andrey Panin
Quoted 3 lines · Russell King

As I've said many a time, we need a generic way to set different hand- shaking modes. I've suggested using some spare bits in termios in the past, but nothing ever came of that - folk lose interest at that point.

No wonder they do. Extra bits are not a problem, but for 8250.c we need some way to glue subdrivers with serial8250_set_termios(). Callback in uart_port structure ?

They lose interest because they want to solve only their own small little problem without looking at the bigger picture. That's not what I'm interested in, so as far as I'm concerned (and I hope this is clear) I have _zero_ interest in solving their small little problems.

By only solving the small little problem, we end up with lots of drivers doing their own stupid implementation of the same feature, which results in multiple differing ways to enable said same feature from userspace.

Plus, there is more to handshaking than just the standard protocol we implement today - yes there's RS485-using-RTS flavour, but there's also an alternative interpretation of RTS to mean "I am requesting to send something" rather than the conventional "it is okay for you to send me something".

And yes, someone has already requested this alternative RTS interpretation.

So, there are three distinct flow control scenarios:

- conventional RTS/CTS
- alternative RTS/CTS
- RS485

As I've said above, if folk wish to bury their heads and just address RS485 in isolation, I'm just plain not interested. Let's do the job properly or not at all.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#9 lore raw
Quoted 11 lines · Russell King
Quoted 10 lines · Andrey Panin
Quoted 5 lines · Russell King
Quoted 4 lines · Andrey Panin
Quoted 3 lines · Russell King

As I've said many a time, we need a generic way to set different hand- shaking modes. I've suggested using some spare bits in termios in the past, but nothing ever came of that - folk lose interest at that point.

No wonder they do. Extra bits are not a problem, but for 8250.c we need some way to glue subdrivers with serial8250_set_termios(). Callback in uart_port structure ?

Finally, let me explain why I favour the termios solution. The biggest (and most important) aspect is that it allows existing applications such as minicom and gettys to work as expected - getting the correct handshaking mode that they desire without having to change userspace.

I think that is an _extremely_ important property to have. Without it, you would end up with (eg) a security issue where a user changes the handshaking mode of the dial-up connection they're on, rendering it useless until the sysadmin "undoes" the damage.

Alternatively, every serial line getty at least needs to be taught how to reset the handshaking mode, which at present means that it needs to be taught about the hardware cards so it knows what silly random ioctl call for some proprietary method to make.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#10 lore raw
In reply to Russell King
Quoted 1 line · Russell King

So, there are three distinct flow control scenarios:

So I'm clear on how you interpret these,
am I correct with the following?

Quoted 1 line

- conventional RTS/CTS

RTS active = ready to receive
CTS active = allowed to send

Quoted 1 line

- alternative RTS/CTS

RTS active = on before send, off after send
CTS active = allowed to send

Quoted 1 line

- RS485

RTS active = on before send, off after send (RTS enables driver) CTS ignored (2 wire mode, no CTS)

So maybe the extra control fields would be:
CRTSONTX - RTS on before send, off after send
CTXONCTS - wait for CTS before sending

Signature · 2 lines
Paul Fulghum
Microgate Systems, Ltd.
#11 lore raw
Quoted 6 lines · Paul Fulghum
Quoted 1 line · Russell King

So, there are three distinct flow control scenarios:

So I'm clear on how you interpret these,
am I correct with the following?

Quoted 7 lines
Quoted 1 line

- conventional RTS/CTS

RTS active = ready to receive
CTS active = allowed to send

Quoted 1 line

- alternative RTS/CTS

RTS active = on before send, off after send
CTS active = allowed to send

I'll have to dig through my archives to confirm this one.

Quoted 7 lines
Quoted 1 line

- RS485

RTS active = on before send, off after send (RTS enables driver) CTS ignored (2 wire mode, no CTS)

So maybe the extra control fields would be:
CRTSONTX - RTS on before send, off after send
CTXONCTS - wait for CTS before sending

That's a possibility, except that programs today expect CRTSCTS to enable RTS/CTS flow control.

What I suggest is to use CRTSCTS to enable the chosen flow control method. Then we have a set of cflag bits which describe the flow control mode, eg CFLOWRS485, CFLOWMODEM, CFLOWALT (probably needs better names.) CFLOWMODEM being the conventional mode should have an all zeros value.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#12 lore raw
Quoted 5 lines · Russell King

What I suggest is to use CRTSCTS to enable the chosen flow control method. Then we have a set of cflag bits which describe the flow control mode, eg CFLOWRS485, CFLOWMODEM, CFLOWALT (probably needs better names.) CFLOWMODEM being the conventional mode should have an all zeros value.

That is better, as it enforces mutual exclusion of the different modes.

Thanks,
Paul

Signature · 2 lines
Paul Fulghum
Microgate Systems, Ltd.