Bug 8458 - setserial fails to set ttyS[4-9] (invalid argument)
Summary: setserial fails to set ttyS[4-9] (invalid argument)
Status: REJECTED DOCUMENTED
Alias: None
Product: Drivers
Classification: Unclassified
Component: Serial (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: Russell King
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-09 08:14 UTC by David L
Modified: 2010-04-09 00:23 UTC (History)
3 users (show)

See Also:
Kernel Version: 2.6.13 and newer
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description David L 2007-05-09 08:14:12 UTC
Most recent kernel where this bug did *NOT* occur: 2.6.12.6
Hardware Environment: http://www.compulab.co.il/i686/html/i686-cm-b-datasheet.htm

Software Environment:
grep 8250 .config
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_NR_UARTS=24
CONFIG_SERIAL_8250_EXTENDED=y
CONFIG_SERIAL_8250_MANY_PORTS=y
CONFIG_SERIAL_8250_SHARE_IRQ=y
# CONFIG_SERIAL_8250_DETECT_IRQ is not set
# CONFIG_SERIAL_8250_RSA is not set
# CONFIG_SERIAL_8250_FOURPORT is not set
# CONFIG_SERIAL_8250_ACCENT is not set
# CONFIG_SERIAL_8250_BOCA is not set
# CONFIG_SERIAL_8250_HUB6 is not set
# Non-8250 serial port support


Problem Description:
setserial returns "Cannot set serial info: Invalid argument" for ttyS's > ttyS3.

Steps to reproduce: Try to setserial in this hardware environment like this:
/bin/setserial /dev/ttyS4 port 0x300 irq 4 uart 16550A ^fourport low_latency

This worked in 2.4.* thru 2.6.12.6 but fails in 2.6.13.5 and newer.

I can get the setserial to work if I set CONFIG_SERIAL_8250_FOURPORT, 
but then I get a lot of byte errors for some reason.  If I use ttyS3 
with the same base address, it works fine.


Example output from 2.6.12.6:
# cat /proc/tty/driver/serial  |head -8
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:0 rx:0
1: uart:16550A port:000002F8 irq:3 tx:0 rx:0 CTS|DSR|CD
2: uart:16550A port:000003E8 irq:4 tx:0 rx:0 CTS|DSR
3: uart:16550A port:000002E8 irq:3 tx:0 rx:0 CTS|DSR|CD|RI
4: uart:unknown port:000001A0 irq:9
5: uart:unknown port:000001A8 irq:9
6: uart:unknown port:000001B0 irq:9
# /bin/setserial /dev/ttyS4 port 0x300 irq 4 uart 16550A ^fourport low_latency
# cat /proc/tty/driver/serial  |head -8
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:0 rx:0
1: uart:16550A port:000002F8 irq:3 tx:0 rx:0 CTS|DSR|CD
2: uart:16550A port:000003E8 irq:4 tx:0 rx:0 CTS|DSR
3: uart:16550A port:000002E8 irq:3 tx:0 rx:0 CTS|DSR|CD|RI
4: uart:16550A port:00000300 irq:4 tx:0 rx:0 CTS|DSR|CD|RI
5: uart:unknown port:000001A8 irq:9
6: uart:unknown port:000001B0 irq:9
# cat /proc/version 
Linux version 2.6.12.6 () (gcc version 4.1.1 20061011 (Red Hat 4.1.1-30)) #1 Mon
May 7 21:13:47 PDT 2007

Example output from 2.6.13.5:
cat /proc/tty/driver/serial  |head -8
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:0 rx:0
1: uart:16550A port:000002F8 irq:3 tx:0 rx:0 CTS|DSR|CD
2: uart:16550A port:000003E8 irq:4 tx:0 rx:0 CTS|DSR
3: uart:16550A port:000002E8 irq:3 tx:0 rx:0 CTS|DSR|CD|RI
4: uart:unknown port:00000000 irq:0
5: uart:unknown port:00000000 irq:0
6: uart:unknown port:00000000 irq:0
# /bin/setserial /dev/ttyS4 port 0x300 irq 4 uart 16550A ^fourport low_latency
Cannot set serial info: Invalid argument
# cat /proc/version 
Linux version 2.6.13.5 () (gcc version 4.1.1 20061011 (Red Hat 4.1.1-30)) #1 Tue
May 8 09:07:37 PDT 2007
Comment 1 Russell King 2007-05-09 11:29:43 UTC
Try also specifying a baud_base.

Comment 2 David L 2007-05-10 09:36:32 UTC
setting baud_base seemed to work.  I haven't been able to verify successful
communication, but setserial no longer fails:

# /bin/setserial /dev/ttyS4 port 0x300 irq 4 uart 16550A ^fourport low_latency
Cannot set serial info: Invalid argument
# /bin/setserial /dev/ttyS4 port 0x300 irq 4 uart 16550A ^fourport low_latency
baud_base 1843200
# cat /proc/tty/driver/serial |head -8
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:0 rx:0
1: uart:16550A port:000002F8 irq:3 tx:0 rx:0
2: uart:16550A port:000003E8 irq:4 tx:0 rx:0 CTS|DSR
3: uart:16550A port:000002E8 irq:3 tx:0 rx:0
4: uart:16550A port:00000300 irq:4 tx:0 rx:0 CTS|DSR
Comment 3 Natalie Protasevich 2007-07-07 02:04:39 UTC
It looks like this bug can be closed.
Comment 4 Hans Thomas 2010-04-09 00:23:08 UTC
(In reply to comment #3)
> It looks like this bug can be closed.

I ran into a similar set of issues trying to get new serial ports installed into an embedded x86 application. The issue for me turned out to be that the setserial program converts its command line arguments, in order, into corresponding ioctl() operations to set the various device parameters. Basically, setserial applied a strategy of:
1)read the current setting for the specific /dev/ttySx
2)modify the values as specifid by each command line arg, with each individual command line argument or flag turning into an ioctl

So, specifying the uart type (or autoconfigure) before you specify the port or irq won't work correctly for ports greater the /dev/ttyS3, because the port value for /dev/ttyS3 isn't initialized to anything. This causes the ioctl() operation to return with errno set to EINVAL (invalid argument). I suspect the chain of ioctl()'s that ^fourport flag followed by low_latency flag turn into something that doesn't make sense to the driver.

Note You need to log in before you can comment on or make changes to this bug.