diff options
-rw-r--r-- | drivers/serial/bfin_5xx.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index e059475c91ae..3a2aa7e277fa 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c | |||
@@ -84,7 +84,7 @@ static void bfin_serial_mctrl_check(struct bfin_serial_port *uart); | |||
84 | static void bfin_serial_stop_tx(struct uart_port *port) | 84 | static void bfin_serial_stop_tx(struct uart_port *port) |
85 | { | 85 | { |
86 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; | 86 | struct bfin_serial_port *uart = (struct bfin_serial_port *)port; |
87 | #ifndef CONFIG_BF54x | 87 | #if !defined(CONFIG_BF54x) && !defined(CONFIG_SERIAL_BFIN_DMA) |
88 | unsigned short ier; | 88 | unsigned short ier; |
89 | #endif | 89 | #endif |
90 | 90 | ||
@@ -307,7 +307,6 @@ static void bfin_serial_tx_chars(struct bfin_serial_port *uart) | |||
307 | UART_PUT_CHAR(uart, uart->port.x_char); | 307 | UART_PUT_CHAR(uart, uart->port.x_char); |
308 | uart->port.icount.tx++; | 308 | uart->port.icount.tx++; |
309 | uart->port.x_char = 0; | 309 | uart->port.x_char = 0; |
310 | return; | ||
311 | } | 310 | } |
312 | /* | 311 | /* |
313 | * Check the modem control lines before | 312 | * Check the modem control lines before |
@@ -376,28 +375,26 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart) | |||
376 | 375 | ||
377 | if (!uart->tx_done) | 376 | if (!uart->tx_done) |
378 | return; | 377 | return; |
379 | |||
380 | uart->tx_done = 0; | 378 | uart->tx_done = 0; |
381 | 379 | ||
380 | if (uart_circ_empty(xmit) || uart_tx_stopped(&uart->port)) { | ||
381 | bfin_serial_stop_tx(&uart->port); | ||
382 | uart->tx_done = 1; | ||
383 | return; | ||
384 | } | ||
385 | |||
382 | if (uart->port.x_char) { | 386 | if (uart->port.x_char) { |
383 | UART_PUT_CHAR(uart, uart->port.x_char); | 387 | UART_PUT_CHAR(uart, uart->port.x_char); |
384 | uart->port.icount.tx++; | 388 | uart->port.icount.tx++; |
385 | uart->port.x_char = 0; | 389 | uart->port.x_char = 0; |
386 | uart->tx_done = 1; | ||
387 | return; | ||
388 | } | 390 | } |
391 | |||
389 | /* | 392 | /* |
390 | * Check the modem control lines before | 393 | * Check the modem control lines before |
391 | * transmitting anything. | 394 | * transmitting anything. |
392 | */ | 395 | */ |
393 | bfin_serial_mctrl_check(uart); | 396 | bfin_serial_mctrl_check(uart); |
394 | 397 | ||
395 | if (uart_circ_empty(xmit) || uart_tx_stopped(&uart->port)) { | ||
396 | bfin_serial_stop_tx(&uart->port); | ||
397 | uart->tx_done = 1; | ||
398 | return; | ||
399 | } | ||
400 | |||
401 | spin_lock_irqsave(&uart->port.lock, flags); | 398 | spin_lock_irqsave(&uart->port.lock, flags); |
402 | uart->tx_count = CIRC_CNT(xmit->head, xmit->tail, UART_XMIT_SIZE); | 399 | uart->tx_count = CIRC_CNT(xmit->head, xmit->tail, UART_XMIT_SIZE); |
403 | if (uart->tx_count > (UART_XMIT_SIZE - xmit->tail)) | 400 | if (uart->tx_count > (UART_XMIT_SIZE - xmit->tail)) |
@@ -471,8 +468,6 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) | |||
471 | int x_pos, pos; | 468 | int x_pos, pos; |
472 | int flags = 0; | 469 | int flags = 0; |
473 | 470 | ||
474 | bfin_serial_dma_tx_chars(uart); | ||
475 | |||
476 | spin_lock_irqsave(&uart->port.lock, flags); | 471 | spin_lock_irqsave(&uart->port.lock, flags); |
477 | x_pos = DMA_RX_XCOUNT - get_dma_curr_xcount(uart->rx_dma_channel); | 472 | x_pos = DMA_RX_XCOUNT - get_dma_curr_xcount(uart->rx_dma_channel); |
478 | if (x_pos == DMA_RX_XCOUNT) | 473 | if (x_pos == DMA_RX_XCOUNT) |
@@ -513,9 +508,9 @@ static irqreturn_t bfin_serial_dma_tx_int(int irq, void *dev_id) | |||
513 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | 508 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
514 | uart_write_wakeup(&uart->port); | 509 | uart_write_wakeup(&uart->port); |
515 | 510 | ||
516 | if (uart_circ_empty(xmit)) | ||
517 | bfin_serial_stop_tx(&uart->port); | ||
518 | uart->tx_done = 1; | 511 | uart->tx_done = 1; |
512 | |||
513 | bfin_serial_dma_tx_chars(uart); | ||
519 | } | 514 | } |
520 | 515 | ||
521 | spin_unlock(&uart->port.lock); | 516 | spin_unlock(&uart->port.lock); |