cpu.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /*
  2. * linux/include/asm-arm/arch-omap/cpu.h
  3. *
  4. * OMAP cpu type detection
  5. *
  6. * Copyright (C) 2004 Nokia Corporation
  7. *
  8. * Written by Tony Lindgren <tony.lindgren@nokia.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. */
  25. #ifndef __ASM_ARCH_OMAP_CPU_H
  26. #define __ASM_ARCH_OMAP_CPU_H
  27. extern unsigned int system_rev;
  28. #define OMAP_DIE_ID_0 0xfffe1800
  29. #define OMAP_DIE_ID_1 0xfffe1804
  30. #define OMAP_PRODUCTION_ID_0 0xfffe2000
  31. #define OMAP_PRODUCTION_ID_1 0xfffe2004
  32. #define OMAP32_ID_0 0xfffed400
  33. #define OMAP32_ID_1 0xfffed404
  34. /*
  35. * Test if multicore OMAP support is needed
  36. */
  37. #undef MULTI_OMAP
  38. #undef OMAP_NAME
  39. #ifdef CONFIG_ARCH_OMAP730
  40. # ifdef OMAP_NAME
  41. # undef MULTI_OMAP
  42. # define MULTI_OMAP
  43. # else
  44. # define OMAP_NAME omap730
  45. # endif
  46. #endif
  47. #ifdef CONFIG_ARCH_OMAP1510
  48. # ifdef OMAP_NAME
  49. # undef MULTI_OMAP
  50. # define MULTI_OMAP
  51. # else
  52. # define OMAP_NAME omap1510
  53. # endif
  54. #endif
  55. #ifdef CONFIG_ARCH_OMAP16XX
  56. # ifdef OMAP_NAME
  57. # undef MULTI_OMAP
  58. # define MULTI_OMAP
  59. # else
  60. # define OMAP_NAME omap1610
  61. # endif
  62. #endif
  63. #ifdef CONFIG_ARCH_OMAP16XX
  64. # ifdef OMAP_NAME
  65. # undef MULTI_OMAP
  66. # define MULTI_OMAP
  67. # else
  68. # define OMAP_NAME omap1710
  69. # endif
  70. #endif
  71. /*
  72. * Generate various OMAP cpu specific macros, and cpu class
  73. * specific macros
  74. */
  75. #define GET_OMAP_TYPE ((system_rev >> 24) & 0xff)
  76. #define GET_OMAP_CLASS (system_rev & 0xff)
  77. #define IS_OMAP_TYPE(type, id) \
  78. static inline int is_omap ##type (void) \
  79. { \
  80. return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
  81. }
  82. #define IS_OMAP_CLASS(class, id) \
  83. static inline int is_omap ##class (void) \
  84. { \
  85. return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
  86. }
  87. IS_OMAP_TYPE(730, 0x07)
  88. IS_OMAP_TYPE(1510, 0x15)
  89. IS_OMAP_TYPE(1610, 0x16)
  90. IS_OMAP_TYPE(5912, 0x16)
  91. IS_OMAP_TYPE(1710, 0x17)
  92. IS_OMAP_TYPE(2420, 0x24)
  93. IS_OMAP_CLASS(7xx, 0x07)
  94. IS_OMAP_CLASS(15xx, 0x15)
  95. IS_OMAP_CLASS(16xx, 0x16)
  96. IS_OMAP_CLASS(24xx, 0x24)
  97. /*
  98. * Macros to group OMAP types into cpu classes.
  99. * These can be used in most places.
  100. * cpu_is_omap15xx(): True for 1510 and 5910
  101. * cpu_is_omap16xx(): True for 1610, 5912 and 1710
  102. */
  103. #if defined(MULTI_OMAP)
  104. # define cpu_is_omap7xx() is_omap7xx()
  105. # define cpu_is_omap15xx() is_omap15xx()
  106. # if !(defined(CONFIG_ARCH_OMAP1510) || defined(CONFIG_ARCH_OMAP730))
  107. # define cpu_is_omap16xx() 1
  108. # else
  109. # define cpu_is_omap16xx() is_omap16xx()
  110. # endif
  111. #else
  112. # if defined(CONFIG_ARCH_OMAP730)
  113. # define cpu_is_omap7xx() 1
  114. # else
  115. # define cpu_is_omap7xx() 0
  116. # endif
  117. # if defined(CONFIG_ARCH_OMAP1510)
  118. # define cpu_is_omap15xx() 1
  119. # else
  120. # define cpu_is_omap15xx() 0
  121. # endif
  122. # if defined(CONFIG_ARCH_OMAP16XX)
  123. # define cpu_is_omap16xx() 1
  124. # else
  125. # define cpu_is_omap16xx() 0
  126. # endif
  127. #endif
  128. #if defined(MULTI_OMAP)
  129. # define cpu_is_omap730() is_omap730()
  130. # define cpu_is_omap1510() is_omap1510()
  131. # define cpu_is_omap1610() is_omap1610()
  132. # define cpu_is_omap5912() is_omap5912()
  133. # define cpu_is_omap1710() is_omap1710()
  134. #else
  135. # if defined(CONFIG_ARCH_OMAP730)
  136. # define cpu_is_omap730() 1
  137. # else
  138. # define cpu_is_omap730() 0
  139. # endif
  140. # if defined(CONFIG_ARCH_OMAP1510)
  141. # define cpu_is_omap1510() 1
  142. # else
  143. # define cpu_is_omap1510() 0
  144. # endif
  145. # if defined(CONFIG_ARCH_OMAP16XX)
  146. # define cpu_is_omap1610() 1
  147. # else
  148. # define cpu_is_omap1610() 0
  149. # endif
  150. # if defined(CONFIG_ARCH_OMAP16XX)
  151. # define cpu_is_omap5912() 1
  152. # else
  153. # define cpu_is_omap5912() 0
  154. # endif
  155. # if defined(CONFIG_ARCH_OMAP16XX)
  156. # define cpu_is_omap1610() is_omap1610()
  157. # define cpu_is_omap5912() is_omap5912()
  158. # define cpu_is_omap1710() is_omap1710()
  159. # else
  160. # define cpu_is_omap1610() 0
  161. # define cpu_is_omap5912() 0
  162. # define cpu_is_omap1710() 0
  163. # endif
  164. # if defined(CONFIG_ARCH_OMAP2420)
  165. # define cpu_is_omap2420() 1
  166. # else
  167. # define cpu_is_omap2420() 0
  168. # endif
  169. #endif
  170. #endif