Thread (140 messages) 140 messages, 1 author, 2015-01-29
STALE4138d

[PATCH 3.13.y-ckt 054/139] serial: samsung: wait for transfer completion before clock disable

From: Kamal Mostafa <hidden>
Date: 2015-01-29 03:19:55
Also in: lkml
Subsystem: arm/samsung s3c, s5p and exynos arm architectures, the rest, tty layer and serial drivers · Maintainers: Krzysztof Kozlowski, Linus Torvalds, Greg Kroah-Hartman, Jiri Slaby

3.13.11-ckt15 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Robert Baldyga <redacted>

commit 1ff383a4c3eda8893ec61b02831826e1b1f46b41 upstream.

This patch adds waiting until transmit buffer and shifter will be empty
before clock disabling.

Without this fix it's possible to have clock disabled while data was
not transmited yet, which causes unproper state of TX line and problems
in following data transfers.

Signed-off-by: Robert Baldyga <redacted>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <redacted>
---
 drivers/tty/serial/samsung.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index c1af04d..6097355 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -544,11 +544,15 @@ static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level,
 			      unsigned int old)
 {
 	struct s3c24xx_uart_port *ourport = to_ourport(port);
+	int timeout = 10000;
 
 	ourport->pm_level = level;
 
 	switch (level) {
 	case 3:
+		while (--timeout && !s3c24xx_serial_txempty_nofifo(port))
+			udelay(100);
+
 		if (!IS_ERR(ourport->baudclk))
 			clk_disable_unprepare(ourport->baudclk);
 
-- 
1.9.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help