OMAP: UART: Keep the TX fifo full when possible
authorDmitry Fink <finik@ti.com>
Mon, 8 Jul 2013 10:04:44 +0000 (13:04 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2013 22:55:44 +0000 (15:55 -0700)
Current logic results in interrupt storm since the fifo
is constantly below the threshold level. Change the logic
to fill all the available spaces in the fifo as long as
we have data to minimize the possibilty of underflow and
elimiate excessive interrupts.

Signed-off-by: Dmitry Fink <finik@ti.com>
Signed-off-by: Alexander Savchenko <oleksandr.savchenko@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/omap-serial.c
include/uapi/linux/serial_reg.h

index 33c758e09d86ba63ab763cc498b52325dd449542..9271a1dceec3d2993703aba1250db691bfacefd5 100644 (file)
@@ -315,7 +315,8 @@ static void transmit_chars(struct uart_omap_port *up, unsigned int lsr)
                serial_omap_stop_tx(&up->port);
                return;
        }
-       count = up->port.fifosize / 4;
+       count = up->port.fifosize -
+               (serial_in(up, UART_OMAP_TXFIFO_LVL) & 0xFF);
        do {
                serial_out(up, UART_TX, xmit->buf[xmit->tail]);
                xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
index e6322605b1380e64ed45208d6935729f0bfb9c08..97c26beae605aacff96ab44662f4d1f79a926ba8 100644 (file)
 #define UART_OMAP_MDR1_FIR_MODE                0x05    /* FIR mode */
 #define UART_OMAP_MDR1_CIR_MODE                0x06    /* CIR mode */
 #define UART_OMAP_MDR1_DISABLE         0x07    /* Disable (default state) */
+#define UART_OMAP_TXFIFO_LVL           0x1A    /* TX FIFO fullness */
 
 /*
  * These are definitions for the Exar XR17V35X and XR17(C|D)15X