ARM: tegra: simplify DEBUG_LL UART selection options
Subsystems (3)
PATCH 1/3 ARM: tegra: simplify DEBUG_LL UART selection options
From: Stephen Warren <[email protected]>
Delete CONFIG_TEGRA_DEBUG_UART_AUTO_SCRATCH; it's not useful any more:
* No upstream bootloader currently or will ever support this option.
* CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA is a much more direct alternative.
Merge the fixed and automatic UART selection menus into a single choice for simplicity; now you either pick AUTO_ODMDATA or a single fixed UART, rather than potentially having an AUTO option override whatever fixed option was chosen.
Remove TEGRA_DEBUG_UART_NONE; if you don't want a Tegra DEBUG_LL UART, simply don't turn on DEBUG_LL. NONE used to be the default option, so pick AUTO_ODMDATA as the new default.
--- arch/arm/mach-tegra/Kconfig | 41 +++++--------------- arch/arm/mach-tegra/common.c | 5 +- arch/arm/mach-tegra/include/mach/iomap.h | 14 ------- arch/arm/mach-tegra/include/mach/uncompress.h | 52 ++----------------------- 4 files changed, 16 insertions(+), 96 deletions(-)
arch/arm/mach-tegra/Kconfig +10 -31
@@ -58,11 +58,17 @@ config TEGRA_AHB perfomance parameters(priority, prefech size). choice - prompt "Default low-level debug console UART" - default TEGRA_DEBUG_UART_NONE + prompt "Low-level debug console UART" + default TEGRA_DEBUG_UART_AUTO_ODMDATA -config TEGRA_DEBUG_UART_NONE - bool "None" +config TEGRA_DEBUG_UART_AUTO_ODMDATA + bool "Via ODMDATA" + help + Automatically determines which UART to use for low-level debug based + on the ODMDATA value. This value is part of the BCT, and is written + to the boot memory device using nvflash, or other flashing tool. + When bits 19:18 are 3, then bits 17:15 indicate which UART to use; + 0/1/2/3/4 are UART A/B/C/D/E. config TEGRA_DEBUG_UARTA bool "UART-A"
@@ -81,33 +87,6 @@ config TEGRA_DEBUG_UARTE endchoice -choice - prompt "Automatic low-level debug console UART" - default TEGRA_DEBUG_UART_AUTO_NONE - -config TEGRA_DEBUG_UART_AUTO_NONE - bool "None" - -config TEGRA_DEBUG_UART_AUTO_ODMDATA - bool "Via ODMDATA" - help - Automatically determines which UART to use for low-level debug based - on the ODMDATA value. This value is part of the BCT, and is written - to the boot memory device using nvflash, or other flashing tool. - When bits 19:18 are 3, then bits 17:15 indicate which UART to use; - 0/1/2/3/4 are UART A/B/C/D/E. - -config TEGRA_DEBUG_UART_AUTO_SCRATCH - bool "Via UART scratch register" - help - Automatically determines which UART to use for low-level debug based - on the UART scratch register value. Some bootloaders put ASCII 'D' - in this register when they initialize their own console UART output. - Using this option allows the kernel to automatically pick the same - UART. - -endchoice - config TEGRA_EMC_SCALING_ENABLE bool "Enable scaling the memory frequency"
arch/arm/mach-tegra/common.c +2 -3
@@ -44,14 +44,13 @@* 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 ), +0 ,/* Debug UART virtual address */ - (u32)(IO_APB_VIRT +TEGRA_DEBUG_UART_OFFSET ), +0 , };#ifdef CONFIG_OF
arch/arm/mach-tegra/include/mach/iomap.h +0 -14
@@ -263,20 +263,6 @@#define TEGRA_SDMMC4_BASE 0xC8000600#define TEGRA_SDMMC4_SIZE SZ_512 -#if defined(CONFIG_TEGRA_DEBUG_UART_NONE ) -# define TEGRA_DEBUG_UART_BASE 0 -#elif defined(CONFIG_TEGRA_DEBUG_UARTA ) -# define TEGRA_DEBUG_UART_BASE TEGRA_UARTA_BASE -#elif defined(CONFIG_TEGRA_DEBUG_UARTB ) -# define TEGRA_DEBUG_UART_BASE TEGRA_UARTB_BASE -#elif defined(CONFIG_TEGRA_DEBUG_UARTC ) -# define TEGRA_DEBUG_UART_BASE TEGRA_UARTC_BASE -#elif defined(CONFIG_TEGRA_DEBUG_UARTD ) -# define TEGRA_DEBUG_UART_BASE TEGRA_UARTD_BASE -#elif defined(CONFIG_TEGRA_DEBUG_UARTE ) -# define TEGRA_DEBUG_UART_BASE TEGRA_UARTE_BASE -#endif -/* On TEGRA, many peripherals are very closely packed in * two 256MB io windows (that actually only use about 64KB * at the start of each).
arch/arm/mach-tegra/include/mach/uncompress.h +4 -48
74 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 2/3 ARM: tegra: make debug-macro.S work standalone
From: Stephen Warren <[email protected]>
Prior to this change, Tegra's debug-macro.S relied on uncompress.h having determined which UART to use, and whether it was safe to use the UART (i.e. is it not in reset, and clocked). This determination was communicated from uncompress.h to debug-macro.S using a few bytes of Tegra's IRAM (an on-SoC RAM). This had the disadvantage that uncompress.h was a required part of the kernel boot process; booting a non-compressed kernel would not allow earlyprintk to operate.
This change duplicates the UART selection and validation logic into debug-macro.S so that the reliance on uncompress.h is removed.
This also helps out with single-zImage work, since there is currently no support for using any uncompress with single-zImage.
--- arch/arm/mach-tegra/common.c | 3 +- arch/arm/mach-tegra/include/mach/debug-macro.S | 151 ++++++++++++++++++++--- arch/arm/mach-tegra/include/mach/irammap.h | 9 -- arch/arm/mach-tegra/include/mach/uncompress.h | 13 -- 4 files changed, 133 insertions(+), 43 deletions(-)
arch/arm/mach-tegra/common.c +2 -1
@@ -44,13 +44,14 @@* 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. */ -u32 tegra_uart_config[3 ] = { +u32 tegra_uart_config[4 ] = {/* Debug UART initialization required */ 1 ,/* Debug UART physical address */ 0 ,/* Debug UART virtual address */ 0 , +/* Scratch space for debug macro */ };#ifdef CONFIG_OF
arch/arm/mach-tegra/include/mach/debug-macro.S +131 -20
194 lines not on this page · raw message
arch/arm/mach-tegra/include/mach/irammap.h +0 -9
@@ -23,13 +23,4 @@#define TEGRA_IRAM_RESET_HANDLER_OFFSET 0#define TEGRA_IRAM_RESET_HANDLER_SIZE SZ_1K -/* -* These locations are written to by uncompress.h, and read by debug-macro.S. -* The first word holds the cookie value if the data is valid. The second -* word holds the UART physical address. -*/ -#define TEGRA_IRAM_DEBUG_UART_OFFSET SZ_1K -#define TEGRA_IRAM_DEBUG_UART_SIZE 8 -#define TEGRA_IRAM_DEBUG_UART_COOKIE 0x55415254 -#endif
arch/arm/mach-tegra/include/mach/uncompress.h +0 -13
@@ -29,7 +29,6 @@#include <linux/serial_reg.h> #include <mach/iomap.h> -#include <mach/irammap.h> #define BIT (x) (1 << (x))#define ARRAY_SIZE (arr) (sizeof(arr) / sizeof((arr)[0]))
@@ -52,17 +51,6 @@ static inline void flush(void) { } -static inline void save_uart_address (void ) -{ -u32 *buf = (u32 *)(TEGRA_IRAM_BASE +TEGRA_IRAM_DEBUG_UART_OFFSET ); - -if (uart) { - buf[0 ] =TEGRA_IRAM_DEBUG_UART_COOKIE ; - buf[1 ] = (u32 )uart; - }else - buf[0 ] =0 ; -} - static const struct { u32 base; u32 reset_reg;
@@ -169,7 +157,6 @@ static inline void arch_decomp_setup(void)else uart = (volatile u8 *)uarts[uart_id].base; -save_uart_address ();if (uart ==NULL )return ;
Signature · 1 line
1.7.0.4
PATCH 3/3 ARM: tegra: move debug-macro.S to include/debug
In reply to Stephen WarrenFrom: Stephen Warren <[email protected]>
Move Tegra's debug-macro.S over to the common debug macro directory.
Move Tegra's debug UART selection menu into ARM's Kconfig.debug, so that all related options are selected in the same place.
Tegra's uncompress.h is left in mach-tegra/include/mach; it will be removed whenever Tegra is converted to multi-platform.
--- arch/arm/Kconfig.debug | 39 +++++ arch/arm/include/debug/tegra.S | 209 +++++++++++++++++++++++ arch/arm/mach-tegra/Kconfig | 30 ---- arch/arm/mach-tegra/include/mach/debug-macro.S | 211 ------------------------ 4 files changed, 248 insertions(+), 241 deletions(-) create mode 100644 arch/arm/include/debug/tegra.S delete mode 100644 arch/arm/mach-tegra/include/mach/debug-macro.S
arch/arm/Kconfig.debug +39 -0
@@ -345,6 +345,13 @@ choice Say Y here if you want kernel low-level debugging support on SOCFPGA based platforms. + config DEBUG_TEGRA_UART + depends on ARCH_TEGRA + bool "Use Tegra UART for low-level debug" + help + Say Y here if you want kernel low-level debugging support + on Tegra based platforms. + config DEBUG_VEXPRESS_UART0_DETECT bool "Autodetect UART0 on Versatile Express Cortex-A core tiles" depends on ARCH_VEXPRESS && CPU_CP15_MMU
@@ -409,6 +416,37 @@ choice endchoice +choice + prompt "Low-level debug console UART" + depends on DEBUG_LL && DEBUG_TEGRA_UART + default TEGRA_DEBUG_UART_AUTO_ODMDATA + + config TEGRA_DEBUG_UART_AUTO_ODMDATA + bool "Via ODMDATA" + help + Automatically determines which UART to use for low-level debug based + on the ODMDATA value. This value is part of the BCT, and is written + to the boot memory device using nvflash, or other flashing tool. + When bits 19:18 are 3, then bits 17:15 indicate which UART to use; + 0/1/2/3/4 are UART A/B/C/D/E. + + config TEGRA_DEBUG_UARTA + bool "UART A" + + config TEGRA_DEBUG_UARTB + bool "UART B" + + config TEGRA_DEBUG_UARTC + bool "UART C" + + config TEGRA_DEBUG_UARTD + bool "UART D" + + config TEGRA_DEBUG_UARTE + bool "UART E" + +endchoice + config DEBUG_LL_INCLUDE string default "debug/icedcc.S" if DEBUG_ICEDCC
@@ -418,6 +456,7 @@ config DEBUG_LL_INCLUDE default "debug/socfpga.S" if DEBUG_SOCFPGA_UART default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT || \ DEBUG_VEXPRESS_UART0_CA9 || DEBUG_VEXPRESS_UART0_RS1 + default "debug/tegra.S" if DEBUG_TEGRA_UART default "mach/debug-macro.S" config EARLY_PRINTK
arch/arm/include/debug/tegra.S new file +209 -0
209 lines not on this page · raw message
arch/arm/mach-tegra/Kconfig +0 -30
@@ -57,36 +57,6 @@ config TEGRA_AHB which controls AHB bus master arbitration and some perfomance parameters(priority, prefech size). -choice - prompt "Low-level debug console UART" - default TEGRA_DEBUG_UART_AUTO_ODMDATA - -config TEGRA_DEBUG_UART_AUTO_ODMDATA - bool "Via ODMDATA" - help - Automatically determines which UART to use for low-level debug based - on the ODMDATA value. This value is part of the BCT, and is written - to the boot memory device using nvflash, or other flashing tool. - When bits 19:18 are 3, then bits 17:15 indicate which UART to use; - 0/1/2/3/4 are UART A/B/C/D/E. - -config TEGRA_DEBUG_UARTA - bool "UART-A" - -config TEGRA_DEBUG_UARTB - bool "UART-B" - -config TEGRA_DEBUG_UARTC - bool "UART-C" - -config TEGRA_DEBUG_UARTD - bool "UART-D" - -config TEGRA_DEBUG_UARTE - bool "UART-E" - -endchoice - config TEGRA_EMC_SCALING_ENABLE bool "Enable scaling the memory frequency"
arch/arm/mach-tegra/include/mach/debug-macro.S deleted +0 -211
211 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 1/3 ARM: tegra: simplify DEBUG_LL UART selection options
In reply to Stephen WarrenOn Tue, Oct 02, 2012 at 01:07:44PM -0600, Stephen Warren wrote:
[...]
arch/arm/mach-tegra/Kconfig config TEGRA_AHB · line 64
Quoted 9 lines
choice
arch/arm/mach-tegra/Kconfig +3
-4- prompt "Default low-level debug console UART" - default TEGRA_DEBUG_UART_NONE + prompt "Low-level debug console UART" + default TEGRA_DEBUG_UART_AUTO_ODMDATA -config TEGRA_DEBUG_UART_NONE - bool "None" +config TEGRA_DEBUG_UART_AUTO_ODMDATA
The first item in a list of choices is automatically selected as the default, so technically the default is redundant here. I suppose it doesn't hurt to be explicit.
Quoted 9 lines
arch/arm/mach-tegra/common.c +0
-1@@ -44,14 +44,13 @@* 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)
arch/arm/mach-tegra/common.c line 54
Quoted 10 lines
arch/arm/mach-tegra/common.c +2
-2u32 tegra_uart_config[3 ] = {/* Debug UART initialization required */ 1 ,/* Debug UART physical address */ - (u32)(IO_APB_PHYS +TEGRA_DEBUG_UART_OFFSET ), +0 ,/* Debug UART virtual address */ - (u32)(IO_APB_VIRT +TEGRA_DEBUG_UART_OFFSET ), +0 , };
I don't quite see how this is supposed to work now. Won't the debug.S code fail if these fields are set to 0?
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121002/6e8b6ce5/attachment.sig>
PATCH 1/3 ARM: tegra: simplify DEBUG_LL UART selection options
Quoted 13 lines · Thierry Reding
On Tue, Oct 02, 2012 at 01:07:44PM -0600, Stephen Warren wrote:
[...]Quoted 6 lines
choice - prompt "Default low-level debug console UART" -
defaultTEGRA_DEBUG_UART_NONE+ prompt "Low-level debug
console UART" + defaultTEGRA_DEBUG_UART_AUTO_ODMDATA-config
TEGRA_DEBUG_UART_NONE- bool "None" +configTEGRA_DEBUG_UART_AUTO_ODMDATAThe first item in a list of choices is automatically selected as the default, so technically the default is redundant here. I suppose it doesn't hurt to be explicit.
Quoted 15 lines
Quoted 12 lines
(quoted diff) +0
-0
b/arch/arm/mach-tegra/common.cindex 0b0a5f5..0913d1f 100644 ---a/arch/arm/mach-tegra/common.c+++b/arch/arm/mach-tegra/common.c@@ -44,14 +44,13 @@ * kernel is loaded. The data is declared here rather thandebug-macro.Sso * that multiple inclusions ofdebug-macro.Spoint at the same data. */ -#defineTEGRA_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), + 0, /* Debug UART
virtual address */ - (u32)(IO_APB_VIRT +TEGRA_DEBUG_UART_OFFSET), + 0, };I don't quite see how this is supposed to work now. Won't the
debug.Scode fail if these fields are set to 0?
If those fields remain set to 0, then there will be no DEBUG_LL output.
However, assuming use of a compressed zImage rather than an uncompressed Image then at this stage in the series, uncompress.h writes the UART selection and a cookie to Tegra's IRAM, and debug-macro.S reads that selection, and re-initializes those fields to whatever uncompress.h chose.
In patch 2 in the series, the coupling between uncompress.h and debug-macro.S is entirely removed, and instead, debug-macro.S initializes those values the first time a character is printed.
The values aren't hard-coded there since they are now (after patch 2) always over-written. Even when a single static UART is selected, we can't hard-code the address since debug-macro.S validates that the clock and reset bits to the UART are correctly set before using it, hence we might end up not using the UART anyway.