diff mbox series

[v2] serial: amba-pl011: Fix RX stall when DMA is used

Message ID 20241113092629.60226-1-kkartik@nvidia.com
State Superseded
Headers show
Series [v2] serial: amba-pl011: Fix RX stall when DMA is used | expand

Commit Message

Kartik Nov. 13, 2024, 9:26 a.m. UTC
Function pl011_throttle_rx() calls pl011_stop_rx() to disable RX, which
also disables the RX DMA by clearing the RXDMAE bit of the DMACR
register. However, to properly unthrottle RX when DMA is used, the
function pl011_unthrottle_rx() is expected to set the RXDMAE bit of
the DMACR register, which it currently lacks. This causes RX to stall
after the throttle API is called.

Set RXDMAE bit in the DMACR register while unthrottling RX if RX DMA is
used.

Fixes: 211565b10099 ("serial: pl011: UPSTAT_AUTORTS requires .throttle/unthrottle")
Cc: <stable@vger.kernel.org>
Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
---
v1 -> v2:
	* Updated my Signed-off-by tag.
	* Added Cc: stable tag in the commit message.
---
 drivers/tty/serial/amba-pl011.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Linus Walleij Nov. 13, 2024, 10:06 a.m. UTC | #1
On Wed, Nov 13, 2024 at 10:26 AM Kartik Rajput <kkartik@nvidia.com> wrote:

> Function pl011_throttle_rx() calls pl011_stop_rx() to disable RX, which
> also disables the RX DMA by clearing the RXDMAE bit of the DMACR
> register. However, to properly unthrottle RX when DMA is used, the
> function pl011_unthrottle_rx() is expected to set the RXDMAE bit of
> the DMACR register, which it currently lacks. This causes RX to stall
> after the throttle API is called.
>
> Set RXDMAE bit in the DMACR register while unthrottling RX if RX DMA is
> used.
>
> Fixes: 211565b10099 ("serial: pl011: UPSTAT_AUTORTS requires .throttle/unthrottle")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Kartik Rajput <kkartik@nvidia.com>

Looks right to me, thanks Kartik!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 7d0134ecd82f..abd789c93c6b 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1819,6 +1819,11 @@  static void pl011_unthrottle_rx(struct uart_port *port)
 
 	pl011_write(uap->im, uap, REG_IMSC);
 
+	if (uap->using_rx_dma) {
+		uap->dmacr |= UART011_RXDMAE;
+		pl011_write(uap->dmacr, uap, REG_DMACR);
+	}
+
 	uart_port_unlock_irqrestore(&uap->port, flags);
 }