Saturday, November 01, 2008

Extended 8250/16550 serial port support

This is a small guide to configure extended serial ports based on my work when building embedded linux on WAFER-LX2 SBC.

In 2.6 kernel:

Make sure kernel has support for Extended 8250/16550 serial driver (CONFIG_SERIAL_8250_EXTENDED)

Device drivers -> Character devices -> Serial drivers

- Support for more than 4 legacy serial ports (CONFIG_SERIAL_8250_MANY_PORTS)
- Support for sharing serial interrupts when needed (CONFIG_SERIAL_8250_SHARE_IRQ)

Set how many serial ports to be registered at runtime or via kernel command line option:


It was very recommended to disable autodetect IRQ on standard ports
(CONFIG_SERIAL_8250_DETECT_IRQ) and use setserial command (eg. boot script)


/sbin/setserial /dev/ttyS4 port 0×338 irq 4 uart 16550A baud_base 115200

To show all serial ports configuration:
/sbin/setserial -bg /dev/ttyS*


I got invalid argument when baud_base was not issued by setserial command (setserial 2.17)

To make the port setting consistent, add any port(s) to /etc/serial.conf and run setserial at boot (boot script, i.e rc.serial)

Use terminal emulation i.e minicom for testing purposes.

Some usefull files:

- /proc/tty/driver/serial -> list serial ports address, irq, tx/rx mappings
- /etc/serial.conf -> serial port configuration
- kernel/Documentation/serial/driver -> serial low level API