[U-Boot] [PATCH] tegra: Specify debugging serial port at boot.

Stephen Warren swarren at wwwdotorg.org
Tue Mar 20 20:57:00 CET 2012


This works together with a kernel change that looks at the scratchpad
register to determine which of the many UARTs it should use for early
printing:

http://www.spinics.net/lists/arm-kernel/msg154633.html

Note that this configuration only affects the kernel's decompressor and
earlyprintk code. Once the kernel is initialized far enough to parse the
device tree, the console is initialized using information contained
therein.

Base on work by Doug Anderson <dianders at chromium.org>, but significantly
rewritten.

Signed-off-by: Stephen Warren <swarren at wwwdotorg.org>
---
Tom, this patch applies on top of u-boot-tegra/master, with the top 4
commits removed and replaced with Simon's latest putc series from last
night.

Simon, I wonder if tegra_pre_console_panic() shouldn't be modified to
remove the uart_ids parameter and simply call get_uart_ids() internally?

BTW, it seems inconsistent to have all the Tegra code key off
CONFIG_TEGRA2_ENABLE_UART*, whereas the serial driver keys off
CONFIG_SYS_NS16550_COM*. Can the two be unified somehow?

 arch/arm/cpu/armv7/tegra2/board.c |   31 +++++++++++++++++++++++++++++--
 1 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/armv7/tegra2/board.c b/arch/arm/cpu/armv7/tegra2/board.c
index c7ea96b..27831f3 100644
--- a/arch/arm/cpu/armv7/tegra2/board.c
+++ b/arch/arm/cpu/armv7/tegra2/board.c
@@ -115,7 +115,7 @@ void tegra_setup_uarts(int uart_ids)
 	}
 }
 
-void board_init_uart_f(void)
+static int get_uart_ids(void)
 {
 	int uart_ids = 0;	/* bit mask of which UART ids to enable */
 
@@ -128,7 +128,13 @@ void board_init_uart_f(void)
 #ifdef CONFIG_TEGRA2_ENABLE_UARTD
 	uart_ids |= TEGRA_UARTD;
 #endif
-	tegra_setup_uarts(uart_ids);
+
+	return uart_ids;
+}
+
+void board_init_uart_f(void)
+{
+	tegra_setup_uarts(get_uart_ids());
 }
 
 #ifndef CONFIG_SYS_DCACHE_OFF
@@ -150,6 +156,27 @@ static const u32 uart_reg_addr[TEGRA_UART_COUNT] = {
 	NV_PA_APB_UARTD_BASE,
 };
 
+void arch_preboot_os(void)
+{
+	int uart_ids, i;
+
+	/*
+	 * The Linux kernel earlyprintk code detects which UART to use by
+	 * searching for one with 'D' in the UART scratch register. This
+	 * is set up here.
+	 */
+	uart_ids = get_uart_ids();
+
+	for (i = 0; i < TEGRA_UART_COUNT; i++) {
+		if (uart_ids & (1 << i)) {
+			NS16550_t regs = (NS16550_t)uart_reg_addr[i];
+			if (!regs)
+				continue;
+			writeb('D', &regs->spr);
+		}
+	}
+}
+
 void tegra_pre_console_panic(int uart_ids, unsigned clock_freq,
 			     unsigned multiplier, const char *str)
 {
-- 
1.7.0.4



More information about the U-Boot mailing list