Linux-Serial Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] serial: uartps: Add monitoring TACTIVE bit in set_termios
@ 2020-01-07 11:55 shubhrajyoti.datta
  0 siblings, 0 replies; only message in thread
From: shubhrajyoti.datta @ 2020-01-07 11:55 UTC (permalink / raw)
  To: linux-serial; +Cc: gregkh, jacmet, git, Raviteja Narayanam

From: Raviteja Narayanam <raviteja.narayanam@xilinx.com>

Before setting up baud rate in set_termios function, make sure
all the data is shifted out from the Uart transmitter by
monitoring TACTIVE bit in the channel status register.

Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
---
 drivers/tty/serial/xilinx_uartps.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index ed2f325..c337544 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -703,11 +703,15 @@ static void cdns_uart_set_termios(struct uart_port *port,
 	unsigned int ctrl_reg, mode_reg, val;
 	int err;
 
-	/* Wait for the transmit FIFO to empty before making changes */
+	/* Wait for the transmit FIFO to empty and Transmitter to shift out
+	 * all the data before making changes
+	 */
 	if (!(readl(port->membase + CDNS_UART_CR) &
 				CDNS_UART_CR_TX_DIS)) {
 		err = readl_poll_timeout(port->membase + CDNS_UART_SR,
-					 val, (val & CDNS_UART_SR_TXEMPTY),
+					 val, ((val & (CDNS_UART_SR_TXEMPTY |
+					 CDNS_UART_SR_TACTIVE)) ==
+					 CDNS_UART_SR_TXEMPTY),
 					 1000, TX_TIMEOUT);
 		if (err) {
 			dev_err(port->dev, "timed out waiting for tx empty");
-- 
2.7.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-07 11:55 [PATCH] serial: uartps: Add monitoring TACTIVE bit in set_termios shubhrajyoti.datta

Linux-Serial Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-serial/0 linux-serial/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-serial linux-serial/ https://lore.kernel.org/linux-serial \
		linux-serial@vger.kernel.org
	public-inbox-index linux-serial

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-serial


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git