Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- drivers/tty/serial/xilinx_uartps.c | 11 ++++++++++-
- 1 file changed, 10 insertions(+), 1 deletion(-)
+ drivers/tty/serial/xilinx_uartps.c | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
/* Rx Trigger level */
static int rx_trigger_level = 56;
-@@ -681,7 +683,8 @@ static void cdns_uart_set_termios(struct
+@@ -681,16 +683,20 @@ static void cdns_uart_set_termios(struct
unsigned int cval = 0;
unsigned int baud, minbaud, maxbaud;
unsigned long flags;
spin_lock_irqsave(&port->lock, flags);
-@@ -691,6 +694,12 @@ static void cdns_uart_set_termios(struct
- while (!(readl(port->membase + CDNS_UART_SR) &
- CDNS_UART_SR_TXEMPTY)) {
- cpu_relax();
+ /* Wait for the transmit FIFO to empty before making changes */
+ if (!(readl(port->membase + CDNS_UART_CR) &
+ CDNS_UART_CR_TX_DIS)) {
+- while (!(readl(port->membase + CDNS_UART_SR) &
+- CDNS_UART_SR_TXEMPTY)) {
+- cpu_relax();
+ err = readl_poll_timeout(port->membase + CDNS_UART_SR,
+ val, (val & CDNS_UART_SR_TXEMPTY),
+ 1000, TX_TIMEOUT);
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
-@@ -1277,6 +1277,7 @@ static int cdns_uart_console_setup(struc
+@@ -1274,6 +1274,7 @@ static int cdns_uart_console_setup(struc
int bits = 8;
int parity = 'n';
int flow = 'n';
if (co->index < 0 || co->index >= CDNS_UART_NR_PORTS)
return -EINVAL;
-@@ -1290,6 +1291,13 @@ static int cdns_uart_console_setup(struc
+@@ -1287,6 +1288,13 @@ static int cdns_uart_console_setup(struc
if (options)
uart_parse_options(options, &baud, &parity, &bits, &flow);