aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-xlnx/3.10/tty-xuartps-Fix-RX-hang-and-TX-corruption-in-set_termios.patch
blob: 4ecd4e48b012104285dedbcdd02e316cb0fc9e70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From c2a532266240230c5b49e56f1035e9ba27a61d96 Mon Sep 17 00:00:00 2001
From: Nathan Rossi <nathan.rossi@xilinx.com>
Date: Mon, 24 Nov 2014 15:11:43 +1000
Subject: [PATCH] tty: xuartps: Fix RX hang, and TX corruption in set_termios

Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
---
 drivers/tty/serial/xilinx_uartps.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index faf2d90..7c842f2 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -642,10 +642,11 @@ static void xuartps_set_termios(struct uart_port *port,
 
 	spin_lock_irqsave(&port->lock, flags);
 
-	/* Empty the receive FIFO 1st before making changes */
-	while ((xuartps_readl(XUARTPS_SR_OFFSET) &
-		 XUARTPS_SR_RXEMPTY) != XUARTPS_SR_RXEMPTY)
-		xuartps_readl(XUARTPS_FIFO_OFFSET);
+	/* Wait for the transmit FIFO to empty before making changes */
+	if (!(xuartps_readl(XUARTPS_CR_OFFSET) & XUARTPS_CR_TX_DIS)) {
+		while (!(xuartps_readl(XUARTPS_SR_OFFSET) & XUARTPS_SR_TXEMPTY))
+			cpu_relax();
+	}
 
 	/* Disable the TX and RX to set baud rate */
 	xuartps_writel(xuartps_readl(XUARTPS_CR_OFFSET) |
-- 
2.1.1