mxc.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /*
  2. * Copyright 2004-2007, 2010 Freescale Semiconductor, Inc. All Rights Reserved.
  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_MX50 50
  32. #define MXC_CPU_MX51 51
  33. #define MXC_CPU_MX53 53
  34. #define MXC_CPU_MXC91231 91231
  35. #define IMX_CHIP_REVISION_1_0 0x10
  36. #define IMX_CHIP_REVISION_1_1 0x11
  37. #define IMX_CHIP_REVISION_1_2 0x12
  38. #define IMX_CHIP_REVISION_1_3 0x13
  39. #define IMX_CHIP_REVISION_2_0 0x20
  40. #define IMX_CHIP_REVISION_2_1 0x21
  41. #define IMX_CHIP_REVISION_2_2 0x22
  42. #define IMX_CHIP_REVISION_2_3 0x23
  43. #define IMX_CHIP_REVISION_3_0 0x30
  44. #define IMX_CHIP_REVISION_3_1 0x31
  45. #define IMX_CHIP_REVISION_3_2 0x32
  46. #define IMX_CHIP_REVISION_3_3 0x33
  47. #define IMX_CHIP_REVISION_UNKNOWN 0xff
  48. #define IMX_CHIP_REVISION_1_0_STRING "1.0"
  49. #define IMX_CHIP_REVISION_1_1_STRING "1.1"
  50. #define IMX_CHIP_REVISION_1_2_STRING "1.2"
  51. #define IMX_CHIP_REVISION_1_3_STRING "1.3"
  52. #define IMX_CHIP_REVISION_2_0_STRING "2.0"
  53. #define IMX_CHIP_REVISION_2_1_STRING "2.1"
  54. #define IMX_CHIP_REVISION_2_2_STRING "2.2"
  55. #define IMX_CHIP_REVISION_2_3_STRING "2.3"
  56. #define IMX_CHIP_REVISION_3_0_STRING "3.0"
  57. #define IMX_CHIP_REVISION_3_1_STRING "3.1"
  58. #define IMX_CHIP_REVISION_3_2_STRING "3.2"
  59. #define IMX_CHIP_REVISION_3_3_STRING "3.3"
  60. #define IMX_CHIP_REVISION_UNKNOWN_STRING "unknown"
  61. #ifndef __ASSEMBLY__
  62. extern unsigned int __mxc_cpu_type;
  63. #endif
  64. #ifdef CONFIG_ARCH_MX1
  65. # ifdef mxc_cpu_type
  66. # undef mxc_cpu_type
  67. # define mxc_cpu_type __mxc_cpu_type
  68. # else
  69. # define mxc_cpu_type MXC_CPU_MX1
  70. # endif
  71. # define cpu_is_mx1() (mxc_cpu_type == MXC_CPU_MX1)
  72. #else
  73. # define cpu_is_mx1() (0)
  74. #endif
  75. #ifdef CONFIG_MACH_MX21
  76. # ifdef mxc_cpu_type
  77. # undef mxc_cpu_type
  78. # define mxc_cpu_type __mxc_cpu_type
  79. # else
  80. # define mxc_cpu_type MXC_CPU_MX21
  81. # endif
  82. # define cpu_is_mx21() (mxc_cpu_type == MXC_CPU_MX21)
  83. #else
  84. # define cpu_is_mx21() (0)
  85. #endif
  86. #ifdef CONFIG_ARCH_MX25
  87. # ifdef mxc_cpu_type
  88. # undef mxc_cpu_type
  89. # define mxc_cpu_type __mxc_cpu_type
  90. # else
  91. # define mxc_cpu_type MXC_CPU_MX25
  92. # endif
  93. # define cpu_is_mx25() (mxc_cpu_type == MXC_CPU_MX25)
  94. #else
  95. # define cpu_is_mx25() (0)
  96. #endif
  97. #ifdef CONFIG_MACH_MX27
  98. # ifdef mxc_cpu_type
  99. # undef mxc_cpu_type
  100. # define mxc_cpu_type __mxc_cpu_type
  101. # else
  102. # define mxc_cpu_type MXC_CPU_MX27
  103. # endif
  104. # define cpu_is_mx27() (mxc_cpu_type == MXC_CPU_MX27)
  105. #else
  106. # define cpu_is_mx27() (0)
  107. #endif
  108. #ifdef CONFIG_SOC_IMX31
  109. # ifdef mxc_cpu_type
  110. # undef mxc_cpu_type
  111. # define mxc_cpu_type __mxc_cpu_type
  112. # else
  113. # define mxc_cpu_type MXC_CPU_MX31
  114. # endif
  115. # define cpu_is_mx31() (mxc_cpu_type == MXC_CPU_MX31)
  116. #else
  117. # define cpu_is_mx31() (0)
  118. #endif
  119. #ifdef CONFIG_SOC_IMX35
  120. # ifdef mxc_cpu_type
  121. # undef mxc_cpu_type
  122. # define mxc_cpu_type __mxc_cpu_type
  123. # else
  124. # define mxc_cpu_type MXC_CPU_MX35
  125. # endif
  126. # define cpu_is_mx35() (mxc_cpu_type == MXC_CPU_MX35)
  127. #else
  128. # define cpu_is_mx35() (0)
  129. #endif
  130. #ifdef CONFIG_SOC_IMX50
  131. # ifdef mxc_cpu_type
  132. # undef mxc_cpu_type
  133. # define mxc_cpu_type __mxc_cpu_type
  134. # else
  135. # define mxc_cpu_type MXC_CPU_MX50
  136. # endif
  137. # define cpu_is_mx50() (mxc_cpu_type == MXC_CPU_MX50)
  138. #else
  139. # define cpu_is_mx50() (0)
  140. #endif
  141. #ifdef CONFIG_SOC_IMX51
  142. # ifdef mxc_cpu_type
  143. # undef mxc_cpu_type
  144. # define mxc_cpu_type __mxc_cpu_type
  145. # else
  146. # define mxc_cpu_type MXC_CPU_MX51
  147. # endif
  148. # define cpu_is_mx51() (mxc_cpu_type == MXC_CPU_MX51)
  149. #else
  150. # define cpu_is_mx51() (0)
  151. #endif
  152. #ifdef CONFIG_SOC_IMX53
  153. # ifdef mxc_cpu_type
  154. # undef mxc_cpu_type
  155. # define mxc_cpu_type __mxc_cpu_type
  156. # else
  157. # define mxc_cpu_type MXC_CPU_MX53
  158. # endif
  159. # define cpu_is_mx53() (mxc_cpu_type == MXC_CPU_MX53)
  160. #else
  161. # define cpu_is_mx53() (0)
  162. #endif
  163. #ifdef CONFIG_ARCH_MXC91231
  164. # ifdef mxc_cpu_type
  165. # undef mxc_cpu_type
  166. # define mxc_cpu_type __mxc_cpu_type
  167. # else
  168. # define mxc_cpu_type MXC_CPU_MXC91231
  169. # endif
  170. # define cpu_is_mxc91231() (mxc_cpu_type == MXC_CPU_MXC91231)
  171. #else
  172. # define cpu_is_mxc91231() (0)
  173. #endif
  174. #ifndef __ASSEMBLY__
  175. struct cpu_op {
  176. u32 cpu_rate;
  177. };
  178. int tzic_enable_wake(int is_idle);
  179. enum mxc_cpu_pwr_mode {
  180. WAIT_CLOCKED, /* wfi only */
  181. WAIT_UNCLOCKED, /* WAIT */
  182. WAIT_UNCLOCKED_POWER_OFF, /* WAIT + SRPG */
  183. STOP_POWER_ON, /* just STOP */
  184. STOP_POWER_OFF, /* STOP + SRPG */
  185. };
  186. extern struct cpu_op *(*get_cpu_op)(int *op);
  187. #endif
  188. #if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX2)
  189. /* These are deprecated, use mx[23][157]_setup_weimcs instead. */
  190. #define CSCR_U(n) (IO_ADDRESS(WEIM_BASE_ADDR + n * 0x10))
  191. #define CSCR_L(n) (IO_ADDRESS(WEIM_BASE_ADDR + n * 0x10 + 0x4))
  192. #define CSCR_A(n) (IO_ADDRESS(WEIM_BASE_ADDR + n * 0x10 + 0x8))
  193. #endif
  194. #define cpu_is_mx3() (cpu_is_mx31() || cpu_is_mx35() || cpu_is_mxc91231())
  195. #define cpu_is_mx2() (cpu_is_mx21() || cpu_is_mx27())
  196. #endif /* __ASM_ARCH_MXC_H__ */