@@ -80,7 +80,8 @@ struct serial8250_config {
#define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */
#define UART_BUG_THRE (1 << 3) /* UART has buggy THRE reassertion */
#define UART_BUG_PARITY (1 << 4) /* UART mishandles parity if FIFO enabled */
-
+#define UART_BUG_DMA_RX (1 << 5) /* UART needs DMA RX req before there is
+ data in FIFO */
#define PROBE_RSA (1 << 0)
#define PROBE_ANY (~0)
@@ -1592,6 +1592,9 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
if (!up->dma || dma_err)
status = serial8250_rx_chars(up, status);
+
+ if (dma_err && up->bugs & UART_BUG_DMA_RX)
+ serial8250_rx_dma(up, 0);
}
serial8250_modem_status(up);
if ((!up->dma || (up->dma && up->dma->tx_err)) &&
@@ -50,9 +50,8 @@ static void __dma_tx_complete(void *param)
spin_unlock_irqrestore(&p->port.lock, flags);
}
-static void __dma_rx_complete(void *param)
+static void __dma_rx_do_complete(struct uart_8250_port *p, bool error)
{
- struct uart_8250_port *p = param;
struct uart_8250_dma *dma = p->dma;
struct tty_port *tty_port = &p->port.state->port;
struct dma_tx_state state;
@@ -68,10 +67,17 @@ static void __dma_rx_complete(void *param)
tty_insert_flip_string(tty_port, dma->rx_buf, count);
p->port.icount.rx += count;
+ if (!error && p->bugs & UART_BUG_DMA_RX)
+ serial8250_rx_dma(p, 0);
tty_flip_buffer_push(tty_port);
}
+static void __dma_rx_complete(void *param)
+{
+ __dma_rx_do_complete(param, false);
+}
+
int serial8250_tx_dma(struct uart_8250_port *p)
{
struct uart_8250_dma *dma = p->dma;
@@ -139,7 +145,7 @@ int serial8250_rx_dma(struct uart_8250_port *p, unsigned int iir)
*/
if (dma_status == DMA_IN_PROGRESS) {
dmaengine_pause(dma->rxchan);
- __dma_rx_complete(p);
+ __dma_rx_do_complete(p, true);
}
return -ETIMEDOUT;
default: