summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH Hartley Sweeten <hartleys@visionengravers.com>2013-03-15 19:16:52 -0500
committerRyan Mallon <rmallon@gmail.com>2013-03-18 09:40:38 +1100
commit605c357bb40ce412c086f3a928d07c1d4349b95b (patch)
tree8abc56dbea1bf45a1dda949b9bcb650b56255db7
parent6dbe51c251a327e012439c4772097a13df43c5b8 (diff)
ARM: ep93xx: Fix wait for UART FIFO to be empty
Commit 210dce5f "ARM: ep93xx: properly wait for UART FIFO to be empty" Removed the timeout loop while waiting for the uart transmit fifo to empty. Some bootloaders leave the uart in a state where there might be bytes in the uart that are not transmitted when execution is handed over to the kernel. This results in a deadlocked system while waiting for the fifo to empty. Add back the timeout wait to prevent the deadlock. Increase the wait time to hopefully prevent the decompressor corruption that lead to commit 210dce5f. This corruption was probably due to a slow uart baudrate. The 10* increase in the wait time should be enough for all cases. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Acked-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Ryan Mallon <rmallon@gmail.com>
-rw-r--r--arch/arm/mach-ep93xx/include/mach/uncompress.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/arm/mach-ep93xx/include/mach/uncompress.h b/arch/arm/mach-ep93xx/include/mach/uncompress.h
index d2afb4dd82a..b5cc77d2380 100644
--- a/arch/arm/mach-ep93xx/include/mach/uncompress.h
+++ b/arch/arm/mach-ep93xx/include/mach/uncompress.h
@@ -47,9 +47,13 @@ static void __raw_writel(unsigned int value, unsigned int ptr)
static inline void putc(int c)
{
- /* Transmit fifo not full? */
- while (__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF)
- ;
+ int i;
+
+ for (i = 0; i < 10000; i++) {
+ /* Transmit fifo not full? */
+ if (!(__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF))
+ break;
+ }
__raw_writeb(c, PHYS_UART_DATA);
}