serial: mxs-auart: disable the Receive Timeout Interrupt when DMA is enabled
authorHuang Shijie <b32955@freescale.com>
Thu, 22 Nov 2012 07:06:29 +0000 (15:06 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 26 Nov 2012 23:38:44 +0000 (15:38 -0800)
When the DMA is enabled, the Receive Timeout interrupt is very easy to be arised
in the 3M baud rate.  The interrupt handler (aka mxs_auart_irq_handle) will call
mxs_auart_rx_chars() to handle the received data. This is not right, we can not
get the correct data from the RXFIFO now, the data have been moved to the
DMA buffer by the DMA engine.

This patch
  (1) disables the Receive Timeout Interrupt when the DMA is enabled,
  (2) and invoke the mxs_auart_rx_chars() only when the DMA is not enabled.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Tested-by: Lauri Hintsala <lauri.hintsala@bluegiga.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/mxs-auart.c

index 3860ff27467cbc26e6677d14499fb83d05095f08..f56d6b92cf3815c8b8244e4d2ea4c262a7cfdee6 100644 (file)
@@ -695,7 +695,8 @@ static void mxs_auart_settermios(struct uart_port *u,
                !test_and_set_bit(MXS_AUART_DMA_RX_READY, &s->flags)) {
                if (!mxs_auart_dma_prep_rx(s)) {
                        /* Disable the normal RX interrupt. */
-                       writel(AUART_INTR_RXIEN, u->membase + AUART_INTR_CLR);
+                       writel(AUART_INTR_RXIEN | AUART_INTR_RTIEN,
+                                       u->membase + AUART_INTR_CLR);
                } else {
                        mxs_auart_dma_exit(s);
                        dev_err(s->dev, "We can not start up the DMA.\n");
@@ -719,7 +720,8 @@ static irqreturn_t mxs_auart_irq_handle(int irq, void *context)
        }
 
        if (istat & (AUART_INTR_RTIS | AUART_INTR_RXIS)) {
-               mxs_auart_rx_chars(s);
+               if (!auart_dma_enabled(s))
+                       mxs_auart_rx_chars(s);
                istat &= ~(AUART_INTR_RTIS | AUART_INTR_RXIS);
        }