Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: tegra: simplify DEBUG_LL UART selection options

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.

Signed-off-by: Stephen Warren <swarren@nvidia.com>

+15 -96
+9 -31
arch/arm/mach-tegra/Kconfig
··· 58 58 perfomance parameters(priority, prefech size). 59 59 60 60 choice 61 - prompt "Default low-level debug console UART" 62 - default TEGRA_DEBUG_UART_NONE 61 + prompt "Low-level debug console UART" 63 62 64 - config TEGRA_DEBUG_UART_NONE 65 - bool "None" 63 + config TEGRA_DEBUG_UART_AUTO_ODMDATA 64 + bool "Via ODMDATA" 65 + help 66 + Automatically determines which UART to use for low-level debug based 67 + on the ODMDATA value. This value is part of the BCT, and is written 68 + to the boot memory device using nvflash, or other flashing tool. 69 + When bits 19:18 are 3, then bits 17:15 indicate which UART to use; 70 + 0/1/2/3/4 are UART A/B/C/D/E. 66 71 67 72 config TEGRA_DEBUG_UARTA 68 73 bool "UART-A" ··· 83 78 84 79 config TEGRA_DEBUG_UARTE 85 80 bool "UART-E" 86 - 87 - endchoice 88 - 89 - choice 90 - prompt "Automatic low-level debug console UART" 91 - default TEGRA_DEBUG_UART_AUTO_NONE 92 - 93 - config TEGRA_DEBUG_UART_AUTO_NONE 94 - bool "None" 95 - 96 - config TEGRA_DEBUG_UART_AUTO_ODMDATA 97 - bool "Via ODMDATA" 98 - help 99 - Automatically determines which UART to use for low-level debug based 100 - on the ODMDATA value. This value is part of the BCT, and is written 101 - to the boot memory device using nvflash, or other flashing tool. 102 - When bits 19:18 are 3, then bits 17:15 indicate which UART to use; 103 - 0/1/2/3/4 are UART A/B/C/D/E. 104 - 105 - config TEGRA_DEBUG_UART_AUTO_SCRATCH 106 - bool "Via UART scratch register" 107 - help 108 - Automatically determines which UART to use for low-level debug based 109 - on the UART scratch register value. Some bootloaders put ASCII 'D' 110 - in this register when they initialize their own console UART output. 111 - Using this option allows the kernel to automatically pick the same 112 - UART. 113 81 114 82 endchoice 115 83
+2 -3
arch/arm/mach-tegra/common.c
··· 44 44 * kernel is loaded. The data is declared here rather than debug-macro.S so 45 45 * that multiple inclusions of debug-macro.S point at the same data. 46 46 */ 47 - #define TEGRA_DEBUG_UART_OFFSET (TEGRA_DEBUG_UART_BASE & 0xFFFF) 48 47 u32 tegra_uart_config[3] = { 49 48 /* Debug UART initialization required */ 50 49 1, 51 50 /* Debug UART physical address */ 52 - (u32)(IO_APB_PHYS + TEGRA_DEBUG_UART_OFFSET), 51 + 0, 53 52 /* Debug UART virtual address */ 54 - (u32)(IO_APB_VIRT + TEGRA_DEBUG_UART_OFFSET), 53 + 0, 55 54 }; 56 55 57 56 #ifdef CONFIG_OF
+4 -48
arch/arm/mach-tegra/include/mach/uncompress.h
··· 139 139 } 140 140 #endif 141 141 142 - #ifdef CONFIG_TEGRA_DEBUG_UART_AUTO_SCRATCH 143 - int auto_scratch(void) 144 - { 145 - int i; 146 - 147 - /* 148 - * Look for the first UART that: 149 - * a) Is not in reset. 150 - * b) Is clocked. 151 - * c) Has a 'D' in the scratchpad register. 152 - * 153 - * Note that on Tegra30, the first two conditions are required, since 154 - * if not true, accesses to the UART scratch register will hang. 155 - * Tegra20 doesn't have this issue. 156 - * 157 - * The intent is that the bootloader will tell the kernel which UART 158 - * to use by setting up those conditions. If nothing found, we'll fall 159 - * back to what's specified in TEGRA_DEBUG_UART_BASE. 160 - */ 161 - for (i = 0; i < ARRAY_SIZE(uarts); i++) { 162 - if (!uart_clocked(i)) 163 - continue; 164 - 165 - uart = (volatile u8 *)uarts[i].base; 166 - if (uart[UART_SCR << DEBUG_UART_SHIFT] != 'D') 167 - continue; 168 - 169 - return i; 170 - } 171 - 172 - return -1; 173 - } 174 - #endif 175 - 176 142 /* 177 143 * Setup before decompression. This is where we do UART selection for 178 144 * earlyprintk and init the uart_base register. 179 145 */ 180 146 static inline void arch_decomp_setup(void) 181 147 { 182 - int uart_id, auto_uart_id; 148 + int uart_id; 183 149 volatile u32 *apb_misc = (volatile u32 *)TEGRA_APB_MISC_BASE; 184 150 u32 chip, div; 185 151 186 - #if defined(CONFIG_TEGRA_DEBUG_UARTA) 152 + #if defined(CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA) 153 + uart_id = auto_odmdata(); 154 + #elif defined(CONFIG_TEGRA_DEBUG_UARTA) 187 155 uart_id = 0; 188 156 #elif defined(CONFIG_TEGRA_DEBUG_UARTB) 189 157 uart_id = 1; ··· 161 193 uart_id = 3; 162 194 #elif defined(CONFIG_TEGRA_DEBUG_UARTE) 163 195 uart_id = 4; 164 - #else 165 - uart_id = -1; 166 196 #endif 167 - 168 - #if defined(CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA) 169 - auto_uart_id = auto_odmdata(); 170 - #elif defined(CONFIG_TEGRA_DEBUG_UART_AUTO_SCRATCH) 171 - auto_uart_id = auto_scratch(); 172 - #else 173 - auto_uart_id = -1; 174 - #endif 175 - if (auto_uart_id != -1) 176 - uart_id = auto_uart_id; 177 197 178 198 if (uart_id < 0 || uart_id >= ARRAY_SIZE(uarts) || 179 199 !uart_clocked(uart_id))
-14
arch/arm/mach-tegra/iomap.h
··· 261 261 #define TEGRA_SDMMC4_BASE 0xC8000600 262 262 #define TEGRA_SDMMC4_SIZE SZ_512 263 263 264 - #if defined(CONFIG_TEGRA_DEBUG_UART_NONE) 265 - # define TEGRA_DEBUG_UART_BASE 0 266 - #elif defined(CONFIG_TEGRA_DEBUG_UARTA) 267 - # define TEGRA_DEBUG_UART_BASE TEGRA_UARTA_BASE 268 - #elif defined(CONFIG_TEGRA_DEBUG_UARTB) 269 - # define TEGRA_DEBUG_UART_BASE TEGRA_UARTB_BASE 270 - #elif defined(CONFIG_TEGRA_DEBUG_UARTC) 271 - # define TEGRA_DEBUG_UART_BASE TEGRA_UARTC_BASE 272 - #elif defined(CONFIG_TEGRA_DEBUG_UARTD) 273 - # define TEGRA_DEBUG_UART_BASE TEGRA_UARTD_BASE 274 - #elif defined(CONFIG_TEGRA_DEBUG_UARTE) 275 - # define TEGRA_DEBUG_UART_BASE TEGRA_UARTE_BASE 276 - #endif 277 - 278 264 /* On TEGRA, many peripherals are very closely packed in 279 265 * two 256MB io windows (that actually only use about 64KB 280 266 * at the start of each).