30 #ifndef __ASM_ARCH_OMAP_CPU_H
31 #define __ASM_ARCH_OMAP_CPU_H
35 #include <linux/bitops.h>
41 #define OMAP2_DEVICE_TYPE_TEST 0
42 #define OMAP2_DEVICE_TYPE_EMU 1
43 #define OMAP2_DEVICE_TYPE_SEC 2
44 #define OMAP2_DEVICE_TYPE_GP 3
45 #define OMAP2_DEVICE_TYPE_BAD 4
60 #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
77 #define GET_OMAP_CLASS (omap_rev() & 0xff)
79 #define IS_OMAP_CLASS(class, id) \
80 static inline int is_omap ##class (void) \
82 return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
85 #define GET_AM_CLASS ((omap_rev() >> 24) & 0xff)
87 #define IS_AM_CLASS(class, id) \
88 static inline int is_am ##class (void) \
90 return (GET_AM_CLASS == (id)) ? 1 : 0; \
93 #define GET_TI_CLASS ((omap_rev() >> 24) & 0xff)
95 #define IS_TI_CLASS(class, id) \
96 static inline int is_ti ##class (void) \
98 return (GET_TI_CLASS == (id)) ? 1 : 0; \
101 #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
103 #define IS_OMAP_SUBCLASS(subclass, id) \
104 static inline int is_omap ##subclass (void) \
106 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
109 #define IS_TI_SUBCLASS(subclass, id) \
110 static inline int is_ti ##subclass (void) \
112 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
115 #define IS_AM_SUBCLASS(subclass, id) \
116 static inline int is_am ##subclass (void) \
118 return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
146 #define cpu_is_omap7xx() 0
147 #define cpu_is_omap15xx() 0
148 #define cpu_is_omap16xx() 0
149 #define cpu_is_omap24xx() 0
150 #define cpu_is_omap242x() 0
151 #define cpu_is_omap243x() 0
152 #define cpu_is_omap34xx() 0
153 #define cpu_is_omap343x() 0
154 #define cpu_is_ti81xx() 0
155 #define cpu_is_ti816x() 0
156 #define cpu_is_ti814x() 0
157 #define soc_is_am35xx() 0
158 #define soc_is_am33xx() 0
159 #define soc_is_am335x() 0
160 #define cpu_is_omap44xx() 0
161 #define cpu_is_omap443x() 0
162 #define cpu_is_omap446x() 0
163 #define cpu_is_omap447x() 0
164 #define soc_is_omap54xx() 0
165 #define soc_is_omap543x() 0
167 #if defined(MULTI_OMAP1)
168 # if defined(CONFIG_ARCH_OMAP730)
169 # undef cpu_is_omap7xx
170 # define cpu_is_omap7xx() is_omap7xx()
172 # if defined(CONFIG_ARCH_OMAP850)
173 # undef cpu_is_omap7xx
174 # define cpu_is_omap7xx() is_omap7xx()
176 # if defined(CONFIG_ARCH_OMAP15XX)
177 # undef cpu_is_omap15xx
178 # define cpu_is_omap15xx() is_omap15xx()
180 # if defined(CONFIG_ARCH_OMAP16XX)
181 # undef cpu_is_omap16xx
182 # define cpu_is_omap16xx() is_omap16xx()
185 # if defined(CONFIG_ARCH_OMAP730)
186 # undef cpu_is_omap7xx
187 # define cpu_is_omap7xx() 1
189 # if defined(CONFIG_ARCH_OMAP850)
190 # undef cpu_is_omap7xx
191 # define cpu_is_omap7xx() 1
193 # if defined(CONFIG_ARCH_OMAP15XX)
194 # undef cpu_is_omap15xx
195 # define cpu_is_omap15xx() 1
197 # if defined(CONFIG_ARCH_OMAP16XX)
198 # undef cpu_is_omap16xx
199 # define cpu_is_omap16xx() 1
203 #if defined(MULTI_OMAP2)
204 # if defined(CONFIG_ARCH_OMAP2)
205 # undef cpu_is_omap24xx
206 # define cpu_is_omap24xx() is_omap24xx()
208 # if defined (CONFIG_SOC_OMAP2420)
209 # undef cpu_is_omap242x
210 # define cpu_is_omap242x() is_omap242x()
212 # if defined (CONFIG_SOC_OMAP2430)
213 # undef cpu_is_omap243x
214 # define cpu_is_omap243x() is_omap243x()
216 # if defined(CONFIG_ARCH_OMAP3)
217 # undef cpu_is_omap34xx
218 # undef cpu_is_omap343x
219 # define cpu_is_omap34xx() is_omap34xx()
220 # define cpu_is_omap343x() is_omap343x()
223 # if defined(CONFIG_ARCH_OMAP2)
224 # undef cpu_is_omap24xx
225 # define cpu_is_omap24xx() 1
227 # if defined(CONFIG_SOC_OMAP2420)
228 # undef cpu_is_omap242x
229 # define cpu_is_omap242x() 1
231 # if defined(CONFIG_SOC_OMAP2430)
232 # undef cpu_is_omap243x
233 # define cpu_is_omap243x() 1
235 # if defined(CONFIG_ARCH_OMAP3)
236 # undef cpu_is_omap34xx
237 # define cpu_is_omap34xx() 1
239 # if defined(CONFIG_SOC_OMAP3430)
240 # undef cpu_is_omap343x
241 # define cpu_is_omap343x() 1
261 #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
263 #define IS_OMAP_TYPE(type, id) \
264 static inline int is_omap ##type (void) \
266 return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
271 IS_OMAP_TYPE(1610, 0x1610)
272 IS_OMAP_TYPE(1611, 0x1611)
273 IS_OMAP_TYPE(5912, 0x1611)
274 IS_OMAP_TYPE(1621, 0x1621)
275 IS_OMAP_TYPE(1710, 0x1710)
276 IS_OMAP_TYPE(2420, 0x2420)
277 IS_OMAP_TYPE(2422, 0x2422)
278 IS_OMAP_TYPE(2423, 0x2423)
279 IS_OMAP_TYPE(2430, 0x2430)
280 IS_OMAP_TYPE(3430, 0x3430)
282 #define cpu_is_omap310() 0
283 #define cpu_is_omap1510() 0
284 #define cpu_is_omap1610() 0
285 #define cpu_is_omap5912() 0
286 #define cpu_is_omap1611() 0
287 #define cpu_is_omap1621() 0
288 #define cpu_is_omap1710() 0
289 #define cpu_is_omap2420() 0
290 #define cpu_is_omap2422() 0
291 #define cpu_is_omap2423() 0
292 #define cpu_is_omap2430() 0
293 #define cpu_is_omap3430() 0
294 #define cpu_is_omap3630() 0
295 #define soc_is_omap5430() 0
302 #if defined(CONFIG_ARCH_OMAP15XX)
303 # undef cpu_is_omap310
304 # undef cpu_is_omap1510
305 # define cpu_is_omap310() is_omap310()
306 # define cpu_is_omap1510() is_omap1510()
309 #if defined(CONFIG_ARCH_OMAP16XX)
310 # undef cpu_is_omap1610
311 # undef cpu_is_omap1611
312 # undef cpu_is_omap5912
313 # undef cpu_is_omap1621
314 # undef cpu_is_omap1710
315 # define cpu_is_omap1610() is_omap1610()
316 # define cpu_is_omap1611() is_omap1611()
317 # define cpu_is_omap5912() is_omap5912()
318 # define cpu_is_omap1621() is_omap1621()
319 # define cpu_is_omap1710() is_omap1710()
322 #if defined(CONFIG_ARCH_OMAP2)
323 # undef cpu_is_omap2420
324 # undef cpu_is_omap2422
325 # undef cpu_is_omap2423
326 # undef cpu_is_omap2430
327 # define cpu_is_omap2420() is_omap2420()
328 # define cpu_is_omap2422() is_omap2422()
329 # define cpu_is_omap2423() is_omap2423()
330 # define cpu_is_omap2430() is_omap2430()
333 #if defined(CONFIG_ARCH_OMAP3)
334 # undef cpu_is_omap3430
335 # undef cpu_is_ti81xx
336 # undef cpu_is_ti816x
337 # undef cpu_is_ti814x
338 # undef soc_is_am35xx
339 # define cpu_is_omap3430() is_omap3430()
340 # undef cpu_is_omap3630
341 # define cpu_is_omap3630() is_omap363x()
342 # define cpu_is_ti81xx() is_ti81xx()
343 # define cpu_is_ti816x() is_ti816x()
344 # define cpu_is_ti814x() is_ti814x()
345 # define soc_is_am35xx() is_am35xx()
348 # if defined(CONFIG_SOC_AM33XX)
349 # undef soc_is_am33xx
350 # undef soc_is_am335x
351 # define soc_is_am33xx() is_am33xx()
352 # define soc_is_am335x() is_am335x()
355 # if defined(CONFIG_ARCH_OMAP4)
356 # undef cpu_is_omap44xx
357 # undef cpu_is_omap443x
358 # undef cpu_is_omap446x
359 # undef cpu_is_omap447x
360 # define cpu_is_omap44xx() is_omap44xx()
361 # define cpu_is_omap443x() is_omap443x()
362 # define cpu_is_omap446x() is_omap446x()
363 # define cpu_is_omap447x() is_omap447x()
366 # if defined(CONFIG_SOC_OMAP5)
367 # undef soc_is_omap54xx
368 # undef soc_is_omap543x
369 # define soc_is_omap54xx() is_omap54xx()
370 # define soc_is_omap543x() is_omap543x()
374 #define cpu_class_is_omap1() (cpu_is_omap7xx() || cpu_is_omap15xx() || \
376 #define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx() || \
377 cpu_is_omap44xx() || soc_is_omap54xx() || \
381 #define OMAP242X_CLASS 0x24200024
382 #define OMAP2420_REV_ES1_0 OMAP242X_CLASS
383 #define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8))
385 #define OMAP243X_CLASS 0x24300024
386 #define OMAP2430_REV_ES1_0 OMAP243X_CLASS
388 #define OMAP343X_CLASS 0x34300034
389 #define OMAP3430_REV_ES1_0 OMAP343X_CLASS
390 #define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8))
391 #define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8))
392 #define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8))
393 #define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8))
394 #define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8))
396 #define OMAP363X_CLASS 0x36300034
397 #define OMAP3630_REV_ES1_0 OMAP363X_CLASS
398 #define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8))
399 #define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8))
401 #define TI816X_CLASS 0x81600034
402 #define TI8168_REV_ES1_0 TI816X_CLASS
403 #define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
405 #define TI814X_CLASS 0x81400034
406 #define TI8148_REV_ES1_0 TI814X_CLASS
407 #define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8))
408 #define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8))
410 #define AM35XX_CLASS 0x35170034
411 #define AM35XX_REV_ES1_0 AM35XX_CLASS
412 #define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8))
414 #define AM335X_CLASS 0x33500033
415 #define AM335X_REV_ES1_0 AM335X_CLASS
417 #define OMAP443X_CLASS 0x44300044
418 #define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
419 #define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8))
420 #define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8))
421 #define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8))
422 #define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8))
424 #define OMAP446X_CLASS 0x44600044
425 #define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
426 #define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8))
428 #define OMAP447X_CLASS 0x44700044
429 #define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8))
431 #define OMAP54XX_CLASS 0x54000054
432 #define OMAP5430_REV_ES1_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x10 << 8))
433 #define OMAP5432_REV_ES1_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x10 << 8))
455 #define OMAP3_HAS_L2CACHE BIT(0)
456 #define OMAP3_HAS_IVA BIT(1)
457 #define OMAP3_HAS_SGX BIT(2)
458 #define OMAP3_HAS_NEON BIT(3)
459 #define OMAP3_HAS_ISP BIT(4)
460 #define OMAP3_HAS_192MHZ_CLK BIT(5)
461 #define OMAP3_HAS_IO_WAKEUP BIT(6)
462 #define OMAP3_HAS_SDRC BIT(7)
463 #define OMAP3_HAS_IO_CHAIN_CTRL BIT(8)
464 #define OMAP4_HAS_MPU_1GHZ BIT(9)
465 #define OMAP4_HAS_MPU_1_2GHZ BIT(10)
466 #define OMAP4_HAS_MPU_1_5GHZ BIT(11)
469 #define OMAP3_HAS_FEATURE(feat,flag) \
470 static inline unsigned int omap3_has_ ##feat(void) \
472 return omap_features & OMAP3_HAS_ ##flag; \
488 #define OMAP4_HAS_FEATURE(feat, flag) \
489 static inline unsigned int omap4_has_ ##feat(void) \
491 return omap_features & OMAP4_HAS_ ##flag; \