aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/bfin_5xx.c
diff options
context:
space:
mode:
authorSonic Zhang <sonic.zhang@analog.com>2007-12-21 03:45:12 -0500
committerBryan Wu <cooloney@kernel.org>2007-12-21 03:45:12 -0500
commit1b73351c6afcc3acbf9e29a43ee14b3c9a386503 (patch)
tree6e004780cdb14854c3ae7fe613bba38bf0919453 /drivers/serial/bfin_5xx.c
parent759eb040901af60d8a1a2b59b93805521b156cbb (diff)
[Blackfin] serial driver: Clean up UART DMA code.
Start next TX DMA in tx dma handler instead of rx timer handler. Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Diffstat (limited to 'drivers/serial/bfin_5xx.c')
-rw-r--r--drivers/serial/bfin_5xx.c25
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);
84static void bfin_serial_stop_tx(struct uart_port *port) 84static 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);