* [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk
@ 2012-01-03 22:25 Stephen Warren
2012-01-03 22:25 ` [PATCH 1/4] ARM: tegra: Introduce define DEBUG_UART_SHIFT Stephen Warren
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: Stephen Warren @ 2012-01-03 22:25 UTC (permalink / raw)
To: linux-arm-kernel
This series allows a Tegra zImage to automatically select the UART to use
for the zImage decompressor and early printk, based on information from
the bootloader. The code scans each UART, looking for one that is clocked,
is out of reset, and that the bootloader has written 'D' (for 'D'ebug) to
the scratch register.
At present, the ChromiumOS branch of U-Boot sets up UARTs in this way. If
this patch is accepted into the kernel, I'll upstream the U-Boot change to
mainline U-Boot.
This is important, since different boards use different UARTs, and it's
nice not to have to configure the kernel differently when switching
boards.
This patch series depends on patch "[PATCH V2] arm/tegra: Support Tegra30
in decompressor UART setup" for context.
Doug Anderson (2):
ARM: tegra: Introduce define DEBUG_UART_SHIFT
ARM: tegra: uncompress.h: Store UART address in a variable
Stephen Warren (2):
ARM: tegra: uncompress.h: Choose a UART at runtime
ARM: tegra: Pass uncompress.h UART selection to DEBUG_LL
arch/arm/mach-tegra/common.c | 17 ++++
arch/arm/mach-tegra/include/mach/debug-macro.S | 87 +++++++++++++++++---
arch/arm/mach-tegra/include/mach/uncompress.h | 108 +++++++++++++++++++++---
3 files changed, 190 insertions(+), 22 deletions(-)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] ARM: tegra: Introduce define DEBUG_UART_SHIFT
2012-01-03 22:25 [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk Stephen Warren
@ 2012-01-03 22:25 ` Stephen Warren
2012-01-03 22:25 ` [PATCH 2/4] ARM: tegra: uncompress.h: Store UART address in a variable Stephen Warren
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Stephen Warren @ 2012-01-03 22:25 UTC (permalink / raw)
To: linux-arm-kernel
From: Doug Anderson <dianders@chromium.org>
This removes the need for the variable "shift" in all functions in
uncompress.h.
Signed-off-by: Doug Anderson <dianders@chromium.org>
[swarren: Extracted from a larger patch by Doug]
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
arch/arm/mach-tegra/include/mach/uncompress.h | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-tegra/include/mach/uncompress.h b/arch/arm/mach-tegra/include/mach/uncompress.h
index 39bd5e5..9797279 100644
--- a/arch/arm/mach-tegra/include/mach/uncompress.h
+++ b/arch/arm/mach-tegra/include/mach/uncompress.h
@@ -2,10 +2,12 @@
* arch/arm/mach-tegra/include/mach/uncompress.h
*
* Copyright (C) 2010 Google, Inc.
+ * Copyright (C) 2011 Google, Inc.
*
* Author:
* Colin Cross <ccross@google.com>
* Erik Gilling <konkers@google.com>
+ * Doug Anderson <dianders@chromium.org>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -26,17 +28,18 @@
#include <mach/iomap.h>
+#define DEBUG_UART_SHIFT 2
+
static void putc(int c)
{
volatile u8 *uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE;
- int shift = 2;
if (uart == NULL)
return;
- while (!(uart[UART_LSR << shift] & UART_LSR_THRE))
+ while (!(uart[UART_LSR << DEBUG_UART_SHIFT] & UART_LSR_THRE))
barrier();
- uart[UART_TX << shift] = c;
+ uart[UART_TX << DEBUG_UART_SHIFT] = c;
}
static inline void flush(void)
@@ -48,7 +51,6 @@ static inline void arch_decomp_setup(void)
volatile u32 *apb_misc = (volatile u32 *)TEGRA_APB_MISC_BASE;
u32 chip, div;
volatile u8 *uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE;
- int shift = 2;
if (uart == NULL)
return;
@@ -59,10 +61,10 @@ static inline void arch_decomp_setup(void)
else
div = 0x00dd;
- uart[UART_LCR << shift] |= UART_LCR_DLAB;
- uart[UART_DLL << shift] = div & 0xff;
- uart[UART_DLM << shift] = div >> 8;
- uart[UART_LCR << shift] = 3;
+ uart[UART_LCR << DEBUG_UART_SHIFT] |= UART_LCR_DLAB;
+ uart[UART_DLL << DEBUG_UART_SHIFT] = div & 0xff;
+ uart[UART_DLM << DEBUG_UART_SHIFT] = div >> 8;
+ uart[UART_LCR << DEBUG_UART_SHIFT] = 3;
}
static inline void arch_decomp_wdog(void)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] ARM: tegra: uncompress.h: Store UART address in a variable
2012-01-03 22:25 [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk Stephen Warren
2012-01-03 22:25 ` [PATCH 1/4] ARM: tegra: Introduce define DEBUG_UART_SHIFT Stephen Warren
@ 2012-01-03 22:25 ` Stephen Warren
2012-01-03 22:25 ` [PATCH 3/4] ARM: tegra: uncompress.h: Choose a UART at runtime Stephen Warren
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Stephen Warren @ 2012-01-03 22:25 UTC (permalink / raw)
To: linux-arm-kernel
From: Doug Anderson <dianders@chromium.org>
This will allow a future change to auto-detect which UART to use.
Signed-off-by: Doug Anderson <dianders@chromium.org>
[swarren: Extracted from a larger patch by Doug]
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
arch/arm/mach-tegra/include/mach/uncompress.h | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-tegra/include/mach/uncompress.h b/arch/arm/mach-tegra/include/mach/uncompress.h
index 9797279..bb3fd35 100644
--- a/arch/arm/mach-tegra/include/mach/uncompress.h
+++ b/arch/arm/mach-tegra/include/mach/uncompress.h
@@ -30,10 +30,10 @@
#define DEBUG_UART_SHIFT 2
+volatile u8 *uart;
+
static void putc(int c)
{
- volatile u8 *uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE;
-
if (uart == NULL)
return;
@@ -50,8 +50,8 @@ static inline void arch_decomp_setup(void)
{
volatile u32 *apb_misc = (volatile u32 *)TEGRA_APB_MISC_BASE;
u32 chip, div;
- volatile u8 *uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE;
+ uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE;
if (uart == NULL)
return;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] ARM: tegra: uncompress.h: Choose a UART at runtime
2012-01-03 22:25 [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk Stephen Warren
2012-01-03 22:25 ` [PATCH 1/4] ARM: tegra: Introduce define DEBUG_UART_SHIFT Stephen Warren
2012-01-03 22:25 ` [PATCH 2/4] ARM: tegra: uncompress.h: Store UART address in a variable Stephen Warren
@ 2012-01-03 22:25 ` Stephen Warren
2012-01-03 22:25 ` [PATCH 4/4] ARM: tegra: Pass uncompress.h UART selection to DEBUG_LL Stephen Warren
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Stephen Warren @ 2012-01-03 22:25 UTC (permalink / raw)
To: linux-arm-kernel
With this change we automatically detect which UART to use for
for printing during decompression. The detection involves coordination
with the bootloader: it's expected that the bootloader will leave a
'D' (for [D]ebug) in the UART scratchpad register for whichever UART we
should use for debugging.
If we don't find any such UART, we fall back to the UART that was
specified during config time: CONFIG_TEGRA_DEBUG_UART_XXX.
As a side effect of this change, uncompress debug messages will work
if you've specified CONFIG_TEGRA_DEBUG_UART_NONE, provided the
bootloader obeys the protocol.
This change is in line with what is documented in
Documentation/arm/Booting.
Other approaches considered:
* Hardcode based on machine ID (as many other ARM boards do).
OK, but nice to not have yet another place to add per-board
code. Better to have bootloader parse device tree and pass us
this info.
* Check for TXE bit (like SA1110). Nice (and doesn't require
a bootloader change), but a little less explicit. Also: if
bootloader (for some reason) uses another UART, it needs to
remember to turn it off before jumping to the kernel or we may
print to it. NOTE: adapting this patch to check TXE too would
be easy if desired.
Signed-off-by: Doug Anderson <dianders@chromium.org>
[swarren: Added clock/reset condition checks]
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
arch/arm/mach-tegra/include/mach/uncompress.h | 74 ++++++++++++++++++++++++-
1 files changed, 73 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-tegra/include/mach/uncompress.h b/arch/arm/mach-tegra/include/mach/uncompress.h
index bb3fd35..4d8e1b7 100644
--- a/arch/arm/mach-tegra/include/mach/uncompress.h
+++ b/arch/arm/mach-tegra/include/mach/uncompress.h
@@ -3,11 +3,13 @@
*
* Copyright (C) 2010 Google, Inc.
* Copyright (C) 2011 Google, Inc.
+ * Copyright (C) 2011 NVIDIA CORPORATION. All Rights Reserved.
*
* Author:
* Colin Cross <ccross@google.com>
* Erik Gilling <konkers@google.com>
* Doug Anderson <dianders@chromium.org>
+ * Stephen Warren <swarren@nvidia.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -46,12 +48,82 @@ static inline void flush(void)
{
}
+/*
+ * Setup before decompression. This is where we do UART selection for
+ * earlyprintk and init the uart_base register.
+ */
static inline void arch_decomp_setup(void)
{
+ static const struct {
+ u32 base;
+ u32 reset_reg;
+ u32 clock_reg;
+ u32 bit;
+ } uarts[] = {
+ {
+ TEGRA_UARTA_BASE,
+ TEGRA_CLK_RESET_BASE + 0x04,
+ TEGRA_CLK_RESET_BASE + 0x10,
+ 6,
+ },
+ {
+ TEGRA_UARTB_BASE,
+ TEGRA_CLK_RESET_BASE + 0x04,
+ TEGRA_CLK_RESET_BASE + 0x10,
+ 7,
+ },
+ {
+ TEGRA_UARTC_BASE,
+ TEGRA_CLK_RESET_BASE + 0x08,
+ TEGRA_CLK_RESET_BASE + 0x14,
+ 23,
+ },
+ {
+ TEGRA_UARTD_BASE,
+ TEGRA_CLK_RESET_BASE + 0x0c,
+ TEGRA_CLK_RESET_BASE + 0x18,
+ 1,
+ },
+ {
+ TEGRA_UARTE_BASE,
+ TEGRA_CLK_RESET_BASE + 0x0c,
+ TEGRA_CLK_RESET_BASE + 0x18,
+ 2,
+ },
+ };
+ int i;
volatile u32 *apb_misc = (volatile u32 *)TEGRA_APB_MISC_BASE;
u32 chip, div;
- uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE;
+ /*
+ * Look for the first UART that:
+ * a) Is not in reset.
+ * b) Is clocked.
+ * c) Has a 'D' in the scratchpad register.
+ *
+ * Note that on Tegra30, the first two conditions are required, since
+ * if not true, accesses to the UART scratch register will hang.
+ * Tegra20 doesn't have this issue.
+ *
+ * The intent is that the bootloader will tell the kernel which UART
+ * to use by setting up those conditions. If nothing found, we'll fall
+ * back to what's specified in TEGRA_DEBUG_UART_BASE.
+ */
+ for (i = 0; i < ARRAY_SIZE(uarts); i++) {
+ if (*(u8 *)uarts[i].reset_reg & BIT(uarts[i].bit))
+ continue;
+
+ if (!(*(u8 *)uarts[i].clock_reg & BIT(uarts[i].bit)))
+ continue;
+
+ uart = (volatile u8 *)uarts[i].base;
+ if (uart[UART_SCR << DEBUG_UART_SHIFT] != 'D')
+ continue;
+
+ break;
+ }
+ if (i == ARRAY_SIZE(uarts))
+ uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE;
if (uart == NULL)
return;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] ARM: tegra: Pass uncompress.h UART selection to DEBUG_LL
2012-01-03 22:25 [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk Stephen Warren
` (2 preceding siblings ...)
2012-01-03 22:25 ` [PATCH 3/4] ARM: tegra: uncompress.h: Choose a UART at runtime Stephen Warren
@ 2012-01-03 22:25 ` Stephen Warren
2012-01-04 23:45 ` [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk Doug Anderson
2012-01-19 4:42 ` Olof Johansson
5 siblings, 0 replies; 9+ messages in thread
From: Stephen Warren @ 2012-01-03 22:25 UTC (permalink / raw)
To: linux-arm-kernel
uncompress.h now saves the selected UART's physical address in Tegra's
IRAM, along with a cookie to indicate validity.
The first time it's run, macro addruart in debug-macro.S looks for this
cookie, and if it's present, uses the UART address stored there. If not,
the static value TEGRA_DEBUG_UART_BASE is used, as was previous behaviour.
The static behaviour will thus be used when not booting using a zImage.
This work was inspired by work by Doug Anderson <dianders@chromium.org>;
see http://lkml.org/lkml/2011/9/26/284. However, this patch relies on
the data passing describe above, rather than duplicating the UART
selection logic in debug-macro.S; the latest selection logic is more
complex due to the need to check reset/clock bits too.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
arch/arm/mach-tegra/common.c | 17 +++++
arch/arm/mach-tegra/include/mach/debug-macro.S | 87 +++++++++++++++++++++---
arch/arm/mach-tegra/include/mach/uncompress.h | 12 +++
3 files changed, 105 insertions(+), 11 deletions(-)
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index a2eb901..76210e5 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -33,6 +33,23 @@
#include "clock.h"
#include "fuse.h"
+/*
+ * Storage for debug-macro.S's state.
+ *
+ * This must be in .data not .bss so that it gets initialized each time the
+ * kernel is loaded. The data is declared here rather than debug-macro.S so
+ * that multiple inclusions of debug-macro.S point at the same data.
+ */
+#define TEGRA_DEBUG_UART_OFFSET (TEGRA_DEBUG_UART_BASE & 0xFFFF)
+u32 tegra_uart_config[3] = {
+ /* Debug UART initialization required */
+ 1,
+ /* Debug UART physical address */
+ (u32)(IO_APB_PHYS + TEGRA_DEBUG_UART_OFFSET),
+ /* Debug UART virtual address */
+ (u32)(IO_APB_VIRT + TEGRA_DEBUG_UART_OFFSET),
+};
+
#ifdef CONFIG_OF
static const struct of_device_id tegra_dt_irq_match[] __initconst = {
{ .compatible = "arm,cortex-a9-gic", .data = gic_of_init },
diff --git a/arch/arm/mach-tegra/include/mach/debug-macro.S b/arch/arm/mach-tegra/include/mach/debug-macro.S
index 619abc6..94802a5 100644
--- a/arch/arm/mach-tegra/include/mach/debug-macro.S
+++ b/arch/arm/mach-tegra/include/mach/debug-macro.S
@@ -1,11 +1,17 @@
/*
* arch/arm/mach-tegra/include/mach/debug-macro.S
*
- * Copyright (C) 2010 Google, Inc.
+ * Copyright (C) 2010,2011 Google, Inc.
+ * Copyright (C) 2011 NVIDIA CORPORATION. All Rights Reserved.
*
* Author:
* Colin Cross <ccross@google.com>
* Erik Gilling <konkers@google.com>
+ * Doug Anderson <dianders@chromium.org>
+ * Stephen Warren <swarren@nvidia.com>
+ *
+ * Portions based on mach-omap2's debug-macro.S
+ * Copyright (C) 1994-1999 Russell King
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -18,18 +24,77 @@
*
*/
+#include <linux/serial_reg.h>
+
#include <mach/io.h>
#include <mach/iomap.h>
- .macro addruart, rp, rv, tmp
- ldr \rp, =IO_APB_PHYS @ physical
- ldr \rv, =IO_APB_VIRT @ virtual
- orr \rp, \rp, #(TEGRA_DEBUG_UART_BASE & 0xFF)
- orr \rp, \rp, #(TEGRA_DEBUG_UART_BASE & 0xFF00)
- orr \rv, \rv, #(TEGRA_DEBUG_UART_BASE & 0xFF)
- orr \rv, \rv, #(TEGRA_DEBUG_UART_BASE & 0xFF00)
- .endm
+ .macro addruart, rp, rv, tmp
+ adr \rp, 99f @ actual addr of 99f
+ ldr \rv, [\rp] @ linked addr is stored there
+ sub \rv, \rv, \rp @ offset between the two
+ ldr \rp, [\rp, #4] @ linked tegra_uart_config
+ sub \tmp, \rp, \rv @ actual tegra_uart_config
+ ldr \rp, [\tmp] @ Load tegra_uart_config
+ cmp \rp, #1 @ needs intitialization?
+ bne 100f @ no; go load the addresses
+ mov \rv, #0 @ yes; record init is done
+ str \rv, [\tmp]
+ mov \rp, #TEGRA_IRAM_BASE @ See if cookie is in IRAM
+ ldr \rv, [\rp, #0x100]
+ movw \rp, #0x5254 @ "UART"
+ movt \rp, #0x5541
+ cmp \rv, \rp @ Cookie present?
+ bne 100f @ No, use default UART
+ mov \rp, #TEGRA_IRAM_BASE @ Load UART address from IRAM
+ ldr \rv, [\rp, #0x104]
+ str \rv, [\tmp, #4] @ Store in tegra_uart_phys
+ sub \rv, \rv, #IO_APB_PHYS @ Calculate virt address
+ add \rv, \rv, #IO_APB_VIRT
+ str \rv, [\tmp, #8] @ Store in tegra_uart_virt
+ b 100f
+
+ .align
+99: .word .
+ .word tegra_uart_config
+ .ltorg
+
+100: ldr \rp, [\tmp, #4] @ Load tegra_uart_phys
+ ldr \rv, [\tmp, #8] @ Load tegra_uart_virt
+ .endm
+
+#define UART_SHIFT 2
+
+/*
+ * Code below is swiped from <asm/hardware/debug-8250.S>, but add an extra
+ * check to make sure that we aren't in the CONFIG_TEGRA_DEBUG_UART_NONE case.
+ * We use the fact that all 5 valid UART addresses all have something in the
+ * 2nd-to-lowest byte.
+ */
+
+ .macro senduart, rd, rx
+ tst \rx, #0x0000ff00
+ strneb \rd, [\rx, #UART_TX << UART_SHIFT]
+1001:
+ .endm
-#define UART_SHIFT 2
-#include <asm/hardware/debug-8250.S>
+ .macro busyuart, rd, rx
+ tst \rx, #0x0000ff00
+ beq 1002f
+1001: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT]
+ and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
+ teq \rd, #UART_LSR_TEMT | UART_LSR_THRE
+ bne 1001b
+1002:
+ .endm
+ .macro waituart, rd, rx
+#ifdef FLOW_CONTROL
+ tst \rx, #0x0000ff00
+ beq 1002f
+1001: ldrb \rd, [\rx, #UART_MSR << UART_SHIFT]
+ tst \rd, #UART_MSR_CTS
+ beq 1001b
+1002:
+#endif
+ .endm
diff --git a/arch/arm/mach-tegra/include/mach/uncompress.h b/arch/arm/mach-tegra/include/mach/uncompress.h
index 4d8e1b7..6bcb2bd 100644
--- a/arch/arm/mach-tegra/include/mach/uncompress.h
+++ b/arch/arm/mach-tegra/include/mach/uncompress.h
@@ -48,6 +48,17 @@ static inline void flush(void)
{
}
+static inline void save_uart_address(void)
+{
+ u32 *iram = (u32 *)(TEGRA_IRAM_BASE + 0x100);
+
+ if (uart) {
+ iram[0] = 0x55415254; /* "UART" */
+ iram[1] = (u32)uart;
+ } else
+ iram[0] = 0;
+}
+
/*
* Setup before decompression. This is where we do UART selection for
* earlyprintk and init the uart_base register.
@@ -124,6 +135,7 @@ static inline void arch_decomp_setup(void)
}
if (i == ARRAY_SIZE(uarts))
uart = (volatile u8 *)TEGRA_DEBUG_UART_BASE;
+ save_uart_address();
if (uart == NULL)
return;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk
2012-01-03 22:25 [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk Stephen Warren
` (3 preceding siblings ...)
2012-01-03 22:25 ` [PATCH 4/4] ARM: tegra: Pass uncompress.h UART selection to DEBUG_LL Stephen Warren
@ 2012-01-04 23:45 ` Doug Anderson
2012-01-04 23:47 ` Doug Anderson
2012-01-19 4:42 ` Olof Johansson
5 siblings, 1 reply; 9+ messages in thread
From: Doug Anderson @ 2012-01-04 23:45 UTC (permalink / raw)
To: linux-arm-kernel
For the series,
Tested-by: Doug Anderson <dianders@chromium.org>
Thank you for picking this up.
A few overall comments on the patch set:1. This patch has the side
effect of requiring the use of zImage to?? ?get the proper behavior.
If we ever try to move decompression? ?of the kernel to the bootloader
(as has been talked about, since? ?u-boot supports it) we'll lose
earlyprintk behavior. ?...of course,?? ?this does match how some other
ARM boards do things. ?I'm OK with? ?this.2. I'm slightly concerned
about cramming stuff into IRAM, since? ?I don't have a good concept of
what IRAM adresses are used when.? ?When I grep for IRAM users in our
kernel, I see?? ?TEGRA_AVP_RESUME_ADDR is using the base of IRAM.
We're not going? ?to be hosing suspend/resume or anything else with
this CL, are we?? ?In the very least, I'd perfer to see a #define for
the '0x100' and?? ?the '0x55415254' so that we can correlate the
constants in?? ?uncompress.h and debug-macro.S
Tested:Tested the series on a Tegra2-based board (Kaen)
withCONFIG_TEGRA_DEBUG_UART_NONE defined on the current ToT
chromium-os?tree with the following pre-changes:1. Reverted hack from
our tree: 63b76a4638f3934e69c8724881060f121845184c2. Added "arm/tegra:
Support Tegra30 in decompressor UART setup" as? ?described in the
patch header.3. Adjusted patch 4 to apply cleanly to our older
"common.c"4. Added missing #include <linux/kernel.h> to uncompress.h,
as?? ?indicated by swarren on tegra IRC.
Also tried stopping in the bootloader and clearing the 'D' with:? mw.b
0x7000605c 0...and validated that I missed the earlyprintks (as
expected) butstill booted.
---
On Tue, Jan 3, 2012 at 2:25 PM, Stephen Warren <swarren@nvidia.com> wrote:
> This series allows a Tegra zImage to automatically select the UART to use
> for the zImage decompressor and early printk, based on information from
> the bootloader. The code scans each UART, looking for one that is clocked,
> is out of reset, and that the bootloader has written 'D' (for 'D'ebug) to
> the scratch register.
>
> At present, the ChromiumOS branch of U-Boot sets up UARTs in this way. If
> this patch is accepted into the kernel, I'll upstream the U-Boot change to
> mainline U-Boot.
>
> This is important, since different boards use different UARTs, and it's
> nice not to have to configure the kernel differently when switching
> boards.
>
> This patch series depends on patch "[PATCH V2] arm/tegra: Support Tegra30
> in decompressor UART setup" for context.
>
> Doug Anderson (2):
> ?ARM: tegra: Introduce define DEBUG_UART_SHIFT
> ?ARM: tegra: uncompress.h: Store UART address in a variable
>
> Stephen Warren (2):
> ?ARM: tegra: uncompress.h: Choose a UART at runtime
> ?ARM: tegra: Pass uncompress.h UART selection to DEBUG_LL
>
> ?arch/arm/mach-tegra/common.c ? ? ? ? ? ? ? ? ? | ? 17 ++++
> ?arch/arm/mach-tegra/include/mach/debug-macro.S | ? 87 +++++++++++++++++---
> ?arch/arm/mach-tegra/include/mach/uncompress.h ?| ?108 +++++++++++++++++++++---
> ?3 files changed, 190 insertions(+), 22 deletions(-)
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk
2012-01-04 23:45 ` [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk Doug Anderson
@ 2012-01-04 23:47 ` Doug Anderson
2012-01-05 22:03 ` Stephen Warren
0 siblings, 1 reply; 9+ messages in thread
From: Doug Anderson @ 2012-01-04 23:47 UTC (permalink / raw)
To: linux-arm-kernel
(repost, since gmail seems to have mangled my message)
For the series,
Tested-by: Doug Anderson <dianders@chromium.org>
Thank you for picking this up.
A few overall comments on the patch set:
1. This patch has the side effect of requiring the use of zImage to
? ?get the proper behavior. ?If we ever try to move decompression
? ?of the kernel to the bootloader (as has been talked about, since
? ?u-boot supports it) we'll lose earlyprintk behavior. ?...of course,
? ?this does match how some other ARM boards do things. ?I'm OK with
? ?this.
2. I'm slightly concerned about cramming stuff into IRAM, since
? ?I don't have a good concept of what IRAM adresses are used when.
? ?When I grep for IRAM users in our kernel, I see
? ?TEGRA_AVP_RESUME_ADDR is using the base of IRAM. ?We're not going
? ?to be hosing suspend/resume or anything else with this CL, are we?
? ?In the very least, I'd perfer to see a #define for the '0x100' and
? ?the '0x55415254' so that we can correlate the constants in
? ?uncompress.h and debug-macro.S
Tested:
Tested the series on a Tegra2-based board (Kaen) with
CONFIG_TEGRA_DEBUG_UART_NONE defined on the current ToT chromium-os
tree with the following pre-changes:
1. Reverted hack from our tree: 63b76a4638f3934e69c8724881060f121845184c
2. Added "arm/tegra: Support Tegra30 in decompressor UART setup" as
? ?described in the patch header.
3. Adjusted patch 4 to apply cleanly to our older "common.c"
4. Added missing #include <linux/kernel.h> to uncompress.h, as
? ?indicated by swarren on tegra IRC.
Also tried stopping in the bootloader and clearing the 'D' with:
? mw.b 0x7000605c 0
...and validated that I missed the earlyprintks (as expected) but
still booted.
---
On Wed, Jan 4, 2012 at 3:45 PM, Doug Anderson <dianders@chromium.org> wrote:
> For the series,
> Tested-by: Doug Anderson <dianders@chromium.org>
> Thank you for picking this up.
> A few overall comments on the patch set:1. This patch has the side
> effect of requiring the use of zImage to?? ?get the proper behavior.
> If we ever try to move decompression? ?of the kernel to the bootloader
> (as has been talked about, since? ?u-boot supports it) we'll lose
> earlyprintk behavior. ?...of course,?? ?this does match how some other
> ARM boards do things. ?I'm OK with? ?this.2. I'm slightly concerned
> about cramming stuff into IRAM, since? ?I don't have a good concept of
> what IRAM adresses are used when.? ?When I grep for IRAM users in our
> kernel, I see?? ?TEGRA_AVP_RESUME_ADDR is using the base of IRAM.
> We're not going? ?to be hosing suspend/resume or anything else with
> this CL, are we?? ?In the very least, I'd perfer to see a #define for
> the '0x100' and?? ?the '0x55415254' so that we can correlate the
> constants in?? ?uncompress.h and debug-macro.S
> Tested:Tested the series on a Tegra2-based board (Kaen)
> withCONFIG_TEGRA_DEBUG_UART_NONE defined on the current ToT
> chromium-os?tree with the following pre-changes:1. Reverted hack from
> our tree: 63b76a4638f3934e69c8724881060f121845184c2. Added "arm/tegra:
> Support Tegra30 in decompressor UART setup" as? ?described in the
> patch header.3. Adjusted patch 4 to apply cleanly to our older
> "common.c"4. Added missing #include <linux/kernel.h> to uncompress.h,
> as?? ?indicated by swarren on tegra IRC.
> Also tried stopping in the bootloader and clearing the 'D' with:? mw.b
> 0x7000605c 0...and validated that I missed the earlyprintks (as
> expected) butstill booted.
> ---
> On Tue, Jan 3, 2012 at 2:25 PM, Stephen Warren <swarren@nvidia.com> wrote:
>> This series allows a Tegra zImage to automatically select the UART to use
>> for the zImage decompressor and early printk, based on information from
>> the bootloader. The code scans each UART, looking for one that is clocked,
>> is out of reset, and that the bootloader has written 'D' (for 'D'ebug) to
>> the scratch register.
>>
>> At present, the ChromiumOS branch of U-Boot sets up UARTs in this way. If
>> this patch is accepted into the kernel, I'll upstream the U-Boot change to
>> mainline U-Boot.
>>
>> This is important, since different boards use different UARTs, and it's
>> nice not to have to configure the kernel differently when switching
>> boards.
>>
>> This patch series depends on patch "[PATCH V2] arm/tegra: Support Tegra30
>> in decompressor UART setup" for context.
>>
>> Doug Anderson (2):
>> ?ARM: tegra: Introduce define DEBUG_UART_SHIFT
>> ?ARM: tegra: uncompress.h: Store UART address in a variable
>>
>> Stephen Warren (2):
>> ?ARM: tegra: uncompress.h: Choose a UART at runtime
>> ?ARM: tegra: Pass uncompress.h UART selection to DEBUG_LL
>>
>> ?arch/arm/mach-tegra/common.c ? ? ? ? ? ? ? ? ? | ? 17 ++++
>> ?arch/arm/mach-tegra/include/mach/debug-macro.S | ? 87 +++++++++++++++++---
>> ?arch/arm/mach-tegra/include/mach/uncompress.h ?| ?108 +++++++++++++++++++++---
>> ?3 files changed, 190 insertions(+), 22 deletions(-)
>>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk
2012-01-04 23:47 ` Doug Anderson
@ 2012-01-05 22:03 ` Stephen Warren
0 siblings, 0 replies; 9+ messages in thread
From: Stephen Warren @ 2012-01-05 22:03 UTC (permalink / raw)
To: linux-arm-kernel
Doug Anderson wrote at Wednesday, January 04, 2012 4:48 PM:
...
> 2. I'm slightly concerned about cramming stuff into IRAM, since
> ? ?I don't have a good concept of what IRAM adresses are used when.
> ? ?When I grep for IRAM users in our kernel, I see
> ? ?TEGRA_AVP_RESUME_ADDR is using the base of IRAM. ?We're not going
> ? ?to be hosing suspend/resume or anything else with this CL, are we?
> ? ?In the very least, I'd perfer to see a #define for the '0x100' and
> ? ?the '0x55415254' so that we can correlate the constants in
> ? ?uncompress.h and debug-macro.S
I discussed this with a few people, and it sounds like it's safe to use
IRAM for this. However, I did discover a few other uses of IRAM too, in
our downstream kernels anyway, so I'll certainly create arch/arm/mach-
tegra/include/mach/irammap.h that provides defines for all the IRAM
offsets, what they're used for, and when.
--
nvpublic
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk
2012-01-03 22:25 [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk Stephen Warren
` (4 preceding siblings ...)
2012-01-04 23:45 ` [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk Doug Anderson
@ 2012-01-19 4:42 ` Olof Johansson
5 siblings, 0 replies; 9+ messages in thread
From: Olof Johansson @ 2012-01-19 4:42 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jan 03, 2012 at 03:25:16PM -0700, Stephen Warren wrote:
> This series allows a Tegra zImage to automatically select the UART to use
> for the zImage decompressor and early printk, based on information from
> the bootloader. The code scans each UART, looking for one that is clocked,
> is out of reset, and that the bootloader has written 'D' (for 'D'ebug) to
> the scratch register.
>
> At present, the ChromiumOS branch of U-Boot sets up UARTs in this way. If
> this patch is accepted into the kernel, I'll upstream the U-Boot change to
> mainline U-Boot.
>
> This is important, since different boards use different UARTs, and it's
> nice not to have to configure the kernel differently when switching
> boards.
>
> This patch series depends on patch "[PATCH V2] arm/tegra: Support Tegra30
> in decompressor UART setup" for context.
>
> Doug Anderson (2):
> ARM: tegra: Introduce define DEBUG_UART_SHIFT
> ARM: tegra: uncompress.h: Store UART address in a variable
>
> Stephen Warren (2):
> ARM: tegra: uncompress.h: Choose a UART at runtime
> ARM: tegra: Pass uncompress.h UART selection to DEBUG_LL
Thanks, applied.
-Olof
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-01-19 4:42 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-03 22:25 [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk Stephen Warren
2012-01-03 22:25 ` [PATCH 1/4] ARM: tegra: Introduce define DEBUG_UART_SHIFT Stephen Warren
2012-01-03 22:25 ` [PATCH 2/4] ARM: tegra: uncompress.h: Store UART address in a variable Stephen Warren
2012-01-03 22:25 ` [PATCH 3/4] ARM: tegra: uncompress.h: Choose a UART at runtime Stephen Warren
2012-01-03 22:25 ` [PATCH 4/4] ARM: tegra: Pass uncompress.h UART selection to DEBUG_LL Stephen Warren
2012-01-04 23:45 ` [PATCH 0/4] ARM: tegra: Automatic UART selection for earlyprintk Doug Anderson
2012-01-04 23:47 ` Doug Anderson
2012-01-05 22:03 ` Stephen Warren
2012-01-19 4:42 ` Olof Johansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).