@@ -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");