From 5aabd3b0077e0577f60a1ca6b8bdad62f23353d8 Mon Sep 17 00:00:00 2001 From: Ian Jamison Date: Mon, 28 Aug 2017 09:02:29 +0100 Subject: serial: imx: Avoid post-PIO cleanup if TX DMA is started MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The imx_transmit_buffer function should return if TX DMA has already been started and not just skip over the buffer PIO write loop. (Which did fix the initial problem, but could have unintentional side-effects) Tested on an i.MX6Q board with half-duplex RS-485 and with RS-232. Cc: Clemens Gruber Cc: Uwe-Kleine König Cc: Greg Kroah-Hartman Cc: Fabio Estevam Fixes: 514ab34dbad6 ("serial: imx: Prevent TX buffer PIO write when a DMA has been started") Signed-off-by: Ian Jamison Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/imx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/tty') diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index d879a9b86424..dfeff3951f93 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -457,7 +457,10 @@ static inline void imx_transmit_buffer(struct imx_port *sport) } } - while (!uart_circ_empty(xmit) && !sport->dma_is_txing && + if (sport->dma_is_txing) + return; + + while (!uart_circ_empty(xmit) && !(readl(sport->port.membase + uts_reg(sport)) & UTS_TXFULL)) { /* send xmit->buf[xmit->tail] * out the port here */ -- cgit v1.2.3