UART16550 MIDI driver for RedHat 6.0

Shiro Kawai

Download patch

This patch adds uart16550 driver to the sound drivers so that you can use external MIDI device attached via serial port. The original work is done by Geroge Hansper (, for OSS/Free sound driver 3.5.4 and Linux kernel 2.0. I made the following modifications:

The original version of the George's patch can be found at his page. He describes settings in detail so I recommend to read his page, too.

RedHat uses different configration method from original OSS/Free, (i.e. vs configure.c), so if you want to use this patch for other distribution of Linux you may need to tweak your configure.c


I compiled the driver under out-of-box RedHat6.0 kernel source (2.2.5).

Any other distribution with kernel 2.2.5 or higher and OSS/Free 3.8s2 or higher may work, but you might need to edit configure.c and Makefile.

I'm using on-board serial port (/dev/ttyS0). I can't configure its baud-rate to 31250 as MIDI specifies. However, Roland SC-88Pro seems to work with 38400 baud. (Set the rear switch of SC-88Pro to "PC-2").


There are four steps to install the driver.

  1. Apply patch to the kernel source
  2. Configure the kernel
  3. Compile and install module files
  4. Set module parameters (optional)

Applying patch

You need to have kernel source tree. I assume you have one under /usr/src/linux.

    # cd /usr/src/linux/drivers/sound
    # patch < /tmp/uart16550-rh6.0.patch

(Replace the path of the patch for the actual path)


    # cd /usr/src/linux
    # make config

You can say `make menuconfig' or `make xconfig' to get more "user-friendly" configuration menus.

In "Sound" section, you'll be asked to configure UART16550 driver. You should say "y" (to compile driver into sound module) or "m" (to compile driver as a module). I recommend to compile the driver as a module. You won't get "y" option if you select entire sound driver to be compiled as modules.

When you select uart16550 driver, config program asks a few hardware parameters.

I/O base for UART16550 MIDI port #1

I/O base address of the first uart16550 driver. The default value is for /dev/ttyS0.

UART16550 IRQ #1

IRQ of the first driver. The default value is for /dev/ttyS0.

UART16550 Divisor #1

Clock divisor. It must be calculated to satisfy the following equation:

31250 = UART_clock_frequency / (16 x UART_divisor)

You can leave it zero here if you're not sure what UART clock frequency is. If the divisor is zero, the driver won't try to change divisor settings, which means you must configure it by using commands like setserial.

For further description of divisor, see original author's page.


    # cd /usr/src/linux
    # make dep
    # make clean
    # make zImage
    # make modules
    # make modules_install
    # depmod -a

Module parameters

If you compile the driver as a module, you can override irq, io base address or divisor parameter when you install the module using insmod or modprobe. The symbols of irq, io base and divisor for first uart16550 device are `irq1', `io1', and `div1', respectively. (By default, this feature is not available for the second to fourth uart16550 device. You need to change #define flag in the source to make them available).

For example, the following command overrides IO address to 0x3f8 and divisor to 3.

    # insmod uart16550 io1=0x3f8 div1=3

Alternatively you can add those options in /etc/conf.modules as follows:

    options uart16550 io1=0x3f8 div1=3

Then, type modprobe uart16550 to install the module.

Shiro Kawai
Last modified: Sat Jul 17 22:17:24 HST 1999