tty:serial:msm:Do not restore Rx interrupts in DMA
authorCharanya Venkatraman <charanya@codeaurora.org>
Tue, 7 Jun 2016 10:28:41 +0000 (15:58 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Jun 2016 17:23:54 +0000 (10:23 -0700)
Avoid data corruption issues that result in CRC errors during file
transfers over serial ports at higher baud rates.

The current msm_serial driver masks the FIFO Rx interrupts in
msm_start_rx_dma() since Rx FIFO interrupts are not required in DMA
mode. However, msm_complete_rx_dma() re-enables the Rx FIFO interrupts
which could cause RXSTALE event to be processed when a TXLEV interrupt
occurs.

The following is the sequence of events that could occur resulting in
data corruption.

msm_start_rx_dma -> msm_complete_rx_dma -->
spin_unlock_irqrestore(&port->lock) -->
msm_uart_irq()(For TXLEV interrupt) -->  msm_handle_rx_dm() (Read from
FIFO resulting in data corruption)

The patch fixes the issue by not restoring the RXLEV and RXSTALE
interrupts in msm_complete_rx_dma(). These interrupts are required only
in FIFO mode.

Signed-off-by: Charanya Venkatraman <charanya@codeaurora.org>
Acked-by: Andy Gross <andy.gross@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/msm_serial.c

index 88af5a3d21dd5cea3631da5e6c16e3a7af70ce0e..d0384d4cccb1d79570150f0b86d52190037a4c70 100644 (file)
@@ -557,10 +557,6 @@ static void msm_complete_rx_dma(void *args)
        val &= ~dma->enable_bit;
        msm_write(port, val, UARTDM_DMEN);
 
-       /* Restore interrupts */
-       msm_port->imr |= UART_IMR_RXLEV | UART_IMR_RXSTALE;
-       msm_write(port, msm_port->imr, UART_IMR);
-
        if (msm_read(port, UART_SR) & UART_SR_OVERRUN) {
                port->icount.overrun++;
                tty_insert_flip_char(tport, 0, TTY_OVERRUN);