Skip to content

Commit 55d8693

Browse files
jiada-wanggregkh
authored andcommitted
serial: imx: add CREAD flag support
Add CREAD flag hanlding in set_termios and UART DMA mode which ignores all received chars when CREAD flag cleared. Signed-off-by: Jiada Wang <[email protected]> Signed-off-by: Anton Bondarenko <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1842dc2 commit 55d8693

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/tty/serial/imx.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
#define IMX21_UTS 0xb4 /* UART Test Register on all other i.mx*/
7575

7676
/* UART Control Register Bit Fields.*/
77+
#define URXD_DUMMY_READ (1<<16)
7778
#define URXD_CHARRDY (1<<15)
7879
#define URXD_ERR (1<<14)
7980
#define URXD_OVRRUN (1<<13)
@@ -710,6 +711,9 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
710711
#endif
711712
}
712713

714+
if (sport->port.ignore_status_mask & URXD_DUMMY_READ)
715+
goto out;
716+
713717
tty_insert_flip_char(port, rx, flg);
714718
}
715719

@@ -910,7 +914,8 @@ static void dma_rx_callback(void *data)
910914
dev_dbg(sport->port.dev, "We get %d bytes.\n", count);
911915

912916
if (count) {
913-
tty_insert_flip_string(port, sport->rx_buf, count);
917+
if (!(sport->port.ignore_status_mask & URXD_DUMMY_READ))
918+
tty_insert_flip_string(port, sport->rx_buf, count);
914919
tty_flip_buffer_push(port);
915920

916921
start_rx_dma(sport);
@@ -1330,6 +1335,9 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
13301335
sport->port.ignore_status_mask |= URXD_OVRRUN;
13311336
}
13321337

1338+
if ((termios->c_cflag & CREAD) == 0)
1339+
sport->port.ignore_status_mask |= URXD_DUMMY_READ;
1340+
13331341
/*
13341342
* Update the per-port timeout.
13351343
*/

0 commit comments

Comments
 (0)