* [PATCH] drivers/exynos4210: Wait the end of last transfer before initializing the UART
@ 2013-05-22 11:50 Julien Grall
2013-05-23 11:58 ` Ian Campbell
0 siblings, 1 reply; 4+ messages in thread
From: Julien Grall @ 2013-05-22 11:50 UTC (permalink / raw)
To: xen-devel; +Cc: patches, ian.campbell, Julien Grall, Stefano.Stabellini
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 <julien.grall@linaro.org>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drivers/exynos4210: Wait the end of last transfer before initializing the UART
2013-05-22 11:50 [PATCH] drivers/exynos4210: Wait the end of last transfer before initializing the UART Julien Grall
@ 2013-05-23 11:58 ` Ian Campbell
2013-05-23 12:01 ` Ian Campbell
0 siblings, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2013-05-23 11:58 UTC (permalink / raw)
To: Julien Grall; +Cc: Stefano.Stabellini, patches, xen-devel
On Wed, 2013-05-22 at 12:50 +0100, Julien Grall wrote:
> 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.
It might actually be useful to do this in early_printk, i.e. a new
early_uart_flush or so called from puts and early_puts (or even just
from the putch hook).
Any opinions?
Perhaps we should take this fix as is for 4.3 and look at the
alternatives for 4.4?
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> ---
> 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);
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drivers/exynos4210: Wait the end of last transfer before initializing the UART
2013-05-23 11:58 ` Ian Campbell
@ 2013-05-23 12:01 ` Ian Campbell
2013-05-23 13:40 ` Julien Grall
0 siblings, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2013-05-23 12:01 UTC (permalink / raw)
To: Julien Grall; +Cc: patches, xen-devel, Stefano.Stabellini
On Thu, 2013-05-23 at 12:58 +0100, Ian Campbell wrote:
> On Wed, 2013-05-22 at 12:50 +0100, Julien Grall wrote:
> > 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.
>
> It might actually be useful to do this in early_printk, i.e. a new
> early_uart_flush or so called from puts and early_puts (or even just
> from the putch hook).
BTW, my concern here is crashing without flushing the buffer and
therefore missing a useful message or having a misleading log...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drivers/exynos4210: Wait the end of last transfer before initializing the UART
2013-05-23 12:01 ` Ian Campbell
@ 2013-05-23 13:40 ` Julien Grall
0 siblings, 0 replies; 4+ messages in thread
From: Julien Grall @ 2013-05-23 13:40 UTC (permalink / raw)
To: Ian Campbell; +Cc: patches, xen-devel, Stefano.Stabellini
On 05/23/2013 01:01 PM, Ian Campbell wrote:
> On Thu, 2013-05-23 at 12:58 +0100, Ian Campbell wrote:
>> On Wed, 2013-05-22 at 12:50 +0100, Julien Grall wrote:
>>> 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.
>>
>> It might actually be useful to do this in early_printk, i.e. a new
>> early_uart_flush or so called from puts and early_puts (or even just
>> from the putch hook).
>
> BTW, my concern here is crashing without flushing the buffer and
> therefore missing a useful message or having a misleading log...
>
>
Right. The change is not complicate, so I will create early_uart_flush
and call it in early_printk.
--
Julien
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-23 13:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-22 11:50 [PATCH] drivers/exynos4210: Wait the end of last transfer before initializing the UART Julien Grall
2013-05-23 11:58 ` Ian Campbell
2013-05-23 12:01 ` Ian Campbell
2013-05-23 13:40 ` Julien Grall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).