soc.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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. #include <asm/irq.h>
  30. #include <mach/hardware.h>
  31. #include <mach/irqs.h>
  32. #ifndef __ASSEMBLY__
  33. #include <linux/bitops.h>
  34. /*
  35. * Test if multicore OMAP support is needed
  36. */
  37. #undef MULTI_OMAP1
  38. #undef OMAP_NAME
  39. #ifdef CONFIG_ARCH_OMAP730
  40. # ifdef OMAP_NAME
  41. # undef MULTI_OMAP1
  42. # define MULTI_OMAP1
  43. # else
  44. # define OMAP_NAME omap730
  45. # endif
  46. #endif
  47. #ifdef CONFIG_ARCH_OMAP850
  48. # ifdef OMAP_NAME
  49. # undef MULTI_OMAP1
  50. # define MULTI_OMAP1
  51. # else
  52. # define OMAP_NAME omap850
  53. # endif
  54. #endif
  55. #ifdef CONFIG_ARCH_OMAP15XX
  56. # ifdef OMAP_NAME
  57. # undef MULTI_OMAP1
  58. # define MULTI_OMAP1
  59. # else
  60. # define OMAP_NAME omap1510
  61. # endif
  62. #endif
  63. #ifdef CONFIG_ARCH_OMAP16XX
  64. # ifdef OMAP_NAME
  65. # undef MULTI_OMAP1
  66. # define MULTI_OMAP1
  67. # else
  68. # define OMAP_NAME omap16xx
  69. # endif
  70. #endif
  71. /*
  72. * omap_rev bits:
  73. * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
  74. * CPU revision (See _REV_ defined in cpu.h) [15:08]
  75. * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
  76. */
  77. unsigned int omap_rev(void);
  78. /*
  79. * Get the CPU revision for OMAP devices
  80. */
  81. #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
  82. /*
  83. * Macros to group OMAP into cpu classes.
  84. * These can be used in most places.
  85. * cpu_is_omap7xx(): True for OMAP730, OMAP850
  86. * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
  87. * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
  88. */
  89. #define GET_OMAP_CLASS (omap_rev() & 0xff)
  90. #define IS_OMAP_CLASS(class, id) \
  91. static inline int is_omap ##class (void) \
  92. { \
  93. return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
  94. }
  95. #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
  96. #define IS_OMAP_SUBCLASS(subclass, id) \
  97. static inline int is_omap ##subclass (void) \
  98. { \
  99. return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
  100. }
  101. IS_OMAP_CLASS(7xx, 0x07)
  102. IS_OMAP_CLASS(15xx, 0x15)
  103. IS_OMAP_CLASS(16xx, 0x16)
  104. #define cpu_is_omap7xx() 0
  105. #define cpu_is_omap15xx() 0
  106. #define cpu_is_omap16xx() 0
  107. #if defined(MULTI_OMAP1)
  108. # if defined(CONFIG_ARCH_OMAP730)
  109. # undef cpu_is_omap7xx
  110. # define cpu_is_omap7xx() is_omap7xx()
  111. # endif
  112. # if defined(CONFIG_ARCH_OMAP850)
  113. # undef cpu_is_omap7xx
  114. # define cpu_is_omap7xx() is_omap7xx()
  115. # endif
  116. # if defined(CONFIG_ARCH_OMAP15XX)
  117. # undef cpu_is_omap15xx
  118. # define cpu_is_omap15xx() is_omap15xx()
  119. # endif
  120. # if defined(CONFIG_ARCH_OMAP16XX)
  121. # undef cpu_is_omap16xx
  122. # define cpu_is_omap16xx() is_omap16xx()
  123. # endif
  124. #else
  125. # if defined(CONFIG_ARCH_OMAP730)
  126. # undef cpu_is_omap7xx
  127. # define cpu_is_omap7xx() 1
  128. # endif
  129. # if defined(CONFIG_ARCH_OMAP850)
  130. # undef cpu_is_omap7xx
  131. # define cpu_is_omap7xx() 1
  132. # endif
  133. # if defined(CONFIG_ARCH_OMAP15XX)
  134. # undef cpu_is_omap15xx
  135. # define cpu_is_omap15xx() 1
  136. # endif
  137. # if defined(CONFIG_ARCH_OMAP16XX)
  138. # undef cpu_is_omap16xx
  139. # define cpu_is_omap16xx() 1
  140. # endif
  141. #endif
  142. /*
  143. * Macros to detect individual cpu types.
  144. * These are only rarely needed.
  145. * cpu_is_omap310(): True for OMAP310
  146. * cpu_is_omap1510(): True for OMAP1510
  147. * cpu_is_omap1610(): True for OMAP1610
  148. * cpu_is_omap1611(): True for OMAP1611
  149. * cpu_is_omap5912(): True for OMAP5912
  150. * cpu_is_omap1621(): True for OMAP1621
  151. * cpu_is_omap1710(): True for OMAP1710
  152. */
  153. #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
  154. #define IS_OMAP_TYPE(type, id) \
  155. static inline int is_omap ##type (void) \
  156. { \
  157. return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
  158. }
  159. IS_OMAP_TYPE(310, 0x0310)
  160. IS_OMAP_TYPE(1510, 0x1510)
  161. IS_OMAP_TYPE(1610, 0x1610)
  162. IS_OMAP_TYPE(1611, 0x1611)
  163. IS_OMAP_TYPE(5912, 0x1611)
  164. IS_OMAP_TYPE(1621, 0x1621)
  165. IS_OMAP_TYPE(1710, 0x1710)
  166. #define cpu_is_omap310() 0
  167. #define cpu_is_omap1510() 0
  168. #define cpu_is_omap1610() 0
  169. #define cpu_is_omap5912() 0
  170. #define cpu_is_omap1611() 0
  171. #define cpu_is_omap1621() 0
  172. #define cpu_is_omap1710() 0
  173. /* These are needed to compile common code */
  174. #ifdef CONFIG_ARCH_OMAP1
  175. #define cpu_is_omap242x() 0
  176. #define cpu_is_omap2430() 0
  177. #define cpu_is_omap243x() 0
  178. #define cpu_is_omap24xx() 0
  179. #define cpu_is_omap34xx() 0
  180. #define cpu_is_omap44xx() 0
  181. #define soc_is_omap54xx() 0
  182. #define soc_is_dra7xx() 0
  183. #define soc_is_am33xx() 0
  184. #define cpu_class_is_omap1() 1
  185. #define cpu_class_is_omap2() 0
  186. #endif
  187. /*
  188. * Whether we have MULTI_OMAP1 or not, we still need to distinguish
  189. * between 310 vs. 1510 and 1611B/5912 vs. 1710.
  190. */
  191. #if defined(CONFIG_ARCH_OMAP15XX)
  192. # undef cpu_is_omap310
  193. # undef cpu_is_omap1510
  194. # define cpu_is_omap310() is_omap310()
  195. # define cpu_is_omap1510() is_omap1510()
  196. #endif
  197. #if defined(CONFIG_ARCH_OMAP16XX)
  198. # undef cpu_is_omap1610
  199. # undef cpu_is_omap1611
  200. # undef cpu_is_omap5912
  201. # undef cpu_is_omap1621
  202. # undef cpu_is_omap1710
  203. # define cpu_is_omap1610() is_omap1610()
  204. # define cpu_is_omap1611() is_omap1611()
  205. # define cpu_is_omap5912() is_omap5912()
  206. # define cpu_is_omap1621() is_omap1621()
  207. # define cpu_is_omap1710() is_omap1710()
  208. #endif
  209. #endif /* __ASSEMBLY__ */
  210. #endif