Skip to contentSkip to conversation

ST16C554 Serial device driver

DISCUSSION Eric Valette 3 participants 8 messages Sep 21, 2004 – Sep 22, 2004 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

Hi,

Sorry to annoy you with one small question : I'm currently working as a
contractor to port an application from LynxOS to linux 2.6 and I'm
annoyed with the serial driver code. I need to find a driver for a ST16C554 quad serial ISA board. I've tried to use setserial with the relevant IO ports and irq but cannot manage to output annything on the PC 104 board.

The setting multiplex the same IRQ (10) for the four ports. Do you have any hint, advice.

Thanks for your help,

Signature · 7 lines
   __
  /  `                   	Eric Valette
 /--   __  o _.          	6 rue Paul Le Flem
(___, / (_(_(__         	35740 Pace

Tel: +33 (0)2 99 85 26 76	Fax: +33 (0)2 99 85 26 76
E-mail: [email protected]
#1 lore raw

Hi,

Try our driver, it is only wrapper for serial.c.
So you may see some hints in it.

http://www.cronyx.ru/~rik/omlinux_current.tgz

But I should warn you that current serial.c is buggy. Our internal tests works fine with linux prior 2.6 and FreeBSD both with our cards and com ports, but fails with serial.c from 2.6.x. This fact enforce me to think that driver is buggy, not test.

rik

Quoted 12 lines · Eric Valette

Hi,

Sorry to annoy you with one small question : I'm currently working as a
contractor to port an application from LynxOS to linux 2.6 and I'm
annoyed with the serial driver code. I need to find a driver for a ST16C554 quad serial ISA board. I've tried to use setserial with the relevant IO ports and irq but cannot manage to output annything on the PC 104 board.

The setting multiplex the same IRQ (10) for the four ports. Do you have any hint, advice.

Thanks for your help,

#2 lore raw
In reply to Eric Valette
Quoted 6 lines · Eric Valette

Sorry to annoy you with one small question : I'm currently working as a contractor to port an application from LynxOS to linux 2.6 and I'm annoyed with the serial driver code. I need to find a driver for a ST16C554 quad serial ISA board. I've tried to use setserial with the relevant IO ports and irq but cannot manage to output annything on the PC 104 board.

The kernel 8250 driver is expected to drive this port.

What is the result of an autodetect at the correct address? What are the commands you're issuing to tell the kernel where this port is? Do you get any kernel messages, and what are they?

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

Sorry to annoy you with one small question : I'm currently working as a
contractor to port an application from LynxOS to linux 2.6 and I'm
annoyed with the serial driver code. I need to find a driver for a ST16C554 quad serial ISA board. I've tried to use setserial with the relevant IO ports and irq but cannot manage to output annything on the PC 104 board.

Quoted 6 lines

The kernel 8250 driver is expected to drive this port.

What is the result of an autodetect at the correct address? What are the commands you're issuing to tell the kernel where this port is? Do you get any kernel messages, and what are they?

I checked the LynOS working driver code and found the following driver uart configuration code (support two differents boards with diffrent IO ranges and irq's) :

ERIMSERIAL(erimserial0, 0x287, 32 + 10, B19200, B19200,

        0x280, 0x288, 0x290, 0x298);

It means : IRQ 10, baud rate 1920 ioports : 0x280, 0x288, 0x290, 0x298 but the interesting register is the 0x287 that is used to

ERIMSERIAL(erimserial1, 0x2a7, 32 + 11, B19200, B19200,

        0x2a0, 0x2a8, 0x2b0, 0x2b8);

It means : IRQ 11, aud rate 1920 ioports : 0x2a0, 0x2a8, 0x2b0, 0x2b8

What is more suspect is the 0x287 (0x2a7) and register address that is described in the manufacturer documentation of the PC104 board that says : "When the same IRQ is shared by the 4 ports, the card uses 2 registers at 287H, one to valid the interrupts and the other to read back the 4 interrupt status". The attached pictures gives the signification of the register.

regarding configuration I basically said :

	setserial /dev/ttyS2 port 0x280 irq 10 autoconfig

(same with the four ports) and

	setserial /dev/ttyS6 port 0x2a0 irq 11 autoconfig

(same with the four ports)

Kernel release = 2.6.9-rc2

Thanks for ansering

Signature · 7 lines
   __
  /  `                   	Eric Valette
 /--   __  o _.          	6 rue Paul Le Flem
