]>
Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
a09e64fb | 2 | * arch/arm/plat-omap/include/mach/cpu.h |
1da177e4 LT |
3 | * |
4 | * OMAP cpu type detection | |
5 | * | |
097c584c | 6 | * Copyright (C) 2004, 2008 Nokia Corporation |
1da177e4 LT |
7 | * |
8 | * Written by Tony Lindgren <tony.lindgren@nokia.com> | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License as published by | |
12 | * the Free Software Foundation; either version 2 of the License, or | |
13 | * (at your option) any later version. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, | |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | * GNU General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License | |
21 | * along with this program; if not, write to the Free Software | |
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
23 | * | |
24 | */ | |
25 | ||
26 | #ifndef __ASM_ARCH_OMAP_CPU_H | |
27 | #define __ASM_ARCH_OMAP_CPU_H | |
28 | ||
097c584c PW |
29 | struct omap_chip_id { |
30 | u8 oc; | |
a8823143 | 31 | u8 type; |
097c584c PW |
32 | }; |
33 | ||
34 | #define OMAP_CHIP_INIT(x) { .oc = x } | |
35 | ||
a8823143 TL |
36 | /* |
37 | * system_rev bits: | |
38 | * CPU id bits (0730, 1510, 1710, 2422...) [31:16] | |
39 | * CPU revision (See _REV_ defined in cpu.h) [15:08] | |
40 | * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00] | |
41 | */ | |
1da177e4 LT |
42 | extern unsigned int system_rev; |
43 | ||
1da177e4 LT |
44 | /* |
45 | * Test if multicore OMAP support is needed | |
46 | */ | |
9839c6b8 TL |
47 | #undef MULTI_OMAP1 |
48 | #undef MULTI_OMAP2 | |
1da177e4 LT |
49 | #undef OMAP_NAME |
50 | ||
51 | #ifdef CONFIG_ARCH_OMAP730 | |
52 | # ifdef OMAP_NAME | |
9839c6b8 TL |
53 | # undef MULTI_OMAP1 |
54 | # define MULTI_OMAP1 | |
1da177e4 LT |
55 | # else |
56 | # define OMAP_NAME omap730 | |
57 | # endif | |
58 | #endif | |
9ad5897c | 59 | #ifdef CONFIG_ARCH_OMAP15XX |
1da177e4 | 60 | # ifdef OMAP_NAME |
9839c6b8 TL |
61 | # undef MULTI_OMAP1 |
62 | # define MULTI_OMAP1 | |
1da177e4 LT |
63 | # else |
64 | # define OMAP_NAME omap1510 | |
65 | # endif | |
66 | #endif | |
67 | #ifdef CONFIG_ARCH_OMAP16XX | |
68 | # ifdef OMAP_NAME | |
9839c6b8 TL |
69 | # undef MULTI_OMAP1 |
70 | # define MULTI_OMAP1 | |
1da177e4 | 71 | # else |
9839c6b8 | 72 | # define OMAP_NAME omap16xx |
1da177e4 LT |
73 | # endif |
74 | #endif | |
2c17f615 | 75 | #if (defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)) |
9839c6b8 TL |
76 | # if (defined(OMAP_NAME) || defined(MULTI_OMAP1)) |
77 | # error "OMAP1 and OMAP2 can't be selected at the same time" | |
2c17f615 SMK |
78 | # endif |
79 | #endif | |
80 | #ifdef CONFIG_ARCH_OMAP2420 | |
81 | # ifdef OMAP_NAME | |
82 | # undef MULTI_OMAP2 | |
83 | # define MULTI_OMAP2 | |
1da177e4 | 84 | # else |
2c17f615 SMK |
85 | # define OMAP_NAME omap2420 |
86 | # endif | |
87 | #endif | |
88 | #ifdef CONFIG_ARCH_OMAP2430 | |
89 | # ifdef OMAP_NAME | |
90 | # undef MULTI_OMAP2 | |
91 | # define MULTI_OMAP2 | |
92 | # else | |
93 | # define OMAP_NAME omap2430 | |
94 | # endif | |
95 | #endif | |
96 | #ifdef CONFIG_ARCH_OMAP3430 | |
97 | # ifdef OMAP_NAME | |
9839c6b8 | 98 | # undef MULTI_OMAP2 |
2c17f615 SMK |
99 | # define MULTI_OMAP2 |
100 | # else | |
101 | # define OMAP_NAME omap3430 | |
1da177e4 LT |
102 | # endif |
103 | #endif | |
104 | ||
105 | /* | |
9839c6b8 TL |
106 | * Macros to group OMAP into cpu classes. |
107 | * These can be used in most places. | |
108 | * cpu_is_omap7xx(): True for OMAP730 | |
9ad5897c | 109 | * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310 |
9839c6b8 | 110 | * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710 |
9ad5897c TL |
111 | * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430 |
112 | * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423 | |
113 | * cpu_is_omap243x(): True for OMAP2430 | |
2c17f615 | 114 | * cpu_is_omap343x(): True for OMAP3430 |
1da177e4 | 115 | */ |
a8823143 | 116 | #define GET_OMAP_CLASS (system_rev & 0xff) |
1da177e4 | 117 | |
1da177e4 LT |
118 | #define IS_OMAP_CLASS(class, id) \ |
119 | static inline int is_omap ##class (void) \ | |
120 | { \ | |
121 | return (GET_OMAP_CLASS == (id)) ? 1 : 0; \ | |
122 | } | |
123 | ||
9ad5897c TL |
124 | #define GET_OMAP_SUBCLASS ((system_rev >> 20) & 0x0fff) |
125 | ||
126 | #define IS_OMAP_SUBCLASS(subclass, id) \ | |
127 | static inline int is_omap ##subclass (void) \ | |
128 | { \ | |
129 | return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \ | |
130 | } | |
131 | ||
1da177e4 LT |
132 | IS_OMAP_CLASS(7xx, 0x07) |
133 | IS_OMAP_CLASS(15xx, 0x15) | |
134 | IS_OMAP_CLASS(16xx, 0x16) | |
135 | IS_OMAP_CLASS(24xx, 0x24) | |
2c17f615 | 136 | IS_OMAP_CLASS(34xx, 0x34) |
1da177e4 | 137 | |
9ad5897c TL |
138 | IS_OMAP_SUBCLASS(242x, 0x242) |
139 | IS_OMAP_SUBCLASS(243x, 0x243) | |
2c17f615 | 140 | IS_OMAP_SUBCLASS(343x, 0x343) |
9ad5897c | 141 | |
9839c6b8 TL |
142 | #define cpu_is_omap7xx() 0 |
143 | #define cpu_is_omap15xx() 0 | |
144 | #define cpu_is_omap16xx() 0 | |
145 | #define cpu_is_omap24xx() 0 | |
9ad5897c TL |
146 | #define cpu_is_omap242x() 0 |
147 | #define cpu_is_omap243x() 0 | |
2c17f615 SMK |
148 | #define cpu_is_omap34xx() 0 |
149 | #define cpu_is_omap343x() 0 | |
9839c6b8 TL |
150 | |
151 | #if defined(MULTI_OMAP1) | |
152 | # if defined(CONFIG_ARCH_OMAP730) | |
153 | # undef cpu_is_omap7xx | |
154 | # define cpu_is_omap7xx() is_omap7xx() | |
155 | # endif | |
9ad5897c | 156 | # if defined(CONFIG_ARCH_OMAP15XX) |
9839c6b8 TL |
157 | # undef cpu_is_omap15xx |
158 | # define cpu_is_omap15xx() is_omap15xx() | |
159 | # endif | |
160 | # if defined(CONFIG_ARCH_OMAP16XX) | |
161 | # undef cpu_is_omap16xx | |
1da177e4 LT |
162 | # define cpu_is_omap16xx() is_omap16xx() |
163 | # endif | |
164 | #else | |
165 | # if defined(CONFIG_ARCH_OMAP730) | |
9839c6b8 | 166 | # undef cpu_is_omap7xx |
1da177e4 | 167 | # define cpu_is_omap7xx() 1 |
1da177e4 | 168 | # endif |
9ad5897c | 169 | # if defined(CONFIG_ARCH_OMAP15XX) |
9839c6b8 | 170 | # undef cpu_is_omap15xx |
1da177e4 | 171 | # define cpu_is_omap15xx() 1 |
1da177e4 LT |
172 | # endif |
173 | # if defined(CONFIG_ARCH_OMAP16XX) | |
9839c6b8 | 174 | # undef cpu_is_omap16xx |
1da177e4 | 175 | # define cpu_is_omap16xx() 1 |
9839c6b8 | 176 | # endif |
2c17f615 SMK |
177 | #endif |
178 | ||
179 | #if defined(MULTI_OMAP2) | |
9839c6b8 TL |
180 | # if defined(CONFIG_ARCH_OMAP24XX) |
181 | # undef cpu_is_omap24xx | |
9ad5897c TL |
182 | # undef cpu_is_omap242x |
183 | # undef cpu_is_omap243x | |
2c17f615 | 184 | # define cpu_is_omap24xx() is_omap24xx() |
9ad5897c TL |
185 | # define cpu_is_omap242x() is_omap242x() |
186 | # define cpu_is_omap243x() is_omap243x() | |
1da177e4 | 187 | # endif |
2c17f615 SMK |
188 | # if defined(CONFIG_ARCH_OMAP34XX) |
189 | # undef cpu_is_omap34xx | |
190 | # undef cpu_is_omap343x | |
191 | # define cpu_is_omap34xx() is_omap34xx() | |
192 | # define cpu_is_omap343x() is_omap343x() | |
193 | # endif | |
194 | #else | |
195 | # if defined(CONFIG_ARCH_OMAP24XX) | |
196 | # undef cpu_is_omap24xx | |
197 | # define cpu_is_omap24xx() 1 | |
198 | # endif | |
199 | # if defined(CONFIG_ARCH_OMAP2420) | |
200 | # undef cpu_is_omap242x | |
201 | # define cpu_is_omap242x() 1 | |
202 | # endif | |
203 | # if defined(CONFIG_ARCH_OMAP2430) | |
204 | # undef cpu_is_omap243x | |
205 | # define cpu_is_omap243x() 1 | |
206 | # endif | |
207 | # if defined(CONFIG_ARCH_OMAP34XX) | |
208 | # undef cpu_is_omap34xx | |
209 | # define cpu_is_omap34xx() 1 | |
210 | # endif | |
211 | # if defined(CONFIG_ARCH_OMAP3430) | |
212 | # undef cpu_is_omap343x | |
213 | # define cpu_is_omap343x() 1 | |
214 | # endif | |
1da177e4 LT |
215 | #endif |
216 | ||
9839c6b8 TL |
217 | /* |
218 | * Macros to detect individual cpu types. | |
219 | * These are only rarely needed. | |
9ad5897c | 220 | * cpu_is_omap330(): True for OMAP330 |
9839c6b8 TL |
221 | * cpu_is_omap730(): True for OMAP730 |
222 | * cpu_is_omap1510(): True for OMAP1510 | |
223 | * cpu_is_omap1610(): True for OMAP1610 | |
224 | * cpu_is_omap1611(): True for OMAP1611 | |
225 | * cpu_is_omap5912(): True for OMAP5912 | |
226 | * cpu_is_omap1621(): True for OMAP1621 | |
227 | * cpu_is_omap1710(): True for OMAP1710 | |
228 | * cpu_is_omap2420(): True for OMAP2420 | |
9ad5897c TL |
229 | * cpu_is_omap2422(): True for OMAP2422 |
230 | * cpu_is_omap2423(): True for OMAP2423 | |
231 | * cpu_is_omap2430(): True for OMAP2430 | |
2c17f615 | 232 | * cpu_is_omap3430(): True for OMAP3430 |
9839c6b8 TL |
233 | */ |
234 | #define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff) | |
235 | ||
236 | #define IS_OMAP_TYPE(type, id) \ | |
237 | static inline int is_omap ##type (void) \ | |
238 | { \ | |
239 | return (GET_OMAP_TYPE == (id)) ? 1 : 0; \ | |
240 | } | |
241 | ||
9ad5897c | 242 | IS_OMAP_TYPE(310, 0x0310) |
9839c6b8 TL |
243 | IS_OMAP_TYPE(730, 0x0730) |
244 | IS_OMAP_TYPE(1510, 0x1510) | |
245 | IS_OMAP_TYPE(1610, 0x1610) | |
246 | IS_OMAP_TYPE(1611, 0x1611) | |
247 | IS_OMAP_TYPE(5912, 0x1611) | |
248 | IS_OMAP_TYPE(1621, 0x1621) | |
249 | IS_OMAP_TYPE(1710, 0x1710) | |
250 | IS_OMAP_TYPE(2420, 0x2420) | |
9ad5897c TL |
251 | IS_OMAP_TYPE(2422, 0x2422) |
252 | IS_OMAP_TYPE(2423, 0x2423) | |
253 | IS_OMAP_TYPE(2430, 0x2430) | |
2c17f615 | 254 | IS_OMAP_TYPE(3430, 0x3430) |
9839c6b8 | 255 | |
9ad5897c | 256 | #define cpu_is_omap310() 0 |
9839c6b8 TL |
257 | #define cpu_is_omap730() 0 |
258 | #define cpu_is_omap1510() 0 | |
259 | #define cpu_is_omap1610() 0 | |
260 | #define cpu_is_omap5912() 0 | |
261 | #define cpu_is_omap1611() 0 | |
262 | #define cpu_is_omap1621() 0 | |
263 | #define cpu_is_omap1710() 0 | |
264 | #define cpu_is_omap2420() 0 | |
9ad5897c TL |
265 | #define cpu_is_omap2422() 0 |
266 | #define cpu_is_omap2423() 0 | |
267 | #define cpu_is_omap2430() 0 | |
2c17f615 | 268 | #define cpu_is_omap3430() 0 |
9839c6b8 TL |
269 | |
270 | #if defined(MULTI_OMAP1) | |
271 | # if defined(CONFIG_ARCH_OMAP730) | |
272 | # undef cpu_is_omap730 | |
273 | # define cpu_is_omap730() is_omap730() | |
274 | # endif | |
1da177e4 LT |
275 | #else |
276 | # if defined(CONFIG_ARCH_OMAP730) | |
9839c6b8 | 277 | # undef cpu_is_omap730 |
1da177e4 | 278 | # define cpu_is_omap730() 1 |
1da177e4 | 279 | # endif |
9839c6b8 TL |
280 | #endif |
281 | ||
282 | /* | |
283 | * Whether we have MULTI_OMAP1 or not, we still need to distinguish | |
9ad5897c | 284 | * between 330 vs. 1510 and 1611B/5912 vs. 1710. |
9839c6b8 | 285 | */ |
9ad5897c TL |
286 | #if defined(CONFIG_ARCH_OMAP15XX) |
287 | # undef cpu_is_omap310 | |
288 | # undef cpu_is_omap1510 | |
289 | # define cpu_is_omap310() is_omap310() | |
290 | # define cpu_is_omap1510() is_omap1510() | |
291 | #endif | |
292 | ||
9839c6b8 TL |
293 | #if defined(CONFIG_ARCH_OMAP16XX) |
294 | # undef cpu_is_omap1610 | |
295 | # undef cpu_is_omap1611 | |
296 | # undef cpu_is_omap5912 | |
297 | # undef cpu_is_omap1621 | |
298 | # undef cpu_is_omap1710 | |
1da177e4 | 299 | # define cpu_is_omap1610() is_omap1610() |
9839c6b8 | 300 | # define cpu_is_omap1611() is_omap1611() |
1da177e4 | 301 | # define cpu_is_omap5912() is_omap5912() |
9839c6b8 | 302 | # define cpu_is_omap1621() is_omap1621() |
1da177e4 | 303 | # define cpu_is_omap1710() is_omap1710() |
9839c6b8 TL |
304 | #endif |
305 | ||
9ad5897c TL |
306 | #if defined(CONFIG_ARCH_OMAP24XX) |
307 | # undef cpu_is_omap2420 | |
308 | # undef cpu_is_omap2422 | |
309 | # undef cpu_is_omap2423 | |
310 | # undef cpu_is_omap2430 | |
311 | # define cpu_is_omap2420() is_omap2420() | |
312 | # define cpu_is_omap2422() is_omap2422() | |
313 | # define cpu_is_omap2423() is_omap2423() | |
314 | # define cpu_is_omap2430() is_omap2430() | |
1da177e4 LT |
315 | #endif |
316 | ||
2c17f615 SMK |
317 | #if defined(CONFIG_ARCH_OMAP34XX) |
318 | # undef cpu_is_omap3430 | |
319 | # define cpu_is_omap3430() is_omap3430() | |
320 | #endif | |
321 | ||
9ad5897c TL |
322 | /* Macros to detect if we have OMAP1 or OMAP2 */ |
323 | #define cpu_class_is_omap1() (cpu_is_omap730() || cpu_is_omap15xx() || \ | |
324 | cpu_is_omap16xx()) | |
2c17f615 SMK |
325 | #define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx()) |
326 | ||
327 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | |
2c17f615 | 328 | |
a8823143 TL |
329 | /* Various silicon revisions for omap2 */ |
330 | #define OMAP242X_CLASS 0x24200024 | |
331 | #define OMAP2420_REV_ES1_0 0x24200024 | |
332 | #define OMAP2420_REV_ES2_0 0x24201024 | |
2c17f615 | 333 | |
a8823143 TL |
334 | #define OMAP243X_CLASS 0x24300024 |
335 | #define OMAP2430_REV_ES1_0 0x24300024 | |
2c17f615 | 336 | |
a8823143 TL |
337 | #define OMAP343X_CLASS 0x34300034 |
338 | #define OMAP3430_REV_ES1_0 0x34300034 | |
339 | #define OMAP3430_REV_ES2_0 0x34301034 | |
340 | #define OMAP3430_REV_ES2_1 0x34302034 | |
341 | #define OMAP3430_REV_ES3_0 0x34303034 | |
097c584c PW |
342 | |
343 | /* | |
344 | * omap_chip bits | |
345 | * | |
346 | * CHIP_IS_OMAP{2420,2430,3430} indicate that a particular structure is | |
347 | * valid on all chips of that type. CHIP_IS_OMAP3430ES{1,2} indicates | |
348 | * something that is only valid on that particular ES revision. | |
349 | * | |
350 | * These bits may be ORed together to indicate structures that are | |
351 | * available on multiple chip types. | |
352 | * | |
353 | * To test whether a particular structure matches the current OMAP chip type, | |
354 | * use omap_chip_is(). | |
355 | * | |
356 | */ | |
357 | #define CHIP_IS_OMAP2420 (1 << 0) | |
358 | #define CHIP_IS_OMAP2430 (1 << 1) | |
359 | #define CHIP_IS_OMAP3430 (1 << 2) | |
360 | #define CHIP_IS_OMAP3430ES1 (1 << 3) | |
361 | #define CHIP_IS_OMAP3430ES2 (1 << 4) | |
362 | ||
363 | #define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430) | |
364 | ||
365 | int omap_chip_is(struct omap_chip_id oci); | |
a8823143 | 366 | int omap_type(void); |
2c17f615 SMK |
367 | |
368 | /* | |
369 | * Macro to detect device type i.e. EMU/HS/TST/GP/BAD | |
370 | */ | |
a8823143 TL |
371 | #define OMAP2_DEVICE_TYPE_TEST 0 |
372 | #define OMAP2_DEVICE_TYPE_EMU 1 | |
373 | #define OMAP2_DEVICE_TYPE_SEC 2 | |
374 | #define OMAP2_DEVICE_TYPE_GP 3 | |
375 | #define OMAP2_DEVICE_TYPE_BAD 4 | |
2c17f615 | 376 | |
097c584c PW |
377 | void omap2_check_revision(void); |
378 | ||
379 | #endif /* defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) */ | |
9ad5897c | 380 | |
1da177e4 | 381 | #endif |