linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: ep93xx: properly wait for UART FIFO to be empty
@ 2012-12-10 21:21 Florian Fainelli
  2012-12-12  0:25 ` Ryan Mallon
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2012-12-10 21:21 UTC (permalink / raw)
  To: linux-arm-kernel

This patch changes the busy-waiting loop around in the decompressor
putc() function on the UART FIFO register. Without a proper wait, the
output of the decompressor was corrupted like this:

Uncompressing Linx. done, booting th enl

To highlight the issue more evidently, looping 100 times instead of 1000
makes the issue appear much faster. This patch takes the approach of
using an active while loop until the FIFO is empty (not FULL).
This issue happened to me on Sim.One running at 200Mhz.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
Ryan, this is based on your ep93xx-fixes branch, thanks!

 arch/arm/mach-ep93xx/include/mach/uncompress.h |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-ep93xx/include/mach/uncompress.h b/arch/arm/mach-ep93xx/include/mach/uncompress.h
index 16026c2..d64274f 100644
--- a/arch/arm/mach-ep93xx/include/mach/uncompress.h
+++ b/arch/arm/mach-ep93xx/include/mach/uncompress.h
@@ -47,13 +47,9 @@ static void __raw_writel(unsigned int value, unsigned int ptr)
 
 static inline void putc(int c)
 {
-	int i;
-
-	for (i = 0; i < 1000; i++) {
-		/* Transmit fifo not full?  */
-		if (!(__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF))
-			break;
-	}
+	/* Transmit fifo not full?  */
+	while (__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF)
+		;
 
 	__raw_writeb(c, PHYS_UART_DATA);
 }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] ARM: ep93xx: properly wait for UART FIFO to be empty
  2012-12-10 21:21 [PATCH] ARM: ep93xx: properly wait for UART FIFO to be empty Florian Fainelli
@ 2012-12-12  0:25 ` Ryan Mallon
  0 siblings, 0 replies; 2+ messages in thread
From: Ryan Mallon @ 2012-12-12  0:25 UTC (permalink / raw)
  To: linux-arm-kernel

On 11/12/12 08:21, Florian Fainelli wrote:
> This patch changes the busy-waiting loop around in the decompressor
> putc() function on the UART FIFO register. Without a proper wait, the
> output of the decompressor was corrupted like this:
> 
> Uncompressing Linx. done, booting th enl
> 
> To highlight the issue more evidently, looping 100 times instead of 1000
> makes the issue appear much faster. This patch takes the approach of
> using an active while loop until the FIFO is empty (not FULL).
> This issue happened to me on Sim.One running at 200Mhz.
> 
> Signed-off-by: Florian Fainelli <florian@openwrt.org>
> ---
> Ryan, this is based on your ep93xx-fixes branch, thanks!

Thank you,

Applied to ep93xx-fixes.

~Ryan

> 
>  arch/arm/mach-ep93xx/include/mach/uncompress.h |   10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/mach-ep93xx/include/mach/uncompress.h b/arch/arm/mach-ep93xx/include/mach/uncompress.h
> index 16026c2..d64274f 100644
> --- a/arch/arm/mach-ep93xx/include/mach/uncompress.h
> +++ b/arch/arm/mach-ep93xx/include/mach/uncompress.h
> @@ -47,13 +47,9 @@ static void __raw_writel(unsigned int value, unsigned int ptr)
>  
>  static inline void putc(int c)
>  {
> -	int i;
> -
> -	for (i = 0; i < 1000; i++) {
> -		/* Transmit fifo not full?  */
> -		if (!(__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF))
> -			break;
> -	}
> +	/* Transmit fifo not full?  */
> +	while (__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF)
> +		;
>  
>  	__raw_writeb(c, PHYS_UART_DATA);
>  }
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-12  0:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-10 21:21 [PATCH] ARM: ep93xx: properly wait for UART FIFO to be empty Florian Fainelli
2012-12-12  0:25 ` Ryan Mallon

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).