Skip to contentSkip to conversation

ARM: ep93xx: properly wait for UART FIFO to be empty

PATCH New Florian Fainelli 2 participants 2 messages Dec 10, 2012 – Dec 12, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: ep93xx: properly wait for UART FIFO to be empty

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.

---
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(-)
arch/arm/mach-ep93xx/include/mach/uncompress.h +3 -7
index 16026c2..d64274f 100644
@@ -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);
 }
Signature · 1 line
1.7.10.4
Applied
#1 lore raw

PATCH 1/1 ARM: ep93xx: properly wait for UART FIFO to be empty

Quoted 6 lines · Florian Fainelli

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

Quoted 8 lines

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.

---
Ryan, this is based on your ep93xx-fixes branch, thanks!

Thank you,

Applied to ep93xx-fixes.

~Ryan

Quoted 26 lines
 arch/arm/mach-ep93xx/include/mach/uncompress.h |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
arch/arm/mach-ep93xx/include/mach/uncompress.h +3 -7
index 16026c2..d64274f 100644
@@ -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);
 }