mxc.h 3.8 KB

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