Thread (10 messages) 10 messages, 3 authors, 1d ago

Re: [PATCH v2] serial: 8250_omap: clear rx_running on zero-length DMA completes

From: Moteen Shah <hidden>
Date: 2026-05-22 08:28:16
Also in: lkml

On 22/05/26 13:54, Matthias Feser wrote:
Thanks for the fast response. I've updated the patch accordingly.

From: Matthias Feser <redacted>
Date: Fri, 22 May 2026 10:11:16 +0200
Subject: [PATCH v2] serial: 8250_omap: clear rx_running on zero-length DMA completes

On AM33xx RX DMA only triggers when the FIFO reaches the
configured threshold (typically 48 bytes). For smaller bursts
no DMA request is issued and the FIFO is drained by RX timeout.

In this case __dma_rx_do_complete() can legitimately see count == 0.

The current code exits early in this case and does not clear
dma->rx_running, leaving the DMA state inconsistent. This can
prevent RX DMA from restarting and may cause
omap_8250_rx_dma_flush() to fail, marking DMA as broken.

Fix this by clearing dma->rx_running once the DMA transfer has
completed or been terminated, even if no data was transferred.

Changes in v2:
- Move dma->rx_running clear before the count check so the state
   is updated immediately after DMA completion/termination
Just a nit pick here: I think the "Changes in v2:" line should come 
below the tear line(---) after signed-off-by.
Code wise LGTM.

Regards,
Moteen
quoted hunk ↗ jump to hunk
Signed-off-by: Matthias Feser <redacted>
---
  drivers/tty/serial/8250/8250_omap.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index c552c6b9a037..76bc8ad324cb 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -944,11 +944,11 @@ static void __dma_rx_do_complete(struct uart_8250_port *p)
  				dev_err(p->port.dev, "teardown incomplete\n");
  		}
  	}
+	dma->rx_running = 0;
  	if (!count)
  		goto out;
  	ret = tty_insert_flip_string(tty_port, dma->rx_buf, count);
  
-	dma->rx_running = 0;
  	p->port.icount.rx += ret;
  	p->port.icount.buf_overrun += count - ret;
  out:
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help