diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index cf5d50ab45f0..5bda3dd197eb 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -1204,9 +1204,17 @@ skip_rx: static void pl011_dma_shutdown(struct uart_amba_port *uap) { + unsigned int cr; if (!(uap->using_tx_dma || uap->using_rx_dma)) return; + /* Fix potential deadlock when UART loopback is enabled. */ + cr = pl011_read(uap, REG_CR); + if (cr & UART011_CR_LBE) { + cr &= ~(UART011_CR_RTSEN | UART011_CR_CTSEN); + pl011_write(cr, uap, REG_CR); + } + /* Disable RX and TX DMA */ while (pl011_read(uap, REG_FR) & uap->vendor->fr_busy) cpu_relax();