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> --- Hello, The only changed compared to (implicit) v1 is that I rebased this patch on top of tty-testing. Best regards Uwe drivers/tty/serial/imx.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 3fdd322b9096..58b585c0465f 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -512,11 +512,14 @@ static inline void imx_uart_transmit_buffer(struct imx_port *sport) } if (sport->dma_is_enabled) { - u32 ucr1; + u32 ucr1, ucr4; /* - * 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. + */ + ucr4 = imx_uart_readl(sport, UCR4); + if (ucr4 & UCR4_TCEN) + imx_uart_writel(sport, ucr4 & ~UCR4_TCEN, UCR4); ucr1 = imx_uart_readl(sport, UCR1); ucr1 &= ~UCR1_TXMPTYEN; if (sport->dma_is_txing) { -- 2.16.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