From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Tue, 20 Mar 2012 13:57:00 -0600 Subject: [U-Boot] [PATCH] tegra: Specify debugging serial port at boot. Message-ID: <1332273420-29109-1-git-send-email-swarren@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 , but significantly rewritten. Signed-off-by: Stephen Warren --- 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', ®s->spr); + } + } +} + void tegra_pre_console_panic(int uart_ids, unsigned clock_freq, unsigned multiplier, const char *str) { -- 1.7.0.4