From: Haavard Skinnemoen Date: Fri, 14 Mar 2008 13:54:13 +0000 (+0100) Subject: atmel_serial: Drain console TX shifter before suspending X-Git-Tag: upstream/snapshot3+hdmi~24391^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e1c609efbc0333840f2af2d875ca52ed8ee18587;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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 Cc: Andrew Victor --- diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index 5f0414f..6aeef22b 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, 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);