aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/atmel_serial.c
diff options
context:
space:
mode:
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-03-14 09:54:13 -0400
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-07-02 05:05:00 -0400
commite1c609efbc0333840f2af2d875ca52ed8ee18587 (patch)
tree29839e026441063433828813b6758a16aa88e9a6 /drivers/serial/atmel_serial.c
parentf826caa44902ddbe93174f0b642d8abf9698c08e (diff)
atmel_serial: Drain console TX shifter before suspending
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>
Diffstat (limited to 'drivers/serial/atmel_serial.c')
-rw-r--r--drivers/serial/atmel_serial.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 5f0414fc1b10..6aeef22bd203 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -1454,6 +1454,12 @@ static int atmel_serial_suspend(struct platform_device *pdev,
1454 struct uart_port *port = platform_get_drvdata(pdev); 1454 struct uart_port *port = platform_get_drvdata(pdev);
1455 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); 1455 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
1456 1456
1457 if (atmel_is_console_port(port) && console_suspend_enabled) {
1458 /* Drain the TX shifter */
1459 while (!(UART_GET_CSR(port) & ATMEL_US_TXEMPTY))
1460 cpu_relax();
1461 }
1462
1457 if (device_may_wakeup(&pdev->dev) 1463 if (device_may_wakeup(&pdev->dev)
1458 && !atmel_serial_clk_will_stop()) 1464 && !atmel_serial_clk_will_stop())
1459 enable_irq_wake(port->irq); 1465 enable_irq_wake(port->irq);