diff options
Diffstat (limited to 'arch/arm/mach-tegra/include/mach/uncompress.h')
-rw-r--r-- | arch/arm/mach-tegra/include/mach/uncompress.h | 175 |
1 files changed, 0 insertions, 175 deletions
diff --git a/arch/arm/mach-tegra/include/mach/uncompress.h b/arch/arm/mach-tegra/include/mach/uncompress.h deleted file mode 100644 index 08386418196f..000000000000 --- a/arch/arm/mach-tegra/include/mach/uncompress.h +++ /dev/null | |||
@@ -1,175 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-tegra/include/mach/uncompress.h | ||
3 | * | ||
4 | * Copyright (C) 2010 Google, Inc. | ||
5 | * Copyright (C) 2011 Google, Inc. | ||
6 | * Copyright (C) 2011-2012 NVIDIA CORPORATION. All Rights Reserved. | ||
7 | * | ||
8 | * Author: | ||
9 | * Colin Cross <ccross@google.com> | ||
10 | * Erik Gilling <konkers@google.com> | ||
11 | * Doug Anderson <dianders@chromium.org> | ||
12 | * Stephen Warren <swarren@nvidia.com> | ||
13 | * | ||
14 | * This software is licensed under the terms of the GNU General Public | ||
15 | * License version 2, as published by the Free Software Foundation, and | ||
16 | * may be copied, distributed, and modified under those terms. | ||
17 | * | ||
18 | * This program is distributed in the hope that it will be useful, | ||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | * GNU General Public License for more details. | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | #ifndef __MACH_TEGRA_UNCOMPRESS_H | ||
26 | #define __MACH_TEGRA_UNCOMPRESS_H | ||
27 | |||
28 | #include <linux/types.h> | ||
29 | #include <linux/serial_reg.h> | ||
30 | |||
31 | #include "../../iomap.h" | ||
32 | |||
33 | #define BIT(x) (1 << (x)) | ||
34 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) | ||
35 | |||
36 | #define DEBUG_UART_SHIFT 2 | ||
37 | |||
38 | volatile u8 *uart; | ||
39 | |||
40 | static void putc(int c) | ||
41 | { | ||
42 | if (uart == NULL) | ||
43 | return; | ||
44 | |||
45 | while (!(uart[UART_LSR << DEBUG_UART_SHIFT] & UART_LSR_THRE)) | ||
46 | barrier(); | ||
47 | uart[UART_TX << DEBUG_UART_SHIFT] = c; | ||
48 | } | ||
49 | |||
50 | static inline void flush(void) | ||
51 | { | ||
52 | } | ||
53 | |||
54 | static const struct { | ||
55 | u32 base; | ||
56 | u32 reset_reg; | ||
57 | u32 clock_reg; | ||
58 | u32 bit; | ||
59 | } uarts[] = { | ||
60 | { | ||
61 | TEGRA_UARTA_BASE, | ||
62 | TEGRA_CLK_RESET_BASE + 0x04, | ||
63 | TEGRA_CLK_RESET_BASE + 0x10, | ||
64 | 6, | ||
65 | }, | ||
66 | { | ||
67 | TEGRA_UARTB_BASE, | ||
68 | TEGRA_CLK_RESET_BASE + 0x04, | ||
69 | TEGRA_CLK_RESET_BASE + 0x10, | ||
70 | 7, | ||
71 | }, | ||
72 | { | ||
73 | TEGRA_UARTC_BASE, | ||
74 | TEGRA_CLK_RESET_BASE + 0x08, | ||
75 | TEGRA_CLK_RESET_BASE + 0x14, | ||
76 | 23, | ||
77 | }, | ||
78 | { | ||
79 | TEGRA_UARTD_BASE, | ||
80 | TEGRA_CLK_RESET_BASE + 0x0c, | ||
81 | TEGRA_CLK_RESET_BASE + 0x18, | ||
82 | 1, | ||
83 | }, | ||
84 | { | ||
85 | TEGRA_UARTE_BASE, | ||
86 | TEGRA_CLK_RESET_BASE + 0x0c, | ||
87 | TEGRA_CLK_RESET_BASE + 0x18, | ||
88 | 2, | ||
89 | }, | ||
90 | }; | ||
91 | |||
92 | static inline bool uart_clocked(int i) | ||
93 | { | ||
94 | if (*(u8 *)uarts[i].reset_reg & BIT(uarts[i].bit)) | ||
95 | return false; | ||
96 | |||
97 | if (!(*(u8 *)uarts[i].clock_reg & BIT(uarts[i].bit))) | ||
98 | return false; | ||
99 | |||
100 | return true; | ||
101 | } | ||
102 | |||
103 | #ifdef CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA | ||
104 | int auto_odmdata(void) | ||
105 | { | ||
106 | volatile u32 *pmc = (volatile u32 *)TEGRA_PMC_BASE; | ||
107 | u32 odmdata = pmc[0xa0 / 4]; | ||
108 | |||
109 | /* | ||
110 | * Bits 19:18 are the console type: 0=default, 1=none, 2==DCC, 3==UART | ||
111 | * Some boards apparently swap the last two values, but we don't have | ||
112 | * any way of catering for that here, so we just accept either. If this | ||
113 | * doesn't make sense for your board, just don't enable this feature. | ||
114 | * | ||
115 | * Bits 17:15 indicate the UART to use, 0/1/2/3/4 are UART A/B/C/D/E. | ||
116 | */ | ||
117 | |||
118 | switch ((odmdata >> 18) & 3) { | ||
119 | case 2: | ||
120 | case 3: | ||
121 | break; | ||
122 | default: | ||
123 | return -1; | ||
124 | } | ||
125 | |||
126 | return (odmdata >> 15) & 7; | ||
127 | } | ||
128 | #endif | ||
129 | |||
130 | /* | ||
131 | * Setup before decompression. This is where we do UART selection for | ||
132 | * earlyprintk and init the uart_base register. | ||
133 | */ | ||
134 | static inline void arch_decomp_setup(void) | ||
135 | { | ||
136 | int uart_id; | ||
137 | volatile u32 *apb_misc = (volatile u32 *)TEGRA_APB_MISC_BASE; | ||
138 | u32 chip, div; | ||
139 | |||
140 | #if defined(CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA) | ||
141 | uart_id = auto_odmdata(); | ||
142 | #elif defined(CONFIG_TEGRA_DEBUG_UARTA) | ||
143 | uart_id = 0; | ||
144 | #elif defined(CONFIG_TEGRA_DEBUG_UARTB) | ||
145 | uart_id = 1; | ||
146 | #elif defined(CONFIG_TEGRA_DEBUG_UARTC) | ||
147 | uart_id = 2; | ||
148 | #elif defined(CONFIG_TEGRA_DEBUG_UARTD) | ||
149 | uart_id = 3; | ||
150 | #elif defined(CONFIG_TEGRA_DEBUG_UARTE) | ||
151 | uart_id = 4; | ||
152 | #endif | ||
153 | |||
154 | if (uart_id < 0 || uart_id >= ARRAY_SIZE(uarts) || | ||
155 | !uart_clocked(uart_id)) | ||
156 | uart = NULL; | ||
157 | else | ||
158 | uart = (volatile u8 *)uarts[uart_id].base; | ||
159 | |||
160 | if (uart == NULL) | ||
161 | return; | ||
162 | |||
163 | chip = (apb_misc[0x804 / 4] >> 8) & 0xff; | ||
164 | if (chip == 0x20) | ||
165 | div = 0x0075; | ||
166 | else | ||
167 | div = 0x00dd; | ||
168 | |||
169 | uart[UART_LCR << DEBUG_UART_SHIFT] |= UART_LCR_DLAB; | ||
170 | uart[UART_DLL << DEBUG_UART_SHIFT] = div & 0xff; | ||
171 | uart[UART_DLM << DEBUG_UART_SHIFT] = div >> 8; | ||
172 | uart[UART_LCR << DEBUG_UART_SHIFT] = 3; | ||
173 | } | ||
174 | |||
175 | #endif | ||