mxc.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. #ifndef __ASSEMBLY__
  49. extern unsigned int __mxc_cpu_type;
  50. #endif
  51. #ifdef CONFIG_ARCH_MX1
  52. # ifdef mxc_cpu_type
  53. # undef mxc_cpu_type
  54. # define mxc_cpu_type __mxc_cpu_type
  55. # else
  56. # define mxc_cpu_type MXC_CPU_MX1
  57. # endif
  58. # define cpu_is_mx1() (mxc_cpu_type == MXC_CPU_MX1)
  59. #else
  60. # define cpu_is_mx1() (0)
  61. #endif
  62. #ifdef CONFIG_MACH_MX21
  63. # ifdef mxc_cpu_type
  64. # undef mxc_cpu_type
  65. # define mxc_cpu_type __mxc_cpu_type
  66. # else
  67. # define mxc_cpu_type MXC_CPU_MX21
  68. # endif
  69. # define cpu_is_mx21() (mxc_cpu_type == MXC_CPU_MX21)
  70. #else
  71. # define cpu_is_mx21() (0)
  72. #endif
  73. #ifdef CONFIG_ARCH_MX25
  74. # ifdef mxc_cpu_type
  75. # undef mxc_cpu_type
  76. # define mxc_cpu_type __mxc_cpu_type
  77. # else
  78. # define mxc_cpu_type MXC_CPU_MX25
  79. # endif
  80. # define cpu_is_mx25() (mxc_cpu_type == MXC_CPU_MX25)
  81. #else
  82. # define cpu_is_mx25() (0)
  83. #endif
  84. #ifdef CONFIG_MACH_MX27
  85. # ifdef mxc_cpu_type
  86. # undef mxc_cpu_type
  87. # define mxc_cpu_type __mxc_cpu_type
  88. # else
  89. # define mxc_cpu_type MXC_CPU_MX27
  90. # endif
  91. # define cpu_is_mx27() (mxc_cpu_type == MXC_CPU_MX27)
  92. #else
  93. # define cpu_is_mx27() (0)
  94. #endif
  95. #ifdef CONFIG_SOC_IMX31
  96. # ifdef mxc_cpu_type
  97. # undef mxc_cpu_type
  98. # define mxc_cpu_type __mxc_cpu_type
  99. # else
  100. # define mxc_cpu_type MXC_CPU_MX31
  101. # endif
  102. # define cpu_is_mx31() (mxc_cpu_type == MXC_CPU_MX31)
  103. #else
  104. # define cpu_is_mx31() (0)
  105. #endif
  106. #ifdef CONFIG_SOC_IMX35
  107. # ifdef mxc_cpu_type
  108. # undef mxc_cpu_type
  109. # define mxc_cpu_type __mxc_cpu_type
  110. # else
  111. # define mxc_cpu_type MXC_CPU_MX35
  112. # endif
  113. # define cpu_is_mx35() (mxc_cpu_type == MXC_CPU_MX35)
  114. #else
  115. # define cpu_is_mx35() (0)
  116. #endif
  117. #ifdef CONFIG_SOC_IMX50
  118. # ifdef mxc_cpu_type
  119. # undef mxc_cpu_type
  120. # define mxc_cpu_type __mxc_cpu_type
  121. # else
  122. # define mxc_cpu_type MXC_CPU_MX50
  123. # endif
  124. # define cpu_is_mx50() (mxc_cpu_type == MXC_CPU_MX50)
  125. #else
  126. # define cpu_is_mx50() (0)
  127. #endif
  128. #ifdef CONFIG_SOC_IMX51
  129. # ifdef mxc_cpu_type
  130. # undef mxc_cpu_type
  131. # define mxc_cpu_type __mxc_cpu_type
  132. # else
  133. # define mxc_cpu_type MXC_CPU_MX51
  134. # endif
  135. # define cpu_is_mx51() (mxc_cpu_type == MXC_CPU_MX51)
  136. #else
  137. # define cpu_is_mx51() (0)
  138. #endif
  139. #ifdef CONFIG_SOC_IMX53
  140. # ifdef mxc_cpu_type
  141. # undef mxc_cpu_type
  142. # define mxc_cpu_type __mxc_cpu_type
  143. # else
  144. # define mxc_cpu_type MXC_CPU_MX53
  145. # endif
  146. # define cpu_is_mx53() (mxc_cpu_type == MXC_CPU_MX53)
  147. #else
  148. # define cpu_is_mx53() (0)
  149. #endif
  150. #ifdef CONFIG_ARCH_MXC91231
  151. # ifdef mxc_cpu_type
  152. # undef mxc_cpu_type
  153. # define mxc_cpu_type __mxc_cpu_type
  154. # else
  155. # define mxc_cpu_type MXC_CPU_MXC91231
  156. # endif
  157. # define cpu_is_mxc91231() (mxc_cpu_type == MXC_CPU_MXC91231)
  158. #else
  159. # define cpu_is_mxc91231() (0)
  160. #endif
  161. #ifndef __ASSEMBLY__
  162. struct cpu_op {
  163. u32 cpu_rate;
  164. };
  165. extern struct cpu_op *(*get_cpu_op)(int *op);
  166. #endif
  167. #if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX2)
  168. /* These are deprecated, use mx[23][157]_setup_weimcs instead. */
  169. #define CSCR_U(n) (IO_ADDRESS(WEIM_BASE_ADDR + n * 0x10))
  170. #define CSCR_L(n) (IO_ADDRESS(WEIM_BASE_ADDR + n * 0x10 + 0x4))
  171. #define CSCR_A(n) (IO_ADDRESS(WEIM_BASE_ADDR + n * 0x10 + 0x8))
  172. #endif
  173. #define cpu_is_mx3() (cpu_is_mx31() || cpu_is_mx35() || cpu_is_mxc91231())
  174. #define cpu_is_mx2() (cpu_is_mx21() || cpu_is_mx27())
  175. #endif /* __ASM_ARCH_MXC_H__ */