tty: serial: 8250_dma: handle error on TX submit
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Tue, 29 Jul 2014 07:45:22 +0000 (09:45 +0200)
committerSebastian Andrzej Siewior <bigeasy@linutronix.de>
Mon, 29 Sep 2014 17:54:43 +0000 (19:54 +0200)
commitd97e216bcd6b3064ce47573af2bdc4dbcd0ecbd5
tree3d045571992d71449af4f2a56820ef93ce24a2ee
parentd61aa191c7a43aa7e0a1c905ce31f0bb35497f91
tty: serial: 8250_dma: handle error on TX submit

Right now it is possible that serial8250_tx_dma() fails and returns
-EBUSY. The caller (serial8250_start_tx()) will then enable
UART_IER_THRI which will generate an interrupt once the TX FIFO is
empty.
In serial8250_handle_irq() nothing will happen because up->dma is set
and so serial8250_tx_chars() won't be invoked. We end up with plenty of
interrupts and some "too much work for irq" output.

This patch introduces dma_tx_err in struct uart_8250_port to signal that
the last invocation of serial8250_tx_dma() failed so we can fill the TX
FIFO manually. Should the next invocation of serial8250_start_tx()
succeed then the dma_tx_err flag along with the THRI bit is removed and
DMA only usage may continue.

Reviewed-by: Tony Lindgren <tony@atomide.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
drivers/tty/serial/8250/8250.h
drivers/tty/serial/8250/8250_core.c
drivers/tty/serial/8250/8250_dma.c