Skip to content

Commit

Permalink
serial: imx: terminate the RX DMA when the UART is suspending
Browse files Browse the repository at this point in the history
When the uart port is suspending, the RX data is useless.
So in this case, we can terminate the RX DMA right now.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Huang Shijie authored and Greg Kroah-Hartman committed Sep 29, 2014
1 parent bb2f861 commit 45564a6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/tty/serial/imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,14 @@ static void imx_stop_rx(struct uart_port *port)
struct imx_port *sport = (struct imx_port *)port;
unsigned long temp;

/*
* We are maybe in the SMP context, so if the DMA TX thread is running
* on other cpu, we have to wait for it to finish.
*/
if (sport->dma_is_enabled && sport->dma_is_rxing)
return;
if (sport->dma_is_enabled && sport->dma_is_rxing) {
if (sport->port.suspended) {
dmaengine_terminate_all(sport->dma_chan_rx);
sport->dma_is_rxing = 0;
} else {
return;
}
}

temp = readl(sport->port.membase + UCR2);
writel(temp & ~UCR2_RXEN, sport->port.membase + UCR2);
Expand Down

0 comments on commit 45564a6

Please sign in to comment.