aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/mpc52xx_uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/mpc52xx_uart.c')
-rw-r--r--drivers/serial/mpc52xx_uart.c46
1 files changed, 16 insertions, 30 deletions
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 1288d6203e94..61dd17d7bace 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -405,17 +405,13 @@ static inline int
405mpc52xx_uart_int_rx_chars(struct uart_port *port, struct pt_regs *regs) 405mpc52xx_uart_int_rx_chars(struct uart_port *port, struct pt_regs *regs)
406{ 406{
407 struct tty_struct *tty = port->info->tty; 407 struct tty_struct *tty = port->info->tty;
408 unsigned char ch; 408 unsigned char ch, flag;
409 unsigned short status; 409 unsigned short status;
410 410
411 /* While we can read, do so ! */ 411 /* While we can read, do so ! */
412 while ( (status = in_be16(&PSC(port)->mpc52xx_psc_status)) & 412 while ( (status = in_be16(&PSC(port)->mpc52xx_psc_status)) &
413 MPC52xx_PSC_SR_RXRDY) { 413 MPC52xx_PSC_SR_RXRDY) {
414 414
415 /* If we are full, just stop reading */
416 if (tty->flip.count >= TTY_FLIPBUF_SIZE)
417 break;
418
419 /* Get the char */ 415 /* Get the char */
420 ch = in_8(&PSC(port)->mpc52xx_psc_buffer_8); 416 ch = in_8(&PSC(port)->mpc52xx_psc_buffer_8);
421 417
@@ -428,45 +424,35 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port, struct pt_regs *regs)
428#endif 424#endif
429 425
430 /* Store it */ 426 /* Store it */
431 *tty->flip.char_buf_ptr = ch; 427
432 *tty->flip.flag_buf_ptr = 0; 428 flag = TTY_NORMAL;
433 port->icount.rx++; 429 port->icount.rx++;
434 430
435 if ( status & (MPC52xx_PSC_SR_PE | 431 if ( status & (MPC52xx_PSC_SR_PE |
436 MPC52xx_PSC_SR_FE | 432 MPC52xx_PSC_SR_FE |
437 MPC52xx_PSC_SR_RB | 433 MPC52xx_PSC_SR_RB) ) {
438 MPC52xx_PSC_SR_OE) ) {
439 434
440 if (status & MPC52xx_PSC_SR_RB) { 435 if (status & MPC52xx_PSC_SR_RB) {
441 *tty->flip.flag_buf_ptr = TTY_BREAK; 436 flag = TTY_BREAK;
442 uart_handle_break(port); 437 uart_handle_break(port);
443 } else if (status & MPC52xx_PSC_SR_PE) 438 } else if (status & MPC52xx_PSC_SR_PE)
444 *tty->flip.flag_buf_ptr = TTY_PARITY; 439 flag = TTY_PARITY;
445 else if (status & MPC52xx_PSC_SR_FE) 440 else if (status & MPC52xx_PSC_SR_FE)
446 *tty->flip.flag_buf_ptr = TTY_FRAME; 441 flag = TTY_FRAME;
447 if (status & MPC52xx_PSC_SR_OE) {
448 /*
449 * Overrun is special, since it's
450 * reported immediately, and doesn't
451 * affect the current character
452 */
453 if (tty->flip.count < (TTY_FLIPBUF_SIZE-1)) {
454 tty->flip.flag_buf_ptr++;
455 tty->flip.char_buf_ptr++;
456 tty->flip.count++;
457 }
458 *tty->flip.flag_buf_ptr = TTY_OVERRUN;
459 }
460 442
461 /* Clear error condition */ 443 /* Clear error condition */
462 out_8(&PSC(port)->command,MPC52xx_PSC_RST_ERR_STAT); 444 out_8(&PSC(port)->command,MPC52xx_PSC_RST_ERR_STAT);
463 445
464 } 446 }
465 447 tty_insert_flip_char(tty, ch, flag);
466 tty->flip.char_buf_ptr++; 448 if (status & MPC52xx_PSC_SR_OE) {
467 tty->flip.flag_buf_ptr++; 449 /*
468 tty->flip.count++; 450 * Overrun is special, since it's
469 451 * reported immediately, and doesn't
452 * affect the current character
453 */
454 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
455 }
470 } 456 }
471 457
472 tty_flip_buffer_push(tty); 458 tty_flip_buffer_push(tty);