]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
serial: samsung: wait for transfer completion before clock disable
authorRobert Baldyga <r.baldyga@samsung.com>
Mon, 24 Nov 2014 06:56:21 +0000 (07:56 +0100)
committerJiri Slaby <jslaby@suse.cz>
Mon, 26 Jan 2015 13:38:59 +0000 (14:38 +0100)
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 <r.baldyga@samsung.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/tty/serial/samsung.c

index f3dfa19a1cb86eb4c8dd0b47ea8f23b8bab5f0e8..6b0adfbfacafb55487e5cd9d29ed36e4d869db37 100644 (file)
@@ -537,11 +537,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);