home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / src / linux-headers-2.6.28-15 / arch / arm / plat-mxc / include / mach / hardware.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-09  |  3.7 KB  |  152 lines

  1. /*
  2.  *  Copyright 2004-2008 Freescale Semiconductor, Inc. All Rights Reserved.
  3.  */
  4.  
  5. /*
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License version 2 as
  8.  * published by the Free Software Foundation.
  9.  */
  10.  
  11. #ifndef __ASM_ARCH_MXC_HARDWARE_H__
  12. #define __ASM_ARCH_MXC_HARDWARE_H__
  13.  
  14. #include <asm/sizes.h>
  15.  
  16. /*
  17.  * ---------------------------------------------------------------------------
  18.  * Processor specific defines
  19.  * ---------------------------------------------------------------------------
  20.  */
  21. #define CHIP_REV_1_0        0x10
  22. #define CHIP_REV_1_1        0x11
  23. #define CHIP_REV_1_2        0x12
  24. #define CHIP_REV_1_3        0x13
  25. #define CHIP_REV_2_0        0x20
  26. #define CHIP_REV_2_1        0x21
  27. #define CHIP_REV_2_2        0x22
  28. #define CHIP_REV_2_3        0x23
  29. #define CHIP_REV_3_0        0x30
  30. #define CHIP_REV_3_1        0x31
  31. #define CHIP_REV_3_2        0x32
  32.  
  33. #define BOARD_REV_2        0x100
  34.  
  35. #ifndef __ASSEMBLY__
  36. extern unsigned int system_rev;
  37. #endif
  38. #define mxc_set_system_rev(part, rev) {            \
  39.     system_rev = (part << 12) | rev;        \
  40. }
  41.  
  42. #define mxc_cpu()        (system_rev >> 12)
  43. #define mxc_is_cpu(part)    ((mxc_cpu() == part) ? 1 : 0)
  44. #define mxc_cpu_rev()        (system_rev & 0xFF)
  45. #define mxc_cpu_rev_major()    ((system_rev >> 4) & 0xF)
  46. #define mxc_cpu_rev_minor()    (system_rev & 0xF)
  47. #define mxc_cpu_is_rev(rev)    \
  48.     ((mxc_cpu_rev() == rev) ? 1 : ((mxc_cpu_rev() < rev) ? -1 : 2))
  49. #define MXC_REV(type)                \
  50. static inline int type## _rev (int rev)        \
  51. {                        \
  52.     return (type() ? mxc_cpu_is_rev(rev) : 0);    \
  53. }
  54.  
  55. #ifdef CONFIG_ARCH_MX3
  56. # include <mach/mx31.h>
  57. #define cpu_is_mx31()        (mxc_is_cpu(0x31))    /*system_rev got from Redboot */
  58. #define cpu_is_mx32()        (mxc_is_cpu(0x32))    /*system_rev got from Redboot */
  59. #else
  60. #define cpu_is_mx31()        (0)
  61. #define cpu_is_mx32()        (0)
  62. #endif
  63.  
  64. #ifdef CONFIG_ARCH_MX35
  65. #include <mach/mx35.h>
  66. #define cpu_is_mx35()   (1)
  67. #define board_is_mx35(rev)   ((system_rev & rev) ? 1 : 0)
  68. #else
  69. #define cpu_is_mx35()   (0)
  70. #define board_is_mx35(rev) (0)
  71. #endif
  72.  
  73. #ifdef CONFIG_ARCH_MX37
  74. #include <mach/mx37.h>
  75. #define cpu_is_mx37()   (1)
  76. #define board_is_mx37(rev)   ((system_rev & rev) ? 1 : 0)
  77. #else
  78. #define cpu_is_mx37()   (0)
  79. #define board_is_mx37(rev)   (0)
  80. #endif
  81.  
  82. #ifdef CONFIG_ARCH_MX51
  83. #include <mach/mx51.h>
  84. #define cpu_is_mx51()   (1)
  85. #else
  86. #define cpu_is_mx51()   (0)
  87. #endif
  88.  
  89. #ifdef CONFIG_ARCH_MX21
  90. #include <mach/mx21.h>
  91. #define cpu_is_mx21()        (1)
  92. #else
  93. #define cpu_is_mx21()        (0)
  94. #endif
  95.  
  96. #ifdef CONFIG_ARCH_MX25
  97. #include <mach/mx25.h>
  98. #define cpu_is_mx25()        (1)
  99. #else
  100. #define cpu_is_mx25()        (0)
  101. #endif
  102.  
  103. #ifdef CONFIG_ARCH_MX27
  104. #include <mach/mx27.h>
  105. #define cpu_is_mx27()        (1)
  106. #else
  107. #define cpu_is_mx27()        (0)
  108. #endif
  109.  
  110. #ifndef __ASSEMBLY__
  111. /*
  112.  * Create inline functions to test for cpu revision
  113.  * Function name is cpu_is_<cpu name>_rev(rev)
  114.  *
  115.  * Returns:
  116.  *     0 - not the cpu queried
  117.  *     1 - cpu and revision match
  118.  *     2 - cpu matches, but cpu revision is greater than queried rev
  119.  *    -1 - cpu matches, but cpu revision is less than queried rev
  120.  */
  121. MXC_REV(cpu_is_mx21);
  122. MXC_REV(cpu_is_mx25);
  123. MXC_REV(cpu_is_mx27);
  124. MXC_REV(cpu_is_mx31);
  125. MXC_REV(cpu_is_mx32);
  126. MXC_REV(cpu_is_mx35);
  127. MXC_REV(cpu_is_mx37);
  128. MXC_REV(cpu_is_mx51);
  129. #endif
  130. #include <mach/mxc.h>
  131.  
  132. #define MXC_MAX_GPIO_LINES      (GPIO_NUM_PIN * GPIO_PORT_NUM)
  133.  
  134. #define MXC_EXP_IO_BASE        (MXC_MAX_INT_LINES + MXC_MAX_GPIO_LINES)
  135. #define MXC_MAX_EXP_IO_LINES    16
  136.  
  137. #ifdef CONFIG_MXC_PSEUDO_IRQS
  138. #define MXC_PSEUDO_IO_BASE    (MXC_EXP_IO_BASE + MXC_MAX_EXP_IO_LINES)
  139. #define MXC_MAX_PSEUDO_IO_LINES 16
  140. #else
  141. #define MXC_MAX_PSEUDO_IO_LINES 0
  142. #endif
  143.  
  144. #ifndef MXC_INT_FORCE
  145. #define MXC_INT_FORCE    -1
  146. #endif
  147. #define MXC_MAX_INTS            (MXC_MAX_INT_LINES + \
  148.                 MXC_MAX_GPIO_LINES + \
  149.                 MXC_MAX_EXP_IO_LINES + \
  150.                 MXC_MAX_PSEUDO_IO_LINES)
  151. #endif /* __ASM_ARCH_MXC_HARDWARE_H__ */
  152.