aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorMike Frysinger <michael.frysinger@analog.com>2007-12-24 06:40:05 -0500
committerBryan Wu <cooloney@kernel.org>2007-12-24 06:40:05 -0500
commit0bcfd70ea11a5d6f2362be463513a60245a62baf (patch)
treefdf47e68cc5fc916da5d985f797b262c36997c4e /drivers/serial
parent4c195ad88b7df54b2e7340dec3446aee6ca84cd1 (diff)
[Blackfin] serial driver: fix bug - cache the bits of the LSR on systems where the LSR is read-to-clear
Cache the bits of the LSR on systems where the LSR is read-to-clear so that we can safely read the LSR in random places. this fixes older parts where break/framing/parity/overflow was not being detected at all in PIO mode, and this fixes newer parts where break/framing/parity/overflow was being reported all the time without being cleared. Signed-off-by: Mike Frysinger <michael.frysinger@analog.com> Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/bfin_5xx.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index ca9ceaa113a2..af84984df775 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -216,8 +216,10 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
216 struct pt_regs *regs = get_irq_regs(); 216 struct pt_regs *regs = get_irq_regs();
217#endif 217#endif
218 218
219 ch = UART_GET_CHAR(uart);
220 status = UART_GET_LSR(uart); 219 status = UART_GET_LSR(uart);
220 UART_CLEAR_LSR(uart);
221
222 ch = UART_GET_CHAR(uart);
221 uart->port.icount.rx++; 223 uart->port.icount.rx++;
222 224
223#ifdef CONFIG_KGDB_UART 225#ifdef CONFIG_KGDB_UART
@@ -335,7 +337,7 @@ static irqreturn_t bfin_serial_rx_int(int irq, void *dev_id)
335 struct bfin_serial_port *uart = dev_id; 337 struct bfin_serial_port *uart = dev_id;
336 338
337 spin_lock(&uart->port.lock); 339 spin_lock(&uart->port.lock);
338 while ((UART_GET_IER(uart) & ERBFI) && (UART_GET_LSR(uart) & DR)) 340 while (UART_GET_LSR(uart) & DR)
339 bfin_serial_rx_chars(uart); 341 bfin_serial_rx_chars(uart);
340 spin_unlock(&uart->port.lock); 342 spin_unlock(&uart->port.lock);
341 343
@@ -347,7 +349,7 @@ static irqreturn_t bfin_serial_tx_int(int irq, void *dev_id)
347 struct bfin_serial_port *uart = dev_id; 349 struct bfin_serial_port *uart = dev_id;
348 350
349 spin_lock(&uart->port.lock); 351 spin_lock(&uart->port.lock);
350 if ((UART_GET_IER(uart) & ETBEI) && (UART_GET_LSR(uart) & THRE)) 352 if (UART_GET_LSR(uart) & THRE)
351 bfin_serial_tx_chars(uart); 353 bfin_serial_tx_chars(uart);
352 spin_unlock(&uart->port.lock); 354 spin_unlock(&uart->port.lock);
353 355
@@ -428,6 +430,8 @@ static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
428 int i, flg, status; 430 int i, flg, status;
429 431
430 status = UART_GET_LSR(uart); 432 status = UART_GET_LSR(uart);
433 UART_CLEAR_LSR(uart);
434
431 uart->port.icount.rx += CIRC_CNT(uart->rx_dma_buf.head, uart->rx_dma_buf.tail, UART_XMIT_SIZE);; 435 uart->port.icount.rx += CIRC_CNT(uart->rx_dma_buf.head, uart->rx_dma_buf.tail, UART_XMIT_SIZE);;
432 436
433 if (status & BI) { 437 if (status & BI) {