(___, / (_(_(__         	35740 Pace

Tel: +33 (0)2 99 85 26 76	Fax: +33 (0)2 99 85 26 76
E-mail: [email protected]
#4 lore raw
Quoted 11 lines · Eric Valette
Quoted 3 lines · Russell King

What is the result of an autodetect at the correct address? What are the commands you're issuing to tell the kernel where this port is? Do you get any kernel messages, and what are they?

What is more suspect is the 0x287 (0x2a7) and register address that is described in the manufacturer documentation of the PC104 board that says : "When the same IRQ is shared by the 4 ports, the card uses 2 registers at 287H, one to valid the interrupts and the other to read back the 4 interrupt status". The attached pictures gives the signification of the register.

Ok the above shouldn't be a problem.

Quoted 8 lines

regarding configuration I basically said :

	setserial /dev/ttyS2 port 0x280 irq 10 autoconfig

(same with the four ports) and

	setserial /dev/ttyS6 port 0x2a0 irq 11 autoconfig

(same with the four ports)

Can you run:

setserial -bav /dev/ttyS2

so we can see what the kernel has done?

Do you get any kernel messages, either when you ask it to do the autoconfig or when you try to use the port(s)?

In addition, looking at /proc/tty/driver/serial and /proc/interrupts may provide some extra information, especially the before and after sending characters.

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

What is the result of an autodetect at the correct address? What are the commands you're issuing to tell the kernel where this port is? Do you get any kernel messages, and what are they?

What is more suspect is the 0x287 (0x2a7) and register address that is described in the manufacturer documentation of the PC104 board that says : "When the same IRQ is shared by the 4 ports, the card uses 2 registers at 287H, one to valid the interrupts and the other to read back the 4 interrupt status". The attached pictures gives the signification of the register.

Ok the above shouldn't be a problem.

Quoted 7 lines

regarding configuration I basically said :

	setserial /dev/ttyS2 port 0x280 irq 10 autoconfig

(same with the four ports) and

	setserial /dev/ttyS6 port 0x2a0 irq 11 autoconfig
Quoted 8 lines
Quoted 1 line

(same with the four ports)

Can you run:

setserial -bav /dev/ttyS2

so we can see what the kernel has done?

setserial -bav /dev/ttyS2
/dev/ttyS2, Line 2, UART: 16550A, Port: 0x0280, IRQ: 10

        Baud_base: 115200, close_delay: 50000, divisor: 0
        closing_wait: 50880
        Flags: spd_normal

So it seems to correctly have detected the uart.

Quoted 8 lines

Do you get any kernel messages, either when you ask it to do the autoconfig or when you try to use the port(s)?

In addition, looking at /proc/tty/driver/serial and /proc/interrupts may provide some extra information, especially the before and after sending characters.

A) at autoconfig time :

1) dmesg contains nothing related to tty execpt the two legacy serial line ttyS0 and ttyS1.

2) cat /proc/interrupts
CPU0

  0:     360857          XT-PIC  timer
  1:          8          XT-PIC  i8042
  2:          0          XT-PIC  cascade
  5:        693          XT-PIC  eth0
 12:         58          XT-PIC  i8042
 13:          0          XT-PIC  fpu
 14:      17935          XT-PIC  ide0
NMI:          0
ERR:          0

3) cat /proc/tty/driver/serial serinfo:1.0 driver revision:
0: uart:16450 port:000003F8 irq:4 tx:0 rx:0 1: uart:16450 port:000002F8 irq:3 tx:0 rx:0 2: uart:16550A port:00000280 irq:10 tx:0 rx:0 CD 3: uart:unknown port:000002E8 irq:3
4: uart:unknown port:000001A0 irq:9
5: uart:unknown port:000001A8 irq:9
6: uart:unknown port:000002A0 irq:11
7: uart:unknown port:000001B8 irq:9
8: uart:unknown port:000002A0 irq:5
9: uart:unknown port:000002A8 irq:5
10: uart:unknown port:000002B0 irq:5
11: uart:unknown port:000002B8 irq:5
12: uart:unknown port:00000330 irq:4
13: uart:unknown port:00000338 irq:4
14: uart:unknown port:00000000 irq:0
15: uart:unknown port:00000000 irq:0
16: uart:unknown port:00000100 irq:12 17: uart:unknown port:00000108 irq:12 18: uart:unknown port:00000110 irq:12 19: uart:unknown port:00000118 irq:12 20: uart:unknown port:00000120 irq:12 21: uart:unknown port:00000128 irq:12 22: uart:unknown port:00000130 irq:12 23: uart:unknown port:00000138 irq:12 24: uart:unknown port:00000140 irq:12 25: uart:unknown port:00000148 irq:12 26: uart:unknown port:00000150 irq:12 27: uart:unknown port:00000158 irq:12 28: uart:unknown port:00000160 irq:12 29: uart:unknown port:00000168 irq:12 30: uart:unknown port:00000170 irq:12 31: uart:unknown port:00000178 irq:12 32: uart:unknown port:00000302 irq:3
33: uart:unknown port:00000302 irq:3
34: uart:unknown port:00000302 irq:3
35: uart:unknown port:00000302 irq:3
36: uart:unknown port:00000302 irq:3
37: uart:unknown port:00000302 irq:3
38: uart:unknown port:00000302 irq:3
39: uart:unknown port:00000302 irq:3
40: uart:unknown port:00000302 irq:3
41: uart:unknown port:00000302 irq:3
42: uart:unknown port:00000302 irq:3
43: uart:unknown port:00000302 irq:3
44: uart:unknown port:00000000 irq:0
45: uart:unknown port:00000000 irq:0
46: uart:unknown port:00000000 irq:0
47: uart:unknown port:00000000 irq:0
48: uart:unknown port:00000000 irq:0
49: uart:unknown port:00000000 irq:0
50: uart:unknown port:00000000 irq:0
51: uart:unknown port:00000000 irq:0 ciblePortage:/home/valette#

