mxc.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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_MX51 51
  32. #define MXC_CPU_MX53 53
  33. #define MXC_CPU_MXC91231 91231
  34. #ifndef __ASSEMBLY__
  35. extern unsigned int __mxc_cpu_type;
  36. #endif
  37. #ifdef CONFIG_ARCH_MX1
  38. # ifdef mxc_cpu_type
  39. # undef mxc_cpu_type
  40. # define mxc_cpu_type __mxc_cpu_type
  41. # else
  42. # define mxc_cpu_type MXC_CPU_MX1
  43. # endif
  44. # define cpu_is_mx1() (mxc_cpu_type == MXC_CPU_MX1)
  45. #else
  46. # define cpu_is_mx1() (0)
  47. #endif
  48. #ifdef CONFIG_MACH_MX21
  49. # ifdef mxc_cpu_type
  50. # undef mxc_cpu_type
  51. # define mxc_cpu_type __mxc_cpu_type
  52. # else
  53. # define mxc_cpu_type MXC_CPU_MX21
  54. # endif
  55. # define cpu_is_mx21() (mxc_cpu_type == MXC_CPU_MX21)
  56. #else
  57. # define cpu_is_mx21() (0)
  58. #endif
  59. #ifdef CONFIG_ARCH_MX25
  60. # ifdef mxc_cpu_type
  61. # undef mxc_cpu_type
  62. # define mxc_cpu_type __mxc_cpu_type
  63. # else
  64. # define mxc_cpu_type MXC_CPU_MX25
  65. # endif
  66. # define cpu_is_mx25() (mxc_cpu_type == MXC_CPU_MX25)
  67. #else
  68. # define cpu_is_mx25() (0)
  69. #endif
  70. #ifdef CONFIG_MACH_MX27
  71. # ifdef mxc_cpu_type
  72. # undef mxc_cpu_type
  73. # define mxc_cpu_type __mxc_cpu_type
  74. # else
  75. # define mxc_cpu_type MXC_CPU_MX27
  76. # endif
  77. # define cpu_is_mx27() (mxc_cpu_type == MXC_CPU_MX27)
  78. #else
  79. # define cpu_is_mx27() (0)
  80. #endif
  81. #ifdef CONFIG_ARCH_MX31
  82. # ifdef mxc_cpu_type
  83. # undef mxc_cpu_type
  84. # define mxc_cpu_type __mxc_cpu_type
  85. # else
  86. # define mxc_cpu_type MXC_CPU_MX31
  87. # endif
  88. # define cpu_is_mx31() (mxc_cpu_type == MXC_CPU_MX31)
  89. #else
  90. # define cpu_is_mx31() (0)
  91. #endif
  92. #ifdef CONFIG_ARCH_MX35
  93. # ifdef mxc_cpu_type
  94. # undef mxc_cpu_type
  95. # define mxc_cpu_type __mxc_cpu_type
  96. # else
  97. # define mxc_cpu_type MXC_CPU_MX35
  98. # endif
  99. # define cpu_is_mx35() (mxc_cpu_type == MXC_CPU_MX35)
  100. #else
  101. # define cpu_is_mx35() (0)
  102. #endif
  103. #ifdef CONFIG_ARCH_MX5
  104. # ifdef mxc_cpu_type
  105. # undef mxc_cpu_type
  106. # define mxc_cpu_type __mxc_cpu_type
  107. # else
  108. # define mxc_cpu_type MXC_CPU_MX51
  109. # endif
  110. # define cpu_is_mx51() (mxc_cpu_type == MXC_CPU_MX51)
  111. # define cpu_is_mx53() (mxc_cpu_type == MXC_CPU_MX53)
  112. #else
  113. # define cpu_is_mx51() (0)
  114. #endif
  115. #ifdef CONFIG_ARCH_MXC91231
  116. # ifdef mxc_cpu_type
  117. # undef mxc_cpu_type
  118. # define mxc_cpu_type __mxc_cpu_type
  119. # else
  120. # define mxc_cpu_type MXC_CPU_MXC91231
  121. # endif
  122. # define cpu_is_mxc91231() (mxc_cpu_type == MXC_CPU_MXC91231)
  123. #else
  124. # define cpu_is_mxc91231() (0)
  125. #endif
  126. #ifndef __ASSEMBLY__
  127. struct cpu_op {
  128. u32 cpu_rate;
  129. };
  130. extern struct cpu_op *(*get_cpu_op)(int *op);
  131. #endif
  132. #if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX2)
  133. /* These are deprecated, use mx[23][157]_setup_weimcs instead. */
  134. #define CSCR_U(n) (IO_ADDRESS(WEIM_BASE_ADDR + n * 0x10))
  135. #define CSCR_L(n) (IO_ADDRESS(WEIM_BASE_ADDR + n * 0x10 + 0x4))
  136. #define CSCR_A(n) (IO_ADDRESS(WEIM_BASE_ADDR + n * 0x10 + 0x8))
  137. #endif
  138. #define cpu_is_mx3() (cpu_is_mx31() || cpu_is_mx35() || cpu_is_mxc91231())
  139. #define cpu_is_mx2() (cpu_is_mx21() || cpu_is_mx27())
  140. #endif /* __ASM_ARCH_MXC_H__ */