aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Baldyga <r.baldyga@samsung.com>2014-11-24 07:56:21 +0100
committerStefan Bader <stefan.bader@canonical.com>2015-05-29 11:54:14 +0200
commite76f71b358a46f45f9ac26cb5ef4963179e32483 (patch)
tree690a5cca82a0101cf50e72470a480d8a4976054d
parent61be54706f6cc94a390e0578b700913c3b680ec8 (diff)
downloadlinux-2.6.32.y-drm33.z-e76f71b358a46f45f9ac26cb5ef4963179e32483.tar.gz
serial: samsung: wait for transfer completion before clock disable
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. Cc: stable@vger.kernel.org Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit 1ff383a4c3eda8893ec61b02831826e1b1f46b41) Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
-rw-r--r--drivers/serial/samsung.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/serial/samsung.c b/drivers/serial/samsung.c
index 1523e8d9ae778..fe6ef16b59569 100644
--- a/drivers/serial/samsung.c
+++ b/drivers/serial/samsung.c
@@ -443,11 +443,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) && ourport->baudclk != NULL)
clk_disable(ourport->baudclk);