linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: shubhrajyoti.datta@gmail.com
To: linux-serial@vger.kernel.org
Cc: gregkh@linuxfoundation.org, jacmet@sunsite.dk, git@xilinx.com,
	Raviteja Narayanam <raviteja.narayanam@xilinx.com>
Subject: [PATCH] serial: uartps: Add monitoring TACTIVE bit in set_termios
Date: Tue,  7 Jan 2020 17:25:36 +0530	[thread overview]
Message-ID: <1578398136-26170-1-git-send-email-shubhrajyoti.datta@gmail.com> (raw)

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


                 reply	other threads:[~2020-01-07 12:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1578398136-26170-1-git-send-email-shubhrajyoti.datta@gmail.com \
    --to=shubhrajyoti.datta@gmail.com \
    --cc=git@xilinx.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jacmet@sunsite.dk \
    --cc=linux-serial@vger.kernel.org \
    --cc=raviteja.narayanam@xilinx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).