Skip to content

Commit

Permalink
ARM: ep93xx: properly wait for UART FIFO to be empty
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Ryan Mallon <rmallon@gmail.com>
  • Loading branch information
Florian Fainelli authored and Ryan Mallon committed Dec 12, 2012
1 parent ddffeb8 commit 210dce5
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions arch/arm/mach-ep93xx/include/mach/uncompress.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 210dce5

Please sign in to comment.