omap1-soc.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * OMAP cpu type detection
  4. *
  5. * Copyright (C) 2004, 2008 Nokia Corporation
  6. *
  7. * Copyright (C) 2009-11 Texas Instruments.
  8. *
  9. * Written by Tony Lindgren <[email protected]>
  10. *
  11. * Added OMAP4/5 specific defines - Santosh Shilimkar<[email protected]>
  12. */
  13. #ifndef __ASM_ARCH_OMAP_CPU_H
  14. #define __ASM_ARCH_OMAP_CPU_H
  15. /*
  16. * Test if multicore OMAP support is needed
  17. */
  18. #undef MULTI_OMAP1
  19. #undef OMAP_NAME
  20. #ifdef CONFIG_ARCH_OMAP730
  21. # ifdef OMAP_NAME
  22. # undef MULTI_OMAP1
  23. # define MULTI_OMAP1
  24. # else
  25. # define OMAP_NAME omap730
  26. # endif
  27. #endif
  28. #ifdef CONFIG_ARCH_OMAP850
  29. # ifdef OMAP_NAME
  30. # undef MULTI_OMAP1
  31. # define MULTI_OMAP1
  32. # else
  33. # define OMAP_NAME omap850
  34. # endif
  35. #endif
  36. #ifdef CONFIG_ARCH_OMAP15XX
  37. # ifdef OMAP_NAME
  38. # undef MULTI_OMAP1
  39. # define MULTI_OMAP1
  40. # else
  41. # define OMAP_NAME omap1510
  42. # endif
  43. #endif
  44. #ifdef CONFIG_ARCH_OMAP16XX
  45. # ifdef OMAP_NAME
  46. # undef MULTI_OMAP1
  47. # define MULTI_OMAP1
  48. # else
  49. # define OMAP_NAME omap16xx
  50. # endif
  51. #endif
  52. /*
  53. * omap_rev bits:
  54. * CPU id bits (0730, 1510, 1710, 2422...) [31:16]
  55. * CPU revision (See _REV_ defined in cpu.h) [15:08]
  56. * CPU class bits (15xx, 16xx, 24xx, 34xx...) [07:00]
  57. */
  58. unsigned int omap_rev(void);
  59. /*
  60. * Get the CPU revision for OMAP devices
  61. */
  62. #define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
  63. /*
  64. * Macros to group OMAP into cpu classes.
  65. * These can be used in most places.
  66. * cpu_is_omap7xx(): True for OMAP730, OMAP850
  67. * cpu_is_omap15xx(): True for OMAP1510, OMAP5910 and OMAP310
  68. * cpu_is_omap16xx(): True for OMAP1610, OMAP5912 and OMAP1710
  69. */
  70. #define GET_OMAP_CLASS (omap_rev() & 0xff)
  71. #define IS_OMAP_CLASS(class, id) \
  72. static inline int is_omap ##class (void) \
  73. { \
  74. return (GET_OMAP_CLASS == (id)) ? 1 : 0; \
  75. }
  76. #define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)
  77. #define IS_OMAP_SUBCLASS(subclass, id) \
  78. static inline int is_omap ##subclass (void) \
  79. { \
  80. return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; \
  81. }
  82. IS_OMAP_CLASS(7xx, 0x07)
  83. IS_OMAP_CLASS(15xx, 0x15)
  84. IS_OMAP_CLASS(16xx, 0x16)
  85. #define cpu_is_omap7xx() 0
  86. #define cpu_is_omap15xx() 0
  87. #define cpu_is_omap16xx() 0
  88. #if defined(MULTI_OMAP1)
  89. # if defined(CONFIG_ARCH_OMAP730)
  90. # undef cpu_is_omap7xx
  91. # define cpu_is_omap7xx() is_omap7xx()
  92. # endif
  93. # if defined(CONFIG_ARCH_OMAP850)
  94. # undef cpu_is_omap7xx
  95. # define cpu_is_omap7xx() is_omap7xx()
  96. # endif
  97. # if defined(CONFIG_ARCH_OMAP15XX)
  98. # undef cpu_is_omap15xx
  99. # define cpu_is_omap15xx() is_omap15xx()
  100. # endif
  101. # if defined(CONFIG_ARCH_OMAP16XX)
  102. # undef cpu_is_omap16xx
  103. # define cpu_is_omap16xx() is_omap16xx()
  104. # endif
  105. #else
  106. # if defined(CONFIG_ARCH_OMAP730)
  107. # undef cpu_is_omap7xx
  108. # define cpu_is_omap7xx() 1
  109. # endif
  110. # if defined(CONFIG_ARCH_OMAP850)
  111. # undef cpu_is_omap7xx
  112. # define cpu_is_omap7xx() 1
  113. # endif
  114. # if defined(CONFIG_ARCH_OMAP15XX)
  115. # undef cpu_is_omap15xx
  116. # define cpu_is_omap15xx() 1
  117. # endif
  118. # if defined(CONFIG_ARCH_OMAP16XX)
  119. # undef cpu_is_omap16xx
  120. # define cpu_is_omap16xx() 1
  121. # endif
  122. #endif
  123. /*
  124. * Macros to detect individual cpu types.
  125. * These are only rarely needed.
  126. * cpu_is_omap310(): True for OMAP310
  127. * cpu_is_omap1510(): True for OMAP1510
  128. * cpu_is_omap1610(): True for OMAP1610
  129. * cpu_is_omap1611(): True for OMAP1611
  130. * cpu_is_omap5912(): True for OMAP5912
  131. * cpu_is_omap1621(): True for OMAP1621
  132. * cpu_is_omap1710(): True for OMAP1710
  133. */
  134. #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
  135. #define IS_OMAP_TYPE(type, id) \
  136. static inline int is_omap ##type (void) \
  137. { \
  138. return (GET_OMAP_TYPE == (id)) ? 1 : 0; \
  139. }
  140. IS_OMAP_TYPE(310, 0x0310)
  141. IS_OMAP_TYPE(1510, 0x1510)
  142. IS_OMAP_TYPE(1610, 0x1610)
  143. IS_OMAP_TYPE(1611, 0x1611)
  144. IS_OMAP_TYPE(5912, 0x1611)
  145. IS_OMAP_TYPE(1621, 0x1621)
  146. IS_OMAP_TYPE(1710, 0x1710)
  147. #define cpu_is_omap310() 0
  148. #define cpu_is_omap1510() 0
  149. #define cpu_is_omap1610() 0
  150. #define cpu_is_omap5912() 0
  151. #define cpu_is_omap1611() 0
  152. #define cpu_is_omap1621() 0
  153. #define cpu_is_omap1710() 0
  154. #define cpu_class_is_omap1() 1
  155. /*
  156. * Whether we have MULTI_OMAP1 or not, we still need to distinguish
  157. * between 310 vs. 1510 and 1611B/5912 vs. 1710.
  158. */
  159. #if defined(CONFIG_ARCH_OMAP15XX)
  160. # undef cpu_is_omap310
  161. # undef cpu_is_omap1510
  162. # define cpu_is_omap310() is_omap310()
  163. # define cpu_is_omap1510() is_omap1510()
  164. #endif
  165. #if defined(CONFIG_ARCH_OMAP16XX)
  166. # undef cpu_is_omap1610
  167. # undef cpu_is_omap1611
  168. # undef cpu_is_omap5912
  169. # undef cpu_is_omap1621
  170. # undef cpu_is_omap1710
  171. # define cpu_is_omap1610() is_omap1610()
  172. # define cpu_is_omap1611() is_omap1611()
  173. # define cpu_is_omap5912() is_omap5912()
  174. # define cpu_is_omap1621() is_omap1621()
  175. # define cpu_is_omap1710() is_omap1710()
  176. #endif
  177. #endif