serial: sirf: don't submit dma desc after timeout irqs occur
authorQipan Li <Qipan.Li@csr.com>
Sat, 21 Sep 2013 01:02:10 +0000 (09:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Sep 2013 22:41:39 +0000 (15:41 -0700)
In rx timeout ISR and tasklet, we don't issue new dma desc as rx_done ISR
will do that.

Signed-off-by: Qipan Li <Qipan.Li@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sirfsoc_uart.c

index 61c1ad03db5b0159d6b7735838a2a0cb800d7bbd..f186a8fb8887119cd036625a129f515bb57f4210 100644 (file)
@@ -529,7 +529,7 @@ static void sirfsoc_rx_tmo_process_tl(unsigned long param)
        while (sirfport->rx_completed != sirfport->rx_issued) {
                sirfsoc_uart_insert_rx_buf_to_tty(sirfport,
                                        SIRFSOC_RX_DMA_BUF_SIZE);
-               sirfsoc_rx_submit_one_dma_desc(port, sirfport->rx_completed++);
+               sirfport->rx_completed++;
                sirfport->rx_completed %= SIRFSOC_RX_LOOP_BUF_CNT;
        }
        count = CIRC_CNT(sirfport->rx_dma_items[sirfport->rx_issued].xmit.head,
@@ -706,12 +706,19 @@ static void sirfsoc_uart_rx_dma_complete_tl(unsigned long param)
 {
        struct sirfsoc_uart_port *sirfport = (struct sirfsoc_uart_port *)param;
        struct uart_port *port = &sirfport->port;
+       struct sirfsoc_register *ureg = &sirfport->uart_reg->uart_reg;
+       struct sirfsoc_int_en *uint_en = &sirfport->uart_reg->uart_int_en;
        unsigned long flags;
        spin_lock_irqsave(&sirfport->rx_lock, flags);
        while (sirfport->rx_completed != sirfport->rx_issued) {
                sirfsoc_uart_insert_rx_buf_to_tty(sirfport,
                                        SIRFSOC_RX_DMA_BUF_SIZE);
-               sirfsoc_rx_submit_one_dma_desc(port, sirfport->rx_completed++);
+               if (rd_regl(port, ureg->sirfsoc_int_en_reg) &
+                               uint_en->sirfsoc_rx_timeout_en)
+                       sirfsoc_rx_submit_one_dma_desc(port,
+                                       sirfport->rx_completed++);
+               else
+                       sirfport->rx_completed++;
                sirfport->rx_completed %= SIRFSOC_RX_LOOP_BUF_CNT;
        }
        spin_unlock_irqrestore(&sirfport->rx_lock, flags);