diff options
author | Stephen Warren <swarren@nvidia.com> | 2012-01-06 05:43:22 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-02-06 21:25:00 -0500 |
commit | 6d7d7b3ecd20a0fbcebdbdffe7b25d94cfa37d93 (patch) | |
tree | efafbbdddc07b69e86d6c7612ca067179e405457 /arch/arm/mach-tegra/include/mach/debug-macro.S | |
parent | fe2639892cb618d5c42ea4570feea8dc497d0487 (diff) |
ARM: tegra: Pass uncompress.h UART selection to DEBUG_LL
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>
Tested-by: Doug Anderson <dianders@chromium.org>
Acked-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/mach-tegra/include/mach/debug-macro.S')
-rw-r--r-- | arch/arm/mach-tegra/include/mach/debug-macro.S | 88 |
1 files changed, 77 insertions, 11 deletions
diff --git a/arch/arm/mach-tegra/include/mach/debug-macro.S b/arch/arm/mach-tegra/include/mach/debug-macro.S index 619abc63aee8..90069abd37bd 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 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-tegra/include/mach/debug-macro.S | 2 | * arch/arm/mach-tegra/include/mach/debug-macro.S |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Google, Inc. | 4 | * Copyright (C) 2010,2011 Google, Inc. |
5 | * Copyright (C) 2011-2012 NVIDIA CORPORATION. All Rights Reserved. | ||
5 | * | 6 | * |
6 | * Author: | 7 | * Author: |
7 | * Colin Cross <ccross@google.com> | 8 | * Colin Cross <ccross@google.com> |
8 | * Erik Gilling <konkers@google.com> | 9 | * Erik Gilling <konkers@google.com> |
10 | * Doug Anderson <dianders@chromium.org> | ||
11 | * Stephen Warren <swarren@nvidia.com> | ||
12 | * | ||
13 | * Portions based on mach-omap2's debug-macro.S | ||
14 | * Copyright (C) 1994-1999 Russell King | ||
9 | * | 15 | * |
10 | * This software is licensed under the terms of the GNU General Public | 16 | * This software is licensed under the terms of the GNU General Public |
11 | * License version 2, as published by the Free Software Foundation, and | 17 | * License version 2, as published by the Free Software Foundation, and |
@@ -18,18 +24,78 @@ | |||
18 | * | 24 | * |
19 | */ | 25 | */ |
20 | 26 | ||
27 | #include <linux/serial_reg.h> | ||
28 | |||
21 | #include <mach/io.h> | 29 | #include <mach/io.h> |
22 | #include <mach/iomap.h> | 30 | #include <mach/iomap.h> |
31 | #include <mach/irammap.h> | ||
32 | |||
33 | .macro addruart, rp, rv, tmp | ||
34 | adr \rp, 99f @ actual addr of 99f | ||
35 | ldr \rv, [\rp] @ linked addr is stored there | ||
36 | sub \rv, \rv, \rp @ offset between the two | ||
37 | ldr \rp, [\rp, #4] @ linked tegra_uart_config | ||
38 | sub \tmp, \rp, \rv @ actual tegra_uart_config | ||
39 | ldr \rp, [\tmp] @ Load tegra_uart_config | ||
40 | cmp \rp, #1 @ needs intitialization? | ||
41 | bne 100f @ no; go load the addresses | ||
42 | mov \rv, #0 @ yes; record init is done | ||
43 | str \rv, [\tmp] | ||
44 | mov \rp, #TEGRA_IRAM_BASE @ See if cookie is in IRAM | ||
45 | ldr \rv, [\rp, #TEGRA_IRAM_DEBUG_UART_OFFSET] | ||
46 | movw \rp, #TEGRA_IRAM_DEBUG_UART_COOKIE & 0xffff | ||
47 | movt \rp, #TEGRA_IRAM_DEBUG_UART_COOKIE >> 16 | ||
48 | cmp \rv, \rp @ Cookie present? | ||
49 | bne 100f @ No, use default UART | ||
50 | mov \rp, #TEGRA_IRAM_BASE @ Load UART address from IRAM | ||
51 | ldr \rv, [\rp, #TEGRA_IRAM_DEBUG_UART_OFFSET + 4] | ||
52 | str \rv, [\tmp, #4] @ Store in tegra_uart_phys | ||
53 | sub \rv, \rv, #IO_APB_PHYS @ Calculate virt address | ||
54 | add \rv, \rv, #IO_APB_VIRT | ||
55 | str \rv, [\tmp, #8] @ Store in tegra_uart_virt | ||
56 | b 100f | ||
57 | |||
58 | .align | ||
59 | 99: .word . | ||
60 | .word tegra_uart_config | ||
61 | .ltorg | ||
62 | |||
63 | 100: ldr \rp, [\tmp, #4] @ Load tegra_uart_phys | ||
64 | ldr \rv, [\tmp, #8] @ Load tegra_uart_virt | ||
65 | .endm | ||
66 | |||
67 | #define UART_SHIFT 2 | ||
68 | |||
69 | /* | ||
70 | * Code below is swiped from <asm/hardware/debug-8250.S>, but add an extra | ||
71 | * check to make sure that we aren't in the CONFIG_TEGRA_DEBUG_UART_NONE case. | ||
72 | * We use the fact that all 5 valid UART addresses all have something in the | ||
73 | * 2nd-to-lowest byte. | ||
74 | */ | ||
23 | 75 | ||
24 | .macro addruart, rp, rv, tmp | 76 | .macro senduart, rd, rx |
25 | ldr \rp, =IO_APB_PHYS @ physical | 77 | tst \rx, #0x0000ff00 |
26 | ldr \rv, =IO_APB_VIRT @ virtual | 78 | strneb \rd, [\rx, #UART_TX << UART_SHIFT] |
27 | orr \rp, \rp, #(TEGRA_DEBUG_UART_BASE & 0xFF) | 79 | 1001: |
28 | orr \rp, \rp, #(TEGRA_DEBUG_UART_BASE & 0xFF00) | 80 | .endm |
29 | orr \rv, \rv, #(TEGRA_DEBUG_UART_BASE & 0xFF) | ||
30 | orr \rv, \rv, #(TEGRA_DEBUG_UART_BASE & 0xFF00) | ||
31 | .endm | ||
32 | 81 | ||
33 | #define UART_SHIFT 2 | 82 | .macro busyuart, rd, rx |
34 | #include <asm/hardware/debug-8250.S> | 83 | tst \rx, #0x0000ff00 |
84 | beq 1002f | ||
85 | 1001: ldrb \rd, [\rx, #UART_LSR << UART_SHIFT] | ||
86 | and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE | ||
87 | teq \rd, #UART_LSR_TEMT | UART_LSR_THRE | ||
88 | bne 1001b | ||
89 | 1002: | ||
90 | .endm | ||
35 | 91 | ||
92 | .macro waituart, rd, rx | ||
93 | #ifdef FLOW_CONTROL | ||
94 | tst \rx, #0x0000ff00 | ||
95 | beq 1002f | ||
96 | 1001: ldrb \rd, [\rx, #UART_MSR << UART_SHIFT] | ||
97 | tst \rd, #UART_MSR_CTS | ||
98 | beq 1001b | ||
99 | 1002: | ||
100 | #endif | ||
101 | .endm | ||