Commit 55d8693a authored by Jiada Wang's avatar Jiada Wang Committed by Greg Kroah-Hartman

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: default avatarJiada Wang <jiada_wang@mentor.com>
Signed-off-by: default avatarAnton Bondarenko <anton_bondarenko@mentor.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1842dc2e
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
#define IMX21_UTS 0xb4 /* UART Test Register on all other i.mx*/ #define IMX21_UTS 0xb4 /* UART Test Register on all other i.mx*/
/* UART Control Register Bit Fields.*/ /* UART Control Register Bit Fields.*/
#define URXD_DUMMY_READ (1<<16)
#define URXD_CHARRDY (1<<15) #define URXD_CHARRDY (1<<15)
#define URXD_ERR (1<<14) #define URXD_ERR (1<<14)
#define URXD_OVRRUN (1<<13) #define URXD_OVRRUN (1<<13)
...@@ -710,6 +711,9 @@ static irqreturn_t imx_rxint(int irq, void *dev_id) ...@@ -710,6 +711,9 @@ static irqreturn_t imx_rxint(int irq, void *dev_id)
#endif #endif
} }
if (sport->port.ignore_status_mask & URXD_DUMMY_READ)
goto out;
tty_insert_flip_char(port, rx, flg); tty_insert_flip_char(port, rx, flg);
} }
...@@ -910,7 +914,8 @@ static void dma_rx_callback(void *data) ...@@ -910,7 +914,8 @@ static void dma_rx_callback(void *data)
dev_dbg(sport->port.dev, "We get %d bytes.\n", count); dev_dbg(sport->port.dev, "We get %d bytes.\n", count);
if (count) { if (count) {
tty_insert_flip_string(port, sport->rx_buf, count); if (!(sport->port.ignore_status_mask & URXD_DUMMY_READ))
tty_insert_flip_string(port, sport->rx_buf, count);
tty_flip_buffer_push(port); tty_flip_buffer_push(port);
start_rx_dma(sport); start_rx_dma(sport);
...@@ -1330,6 +1335,9 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios, ...@@ -1330,6 +1335,9 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
sport->port.ignore_status_mask |= URXD_OVRRUN; sport->port.ignore_status_mask |= URXD_OVRRUN;
} }
if ((termios->c_cflag & CREAD) == 0)
sport->port.ignore_status_mask |= URXD_DUMMY_READ;
/* /*
* Update the per-port timeout. * Update the per-port timeout.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment