Skip to content

Commit 33ae787

Browse files
shariffsinboxgregkh
authored andcommitted
serial: tegra: add support to ignore read
Add support to ignore read characters if CREAD flag is not set. Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com> Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com> Link: https://lore.kernel.org/r/1567572187-29820-2-git-send-email-kyarlagadda@nvidia.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9c801e3 commit 33ae787

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/tty/serial/serial-tegra.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,9 @@ static void tegra_uart_handle_rx_pio(struct tegra_uart_port *tup,
547547

548548
if (!uart_handle_sysrq_char(&tup->uport, ch) && tty)
549549
tty_insert_flip_char(tty, ch, flag);
550+
551+
if (tup->uport.ignore_status_mask & UART_LSR_DR)
552+
continue;
550553
} while (1);
551554
}
552555

@@ -565,6 +568,10 @@ static void tegra_uart_copy_rx_to_tty(struct tegra_uart_port *tup,
565568
dev_err(tup->uport.dev, "No tty port\n");
566569
return;
567570
}
571+
572+
if (tup->uport.ignore_status_mask & UART_LSR_DR)
573+
return;
574+
568575
dma_sync_single_for_cpu(tup->uport.dev, tup->rx_dma_buf_phys,
569576
TEGRA_UART_RX_DMA_BUFFER_SIZE, DMA_FROM_DEVICE);
570577
copied = tty_insert_flip_string(tty,
@@ -1193,6 +1200,11 @@ static void tegra_uart_set_termios(struct uart_port *u,
11931200
tegra_uart_write(tup, tup->ier_shadow, UART_IER);
11941201
tegra_uart_read(tup, UART_IER);
11951202

1203+
tup->uport.ignore_status_mask = 0;
1204+
/* Ignore all characters if CREAD is not set */
1205+
if ((termios->c_cflag & CREAD) == 0)
1206+
tup->uport.ignore_status_mask |= UART_LSR_DR;
1207+
11961208
spin_unlock_irqrestore(&u->lock, flags);
11971209
}
11981210

0 commit comments

Comments
 (0)