From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: [PATCH] drivers/exynos4210: Wait the end of last transfer before initializing the UART Date: Wed, 22 May 2013 12:50:56 +0100 Message-ID: <1369223456-3701-1-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: patches@linaro.org, ian.campbell@citrix.com, Julien Grall , Stefano.Stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org When early printk is enabled by the user, it's possible to loose the last characters if the UART is initialized without waiting that the last transfer was completed. Signed-off-by: Julien Grall --- xen/drivers/char/exynos4210-uart.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xen/drivers/char/exynos4210-uart.c b/xen/drivers/char/exynos4210-uart.c index f7971da..13758d4 100644 --- a/xen/drivers/char/exynos4210-uart.c +++ b/xen/drivers/char/exynos4210-uart.c @@ -104,6 +104,12 @@ static void __init exynos4210_uart_init_preirq(struct serial_port *port) unsigned int divisor; uint32_t ulcon; +#ifdef EARLY_PRINTK + /* Flush the UART */ + while ( !(exynos4210_read(uart, UTRSTAT) & UTRSTAT_TX_EMPTY) ) + cpu_relax(); +#endif + /* reset, TX/RX disables */ exynos4210_write(uart, UCON, 0); -- 1.7.10.4