then I do cat /etc/passwd > /dev/ttyS2 (I have a serial line analyser connected) that gets the caracter if I use ttyS0 instead of S2, the sesion hangs when trying to flush the buffer as if there were no transmit interrupt...

strace cat /etc/passwd > /dev/ttyS2
execve("/bin/cat", ["cat", "/etc/passwd"], [/* 14 vars */]) = 0 uname({sys="Linux", node="ciblePortage", ...}) = 0
brk(0) = 0x804d000
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7fe9 000

access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=8278, ...}) = 0
old_mmap(NULL, 8278, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7fe6000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/tls/libc.so.6", O_RDONLY)    = 3

read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340X\1"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0644, st_size=1279076, ...}) = 0
old_mmap(NULL, 1289388, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xb7eab000
old_mmap(0xb7fdb000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x12f000) = 0xb7fdb000
old_mmap(0xb7fe4000, 7340, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7fe4000
close(3) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7eaa 000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7eaa080, limit:1048575, seg_32bit: 1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0

munmap(0xb7fe6000, 8278)                = 0
brk(0)                                  = 0x804d000
brk(0x806e000)                          = 0x806e000
brk(0)                                  = 0x806e000

fstat64(1, {st_mode=S_IFCHR|0660, st_rdev=makedev(4, 66), ...}) = 0 open("/etc/passwd", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=866, ...}) = 0 read(3, "root:x:0:0:root:/root:/bin/bash\n"..., 4096) = 866 write(1, "root:x:0:0:root:/root:/bin/bash\n"..., 866) = 866

read(3, "", 4096)                       = 0
close(3)                                = 0
close(1)                                = 0

exit_group(0) <=== hung here

cat /proc/interrupts

CPU0

  0:     802459          XT-PIC  timer
  1:          8          XT-PIC  i8042
  2:          0          XT-PIC  cascade
  5:       1647          XT-PIC  eth0
 10:          0          XT-PIC  serial  <===============
 12:         58          XT-PIC  i8042
 13:          0          XT-PIC  fpu
 14:      18323          XT-PIC  ide0
NMI:          0
ERR:          0

cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:16450 port:000003F8 irq:4 tx:0 rx:0
1: uart:16450 port:000002F8 irq:3 tx:0 rx:0
2: uart:16550A port:00000280 irq:10 tx:0 rx:0 RTS|DTR|CD 3: uart:unknown port:000002E8 irq:3
4: uart:unknown port:000001A0 irq:9
5: uart:unknown port:000001A8 irq:9
6: uart:unknown port:000002A0 irq:11
7: uart:unknown port:000001B8 irq:9
8: uart:unknown port:000002A0 irq:5
9: uart:unknown port:000002A8 irq:5
10: uart:unknown port:000002B0 irq:5
11: uart:unknown port:000002B8 irq:5
12: uart:unknown port:00000330 irq:4
13: uart:unknown port:00000338 irq:4
14: uart:unknown port:00000000 irq:0
15: uart:unknown port:00000000 irq:0
16: uart:unknown port:00000100 irq:12
17: uart:unknown port:00000108 irq:12
18: uart:unknown port:00000110 irq:12
19: uart:unknown port:00000118 irq:12
20: uart:unknown port:00000120 irq:12
21: uart:unknown port:00000128 irq:12
22: uart:unknown port:00000130 irq:12
23: uart:unknown port:00000138 irq:12
24: uart:unknown port:00000140 irq:12
25: uart:unknown port:00000148 irq:12
26: uart:unknown port:00000150 irq:12
27: uart:unknown port:00000158 irq:12
28: uart:unknown port:00000160 irq:12
29: uart:unknown port:00000168 irq:12
30: uart:unknown port:00000170 irq:12
31: uart:unknown port:00000178 irq:12
32: uart:unknown port:00000302 irq:3
33: uart:unknown port:00000302 irq:3
34: uart:unknown port:00000302 irq:3
35: uart:unknown port:00000302 irq:3
36: uart:unknown port:00000302 irq:3
37: uart:unknown port:00000302 irq:3
38: uart:unknown port:00000302 irq:3
39: uart:unknown port:00000302 irq:3
40: uart:unknown port:00000302 irq:3
41: uart:unknown port:00000302 irq:3
42: uart:unknown port:00000302 irq:3
43: uart:unknown port:00000302 irq:3
44: uart:unknown port:00000000 irq:0
45: uart:unknown port:00000000 irq:0
46: uart:unknown port:00000000 irq:0
47: uart:unknown port:00000000 irq:0
48: uart:unknown port:00000000 irq:0
49: uart:unknown port:00000000 irq:0
50: uart:unknown port:00000000 irq:0
51: uart:unknown port:00000000 irq:0

Do not hesitate to ask more, I can recompile a kernel also if you want...

Signature · 7 lines
   __
  /  `                   	Eric Valette
 /--   __  o _.          	6 rue Paul Le Flem
(___, / (_(_(__         	35740 Pace

Tel: +33 (0)2 99 85 26 76	Fax: +33 (0)2 99 85 26 76
E-mail: [email protected]
#6 lore raw
Quoted 1 line · Eric Valette

Do not hesitate to ask more, I can recompile a kernel also if you want...

I forgot to mention that I am not suscribed so please CC me.

-- eric

#7 lore raw
In reply to Eric Valette
Quoted 2 lines

What is more suspect is the 0x287 (0x2a7) and register address that is described in the manufacturer documentation of the PC104 board that says : "When the same IRQ is shared by the 4 ports, the card uses 2 registers at 287H, one to valid the interrupts and the other to read back the 4 interrupt status". The attached pictures gives the signification of the

Enabling the IRQ via the additionnal 0x287 port, makes the driver receive interrupt and work. I have added a samm program that is called at the end of init setserial command...

Signature · 7 lines
   __
  /  `                   	Eric Valette
 /--   __  o _.          	6 rue Paul Le Flem
(___, / (_(_(__         	35740 Pace

Tel: +33 (0)2 99 85 26 76	Fax: +33 (0)2 99 85 26 76
E-mail: [email protected]