diff options
author | Sonic Zhang <sonic.zhang@analog.com> | 2008-02-28 23:08:42 -0500 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2008-02-28 23:08:42 -0500 |
commit | 0aef45645174525ee6aa7baed247a130e052740d (patch) | |
tree | b34c1ae86e5f3ce85751d7499a47112099680121 /drivers/serial | |
parent | 56f5de8fe7c127f6fb94b7a061d53090fd4a1c49 (diff) |
Blackfin Serial Driver: Fix bug - Only insert UART rx char in timer task.
http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=3910
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/bfin_5xx.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c index 2a4117485799..0aa345b9a38b 100644 --- a/drivers/serial/bfin_5xx.c +++ b/drivers/serial/bfin_5xx.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #define DMA_RX_XCOUNT 512 | 48 | #define DMA_RX_XCOUNT 512 |
49 | #define DMA_RX_YCOUNT (PAGE_SIZE / DMA_RX_XCOUNT) | 49 | #define DMA_RX_YCOUNT (PAGE_SIZE / DMA_RX_XCOUNT) |
50 | 50 | ||
51 | #define DMA_RX_FLUSH_JIFFIES 5 | 51 | #define DMA_RX_FLUSH_JIFFIES (HZ / 50) |
52 | 52 | ||
53 | #ifdef CONFIG_SERIAL_BFIN_DMA | 53 | #ifdef CONFIG_SERIAL_BFIN_DMA |
54 | static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart); | 54 | static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart); |
@@ -393,7 +393,6 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart) | |||
393 | { | 393 | { |
394 | struct circ_buf *xmit = &uart->port.info->xmit; | 394 | struct circ_buf *xmit = &uart->port.info->xmit; |
395 | unsigned short ier; | 395 | unsigned short ier; |
396 | int flags = 0; | ||
397 | 396 | ||
398 | uart->tx_done = 0; | 397 | uart->tx_done = 0; |
399 | 398 | ||
@@ -491,9 +490,7 @@ static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart) | |||
491 | void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) | 490 | void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) |
492 | { | 491 | { |
493 | int x_pos, pos; | 492 | int x_pos, pos; |
494 | int flags = 0; | ||
495 | 493 | ||
496 | spin_lock_irqsave(&uart->port.lock, flags); | ||
497 | uart->rx_dma_nrows = get_dma_curr_ycount(uart->rx_dma_channel); | 494 | uart->rx_dma_nrows = get_dma_curr_ycount(uart->rx_dma_channel); |
498 | x_pos = get_dma_curr_xcount(uart->rx_dma_channel); | 495 | x_pos = get_dma_curr_xcount(uart->rx_dma_channel); |
499 | uart->rx_dma_nrows = DMA_RX_YCOUNT - uart->rx_dma_nrows; | 496 | uart->rx_dma_nrows = DMA_RX_YCOUNT - uart->rx_dma_nrows; |
@@ -509,7 +506,7 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) | |||
509 | bfin_serial_dma_rx_chars(uart); | 506 | bfin_serial_dma_rx_chars(uart); |
510 | uart->rx_dma_buf.tail = uart->rx_dma_buf.head; | 507 | uart->rx_dma_buf.tail = uart->rx_dma_buf.head; |
511 | } | 508 | } |
512 | spin_unlock_irqrestore(&uart->port.lock, flags); | 509 | |
513 | uart->rx_dma_timer.expires = jiffies + DMA_RX_FLUSH_JIFFIES; | 510 | uart->rx_dma_timer.expires = jiffies + DMA_RX_FLUSH_JIFFIES; |
514 | add_timer(&(uart->rx_dma_timer)); | 511 | add_timer(&(uart->rx_dma_timer)); |
515 | } | 512 | } |
@@ -548,22 +545,16 @@ static irqreturn_t bfin_serial_dma_rx_int(int irq, void *dev_id) | |||
548 | { | 545 | { |
549 | struct bfin_serial_port *uart = dev_id; | 546 | struct bfin_serial_port *uart = dev_id; |
550 | unsigned short irqstat; | 547 | unsigned short irqstat; |
551 | int pos; | ||
552 | |||
553 | uart->rx_dma_nrows = DMA_RX_YCOUNT - | ||
554 | get_dma_curr_ycount(uart->rx_dma_channel); | ||
555 | pos = DMA_RX_XCOUNT * uart->rx_dma_nrows; | ||
556 | if (pos != uart->rx_dma_buf.tail) { | ||
557 | uart->rx_dma_buf.head = pos; | ||
558 | bfin_serial_dma_rx_chars(uart); | ||
559 | uart->rx_dma_buf.tail = uart->rx_dma_buf.head; | ||
560 | } | ||
561 | 548 | ||
562 | spin_lock(&uart->port.lock); | 549 | spin_lock(&uart->port.lock); |
563 | irqstat = get_dma_curr_irqstat(uart->rx_dma_channel); | 550 | irqstat = get_dma_curr_irqstat(uart->rx_dma_channel); |
564 | clear_dma_irqstat(uart->rx_dma_channel); | 551 | clear_dma_irqstat(uart->rx_dma_channel); |
565 | |||
566 | spin_unlock(&uart->port.lock); | 552 | spin_unlock(&uart->port.lock); |
553 | |||
554 | del_timer(&(uart->rx_dma_timer)); | ||
555 | uart->rx_dma_timer.expires = jiffies; | ||
556 | add_timer(&(uart->rx_dma_timer)); | ||
557 | |||
567 | return IRQ_HANDLED; | 558 | return IRQ_HANDLED; |
568 | } | 559 | } |
569 | #endif | 560 | #endif |