]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
serial/imx: support to handle break character
authorHui Wang <jason77.wang@gmail.com>
Wed, 24 Aug 2011 09:41:47 +0000 (17:41 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:34:22 +0000 (08:34 +0200)
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>
(cherry picked from commit 019dc9ea8d528eb3640bbba604e1e5a2f6994b1f)

drivers/tty/serial/imx.c

index fa453518139f91a29958bf7e526f3c8c27265f91..10163b61cda17815167baf21f8995cefec794688 100644 (file)
@@ -556,8 +556,10 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
                if (uart_handle_sysrq_char(&sport->port, (unsigned char)rx))
                        continue;
 
-               if (rx & (URXD_PRERR | URXD_OVRRUN | URXD_FRMERR) ) {
-                       if (rx & URXD_PRERR)
+               if (unlikely(rx & URXD_ERR)) {
+                       if (rx & URXD_BRK)
+                               sport->port.icount.brk++;
+                       else if (rx & URXD_PRERR)
                                sport->port.icount.parity++;
                        else if (rx & URXD_FRMERR)
                                sport->port.icount.frame++;
@@ -572,7 +574,9 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
 
                        rx &= sport->port.read_status_mask;
 
-                       if (rx & URXD_PRERR)
+                       if (rx & URXD_BRK)
+                               flg = TTY_BREAK;
+                       else if (rx & URXD_PRERR)
                                flg = TTY_PARITY;
                        else if (rx & URXD_FRMERR)
                                flg = TTY_FRAME;