summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/8250/8250_port.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2016-04-09 22:14:36 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-04-30 09:26:55 -0700
commit33d9b8b23a73d5d8609a740d0adeea8235c2ae52 (patch)
treeef63a64eb25995cc3dd6f9912ced54560275e71c /drivers/tty/serial/8250/8250_port.c
parentb74fdd23d8fb4e349185ed9d963da8fc2b6eb34c (diff)
serial: 8250: Extract IIR logic steering from rx dma
Using fake IIR values to perform rx dma operations unnecessarily conflates separate operations, stopping in-progress dma with starting new dma. Introduce serial8250_rx_dma_flush() to handle stopping in-progress dma [omap8250 already has equivalent omap_8250_rx_dma_flush()]. Replace rx_dma(UART_IIR_RX_TIMEOUT) with the equivalent *_rx_dma_flush(), and rx_dma(0) with the equivalent *_rx_dma(). Handle IIR steering in the irq handler with handle_rx_dma() helper. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/8250/8250_port.c')
-rw-r--r--drivers/tty/serial/8250/8250_port.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index b2bbb9dcfa0b..215e8da78a06 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1788,6 +1788,18 @@ unsigned int serial8250_modem_status(struct uart_8250_port *up)
}
EXPORT_SYMBOL_GPL(serial8250_modem_status);
+static bool handle_rx_dma(struct uart_8250_port *up, unsigned int iir)
+{
+ switch (iir & 0x3f) {
+ case UART_IIR_RX_TIMEOUT:
+ serial8250_rx_dma_flush(up);
+ /* fall-through */
+ case UART_IIR_RLSI:
+ return true;
+ }
+ return up->dma->rx_dma(up);
+}
+
/*
* This handles the interrupt from one port.
*/
@@ -1807,7 +1819,7 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
DEBUG_INTR("status = %x...", status);
if (status & (UART_LSR_DR | UART_LSR_BI)) {
- if (!up->dma || up->dma->rx_dma(up, iir))
+ if (!up->dma || handle_rx_dma(up, iir))
status = serial8250_rx_chars(up, status);
}
serial8250_modem_status(up);