cpu.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. /*
  2. * arch/arm/plat-omap/include/mach/cpu.h
  3. *
  4. * OMAP cpu type detection
  5. *
  6. * Copyright (C) 2004, 2008 Nokia Corporation
  7. *
  8. * Copyright (C) 2009-11 Texas Instruments.
  9. *
  10. * Written by Tony Lindgren <tony.lindgren@nokia.com>
  11. *
  12. * Added OMAP4 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com>
  13. *
  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.
  18. *
  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.
  23. *
  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
  27. *
  28. */
  29. #ifndef __ASM_ARCH_OMAP_CPU_H
  30. #define __ASM_ARCH_OMAP_CPU_H
  31. #include <linux/bitops.h>
  32. #include <plat/multi.h>
  33. /*
  34. * Omap device type i.e. EMU/HS/TST/GP/BAD
  35. */
  36. #define OMAP2_DEVICE_TYPE_TEST 0
  37. #define OMAP2_DEVICE_TYPE_EMU 1
  38. #define OMAP2_DEVICE_TYPE_SEC 2
  39. #define OMAP2_DEVICE_TYPE_GP 3
  40. #define OMAP2_DEVICE_TYPE_BAD 4
  41. int omap_type(void);
  42. struct omap_chip_id {
  43. u16 oc;
  44. u8 type;
  45. };
  46. #define OMAP_CHIP_INIT(x) { .oc = x }
  47. /*
  48. * omap_rev bits:
  49. * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
  50. * CPU revision (See _REV_ defined in cpu.h) [15:08]
  51. * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
  52. */
  53. unsigned int omap_rev(void);
  54. /*
  55. * Define CPU revision bits
  56. *
  57. * Verbose meaning of the revision bits may be different for a silicon
  58. * family. This difference can be handled separately.
  59. */
  60. #define OMAP_REVBITS_00 0x00
  61. #define OMAP_REVBITS_01 0x01
  62. #define OMAP_REVBITS_02 0x02
  63. #define OMAP_REVBITS_03 0x03
  64. #define OMAP_REVBITS_04 0x04
  65. #define OMAP_REVBITS_05 0x05
  66. /*
  67. * Get the CPU revision for OMAP devices
  68. */
  69. #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
  70. /*
  71. * Macros to group OMAP into cpu classes.
  72. * These can be used in most places.
  73. * cpu_is_omap7xx(): True for OMAP730, OMAP850
  74. * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
  75. * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
  76. * cpu_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
  77. * cpu_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
  78. * cpu_is_omap243x(): True for OMAP2430
  79. * cpu_is_omap343x(): True for OMAP3430
  80. * cpu_is_omap443x(): True for OMAP4430
  81. * cpu_is_omap446x(): True for OMAP4460
  82. */
  83. #define GET_OMAP_CLASS (omap_rev() & 0xff)
  84. #define IS_OMAP_CLASS(class, id) \
  85. static inline int is_omap ##class (void) \
  86. { \
  87. return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
  88. }
  89. #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
  90. #define IS_OMAP_SUBCLASS(subclass, id) \
  91. static inline int is_omap ##subclass (void) \
  92. { \
  93. return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
  94. }
  95. #define IS_TI_SUBCLASS(subclass, id) \
  96. static inline int is_ti ##subclass (void) \
  97. { \
  98. return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
  99. }
  100. IS_OMAP_CLASS(7xx, 0x07)
  101. IS_OMAP_CLASS(15xx, 0x15)
  102. IS_OMAP_CLASS(16xx, 0x16)
  103. IS_OMAP_CLASS(24xx, 0x24)
  104. IS_OMAP_CLASS(34xx, 0x34)
  105. IS_OMAP_CLASS(44xx, 0x44)
  106. IS_OMAP_SUBCLASS(242x, 0x242)
  107. IS_OMAP_SUBCLASS(243x, 0x243)
  108. IS_OMAP_SUBCLASS(343x, 0x343)
  109. IS_OMAP_SUBCLASS(363x, 0x363)
  110. IS_OMAP_SUBCLASS(443x, 0x443)
  111. IS_OMAP_SUBCLASS(446x, 0x446)
  112. IS_TI_SUBCLASS(816x, 0x816)
  113. #define cpu_is_omap7xx() 0
  114. #define cpu_is_omap15xx() 0
  115. #define cpu_is_omap16xx() 0
  116. #define cpu_is_omap24xx() 0
  117. #define cpu_is_omap242x() 0
  118. #define cpu_is_omap243x() 0
  119. #define cpu_is_omap34xx() 0
  120. #define cpu_is_omap343x() 0
  121. #define cpu_is_ti816x() 0
  122. #define cpu_is_omap44xx() 0
  123. #define cpu_is_omap443x() 0
  124. #define cpu_is_omap446x() 0
  125. #if defined(MULTI_OMAP1)
  126. # if defined(CONFIG_ARCH_OMAP730)
  127. # undef cpu_is_omap7xx
  128. # define cpu_is_omap7xx() is_omap7xx()
  129. # endif
  130. # if defined(CONFIG_ARCH_OMAP850)
  131. # undef cpu_is_omap7xx
  132. # define cpu_is_omap7xx() is_omap7xx()
  133. # endif
  134. # if defined(CONFIG_ARCH_OMAP15XX)
  135. # undef cpu_is_omap15xx
  136. # define cpu_is_omap15xx() is_omap15xx()
  137. # endif
  138. # if defined(CONFIG_ARCH_OMAP16XX)
  139. # undef cpu_is_omap16xx
  140. # define cpu_is_omap16xx() is_omap16xx()
  141. # endif
  142. #else
  143. # if defined(CONFIG_ARCH_OMAP730)
  144. # undef cpu_is_omap7xx
  145. # define cpu_is_omap7xx() 1
  146. # endif
  147. # if defined(CONFIG_ARCH_OMAP850)
  148. # undef cpu_is_omap7xx
  149. # define cpu_is_omap7xx() 1
  150. # endif
  151. # if defined(CONFIG_ARCH_OMAP15XX)
  152. # undef cpu_is_omap15xx
  153. # define cpu_is_omap15xx() 1
  154. # endif
  155. # if defined(CONFIG_ARCH_OMAP16XX)
  156. # undef cpu_is_omap16xx
  157. # define cpu_is_omap16xx() 1
  158. # endif
  159. #endif
  160. #if defined(MULTI_OMAP2)
  161. # if defined(CONFIG_ARCH_OMAP2)
  162. # undef cpu_is_omap24xx
  163. # define cpu_is_omap24xx() is_omap24xx()
  164. # endif
  165. # if defined (CONFIG_SOC_OMAP2420)
  166. # undef cpu_is_omap242x
  167. # define cpu_is_omap242x() is_omap242x()
  168. # endif
  169. # if defined (CONFIG_SOC_OMAP2430)
  170. # undef cpu_is_omap243x
  171. # define cpu_is_omap243x() is_omap243x()
  172. # endif
  173. # if defined(CONFIG_ARCH_OMAP3)
  174. # undef cpu_is_omap34xx
  175. # undef cpu_is_omap343x
  176. # define cpu_is_omap34xx() is_omap34xx()
  177. # define cpu_is_omap343x() is_omap343x()
  178. # endif
  179. #else
  180. # if defined(CONFIG_ARCH_OMAP2)
  181. # undef cpu_is_omap24xx
  182. # define cpu_is_omap24xx() 1
  183. # endif
  184. # if defined(CONFIG_SOC_OMAP2420)
  185. # undef cpu_is_omap242x
  186. # define cpu_is_omap242x() 1
  187. # endif
  188. # if defined(CONFIG_SOC_OMAP2430)
  189. # undef cpu_is_omap243x
  190. # define cpu_is_omap243x() 1
  191. # endif
  192. # if defined(CONFIG_ARCH_OMAP3)
  193. # undef cpu_is_omap34xx
  194. # define cpu_is_omap34xx() 1
  195. # endif
  196. # if defined(CONFIG_SOC_OMAP3430)
  197. # undef cpu_is_omap343x
  198. # define cpu_is_omap343x() 1
  199. # endif
  200. #endif
  201. /*
  202. * Macros to detect individual cpu types.
  203. * These are only rarely needed.
  204. * cpu_is_omap330(): True for OMAP330
  205. * cpu_is_omap730(): True for OMAP730
  206. * cpu_is_omap850(): True for OMAP850
  207. * cpu_is_omap1510(): True for OMAP1510
  208. * cpu_is_omap1610(): True for OMAP1610
  209. * cpu_is_omap1611(): True for OMAP1611
  210. * cpu_is_omap5912(): True for OMAP5912
  211. * cpu_is_omap1621(): True for OMAP1621
  212. * cpu_is_omap1710(): True for OMAP1710
  213. * cpu_is_omap2420(): True for OMAP2420
  214. * cpu_is_omap2422(): True for OMAP2422
  215. * cpu_is_omap2423(): True for OMAP2423
  216. * cpu_is_omap2430(): True for OMAP2430
  217. * cpu_is_omap3430(): True for OMAP3430
  218. * cpu_is_omap4430(): True for OMAP4430
  219. * cpu_is_omap3505(): True for OMAP3505
  220. * cpu_is_omap3517(): True for OMAP3517
  221. */
  222. #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
  223. #define IS_OMAP_TYPE(type, id) \
  224. static inline int is_omap ##type (void) \
  225. { \
  226. return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
  227. }
  228. IS_OMAP_TYPE(310, 0x0310)
  229. IS_OMAP_TYPE(730, 0x0730)
  230. IS_OMAP_TYPE(850, 0x0850)
  231. IS_OMAP_TYPE(1510, 0x1510)
  232. IS_OMAP_TYPE(1610, 0x1610)
  233. IS_OMAP_TYPE(1611, 0x1611)
  234. IS_OMAP_TYPE(5912, 0x1611)
  235. IS_OMAP_TYPE(1621, 0x1621)
  236. IS_OMAP_TYPE(1710, 0x1710)
  237. IS_OMAP_TYPE(2420, 0x2420)
  238. IS_OMAP_TYPE(2422, 0x2422)
  239. IS_OMAP_TYPE(2423, 0x2423)
  240. IS_OMAP_TYPE(2430, 0x2430)
  241. IS_OMAP_TYPE(3430, 0x3430)
  242. IS_OMAP_TYPE(3505, 0x3505)
  243. IS_OMAP_TYPE(3517, 0x3517)
  244. #define cpu_is_omap310() 0
  245. #define cpu_is_omap730() 0
  246. #define cpu_is_omap850() 0
  247. #define cpu_is_omap1510() 0
  248. #define cpu_is_omap1610() 0
  249. #define cpu_is_omap5912() 0
  250. #define cpu_is_omap1611() 0
  251. #define cpu_is_omap1621() 0
  252. #define cpu_is_omap1710() 0
  253. #define cpu_is_omap2420() 0
  254. #define cpu_is_omap2422() 0
  255. #define cpu_is_omap2423() 0
  256. #define cpu_is_omap2430() 0
  257. #define cpu_is_omap3503() 0
  258. #define cpu_is_omap3515() 0
  259. #define cpu_is_omap3525() 0
  260. #define cpu_is_omap3530() 0
  261. #define cpu_is_omap3505() 0
  262. #define cpu_is_omap3517() 0
  263. #define cpu_is_omap3430() 0
  264. #define cpu_is_omap4430() 0
  265. #define cpu_is_omap3630() 0
  266. /*
  267. * Whether we have MULTI_OMAP1 or not, we still need to distinguish
  268. * between 730 vs 850, 330 vs. 1510 and 1611B/5912 vs. 1710.
  269. */
  270. #if defined(CONFIG_ARCH_OMAP730)
  271. # undef cpu_is_omap730
  272. # define cpu_is_omap730() is_omap730()
  273. #endif
  274. #if defined(CONFIG_ARCH_OMAP850)
  275. # undef cpu_is_omap850
  276. # define cpu_is_omap850() is_omap850()
  277. #endif
  278. #if defined(CONFIG_ARCH_OMAP15XX)
  279. # undef cpu_is_omap310
  280. # undef cpu_is_omap1510
  281. # define cpu_is_omap310() is_omap310()
  282. # define cpu_is_omap1510() is_omap1510()
  283. #endif
  284. #if defined(CONFIG_ARCH_OMAP16XX)
  285. # undef cpu_is_omap1610
  286. # undef cpu_is_omap1611
  287. # undef cpu_is_omap5912
  288. # undef cpu_is_omap1621
  289. # undef cpu_is_omap1710
  290. # define cpu_is_omap1610() is_omap1610()
  291. # define cpu_is_omap1611() is_omap1611()
  292. # define cpu_is_omap5912() is_omap5912()
  293. # define cpu_is_omap1621() is_omap1621()
  294. # define cpu_is_omap1710() is_omap1710()
  295. #endif
  296. #if defined(CONFIG_ARCH_OMAP2)
  297. # undef cpu_is_omap2420
  298. # undef cpu_is_omap2422
  299. # undef cpu_is_omap2423
  300. # undef cpu_is_omap2430
  301. # define cpu_is_omap2420() is_omap2420()
  302. # define cpu_is_omap2422() is_omap2422()
  303. # define cpu_is_omap2423() is_omap2423()
  304. # define cpu_is_omap2430() is_omap2430()
  305. #endif
  306. #if defined(CONFIG_ARCH_OMAP3)
  307. # undef cpu_is_omap3430
  308. # undef cpu_is_omap3503
  309. # undef cpu_is_omap3515
  310. # undef cpu_is_omap3525
  311. # undef cpu_is_omap3530
  312. # undef cpu_is_omap3505
  313. # undef cpu_is_omap3517
  314. # undef cpu_is_ti816x
  315. # define cpu_is_omap3430() is_omap3430()
  316. # define cpu_is_omap3503() (cpu_is_omap3430() && \
  317. (!omap3_has_iva()) && \
  318. (!omap3_has_sgx()))
  319. # define cpu_is_omap3515() (cpu_is_omap3430() && \
  320. (!omap3_has_iva()) && \
  321. (omap3_has_sgx()))
  322. # define cpu_is_omap3525() (cpu_is_omap3430() && \
  323. (!omap3_has_sgx()) && \
  324. (omap3_has_iva()))
  325. # define cpu_is_omap3530() (cpu_is_omap3430())
  326. # define cpu_is_omap3505() is_omap3505()
  327. # define cpu_is_omap3517() is_omap3517()
  328. # undef cpu_is_omap3630
  329. # define cpu_is_omap3630() is_omap363x()
  330. # define cpu_is_ti816x() is_ti816x()
  331. #endif
  332. # if defined(CONFIG_ARCH_OMAP4)
  333. # undef cpu_is_omap44xx
  334. # undef cpu_is_omap443x
  335. # undef cpu_is_omap446x
  336. # define cpu_is_omap44xx() is_omap44xx()
  337. # define cpu_is_omap443x() is_omap443x()
  338. # define cpu_is_omap446x() is_omap446x()
  339. # endif
  340. /* Macros to detect if we have OMAP1 or OMAP2 */
  341. #define cpu_class_is_omap1() (cpu_is_omap7xx() || cpu_is_omap15xx() || \
  342. cpu_is_omap16xx())
  343. #define cpu_class_is_omap2() (cpu_is_omap24xx() || cpu_is_omap34xx() || \
  344. cpu_is_omap44xx())
  345. /* Various silicon revisions for omap2 */
  346. #define OMAP242X_CLASS 0x24200024
  347. #define OMAP2420_REV_ES1_0 OMAP242X_CLASS
  348. #define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (OMAP_REVBITS_01 << 8))
  349. #define OMAP243X_CLASS 0x24300024
  350. #define OMAP2430_REV_ES1_0 OMAP243X_CLASS
  351. #define OMAP343X_CLASS 0x34300034
  352. #define OMAP3430_REV_ES1_0 OMAP343X_CLASS
  353. #define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (OMAP_REVBITS_01 << 8))
  354. #define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (OMAP_REVBITS_02 << 8))
  355. #define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (OMAP_REVBITS_03 << 8))
  356. #define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (OMAP_REVBITS_04 << 8))
  357. #define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (OMAP_REVBITS_05 << 8))
  358. #define OMAP363X_CLASS 0x36300034
  359. #define OMAP3630_REV_ES1_0 OMAP363X_CLASS
  360. #define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (OMAP_REVBITS_01 << 8))
  361. #define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (OMAP_REVBITS_02 << 8))
  362. #define OMAP35XX_CLASS 0x35000034
  363. #define OMAP3503_REV(v) (OMAP35XX_CLASS | (0x3503 << 16) | (v << 8))
  364. #define OMAP3515_REV(v) (OMAP35XX_CLASS | (0x3515 << 16) | (v << 8))
  365. #define OMAP3525_REV(v) (OMAP35XX_CLASS | (0x3525 << 16) | (v << 8))
  366. #define OMAP3530_REV(v) (OMAP35XX_CLASS | (0x3530 << 16) | (v << 8))
  367. #define OMAP3505_REV(v) (OMAP35XX_CLASS | (0x3505 << 16) | (v << 8))
  368. #define OMAP3517_REV(v) (OMAP35XX_CLASS | (0x3517 << 16) | (v << 8))
  369. #define TI816X_CLASS 0x81600034
  370. #define TI8168_REV_ES1_0 TI816X_CLASS
  371. #define TI8168_REV_ES1_1 (TI816X_CLASS | (OMAP_REVBITS_01 << 8))
  372. #define OMAP443X_CLASS 0x44300044
  373. #define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
  374. #define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8))
  375. #define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8))
  376. #define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8))
  377. #define OMAP446X_CLASS 0x44600044
  378. #define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
  379. /*
  380. * omap_chip bits
  381. *
  382. * CHIP_IS_OMAP{2420,2430,3430} indicate that a particular structure is
  383. * valid on all chips of that type. CHIP_IS_OMAP3430ES{1,2} indicates
  384. * something that is only valid on that particular ES revision.
  385. *
  386. * These bits may be ORed together to indicate structures that are
  387. * available on multiple chip types.
  388. *
  389. * To test whether a particular structure matches the current OMAP chip type,
  390. * use omap_chip_is().
  391. *
  392. */
  393. #define CHIP_IS_OMAP2420 (1 << 0)
  394. #define CHIP_IS_OMAP2430 (1 << 1)
  395. #define CHIP_IS_OMAP3430 (1 << 2)
  396. #define CHIP_IS_OMAP3430ES1 (1 << 3)
  397. #define CHIP_IS_OMAP3430ES2 (1 << 4)
  398. #define CHIP_IS_OMAP3430ES3_0 (1 << 5)
  399. #define CHIP_IS_OMAP3430ES3_1 (1 << 6)
  400. #define CHIP_IS_OMAP3630ES1 (1 << 7)
  401. #define CHIP_IS_OMAP4430ES1 (1 << 8)
  402. #define CHIP_IS_OMAP3630ES1_1 (1 << 9)
  403. #define CHIP_IS_OMAP3630ES1_2 (1 << 10)
  404. #define CHIP_IS_OMAP4430ES2 (1 << 11)
  405. #define CHIP_IS_OMAP4430ES2_1 (1 << 12)
  406. #define CHIP_IS_OMAP4430ES2_2 (1 << 13)
  407. #define CHIP_IS_TI816X (1 << 14)
  408. #define CHIP_IS_OMAP4460ES1_0 (1 << 15)
  409. #define CHIP_IS_OMAP24XX (CHIP_IS_OMAP2420 | CHIP_IS_OMAP2430)
  410. #define CHIP_IS_OMAP4430 (CHIP_IS_OMAP4430ES1 | \
  411. CHIP_IS_OMAP4430ES2 | \
  412. CHIP_IS_OMAP4430ES2_1 | \
  413. CHIP_IS_OMAP4430ES2_2 | \
  414. CHIP_IS_OMAP4460ES1_0)
  415. /*
  416. * "GE" here represents "greater than or equal to" in terms of ES
  417. * levels. So CHIP_GE_OMAP3430ES2 is intended to match all OMAP3430
  418. * chips at ES2 and beyond, but not, for example, any OMAP lines after
  419. * OMAP3.
  420. */
  421. #define CHIP_GE_OMAP3430ES2 (CHIP_IS_OMAP3430ES2 | \
  422. CHIP_IS_OMAP3430ES3_0 | \
  423. CHIP_GE_OMAP3430ES3_1)
  424. #define CHIP_GE_OMAP3430ES3_1 (CHIP_IS_OMAP3430ES3_1 | \
  425. CHIP_IS_OMAP3630ES1 | \
  426. CHIP_GE_OMAP3630ES1_1)
  427. #define CHIP_GE_OMAP3630ES1_1 (CHIP_IS_OMAP3630ES1_1 | \
  428. CHIP_IS_OMAP3630ES1_2)
  429. int omap_chip_is(struct omap_chip_id oci);
  430. void omap2_check_revision(void);
  431. /*
  432. * Runtime detection of OMAP3 features
  433. */
  434. extern u32 omap_features;
  435. #define OMAP3_HAS_L2CACHE BIT(0)
  436. #define OMAP3_HAS_IVA BIT(1)
  437. #define OMAP3_HAS_SGX BIT(2)
  438. #define OMAP3_HAS_NEON BIT(3)
  439. #define OMAP3_HAS_ISP BIT(4)
  440. #define OMAP3_HAS_192MHZ_CLK BIT(5)
  441. #define OMAP3_HAS_IO_WAKEUP BIT(6)
  442. #define OMAP3_HAS_SDRC BIT(7)
  443. #define OMAP4_HAS_MPU_1GHZ BIT(8)
  444. #define OMAP4_HAS_MPU_1_2GHZ BIT(9)
  445. #define OMAP4_HAS_MPU_1_5GHZ BIT(10)
  446. #define OMAP3_HAS_FEATURE(feat,flag) \
  447. static inline unsigned int omap3_has_ ##feat(void) \
  448. { \
  449. return omap_features & OMAP3_HAS_ ##flag; \
  450. } \
  451. OMAP3_HAS_FEATURE(l2cache, L2CACHE)
  452. OMAP3_HAS_FEATURE(sgx, SGX)
  453. OMAP3_HAS_FEATURE(iva, IVA)
  454. OMAP3_HAS_FEATURE(neon, NEON)
  455. OMAP3_HAS_FEATURE(isp, ISP)
  456. OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
  457. OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP)
  458. OMAP3_HAS_FEATURE(sdrc, SDRC)
  459. /*
  460. * Runtime detection of OMAP4 features
  461. */
  462. extern u32 omap_features;
  463. #define OMAP4_HAS_FEATURE(feat, flag) \
  464. static inline unsigned int omap4_has_ ##feat(void) \
  465. { \
  466. return omap_features & OMAP4_HAS_ ##flag; \
  467. } \
  468. OMAP4_HAS_FEATURE(mpu_1ghz, MPU_1GHZ)
  469. OMAP4_HAS_FEATURE(mpu_1_2ghz, MPU_1_2GHZ)
  470. OMAP4_HAS_FEATURE(mpu_1_5ghz, MPU_1_5GHZ)
  471. #endif