]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
atmel_serial: Drain console TX shifter before suspending
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
Fri, 14 Mar 2008 13:54:13 +0000 (14:54 +0100)
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
Wed, 2 Jul 2008 09:05:00 +0000 (11:05 +0200)
Funny things may happen if we stop the USART clock before the shifter is
empty. Prevent this from happening by waiting until the shifter is
completely drained before allowing suspend to continue.

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Cc: Andrew Victor <linux@maxim.org.za>
drivers/serial/atmel_serial.c

index 5f0414fc1b106f9f004385fb204c92e0c0c3b9b9..6aeef22bd2039ea41fbfc2cc6062dbb4c03cd83e 100644 (file)
@@ -1454,6 +1454,12 @@ static int atmel_serial_suspend(struct platform_device *pdev,
        struct uart_port *port = platform_get_drvdata(pdev);
        struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
 
+       if (atmel_is_console_port(port) && console_suspend_enabled) {
+               /* Drain the TX shifter */
+               while (!(UART_GET_CSR(port) & ATMEL_US_TXEMPTY))
+                       cpu_relax();
+       }
+
        if (device_may_wakeup(&pdev->dev)
            && !atmel_serial_clk_will_stop())
                enable_irq_wake(port->irq);