soc.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. /*
  2. * OMAP cpu type detection
  3. *
  4. * Copyright (C) 2004, 2008 Nokia Corporation
  5. *
  6. * Copyright (C) 2009-11 Texas Instruments.
  7. *
  8. * Written by Tony Lindgren <tony.lindgren@nokia.com>
  9. *
  10. * Added OMAP4/5 specific defines - Santosh Shilimkar<santosh.shilimkar@ti.com>
  11. * Added DRA7xxx specific defines - Sricharan R<r.sricharan@ti.com>
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation; either version 2 of the License, or
  16. * (at your option) any later version.
  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. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  26. *
  27. */
  28. #include "omap24xx.h"
  29. #include "omap34xx.h"
  30. #include "omap44xx.h"
  31. #include "ti81xx.h"
  32. #include "am33xx.h"
  33. #include "omap54xx.h"
  34. #ifndef __ASSEMBLY__
  35. #include <linux/bitops.h>
  36. #include <linux/of.h>
  37. /*
  38. * Test if multicore OMAP support is needed
  39. */
  40. #undef MULTI_OMAP2
  41. #undef OMAP_NAME
  42. #ifdef CONFIG_ARCH_MULTIPLATFORM
  43. #define MULTI_OMAP2
  44. #endif
  45. #ifdef CONFIG_SOC_OMAP2420
  46. # ifdef OMAP_NAME
  47. # undef MULTI_OMAP2
  48. # define MULTI_OMAP2
  49. # else
  50. # define OMAP_NAME omap2420
  51. # endif
  52. #endif
  53. #ifdef CONFIG_SOC_OMAP2430
  54. # ifdef OMAP_NAME
  55. # undef MULTI_OMAP2
  56. # define MULTI_OMAP2
  57. # else
  58. # define OMAP_NAME omap2430
  59. # endif
  60. #endif
  61. #ifdef CONFIG_ARCH_OMAP3
  62. # ifdef OMAP_NAME
  63. # undef MULTI_OMAP2
  64. # define MULTI_OMAP2
  65. # else
  66. # define OMAP_NAME omap3
  67. # endif
  68. #endif
  69. #ifdef CONFIG_ARCH_OMAP4
  70. # ifdef OMAP_NAME
  71. # undef MULTI_OMAP2
  72. # define MULTI_OMAP2
  73. # else
  74. # define OMAP_NAME omap4
  75. # endif
  76. #endif
  77. #ifdef CONFIG_SOC_OMAP5
  78. # ifdef OMAP_NAME
  79. # undef MULTI_OMAP2
  80. # define MULTI_OMAP2
  81. # else
  82. # define OMAP_NAME omap5
  83. # endif
  84. #endif
  85. #ifdef CONFIG_SOC_AM33XX
  86. # ifdef OMAP_NAME
  87. # undef MULTI_OMAP2
  88. # define MULTI_OMAP2
  89. # else
  90. # define OMAP_NAME am33xx
  91. # endif
  92. #endif
  93. #ifdef CONFIG_SOC_AM43XX
  94. # ifdef OMAP_NAME
  95. # undef MULTI_OMAP2
  96. # define MULTI_OMAP2
  97. # else
  98. # define OMAP_NAME am43xx
  99. # endif
  100. #endif
  101. #ifdef CONFIG_SOC_DRA7XX
  102. # ifdef OMAP_NAME
  103. # undef MULTI_OMAP2
  104. # define MULTI_OMAP2
  105. # else
  106. # define OMAP_NAME DRA7XX
  107. # endif
  108. #endif
  109. /*
  110. * Omap device type i.e. EMU/HS/TST/GP/BAD
  111. */
  112. #define OMAP2_DEVICE_TYPE_TEST 0
  113. #define OMAP2_DEVICE_TYPE_EMU 1
  114. #define OMAP2_DEVICE_TYPE_SEC 2
  115. #define OMAP2_DEVICE_TYPE_GP 3
  116. #define OMAP2_DEVICE_TYPE_BAD 4
  117. int omap_type(void);
  118. /*
  119. * omap_rev bits:
  120. * SoC id bits (0730, 1510, 1710, 2422...) [31:16]
  121. * SoC revision (See _REV_ defined in cpu.h) [15:08]
  122. * SoC class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
  123. */
  124. unsigned int omap_rev(void);
  125. static inline int soc_is_omap(void)
  126. {
  127. return omap_rev() != 0;
  128. }
  129. /*
  130. * Get the SoC revision for OMAP devices
  131. */
  132. #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
  133. /*
  134. * Macros to group OMAP into cpu classes.
  135. * These can be used in most places.
  136. * soc_is_omap24xx(): True for OMAP2420, OMAP2422, OMAP2423, OMAP2430
  137. * soc_is_omap242x(): True for OMAP2420, OMAP2422, OMAP2423
  138. * soc_is_omap243x(): True for OMAP2430
  139. * soc_is_omap343x(): True for OMAP3430
  140. * soc_is_omap443x(): True for OMAP4430
  141. * soc_is_omap446x(): True for OMAP4460
  142. * soc_is_omap447x(): True for OMAP4470
  143. * soc_is_omap543x(): True for OMAP5430, OMAP5432
  144. */
  145. #define GET_OMAP_CLASS (omap_rev() & 0xff)
  146. #define IS_OMAP_CLASS(class, id) \
  147. static inline int is_omap ##class (void) \
  148. { \
  149. return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
  150. }
  151. #define GET_AM_CLASS ((omap_rev() >> 24) & 0xff)
  152. #define IS_AM_CLASS(class, id) \
  153. static inline int is_am ##class (void) \
  154. { \
  155. return (GET_AM_CLASS == (id)) ? 1 : 0; \
  156. }
  157. #define GET_TI_CLASS ((omap_rev() >> 24) & 0xff)
  158. #define IS_TI_CLASS(class, id) \
  159. static inline int is_ti ##class (void) \
  160. { \
  161. return (GET_TI_CLASS == (id)) ? 1 : 0; \
  162. }
  163. #define GET_DRA_CLASS ((omap_rev() >> 24) & 0xff)
  164. #define IS_DRA_CLASS(class, id) \
  165. static inline int is_dra ##class (void) \
  166. { \
  167. return (GET_DRA_CLASS == (id)) ? 1 : 0; \
  168. }
  169. #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
  170. #define IS_OMAP_SUBCLASS(subclass, id) \
  171. static inline int is_omap ##subclass (void) \
  172. { \
  173. return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
  174. }
  175. #define IS_TI_SUBCLASS(subclass, id) \
  176. static inline int is_ti ##subclass (void) \
  177. { \
  178. return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
  179. }
  180. #define IS_AM_SUBCLASS(subclass, id) \
  181. static inline int is_am ##subclass (void) \
  182. { \
  183. return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
  184. }
  185. #define IS_DRA_SUBCLASS(subclass, id) \
  186. static inline int is_dra ##subclass (void) \
  187. { \
  188. return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
  189. }
  190. IS_OMAP_CLASS(24xx, 0x24)
  191. IS_OMAP_CLASS(34xx, 0x34)
  192. IS_OMAP_CLASS(44xx, 0x44)
  193. IS_AM_CLASS(35xx, 0x35)
  194. IS_OMAP_CLASS(54xx, 0x54)
  195. IS_AM_CLASS(33xx, 0x33)
  196. IS_AM_CLASS(43xx, 0x43)
  197. IS_TI_CLASS(81xx, 0x81)
  198. IS_DRA_CLASS(7xx, 0x7)
  199. IS_OMAP_SUBCLASS(242x, 0x242)
  200. IS_OMAP_SUBCLASS(243x, 0x243)
  201. IS_OMAP_SUBCLASS(343x, 0x343)
  202. IS_OMAP_SUBCLASS(363x, 0x363)
  203. IS_OMAP_SUBCLASS(443x, 0x443)
  204. IS_OMAP_SUBCLASS(446x, 0x446)
  205. IS_OMAP_SUBCLASS(447x, 0x447)
  206. IS_OMAP_SUBCLASS(543x, 0x543)
  207. IS_TI_SUBCLASS(816x, 0x816)
  208. IS_TI_SUBCLASS(814x, 0x814)
  209. IS_AM_SUBCLASS(335x, 0x335)
  210. IS_AM_SUBCLASS(437x, 0x437)
  211. IS_DRA_SUBCLASS(75x, 0x75)
  212. IS_DRA_SUBCLASS(72x, 0x72)
  213. #define soc_is_omap24xx() 0
  214. #define soc_is_omap242x() 0
  215. #define soc_is_omap243x() 0
  216. #define soc_is_omap34xx() 0
  217. #define soc_is_omap343x() 0
  218. #define soc_is_ti81xx() 0
  219. #define soc_is_ti816x() 0
  220. #define soc_is_ti814x() 0
  221. #define soc_is_am35xx() 0
  222. #define soc_is_am33xx() 0
  223. #define soc_is_am335x() 0
  224. #define soc_is_am43xx() 0
  225. #define soc_is_am437x() 0
  226. #define soc_is_omap44xx() 0
  227. #define soc_is_omap443x() 0
  228. #define soc_is_omap446x() 0
  229. #define soc_is_omap447x() 0
  230. #define soc_is_omap54xx() 0
  231. #define soc_is_omap543x() 0
  232. #define soc_is_dra7xx() 0
  233. #define soc_is_dra74x() 0
  234. #define soc_is_dra72x() 0
  235. #if defined(MULTI_OMAP2)
  236. # if defined(CONFIG_ARCH_OMAP2)
  237. # undef soc_is_omap24xx
  238. # define soc_is_omap24xx() is_omap24xx()
  239. # endif
  240. # if defined (CONFIG_SOC_OMAP2420)
  241. # undef soc_is_omap242x
  242. # define soc_is_omap242x() is_omap242x()
  243. # endif
  244. # if defined (CONFIG_SOC_OMAP2430)
  245. # undef soc_is_omap243x
  246. # define soc_is_omap243x() is_omap243x()
  247. # endif
  248. # if defined(CONFIG_ARCH_OMAP3)
  249. # undef soc_is_omap34xx
  250. # undef soc_is_omap343x
  251. # define soc_is_omap34xx() is_omap34xx()
  252. # define soc_is_omap343x() is_omap343x()
  253. # endif
  254. #else
  255. # if defined(CONFIG_ARCH_OMAP2)
  256. # undef soc_is_omap24xx
  257. # define soc_is_omap24xx() 1
  258. # endif
  259. # if defined(CONFIG_SOC_OMAP2420)
  260. # undef soc_is_omap242x
  261. # define soc_is_omap242x() 1
  262. # endif
  263. # if defined(CONFIG_SOC_OMAP2430)
  264. # undef soc_is_omap243x
  265. # define soc_is_omap243x() 1
  266. # endif
  267. # if defined(CONFIG_ARCH_OMAP3)
  268. # undef soc_is_omap34xx
  269. # define soc_is_omap34xx() 1
  270. # endif
  271. # if defined(CONFIG_SOC_OMAP3430)
  272. # undef soc_is_omap343x
  273. # define soc_is_omap343x() 1
  274. # endif
  275. #endif
  276. /*
  277. * Macros to detect individual cpu types.
  278. * These are only rarely needed.
  279. * soc_is_omap2420(): True for OMAP2420
  280. * soc_is_omap2422(): True for OMAP2422
  281. * soc_is_omap2423(): True for OMAP2423
  282. * soc_is_omap2430(): True for OMAP2430
  283. * soc_is_omap3430(): True for OMAP3430
  284. */
  285. #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
  286. #define IS_OMAP_TYPE(type, id) \
  287. static inline int is_omap ##type (void) \
  288. { \
  289. return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
  290. }
  291. IS_OMAP_TYPE(2420, 0x2420)
  292. IS_OMAP_TYPE(2422, 0x2422)
  293. IS_OMAP_TYPE(2423, 0x2423)
  294. IS_OMAP_TYPE(2430, 0x2430)
  295. IS_OMAP_TYPE(3430, 0x3430)
  296. #define soc_is_omap2420() 0
  297. #define soc_is_omap2422() 0
  298. #define soc_is_omap2423() 0
  299. #define soc_is_omap2430() 0
  300. #define soc_is_omap3430() 0
  301. #define soc_is_omap3630() 0
  302. #define soc_is_omap5430() 0
  303. /* These are needed for the common code */
  304. #ifdef CONFIG_ARCH_OMAP2PLUS
  305. #define soc_is_omap7xx() 0
  306. #define soc_is_omap15xx() 0
  307. #define soc_is_omap16xx() 0
  308. #define soc_is_omap1510() 0
  309. #define soc_is_omap1610() 0
  310. #define soc_is_omap1611() 0
  311. #define soc_is_omap1621() 0
  312. #define soc_is_omap1710() 0
  313. #define cpu_class_is_omap1() 0
  314. #define cpu_class_is_omap2() 1
  315. #endif
  316. #if defined(CONFIG_ARCH_OMAP2)
  317. # undef soc_is_omap2420
  318. # undef soc_is_omap2422
  319. # undef soc_is_omap2423
  320. # undef soc_is_omap2430
  321. # define soc_is_omap2420() is_omap2420()
  322. # define soc_is_omap2422() is_omap2422()
  323. # define soc_is_omap2423() is_omap2423()
  324. # define soc_is_omap2430() is_omap2430()
  325. #endif
  326. #if defined(CONFIG_ARCH_OMAP3)
  327. # undef soc_is_omap3430
  328. # undef soc_is_ti81xx
  329. # undef soc_is_ti816x
  330. # undef soc_is_ti814x
  331. # undef soc_is_am35xx
  332. # define soc_is_omap3430() is_omap3430()
  333. # undef soc_is_omap3630
  334. # define soc_is_omap3630() is_omap363x()
  335. # define soc_is_ti81xx() is_ti81xx()
  336. # define soc_is_ti816x() is_ti816x()
  337. # define soc_is_ti814x() is_ti814x()
  338. # define soc_is_am35xx() is_am35xx()
  339. #endif
  340. # if defined(CONFIG_SOC_AM33XX)
  341. # undef soc_is_am33xx
  342. # undef soc_is_am335x
  343. # define soc_is_am33xx() is_am33xx()
  344. # define soc_is_am335x() is_am335x()
  345. #endif
  346. #ifdef CONFIG_SOC_AM43XX
  347. # undef soc_is_am43xx
  348. # undef soc_is_am437x
  349. # define soc_is_am43xx() is_am43xx()
  350. # define soc_is_am437x() is_am437x()
  351. #endif
  352. # if defined(CONFIG_ARCH_OMAP4)
  353. # undef soc_is_omap44xx
  354. # undef soc_is_omap443x
  355. # undef soc_is_omap446x
  356. # undef soc_is_omap447x
  357. # define soc_is_omap44xx() is_omap44xx()
  358. # define soc_is_omap443x() is_omap443x()
  359. # define soc_is_omap446x() is_omap446x()
  360. # define soc_is_omap447x() is_omap447x()
  361. # endif
  362. # if defined(CONFIG_SOC_OMAP5)
  363. # undef soc_is_omap54xx
  364. # undef soc_is_omap543x
  365. # define soc_is_omap54xx() is_omap54xx()
  366. # define soc_is_omap543x() is_omap543x()
  367. #endif
  368. #if defined(CONFIG_SOC_DRA7XX)
  369. #undef soc_is_dra7xx
  370. #undef soc_is_dra74x
  371. #undef soc_is_dra72x
  372. #define soc_is_dra7xx() is_dra7xx()
  373. #define soc_is_dra74x() is_dra75x()
  374. #define soc_is_dra72x() is_dra72x()
  375. #endif
  376. /* Various silicon revisions for omap2 */
  377. #define OMAP242X_CLASS 0x24200024
  378. #define OMAP2420_REV_ES1_0 OMAP242X_CLASS
  379. #define OMAP2420_REV_ES2_0 (OMAP242X_CLASS | (0x1 << 8))
  380. #define OMAP243X_CLASS 0x24300024
  381. #define OMAP2430_REV_ES1_0 OMAP243X_CLASS
  382. #define OMAP343X_CLASS 0x34300034
  383. #define OMAP3430_REV_ES1_0 OMAP343X_CLASS
  384. #define OMAP3430_REV_ES2_0 (OMAP343X_CLASS | (0x1 << 8))
  385. #define OMAP3430_REV_ES2_1 (OMAP343X_CLASS | (0x2 << 8))
  386. #define OMAP3430_REV_ES3_0 (OMAP343X_CLASS | (0x3 << 8))
  387. #define OMAP3430_REV_ES3_1 (OMAP343X_CLASS | (0x4 << 8))
  388. #define OMAP3430_REV_ES3_1_2 (OMAP343X_CLASS | (0x5 << 8))
  389. #define OMAP363X_CLASS 0x36300034
  390. #define OMAP3630_REV_ES1_0 OMAP363X_CLASS
  391. #define OMAP3630_REV_ES1_1 (OMAP363X_CLASS | (0x1 << 8))
  392. #define OMAP3630_REV_ES1_2 (OMAP363X_CLASS | (0x2 << 8))
  393. #define TI816X_CLASS 0x81600081
  394. #define TI8168_REV_ES1_0 TI816X_CLASS
  395. #define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
  396. #define TI8168_REV_ES2_0 (TI816X_CLASS | (0x2 << 8))
  397. #define TI8168_REV_ES2_1 (TI816X_CLASS | (0x3 << 8))
  398. #define TI814X_CLASS 0x81400081
  399. #define TI8148_REV_ES1_0 TI814X_CLASS
  400. #define TI8148_REV_ES2_0 (TI814X_CLASS | (0x1 << 8))
  401. #define TI8148_REV_ES2_1 (TI814X_CLASS | (0x2 << 8))
  402. #define AM35XX_CLASS 0x35170034
  403. #define AM35XX_REV_ES1_0 AM35XX_CLASS
  404. #define AM35XX_REV_ES1_1 (AM35XX_CLASS | (0x1 << 8))
  405. #define AM335X_CLASS 0x33500033
  406. #define AM335X_REV_ES1_0 AM335X_CLASS
  407. #define AM335X_REV_ES2_0 (AM335X_CLASS | (0x1 << 8))
  408. #define AM335X_REV_ES2_1 (AM335X_CLASS | (0x2 << 8))
  409. #define AM437X_CLASS 0x43700000
  410. #define AM437X_REV_ES1_0 (AM437X_CLASS | (0x10 << 8))
  411. #define AM437X_REV_ES1_1 (AM437X_CLASS | (0x11 << 8))
  412. #define AM437X_REV_ES1_2 (AM437X_CLASS | (0x12 << 8))
  413. #define OMAP443X_CLASS 0x44300044
  414. #define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
  415. #define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8))
  416. #define OMAP4430_REV_ES2_1 (OMAP443X_CLASS | (0x21 << 8))
  417. #define OMAP4430_REV_ES2_2 (OMAP443X_CLASS | (0x22 << 8))
  418. #define OMAP4430_REV_ES2_3 (OMAP443X_CLASS | (0x23 << 8))
  419. #define OMAP446X_CLASS 0x44600044
  420. #define OMAP4460_REV_ES1_0 (OMAP446X_CLASS | (0x10 << 8))
  421. #define OMAP4460_REV_ES1_1 (OMAP446X_CLASS | (0x11 << 8))
  422. #define OMAP447X_CLASS 0x44700044
  423. #define OMAP4470_REV_ES1_0 (OMAP447X_CLASS | (0x10 << 8))
  424. #define OMAP54XX_CLASS 0x54000054
  425. #define OMAP5430_REV_ES2_0 (OMAP54XX_CLASS | (0x30 << 16) | (0x20 << 8))
  426. #define OMAP5432_REV_ES2_0 (OMAP54XX_CLASS | (0x32 << 16) | (0x20 << 8))
  427. #define DRA7XX_CLASS 0x07000000
  428. #define DRA752_REV_ES1_0 (DRA7XX_CLASS | (0x52 << 16) | (0x10 << 8))
  429. #define DRA752_REV_ES1_1 (DRA7XX_CLASS | (0x52 << 16) | (0x11 << 8))
  430. #define DRA752_REV_ES2_0 (DRA7XX_CLASS | (0x52 << 16) | (0x20 << 8))
  431. #define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8))
  432. #define DRA722_REV_ES1_0 (DRA7XX_CLASS | (0x22 << 16) | (0x10 << 8))
  433. #define DRA722_REV_ES2_0 (DRA7XX_CLASS | (0x22 << 16) | (0x20 << 8))
  434. void omap2xxx_check_revision(void);
  435. void omap3xxx_check_revision(void);
  436. void omap4xxx_check_revision(void);
  437. void omap5xxx_check_revision(void);
  438. void dra7xxx_check_revision(void);
  439. void omap3xxx_check_features(void);
  440. void ti81xx_check_features(void);
  441. void am33xx_check_features(void);
  442. void omap4xxx_check_features(void);
  443. /*
  444. * Runtime detection of OMAP3 features
  445. *
  446. * OMAP3_HAS_IO_CHAIN_CTRL: Some later members of the OMAP3 chip
  447. * family have OS-level control over the I/O chain clock. This is
  448. * to avoid a window during which wakeups could potentially be lost
  449. * during powerdomain transitions. If this bit is set, it
  450. * indicates that the chip does support OS-level control of this
  451. * feature.
  452. */
  453. extern u32 omap_features;
  454. #define OMAP3_HAS_L2CACHE BIT(0)
  455. #define OMAP3_HAS_IVA BIT(1)
  456. #define OMAP3_HAS_SGX BIT(2)
  457. #define OMAP3_HAS_NEON BIT(3)
  458. #define OMAP3_HAS_ISP BIT(4)
  459. #define OMAP3_HAS_192MHZ_CLK BIT(5)
  460. #define OMAP3_HAS_IO_WAKEUP BIT(6)
  461. #define OMAP3_HAS_SDRC BIT(7)
  462. #define OMAP3_HAS_IO_CHAIN_CTRL BIT(8)
  463. #define OMAP4_HAS_PERF_SILICON BIT(9)
  464. #define OMAP3_HAS_FEATURE(feat,flag) \
  465. static inline unsigned int omap3_has_ ##feat(void) \
  466. { \
  467. return omap_features & OMAP3_HAS_ ##flag; \
  468. } \
  469. OMAP3_HAS_FEATURE(l2cache, L2CACHE)
  470. OMAP3_HAS_FEATURE(sgx, SGX)
  471. OMAP3_HAS_FEATURE(iva, IVA)
  472. OMAP3_HAS_FEATURE(neon, NEON)
  473. OMAP3_HAS_FEATURE(isp, ISP)
  474. OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
  475. OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP)
  476. OMAP3_HAS_FEATURE(sdrc, SDRC)
  477. OMAP3_HAS_FEATURE(io_chain_ctrl, IO_CHAIN_CTRL)
  478. /*
  479. * Runtime detection of OMAP4 features
  480. */
  481. #define OMAP4_HAS_FEATURE(feat, flag) \
  482. static inline unsigned int omap4_has_ ##feat(void) \
  483. { \
  484. return omap_features & OMAP4_HAS_ ##flag; \
  485. } \
  486. OMAP4_HAS_FEATURE(perf_silicon, PERF_SILICON)
  487. /*
  488. * We need to make sure omap initcalls don't run when
  489. * multiplatform kernels are booted on other SoCs.
  490. */
  491. #define omap_initcall(level, fn) \
  492. static int __init __used __##fn(void) \
  493. { \
  494. if (!soc_is_omap()) \
  495. return 0; \
  496. return fn(); \
  497. } \
  498. level(__##fn);
  499. #define omap_early_initcall(fn) omap_initcall(early_initcall, fn)
  500. #define omap_core_initcall(fn) omap_initcall(core_initcall, fn)
  501. #define omap_postcore_initcall(fn) omap_initcall(postcore_initcall, fn)
  502. #define omap_arch_initcall(fn) omap_initcall(arch_initcall, fn)
  503. #define omap_subsys_initcall(fn) omap_initcall(subsys_initcall, fn)
  504. #define omap_device_initcall(fn) omap_initcall(device_initcall, fn)
  505. #define omap_late_initcall(fn) omap_initcall(late_initcall, fn)
  506. #define omap_late_initcall_sync(fn) omap_initcall(late_initcall_sync, fn)
  507. /* Legacy defines, these can be removed when users are removed */
  508. #define cpu_is_omap2420() soc_is_omap2420()
  509. #define cpu_is_omap2422() soc_is_omap2422()
  510. #define cpu_is_omap242x() soc_is_omap242x()
  511. #define cpu_is_omap2430() soc_is_omap2430()
  512. #define cpu_is_omap243x() soc_is_omap243x()
  513. #define cpu_is_omap24xx() soc_is_omap24xx()
  514. #define cpu_is_omap3430() soc_is_omap3430()
  515. #define cpu_is_omap343x() soc_is_omap343x()
  516. #define cpu_is_omap34xx() soc_is_omap34xx()
  517. #define cpu_is_omap3630() soc_is_omap3630()
  518. #define cpu_is_omap443x() soc_is_omap443x()
  519. #define cpu_is_omap446x() soc_is_omap446x()
  520. #define cpu_is_omap44xx() soc_is_omap44xx()
  521. #define cpu_is_ti814x() soc_is_ti814x()
  522. #define cpu_is_ti816x() soc_is_ti816x()
  523. #define cpu_is_ti81xx() soc_is_ti81xx()
  524. #endif /* __ASSEMBLY__ */