Commit 69db2635ad6a3735caa4fad2b5286c15135b9105

Authored by Robert Baldyga
Committed by Greg Kroah-Hartman
1 parent 0fd0e781e9

serial: samsung: wait for transfer completion before clock disable

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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 4 additions and 0 deletions Side-by-side Diff

drivers/tty/serial/samsung.c
... ... @@ -559,11 +559,15 @@
559 559 unsigned int old)
560 560 {
561 561 struct s3c24xx_uart_port *ourport = to_ourport(port);
  562 + int timeout = 10000;
562 563  
563 564 ourport->pm_level = level;
564 565  
565 566 switch (level) {
566 567 case 3:
  568 + while (--timeout && !s3c24xx_serial_txempty_nofifo(port))
  569 + udelay(100);
  570 +
567 571 if (!IS_ERR(ourport->baudclk))
568 572 clk_disable_unprepare(ourport->baudclk);
569 573