Skip to content

Commit 75df022

Browse files
Heikki Krogerusgregkh
authored andcommitted
serial: 8250_dma: Fix RX handling
Overrun, parity and framing errors should be handled in 8250_core. This also adds check for the dma_status and exits if the channel is not idle. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5ea5b24 commit 75df022

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

drivers/tty/serial/8250/8250_dma.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,29 @@ int serial8250_rx_dma(struct uart_8250_port *p, unsigned int iir)
101101
struct dma_tx_state state;
102102
int dma_status;
103103

104-
/*
105-
* If RCVR FIFO trigger level was not reached, complete the transfer and
106-
* let 8250.c copy the remaining data.
107-
*/
108-
if ((iir & 0x3f) == UART_IIR_RX_TIMEOUT) {
109-
dma_status = dmaengine_tx_status(dma->rxchan, dma->rx_cookie,
110-
&state);
104+
dma_status = dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
105+
106+
switch (iir & 0x3f) {
107+
case UART_IIR_RLSI:
108+
/* 8250_core handles errors and break interrupts */
109+
return -EIO;
110+
case UART_IIR_RX_TIMEOUT:
111+
/*
112+
* If RCVR FIFO trigger level was not reached, complete the
113+
* transfer and let 8250_core copy the remaining data.
114+
*/
111115
if (dma_status == DMA_IN_PROGRESS) {
112116
dmaengine_pause(dma->rxchan);
113117
__dma_rx_complete(p);
114118
}
115119
return -ETIMEDOUT;
120+
default:
121+
break;
116122
}
117123

124+
if (dma_status)
125+
return 0;
126+
118127
desc = dmaengine_prep_slave_single(dma->rxchan, dma->rx_addr,
119128
dma->rx_size, DMA_DEV_TO_MEM,
120129
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);

0 commit comments

Comments
 (0)