linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2] serial: uartps: Add monitoring TACTIVE bit in set_termios
@ 2020-01-07 11:57 shubhrajyoti.datta
  2020-01-07 12:51 ` Johan Hovold
  0 siblings, 1 reply; 2+ messages in thread
From: shubhrajyoti.datta @ 2020-01-07 11:57 UTC (permalink / raw)
  To: linux-serial; +Cc: gregkh, jacmet, git, Raviteja Narayanam, Shubhrajyoti Datta

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>
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
v2: fix the signed-off

 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 4e55bc3..7424f33 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -690,11 +690,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.1.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-07 12:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-07 11:57 [PATCHv2] serial: uartps: Add monitoring TACTIVE bit in set_termios shubhrajyoti.datta
2020-01-07 12:51 ` Johan Hovold

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).