commit: http://blackfin.uclinux.org/git/?p=u-boot;a=commitdiff;h=db270fca4b0b51a14f3226840e980619869aacec
branch: http://blackfin.uclinux.org/git/?p=u-boot;a=shortlog;h=refs/heads/trunk

In BFIN_BOOT_BYPASS mode, don't call generic serial_puts, because
early print in bypass mode is running before code binary is reloccated
to the link address.

Signed-off-by: Sonic Zhang <sonic.zh...@analog.com>
---
 arch/blackfin/cpu/serial.c |   23 +++++++++++++++++++++++
 arch/blackfin/cpu/serial.h |   12 ++++--------
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/arch/blackfin/cpu/serial.c b/arch/blackfin/cpu/serial.c
index 4e07509..51d5071 100644
--- a/arch/blackfin/cpu/serial.c
+++ b/arch/blackfin/cpu/serial.c
@@ -315,6 +315,28 @@ void bfin_serial_initialize(void)
 #endif
 }
 
+#ifdef CONFIG_DEBUG_EARLY_SERIAL
+inline void uart_early_putc(uint32_t uart_base, const char c)
+{
+	/* send a \r for compatibility */
+	if (c == '\n')
+		uart_early_putc(uart_base, '\r');
+
+	/* wait for the hardware fifo to clear up */
+	while (!(_lsr_read(pUART) & THRE))
+		continue;
+
+	/* queue the character for transmission */
+	bfin_write(&pUART->thr, c);
+	SSYNC();
+}
+
+void uart_early_puts(const char *s)
+{
+	while (*s)
+		uart_early_putc(UART_BASE, *s++);
+}
+
 /* Symbol for our assembly to call. */
 void _serial_early_set_baud(uint32_t baud)
 {
@@ -326,6 +348,7 @@ void _serial_early_init(void)
 {
 	serial_early_init(UART_BASE);
 }
+#endif
 
 #elif defined(CONFIG_UART_MEM)
 
diff --git a/arch/blackfin/cpu/serial.h b/arch/blackfin/cpu/serial.h
index a21393f..87a337d 100644
--- a/arch/blackfin/cpu/serial.h
+++ b/arch/blackfin/cpu/serial.h
@@ -78,17 +78,13 @@ static inline void serial_early_puts(const char *s)
 #else
 
 .macro serial_early_init
-#if defined(CONFIG_DEBUG_EARLY_SERIAL) && \
-	CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS && \
-	!defined(CONFIG_UART_MEM)
+#if defined(CONFIG_DEBUG_EARLY_SERIAL) && !defined(CONFIG_UART_MEM)
 	call __serial_early_init;
 #endif
 .endm
 
 .macro serial_early_set_baud
-#if defined(CONFIG_DEBUG_EARLY_SERIAL) && \
-	CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS && \
-	!defined(CONFIG_UART_MEM)
+#if defined(CONFIG_DEBUG_EARLY_SERIAL) && !defined(CONFIG_UART_MEM)
 	R0.L = LO(CONFIG_BAUDRATE);
 	R0.H = HI(CONFIG_BAUDRATE);
 	call __serial_early_set_baud;
@@ -120,12 +116,12 @@ static inline void serial_early_puts(const char *s)
 	.ascii __FILE__; \
 	.ascii ": "; \
 	.ascii str; \
-	.ascii "\n"; \
+	.asciz "\n"; \
 	.previous; \
 	R0.L = 7b; \
 	R0.H = 7b; \
 	update_serial_early_string_addr \
-	call _serial_puts;
+	call _uart_early_puts;
 #else
 # define serial_early_puts(str)
 #endif
_______________________________________________
U-Boot-commits mailing list
U-Boot-commits@blackfin.uclinux.org
https://blackfin.uclinux.org/mailman/listinfo/u-boot-commits

Reply via email to