aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/imx.c
diff options
context:
space:
mode:
authorHui Wang <jason77.wang@gmail.com>2011-08-24 05:41:47 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-24 18:27:59 -0400
commit019dc9ea8d528eb3640bbba604e1e5a2f6994b1f (patch)
tree7acf8e0361af95ea8ab490a6cd2fff4f6a4ac5b9 /drivers/tty/serial/imx.c
parent9a234349de01de3437784c0ef03d95353f055fae (diff)
serial/imx: support to handle break character
The imx UART hardware controller can identify BREAK character and the imx_set_termios() can accept BRKINT set by users, but current existing imx_rxint() can't pass BREAK character and TTY_BREAK to the tty layer as other serial drivers do (8250.c omap_serial.c). Here add code to handle BREAK character and pass it to tty layer. To detect error occurrence, i use URXD_ERR to replace (URXD_OVRRUN | URXD_FRMERR | ...) because any kind of error occurs, URXD_ERR will always be set to 1. I put the URXD_BRK to the first place to check since when BREAK error occurs, not only URXD_BRK is set to 1, but also URXD_PRERR and URXD_FRMERR are all set to 1. This arrangement can filter out fake parity and frame errors when BREAK error occurs. Signed-off-by: Hui Wang <jason77.wang@gmail.com> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/tty/serial/imx.c')
-rw-r--r--drivers/tty/serial/imx.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 7e91b3d368cd..54ffdc6243f9 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -508,8 +508,10 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
508 if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx)) 508 if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx))
509 continue; 509 continue;
510 510
511 if (rx & (URXD_PRERR | URXD_OVRRUN | URXD_FRMERR) ) { 511 if (unlikely(rx & URXD_ERR)) {
512 if (rx & URXD_PRERR) 512 if (rx & URXD_BRK)
513 sport->port.icount.brk++;
514 else if (rx & URXD_PRERR)
513 sport->port.icount.parity++; 515 sport->port.icount.parity++;
514 else if (rx & URXD_FRMERR) 516 else if (rx & URXD_FRMERR)
515 sport->port.icount.frame++; 517 sport->port.icount.frame++;
@@ -524,7 +526,9 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
524 526
525 rx &= sport->port.read_status_mask; 527 rx &= sport->port.read_status_mask;
526 528
527 if (rx & URXD_PRERR) 529 if (rx & URXD_BRK)
530 flg = TTY_BREAK;
531 else if (rx & URXD_PRERR)
528 flg = TTY_PARITY; 532 flg = TTY_PARITY;
529 else if (rx & URXD_FRMERR) 533 else if (rx & URXD_FRMERR)
530 flg = TTY_FRAME; 534 flg = TTY_FRAME;