2 * arch/arm/plat-omap/include/mach/cpu.h
4 * OMAP cpu type detection
6 * Copyright (C) 2004, 2008 Nokia Corporation
8 * Copyright (C) 2009 Texas Instruments.
10 * Written by Tony Lindgren <tony.lindgren@nokia.com>
12 * Added OMAP4 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com>
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #ifndef __ASM_ARCH_OMAP_CPU_H
31 #define __ASM_ARCH_OMAP_CPU_H
33 #include <linux/bitops.h>
36 * Omap device type i.e. EMU/HS/TST/GP/BAD
38 #define OMAP2_DEVICE_TYPE_TEST 0
39 #define OMAP2_DEVICE_TYPE_EMU 1
40 #define OMAP2_DEVICE_TYPE_SEC 2
41 #define OMAP2_DEVICE_TYPE_GP 3
42 #define OMAP2_DEVICE_TYPE_BAD 4
51 #define OMAP_CHIP_INIT(x) { .oc = x }
55 * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
56 * CPU revision (See _REV_ defined in cpu.h) [15:08]
57 * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
59 unsigned int omap_rev(void);
62 * Define CPU revision bits
64 * Verbose meaning of the revision bits may be different for a silicon
65 * family. This difference can be handled separately.
67 #define OMAP_REVBITS_00 0x00
68 #define OMAP_REVBITS_10 0x10
69 #define OMAP_REVBITS_20 0x20
70 #define OMAP_REVBITS_30 0x30
71 #define OMAP_REVBITS_40 0x40
74 * Get the CPU revision for OMAP devices
76 #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
79 * Test if multicore OMAP support is needed
85 #ifdef CONFIG_ARCH_OMAP730
90 # define OMAP_NAME omap730
93 #ifdef CONFIG_ARCH_OMAP850
98 # define OMAP_NAME omap850
101 #ifdef CONFIG_ARCH_OMAP15XX
106 # define OMAP_NAME omap1510
109 #ifdef CONFIG_ARCH_OMAP16XX
114 # define OMAP_NAME omap16xx
117 #if (defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX))
118 # if (defined(OMAP_NAME) || defined(MULTI_OMAP1))
119 # error "OMAP1 and OMAP2 can't be selected at the same time"
122 #ifdef CONFIG_ARCH_OMAP2420
127 # define OMAP_NAME omap2420
130 #ifdef CONFIG_ARCH_OMAP2430
135 # define OMAP_NAME omap2430
138 #ifdef CONFIG_ARCH_OMAP3430
143 # define OMAP_NAME omap3430
148 * Macros to group OMAP into cpu classes.
149 * These can be used in most places.
150 * cpu_is_omap7xx(): True for OMAP730, OMAP850
151 * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
152 * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
153 * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
154 * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
155 * cpu_is_omap243x(): True for OMAP2430
156 * cpu_is_omap343x(): True for OMAP3430
158 #define GET_OMAP_CLASS (omap_rev() & 0xff)
160 #define IS_OMAP_CLASS(class, id) \
161 static inline int is_omap ##class (void) \
163 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
166 #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
168 #define IS_OMAP_SUBCLASS(subclass, id) \
169 static inline int is_omap ##subclass (void) \
171 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
174 IS_OMAP_CLASS(7xx, 0x07)
175 IS_OMAP_CLASS(15xx, 0x15)
176 IS_OMAP_CLASS(16xx, 0x16)
177 IS_OMAP_CLASS(24xx, 0x24)
178 IS_OMAP_CLASS(34xx, 0x34)
180 IS_OMAP_SUBCLASS(242x, 0x242)
181 IS_OMAP_SUBCLASS(243x, 0x243)
182 IS_OMAP_SUBCLASS(343x, 0x343)
183 IS_OMAP_SUBCLASS(363x, 0x363)
185 #define cpu_is_omap7xx() 0
186 #define cpu_is_omap15xx() 0
187 #define cpu_is_omap16xx() 0
188 #define cpu_is_omap24xx() 0
189 #define cpu_is_omap242x() 0
190 #define cpu_is_omap243x() 0
191 #define cpu_is_omap34xx() 0
192 #define cpu_is_omap343x() 0
193 #define cpu_is_omap44xx() 0
194 #define cpu_is_omap443x() 0
196 #if defined(MULTI_OMAP1)
197 # if defined(CONFIG_ARCH_OMAP730)
198 # undef cpu_is_omap7xx
199 # define cpu_is_omap7xx() is_omap7xx()
201 # if defined(CONFIG_ARCH_OMAP850)
202 # undef cpu_is_omap7xx
203 # define cpu_is_omap7xx() is_omap7xx()
205 # if defined(CONFIG_ARCH_OMAP15XX)
206 # undef cpu_is_omap15xx
207 # define cpu_is_omap15xx() is_omap15xx()
209 # if defined(CONFIG_ARCH_OMAP16XX)
210 # undef cpu_is_omap16xx
211 # define cpu_is_omap16xx() is_omap16xx()
214 # if defined(CONFIG_ARCH_OMAP730)
215 # undef cpu_is_omap7xx
216 # define cpu_is_omap7xx() 1
218 # if defined(CONFIG_ARCH_OMAP850)
219 # undef cpu_is_omap7xx
220 # define cpu_is_omap7xx() 1
222 # if defined(CONFIG_ARCH_OMAP15XX)
223 # undef cpu_is_omap15xx
224 # define cpu_is_omap15xx() 1
226 # if defined(CONFIG_ARCH_OMAP16XX)
227 # undef cpu_is_omap16xx
228 # define cpu_is_omap16xx() 1
232 #if defined(MULTI_OMAP2)
233 # if defined(CONFIG_ARCH_OMAP24XX)
234 # undef cpu_is_omap24xx
235 # undef cpu_is_omap242x
236 # undef cpu_is_omap243x
237 # define cpu_is_omap24xx() is_omap24xx()
238 # define cpu_is_omap242x() is_omap242x()
239 # define cpu_is_omap243x() is_omap243x()
241 # if defined(CONFIG_ARCH_OMAP34XX)
242 # undef cpu_is_omap34xx
243 # undef cpu_is_omap343x
244 # define cpu_is_omap34xx() is_omap34xx()
245 # define cpu_is_omap343x() is_omap343x()
248 # if defined(CONFIG_ARCH_OMAP24XX)
249 # undef cpu_is_omap24xx
250 # define cpu_is_omap24xx() 1
252 # if defined(CONFIG_ARCH_OMAP2420)
253 # undef cpu_is_omap242x
254 # define cpu_is_omap242x() 1
256 # if defined(CONFIG_ARCH_OMAP2430)
257 # undef cpu_is_omap243x
258 # define cpu_is_omap243x() 1
260 # if defined(CONFIG_ARCH_OMAP34XX)
261 # undef cpu_is_omap34xx
262 # define cpu_is_omap34xx() 1
264 # if defined(CONFIG_ARCH_OMAP3430)
265 # undef cpu_is_omap343x
266 # define cpu_is_omap343x() 1
271 * Macros to detect individual cpu types.
272 * These are only rarely needed.
273 * cpu_is_omap330(): True for OMAP330
274 * cpu_is_omap730(): True for OMAP730
275 * cpu_is_omap850(): True for OMAP850
276 * cpu_is_omap1510(): True for OMAP1510
277 * cpu_is_omap1610(): True for OMAP1610
278 * cpu_is_omap1611(): True for OMAP1611
279 * cpu_is_omap5912(): True for OMAP5912
280 * cpu_is_omap1621(): True for OMAP1621
281 * cpu_is_omap1710(): True for OMAP1710
282 * cpu_is_omap2420(): True for OMAP2420
283 * cpu_is_omap2422(): True for OMAP2422
284 * cpu_is_omap2423(): True for OMAP2423
285 * cpu_is_omap2430(): True for OMAP2430
286 * cpu_is_omap3430(): True for OMAP3430
287 * cpu_is_omap3505(): True for OMAP3505
288 * cpu_is_omap3517(): True for OMAP3517
290 #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
292 #define IS_OMAP_TYPE(type, id) \
293 static inline int is_omap ##type (void) \
295 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
298 IS_OMAP_TYPE(310, 0x0310)
299 IS_OMAP_TYPE(730, 0x0730)
300 IS_OMAP_TYPE(850, 0x0850)
301 IS_OMAP_TYPE(1510, 0x1510)
302 IS_OMAP_TYPE(1610, 0x1610)
303 IS_OMAP_TYPE(1611, 0x1611)
304 IS_OMAP_TYPE(5912, 0x1611)
305 IS_OMAP_TYPE(1621, 0x1621)
306 IS_OMAP_TYPE(1710, 0x1710)
307 IS_OMAP_TYPE(2420, 0x2420)
308 IS_OMAP_TYPE(2422, 0x2422)
309 IS_OMAP_TYPE(2423, 0x2423)
310 IS_OMAP_TYPE(2430, 0x2430)
311 IS_OMAP_TYPE(3430, 0x3430)
312 IS_OMAP_TYPE(3505, 0x3505)
313 IS_OMAP_TYPE(3517, 0x3517)
315 #define cpu_is_omap310() 0
316 #define cpu_is_omap730() 0
317 #define cpu_is_omap850() 0
318 #define cpu_is_omap1510() 0
319 #define cpu_is_omap1610() 0
320 #define cpu_is_omap5912() 0
321 #define cpu_is_omap1611() 0
322 #define cpu_is_omap1621() 0
323 #define cpu_is_omap1710() 0
324 #define cpu_is_omap2420() 0
325 #define cpu_is_omap2422() 0
326 #define cpu_is_omap2423() 0
327 #define cpu_is_omap2430() 0
328 #define cpu_is_omap3503() 0
329 #define cpu_is_omap3515() 0
330 #define cpu_is_omap3525() 0
331 #define cpu_is_omap3530() 0
332 #define cpu_is_omap3505() 0
333 #define cpu_is_omap3517() 0
334 #define cpu_is_omap3430() 0
335 #define cpu_is_omap3630() 0
338 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
339 * between 730 vs 850, 330 vs. 1510 and 1611B/5912 vs. 1710.
342 #if defined(CONFIG_ARCH_OMAP730)
343 # undef cpu_is_omap730
344 # define cpu_is_omap730() is_omap730()
347 #if defined(CONFIG_ARCH_OMAP850)
348 # undef cpu_is_omap850
349 # define cpu_is_omap850() is_omap850()
352 #if defined(CONFIG_ARCH_OMAP15XX)
353 # undef cpu_is_omap310
354 # undef cpu_is_omap1510
355 # define cpu_is_omap310() is_omap310()
356 # define cpu_is_omap1510() is_omap1510()
359 #if defined(CONFIG_ARCH_OMAP16XX)
360 # undef cpu_is_omap1610
361 # undef cpu_is_omap1611
362 # undef cpu_is_omap5912
363 # undef cpu_is_omap1621
364 # undef cpu_is_omap1710
365 # define cpu_is_omap1610() is_omap1610()
366 # define cpu_is_omap1611() is_omap1611()
367 # define cpu_is_omap5912() is_omap5912()
368 # define cpu_is_omap1621() is_omap1621()
369 # define cpu_is_omap1710() is_omap1710()
372 #if defined(CONFIG_ARCH_OMAP24XX)
373 # undef cpu_is_omap2420
374 # undef cpu_is_omap2422
375 # undef cpu_is_omap2423
376 # undef cpu_is_omap2430
377 # define cpu_is_omap2420() is_omap2420()
378 # define cpu_is_omap2422() is_omap2422()
379 # define cpu_is_omap2423() is_omap2423()
380 # define cpu_is_omap2430() is_omap2430()
383 #if defined(CONFIG_ARCH_OMAP34XX)
384 # undef cpu_is_omap3430
385 # undef cpu_is_omap3503
386 # undef cpu_is_omap3515
387 # undef cpu_is_omap3525
388 # undef cpu_is_omap3530
389 # undef cpu_is_omap3505
390 # undef cpu_is_omap3517
391 # define cpu_is_omap3430() is_omap3430()
392 # define cpu_is_omap3503() (cpu_is_omap3430() && \
393 (!omap3_has_iva()) && \
395 # define cpu_is_omap3515() (cpu_is_omap3430() && \
396 (omap3_has_iva()) && \
398 # define cpu_is_omap3525() (cpu_is_omap3430() && \
399 (omap3_has_sgx()) && \
401 # define cpu_is_omap3530() (cpu_is_omap3430())
402 # define cpu_is_omap3505() is_omap3505()
403 # define cpu_is_omap3517() is_omap3517()
404 # undef cpu_is_omap3630
405 # define cpu_is_omap3630() is_omap363x()
408 # if defined(CONFIG_ARCH_OMAP4)
409 # undef cpu_is_omap44xx
410 # undef cpu_is_omap443x
411 # define cpu_is_omap44xx() 1
412 # define cpu_is_omap443x() 1
415 /* Macros to detect if we have OMAP1 or OMAP2 */
416 #define cpu_class_is_omap1() (cpu_is_omap7xx() || cpu_is_omap15xx() || \
418 #define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx() || \
421 /* Various silicon revisions for omap2 */
422 #define OMAP242X_CLASS 0x24200024
423 #define OMAP2420_REV_ES1_0 0x24200024
424 #define OMAP2420_REV_ES2_0 0x24201024
426 #define OMAP243X_CLASS 0x24300024
427 #define OMAP2430_REV_ES1_0 0x24300024
429 #define OMAP343X_CLASS 0x34300034
430 #define OMAP3430_REV_ES1_0 0x34300034
431 #define OMAP3430_REV_ES2_0 0x34301034
432 #define OMAP3430_REV_ES2_1 0x34302034
433 #define OMAP3430_REV_ES3_0 0x34303034
434 #define OMAP3430_REV_ES3_1 0x34304034
436 #define OMAP3630_REV_ES1_0 0x36300034
438 #define OMAP35XX_CLASS 0x35000034
439 #define OMAP3503_REV(v) (OMAP35XX_CLASS | (0x3503 << 16) | (v << 12))
440 #define OMAP3515_REV(v) (OMAP35XX_CLASS | (0x3515 << 16) | (v << 12))
441 #define OMAP3525_REV(v) (OMAP35XX_CLASS | (0x3525 << 16) | (v << 12))
442 #define OMAP3530_REV(v) (OMAP35XX_CLASS | (0x3530 << 16) | (v << 12))
443 #define OMAP3505_REV(v) (OMAP35XX_CLASS | (0x3505 << 16) | (v << 12))
444 #define OMAP3517_REV(v) (OMAP35XX_CLASS | (0x3517 << 16) | (v << 12))
446 #define OMAP443X_CLASS 0x44300034
451 * CHIP_IS_OMAP{2420,2430,3430} indicate that a particular structure is
452 * valid on all chips of that type. CHIP_IS_OMAP3430ES{1,2} indicates
453 * something that is only valid on that particular ES revision.
455 * These bits may be ORed together to indicate structures that are
456 * available on multiple chip types.
458 * To test whether a particular structure matches the current OMAP chip type,
459 * use omap_chip_is().
462 #define CHIP_IS_OMAP2420 (1 << 0)
463 #define CHIP_IS_OMAP2430 (1 << 1)
464 #define CHIP_IS_OMAP3430 (1 << 2)
465 #define CHIP_IS_OMAP3430ES1 (1 << 3)
466 #define CHIP_IS_OMAP3430ES2 (1 << 4)
467 #define CHIP_IS_OMAP3430ES3_0 (1 << 5)
468 #define CHIP_IS_OMAP3430ES3_1 (1 << 6)
469 #define CHIP_IS_OMAP3630ES1 (1 << 7)
471 #define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)
474 * "GE" here represents "greater than or equal to" in terms of ES
475 * levels. So CHIP_GE_OMAP3430ES2 is intended to match all OMAP3430
476 * chips at ES2 and beyond, but not, for example, any OMAP lines after
479 #define CHIP_GE_OMAP3430ES2 (CHIP_IS_OMAP3430ES2 | \
480 CHIP_IS_OMAP3430ES3_0 | \
481 CHIP_IS_OMAP3430ES3_1 | \
483 #define CHIP_GE_OMAP3430ES3_1 (CHIP_IS_OMAP3430ES3_1 | \
487 int omap_chip_is(struct omap_chip_id oci);
488 void omap2_check_revision(void);
491 * Runtime detection of OMAP3 features
493 extern u32 omap3_features;
495 #define OMAP3_HAS_L2CACHE BIT(0)
496 #define OMAP3_HAS_IVA BIT(1)
497 #define OMAP3_HAS_SGX BIT(2)
498 #define OMAP3_HAS_NEON BIT(3)
499 #define OMAP3_HAS_ISP BIT(4)
501 #define OMAP3_HAS_FEATURE(feat,flag) \
502 static inline unsigned int omap3_has_ ##feat(void) \
504 return (omap3_features & OMAP3_HAS_ ##flag); \
507 OMAP3_HAS_FEATURE(l2cache, L2CACHE)
508 OMAP3_HAS_FEATURE(sgx, SGX)
509 OMAP3_HAS_FEATURE(iva, IVA)
510 OMAP3_HAS_FEATURE(neon, NEON)
511 OMAP3_HAS_FEATURE(isp, ISP)