mxc.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. * Copyright 2004-2007, 2010-2015 Freescale Semiconductor, Inc.
  3. * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or (at your option) any later version.
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  17. * MA 02110-1301, USA.
  18. */
  19. #ifndef __ASM_ARCH_MXC_H__
  20. #define __ASM_ARCH_MXC_H__
  21. #include <linux/types.h>
  22. #ifndef __ASM_ARCH_MXC_HARDWARE_H__
  23. #error "Do not include directly."
  24. #endif
  25. #define MXC_CPU_MX1 1
  26. #define MXC_CPU_MX21 21
  27. #define MXC_CPU_MX25 25
  28. #define MXC_CPU_MX27 27
  29. #define MXC_CPU_MX31 31
  30. #define MXC_CPU_MX35 35
  31. #define MXC_CPU_MX51 51
  32. #define MXC_CPU_MX53 53
  33. #define MXC_CPU_IMX6SL 0x60
  34. #define MXC_CPU_IMX6DL 0x61
  35. #define MXC_CPU_IMX6SX 0x62
  36. #define MXC_CPU_IMX6Q 0x63
  37. #define MXC_CPU_IMX6UL 0x64
  38. #define MXC_CPU_IMX7D 0x72
  39. #define IMX_DDR_TYPE_LPDDR2 1
  40. #ifndef __ASSEMBLY__
  41. extern unsigned int __mxc_cpu_type;
  42. #endif
  43. #ifdef CONFIG_SOC_IMX1
  44. # ifdef mxc_cpu_type
  45. # undef mxc_cpu_type
  46. # define mxc_cpu_type __mxc_cpu_type
  47. # else
  48. # define mxc_cpu_type MXC_CPU_MX1
  49. # endif
  50. # define cpu_is_mx1() (mxc_cpu_type == MXC_CPU_MX1)
  51. #else
  52. # define cpu_is_mx1() (0)
  53. #endif
  54. #ifdef CONFIG_SOC_IMX21
  55. # ifdef mxc_cpu_type
  56. # undef mxc_cpu_type
  57. # define mxc_cpu_type __mxc_cpu_type
  58. # else
  59. # define mxc_cpu_type MXC_CPU_MX21
  60. # endif
  61. # define cpu_is_mx21() (mxc_cpu_type == MXC_CPU_MX21)
  62. #else
  63. # define cpu_is_mx21() (0)
  64. #endif
  65. #ifdef CONFIG_SOC_IMX25
  66. # ifdef mxc_cpu_type
  67. # undef mxc_cpu_type
  68. # define mxc_cpu_type __mxc_cpu_type
  69. # else
  70. # define mxc_cpu_type MXC_CPU_MX25
  71. # endif
  72. # define cpu_is_mx25() (mxc_cpu_type == MXC_CPU_MX25)
  73. #else
  74. # define cpu_is_mx25() (0)
  75. #endif
  76. #ifdef CONFIG_SOC_IMX27
  77. # ifdef mxc_cpu_type
  78. # undef mxc_cpu_type
  79. # define mxc_cpu_type __mxc_cpu_type
  80. # else
  81. # define mxc_cpu_type MXC_CPU_MX27
  82. # endif
  83. # define cpu_is_mx27() (mxc_cpu_type == MXC_CPU_MX27)
  84. #else
  85. # define cpu_is_mx27() (0)
  86. #endif
  87. #ifdef CONFIG_SOC_IMX31
  88. # ifdef mxc_cpu_type
  89. # undef mxc_cpu_type
  90. # define mxc_cpu_type __mxc_cpu_type
  91. # else
  92. # define mxc_cpu_type MXC_CPU_MX31
  93. # endif
  94. # define cpu_is_mx31() (mxc_cpu_type == MXC_CPU_MX31)
  95. #else
  96. # define cpu_is_mx31() (0)
  97. #endif
  98. #ifdef CONFIG_SOC_IMX35
  99. # ifdef mxc_cpu_type
  100. # undef mxc_cpu_type
  101. # define mxc_cpu_type __mxc_cpu_type
  102. # else
  103. # define mxc_cpu_type MXC_CPU_MX35
  104. # endif
  105. # define cpu_is_mx35() (mxc_cpu_type == MXC_CPU_MX35)
  106. #else
  107. # define cpu_is_mx35() (0)
  108. #endif
  109. #ifdef CONFIG_SOC_IMX51
  110. # ifdef mxc_cpu_type
  111. # undef mxc_cpu_type
  112. # define mxc_cpu_type __mxc_cpu_type
  113. # else
  114. # define mxc_cpu_type MXC_CPU_MX51
  115. # endif
  116. # define cpu_is_mx51() (mxc_cpu_type == MXC_CPU_MX51)
  117. #else
  118. # define cpu_is_mx51() (0)
  119. #endif
  120. #ifdef CONFIG_SOC_IMX53
  121. # ifdef mxc_cpu_type
  122. # undef mxc_cpu_type
  123. # define mxc_cpu_type __mxc_cpu_type
  124. # else
  125. # define mxc_cpu_type MXC_CPU_MX53
  126. # endif
  127. # define cpu_is_mx53() (mxc_cpu_type == MXC_CPU_MX53)
  128. #else
  129. # define cpu_is_mx53() (0)
  130. #endif
  131. #ifndef __ASSEMBLY__
  132. #ifdef CONFIG_SOC_IMX6SL
  133. static inline bool cpu_is_imx6sl(void)
  134. {
  135. return __mxc_cpu_type == MXC_CPU_IMX6SL;
  136. }
  137. #else
  138. static inline bool cpu_is_imx6sl(void)
  139. {
  140. return false;
  141. }
  142. #endif
  143. static inline bool cpu_is_imx6dl(void)
  144. {
  145. return __mxc_cpu_type == MXC_CPU_IMX6DL;
  146. }
  147. static inline bool cpu_is_imx6sx(void)
  148. {
  149. return __mxc_cpu_type == MXC_CPU_IMX6SX;
  150. }
  151. static inline bool cpu_is_imx6ul(void)
  152. {
  153. return __mxc_cpu_type == MXC_CPU_IMX6UL;
  154. }
  155. static inline bool cpu_is_imx6q(void)
  156. {
  157. return __mxc_cpu_type == MXC_CPU_IMX6Q;
  158. }
  159. static inline bool cpu_is_imx7d(void)
  160. {
  161. return __mxc_cpu_type == MXC_CPU_IMX7D;
  162. }
  163. struct cpu_op {
  164. u32 cpu_rate;
  165. };
  166. int tzic_enable_wake(void);
  167. extern struct cpu_op *(*get_cpu_op)(int *op);
  168. #endif
  169. #define cpu_is_mx3() (cpu_is_mx31() || cpu_is_mx35())
  170. #define cpu_is_mx2() (cpu_is_mx21() || cpu_is_mx27())
  171. #endif /* __ASM_ARCH_MXC_H__ */