Bug 7389 - Serial: 8250/16550 driver misdetects NSC6001 irda port as serial port
Summary: Serial: 8250/16550 driver misdetects NSC6001 irda port as serial port
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: 2006-10-20 03:19 UTC by Sascha Sommer
Modified: 2008-09-23 09:51 UTC (History)
4 users (show)

See Also:
Kernel Version: 2.6.18.1
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description Sascha Sommer 2006-10-20 03:19:18 UTC
Most recent kernel where this bug did not occur: 
Distribution: SUSE 10.1
Hardware Environment: i386
Software Environment:
Problem Description:
After enabling some of the debug #ifdefs in drivers/serial/8250.c and 
drivers/serial/8250_pnp.c in the mainline 2.6.18.1 sources I can find the 
following output in dmesg. This is with a Samsung P35 notebook.

Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
ttyS0: autoconf (0x03f8, 0x00000000): iir=3 iir1=6 iir2=6 type=16550A
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
ttyS1: autoconf (0x02f8, 0x00000000): IER test failed (ff, ff) type=unknown
ttyS2: autoconf (0x03e8, 0x00000000): IER test failed (ff, ff) type=unknown
ttyS3: autoconf (0x02e8, 0x00000000): iir=3 iir1=6 iir2=6 type=16550A
serial8250: ttyS3 at I/O 0x2e8 (irq = 3) is a 16550A
parport: PnPBIOS parport detected.
parport0: PC-style at 0x378 (0x778), irq 7, dma 3 
[PCSPP,TRISTATE,COMPAT,EPP,ECP,DMA]
lp0: using parport0 (interrupt-driven).
Setup PNP port: port 3f8, mem 0x0, irq 4, type 0
ttyS0: autoconf (0x03f8, 0x00000000): iir=3 iir1=6 iir2=6 type=16550A
00:07: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A

As you can see it detects 2 serial ports: ttyS0 and ttyS3 however only ttyS0 is 
a valid serial port. The port at 0x02e8 is actually a irda port.
The nice thing is that ttyS0 also gets autodetected twice. The first time by 
the 8250 module and the 2nd time by the 8250_pnp module.

Later the irda driver will fail because the port is already claimed by the 8250 
driver:
nsc-ircc, chip->init
nsc-ircc, Found chip at base=0x02e
nsc-ircc, driver loaded (Dag Brattli)
nsc_ircc_open(), can't get iobase of 0x2e8
nsc-ircc, Found chip at base=0x02e
nsc-ircc, driver loaded (Dag Brattli)
nsc_ircc_open(), can't get iobase of 0x2e8

Please tell me if you need more info or if I should test some patches.
Steps to reproduce:
boot....
Comment 1 Natalie Protasevich 2007-07-07 01:26:16 UTC
Is this still a problem with latest kernels?
Thanks.
Comment 2 Bjorn Helgaas 2007-07-27 17:04:22 UTC
Yes, this problem still occurs on the current kernel.  This patch:
  http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=7e92b4fc345f5b6f57585fbe5ffdb0f24d7c9b26

keeps 8250 from claiming the IR device.  It also gets rid of the double
detection of ttyS0.

Unfortunately, the patch has some serious defects as it stands (it reorders
ttyS0/ttyS1 on a few machines, and it needs some module load/unload cleanup),
so it will be reverted before 2.6.23.

But this is still on my list of things I'd like to clean up.  Someday.
Comment 3 Natalie Protasevich 2008-04-01 20:19:00 UTC
It looks like there were some fixes/cleanups in this area. Bjorn, is this one done, or you have still work to do?
Comment 4 Bjorn Helgaas 2008-04-02 07:50:58 UTC
This is still an issue.  I have not come up with a good solution yet.
Comment 5 Alan 2008-09-22 12:38:02 UTC
Using setserial is the long documented solution - in SIR mode the tty driver needs to grab it, in FIR mode it needs its own driver. Even better someone should write code to hand it off ...

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