soc.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 2 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  25. *
  26. */
  27. #ifndef __ASM_ARCH_OMAP_CPU_H
  28. #define __ASM_ARCH_OMAP_CPU_H
  29. #ifndef __ASSEMBLY__
  30. #include <linux/bitops.h>
  31. /*
  32. * Test if multicore OMAP support is needed
  33. */
  34. #undef MULTI_OMAP1
  35. #undef OMAP_NAME
  36. #ifdef CONFIG_ARCH_OMAP730
  37. # ifdef OMAP_NAME
  38. # undef MULTI_OMAP1
  39. # define MULTI_OMAP1
  40. # else
  41. # define OMAP_NAME omap730
  42. # endif
  43. #endif
  44. #ifdef CONFIG_ARCH_OMAP850
  45. # ifdef OMAP_NAME
  46. # undef MULTI_OMAP1
  47. # define MULTI_OMAP1
  48. # else
  49. # define OMAP_NAME omap850
  50. # endif
  51. #endif
  52. #ifdef CONFIG_ARCH_OMAP15XX
  53. # ifdef OMAP_NAME
  54. # undef MULTI_OMAP1
  55. # define MULTI_OMAP1
  56. # else
  57. # define OMAP_NAME omap1510
  58. # endif
  59. #endif
  60. #ifdef CONFIG_ARCH_OMAP16XX
  61. # ifdef OMAP_NAME
  62. # undef MULTI_OMAP1
  63. # define MULTI_OMAP1
  64. # else
  65. # define OMAP_NAME omap16xx
  66. # endif
  67. #endif
  68. /*
  69. * omap_rev bits:
  70. * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
  71. * CPU revision (See _REV_ defined in cpu.h) [15:08]
  72. * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
  73. */
  74. unsigned int omap_rev(void);
  75. /*
  76. * Get the CPU revision for OMAP devices
  77. */
  78. #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
  79. /*
  80. * Macros to group OMAP into cpu classes.
  81. * These can be used in most places.
  82. * cpu_is_omap7xx(): True for OMAP730, OMAP850
  83. * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
  84. * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
  85. */
  86. #define GET_OMAP_CLASS (omap_rev() & 0xff)
  87. #define IS_OMAP_CLASS(class, id) \
  88. static inline int is_omap ##class (void) \
  89. { \
  90. return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
  91. }
  92. #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
  93. #define IS_OMAP_SUBCLASS(subclass, id) \
  94. static inline int is_omap ##subclass (void) \
  95. { \
  96. return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
  97. }
  98. IS_OMAP_CLASS(7xx, 0x07)
  99. IS_OMAP_CLASS(15xx, 0x15)
  100. IS_OMAP_CLASS(16xx, 0x16)
  101. #define cpu_is_omap7xx() 0
  102. #define cpu_is_omap15xx() 0
  103. #define cpu_is_omap16xx() 0
  104. #if defined(MULTI_OMAP1)
  105. # if defined(CONFIG_ARCH_OMAP730)
  106. # undef cpu_is_omap7xx
  107. # define cpu_is_omap7xx() is_omap7xx()
  108. # endif
  109. # if defined(CONFIG_ARCH_OMAP850)
  110. # undef cpu_is_omap7xx
  111. # define cpu_is_omap7xx() is_omap7xx()
  112. # endif
  113. # if defined(CONFIG_ARCH_OMAP15XX)
  114. # undef cpu_is_omap15xx
  115. # define cpu_is_omap15xx() is_omap15xx()
  116. # endif
  117. # if defined(CONFIG_ARCH_OMAP16XX)
  118. # undef cpu_is_omap16xx
  119. # define cpu_is_omap16xx() is_omap16xx()
  120. # endif
  121. #else
  122. # if defined(CONFIG_ARCH_OMAP730)
  123. # undef cpu_is_omap7xx
  124. # define cpu_is_omap7xx() 1
  125. # endif
  126. # if defined(CONFIG_ARCH_OMAP850)
  127. # undef cpu_is_omap7xx
  128. # define cpu_is_omap7xx() 1
  129. # endif
  130. # if defined(CONFIG_ARCH_OMAP15XX)
  131. # undef cpu_is_omap15xx
  132. # define cpu_is_omap15xx() 1
  133. # endif
  134. # if defined(CONFIG_ARCH_OMAP16XX)
  135. # undef cpu_is_omap16xx
  136. # define cpu_is_omap16xx() 1
  137. # endif
  138. #endif
  139. /*
  140. * Macros to detect individual cpu types.
  141. * These are only rarely needed.
  142. * cpu_is_omap310(): True for OMAP310
  143. * cpu_is_omap1510(): True for OMAP1510
  144. * cpu_is_omap1610(): True for OMAP1610
  145. * cpu_is_omap1611(): True for OMAP1611
  146. * cpu_is_omap5912(): True for OMAP5912
  147. * cpu_is_omap1621(): True for OMAP1621
  148. * cpu_is_omap1710(): True for OMAP1710
  149. */
  150. #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
  151. #define IS_OMAP_TYPE(type, id) \
  152. static inline int is_omap ##type (void) \
  153. { \
  154. return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
  155. }
  156. IS_OMAP_TYPE(310, 0x0310)
  157. IS_OMAP_TYPE(1510, 0x1510)
  158. IS_OMAP_TYPE(1610, 0x1610)
  159. IS_OMAP_TYPE(1611, 0x1611)
  160. IS_OMAP_TYPE(5912, 0x1611)
  161. IS_OMAP_TYPE(1621, 0x1621)
  162. IS_OMAP_TYPE(1710, 0x1710)
  163. #define cpu_is_omap310() 0
  164. #define cpu_is_omap1510() 0
  165. #define cpu_is_omap1610() 0
  166. #define cpu_is_omap5912() 0
  167. #define cpu_is_omap1611() 0
  168. #define cpu_is_omap1621() 0
  169. #define cpu_is_omap1710() 0
  170. /* These are needed to compile common code */
  171. #ifdef CONFIG_ARCH_OMAP1
  172. #define cpu_is_omap242x() 0
  173. #define cpu_is_omap2430() 0
  174. #define cpu_is_omap243x() 0
  175. #define cpu_is_omap24xx() 0
  176. #define cpu_is_omap34xx() 0
  177. #define cpu_is_omap44xx() 0
  178. #define soc_is_omap54xx() 0
  179. #define soc_is_am33xx() 0
  180. #define cpu_class_is_omap1() 1
  181. #define cpu_class_is_omap2() 0
  182. #endif
  183. /*
  184. * Whether we have MULTI_OMAP1 or not, we still need to distinguish
  185. * between 310 vs. 1510 and 1611B/5912 vs. 1710.
  186. */
  187. #if defined(CONFIG_ARCH_OMAP15XX)
  188. # undef cpu_is_omap310
  189. # undef cpu_is_omap1510
  190. # define cpu_is_omap310() is_omap310()
  191. # define cpu_is_omap1510() is_omap1510()
  192. #endif
  193. #if defined(CONFIG_ARCH_OMAP16XX)
  194. # undef cpu_is_omap1610
  195. # undef cpu_is_omap1611
  196. # undef cpu_is_omap5912
  197. # undef cpu_is_omap1621
  198. # undef cpu_is_omap1710
  199. # define cpu_is_omap1610() is_omap1610()
  200. # define cpu_is_omap1611() is_omap1611()
  201. # define cpu_is_omap5912() is_omap5912()
  202. # define cpu_is_omap1621() is_omap1621()
  203. # define cpu_is_omap1710() is_omap1710()
  204. #endif
  205. #endif /* __ASSEMBLY__ */
  206. #endif