On an i.MX6Q based system using the imx-UART in rs485 mode the following could be observed: When a character is supposed to be sent, imx_start_tx() enables the Transmit Complete Interrupt (UCR4_TCEN) and then enables DMA. If then the Transmit Complete Interrupt triggers before the DMA request starts to send characters the irq handler disables the Transmitter Empty Interrupt (UCR1_TXMPTYEN) in imx_transmit_buffer() but not Transmit Complete Interrupt and so fails to remove this irq source which prevents the DMA request to start and completely locks up the system. To prevent this lock-up also disable UCR4_TCEN when starting DMA and expand the comment accordingly. Fixes: 17b8f2a3fdca ("serial: imx: add support for half duplex rs485") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> --- drivers/tty/serial/imx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 1d7ca382bc12..2a7311ad4788 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -436,9 +436,12 @@ static inline void imx_transmit_buffer(struct imx_port *sport) if (sport->dma_is_enabled) { /* - * We've just sent a X-char Ensure the TX DMA is enabled - * and the TX IRQ is disabled. - **/ + * Ensure the TX IRQs are disabled when enabling DMA. Otherwise + * the triggering TX IRQ might prevent to start the DMA request. + */ + temp = readl(sport->port.membase + UCR4); + if (temp & UCR4_TCEN) + writel(temp & ~UCR4_TCEN, sport->port.membase + UCR4); temp = readl(sport->port.membase + UCR1); temp &= ~UCR1_TXMPTYEN; if (sport->dma_is_txing) { -- 2.15.1 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html