mx3x.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. /*
  2. * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  3. */
  4. /*
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #ifndef __ASM_ARCH_MXC_MX31_H__
  10. #define __ASM_ARCH_MXC_MX31_H__
  11. #ifndef __ASM_ARCH_MXC_HARDWARE_H__
  12. #error "Do not include directly."
  13. #endif
  14. /*
  15. * MX31 memory map:
  16. *
  17. * Virt Phys Size What
  18. * ---------------------------------------------------------------------------
  19. * FC000000 43F00000 1M AIPS 1
  20. * FC100000 50000000 1M SPBA
  21. * FC200000 53F00000 1M AIPS 2
  22. * FC500000 60000000 128M ROMPATCH
  23. * FC400000 68000000 128M AVIC
  24. * 70000000 256M IPU (MAX M2)
  25. * 80000000 256M CSD0 SDRAM/DDR
  26. * 90000000 256M CSD1 SDRAM/DDR
  27. * A0000000 128M CS0 Flash
  28. * A8000000 128M CS1 Flash
  29. * B0000000 32M CS2
  30. * B2000000 32M CS3
  31. * F4000000 B4000000 32M CS4
  32. * B6000000 32M CS5
  33. * FC320000 B8000000 64K NAND, SDRAM, WEIM, M3IF, EMI controllers
  34. * C0000000 64M PCMCIA/CF
  35. */
  36. #define CS0_BASE_ADDR 0xA0000000
  37. #define CS1_BASE_ADDR 0xA8000000
  38. #define CS2_BASE_ADDR 0xB0000000
  39. #define CS3_BASE_ADDR 0xB2000000
  40. #define CS4_BASE_ADDR 0xB4000000
  41. #define CS4_BASE_ADDR_VIRT 0xF4000000
  42. #define CS4_SIZE SZ_32M
  43. #define CS5_BASE_ADDR 0xB6000000
  44. #define CS5_BASE_ADDR_VIRT 0xF6000000
  45. #define CS5_SIZE SZ_32M
  46. #define PCMCIA_MEM_BASE_ADDR 0xBC000000
  47. /*
  48. * L2CC
  49. */
  50. #define L2CC_BASE_ADDR 0x30000000
  51. #define L2CC_SIZE SZ_1M
  52. /*
  53. * AIPS 1
  54. */
  55. #define AIPS1_BASE_ADDR 0x43F00000
  56. #define AIPS1_BASE_ADDR_VIRT 0xFC000000
  57. #define AIPS1_SIZE SZ_1M
  58. #define MAX_BASE_ADDR (AIPS1_BASE_ADDR + 0x00004000)
  59. #define EVTMON_BASE_ADDR (AIPS1_BASE_ADDR + 0x00008000)
  60. #define CLKCTL_BASE_ADDR (AIPS1_BASE_ADDR + 0x0000C000)
  61. #define ETB_SLOT4_BASE_ADDR (AIPS1_BASE_ADDR + 0x00010000)
  62. #define ETB_SLOT5_BASE_ADDR (AIPS1_BASE_ADDR + 0x00014000)
  63. #define ECT_CTIO_BASE_ADDR (AIPS1_BASE_ADDR + 0x00018000)
  64. #define I2C_BASE_ADDR (AIPS1_BASE_ADDR + 0x00080000)
  65. #define I2C3_BASE_ADDR (AIPS1_BASE_ADDR + 0x00084000)
  66. #define UART1_BASE_ADDR (AIPS1_BASE_ADDR + 0x00090000)
  67. #define UART2_BASE_ADDR (AIPS1_BASE_ADDR + 0x00094000)
  68. #define I2C2_BASE_ADDR (AIPS1_BASE_ADDR + 0x00098000)
  69. #define OWIRE_BASE_ADDR (AIPS1_BASE_ADDR + 0x0009C000)
  70. #define SSI1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A0000)
  71. #define CSPI1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A4000)
  72. #define KPP_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A8000)
  73. #define IOMUXC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000AC000)
  74. #define ECT_IP1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B8000)
  75. #define ECT_IP2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000BC000)
  76. /*
  77. * SPBA global module enabled #0
  78. */
  79. #define SPBA0_BASE_ADDR 0x50000000
  80. #define SPBA0_BASE_ADDR_VIRT 0xFC100000
  81. #define SPBA0_SIZE SZ_1M
  82. #define UART3_BASE_ADDR (SPBA0_BASE_ADDR + 0x0000C000)
  83. #define CSPI2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00010000)
  84. #define SSI2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00014000)
  85. #define ATA_DMA_BASE_ADDR (SPBA0_BASE_ADDR + 0x00020000)
  86. #define MSHC1_BASE_ADDR (SPBA0_BASE_ADDR + 0x00024000)
  87. #define SPBA_CTRL_BASE_ADDR (SPBA0_BASE_ADDR + 0x0003C000)
  88. /*
  89. * AIPS 2
  90. */
  91. #define AIPS2_BASE_ADDR 0x53F00000
  92. #define AIPS2_BASE_ADDR_VIRT 0xFC200000
  93. #define AIPS2_SIZE SZ_1M
  94. #define CCM_BASE_ADDR (AIPS2_BASE_ADDR + 0x00080000)
  95. #define GPT1_BASE_ADDR (AIPS2_BASE_ADDR + 0x00090000)
  96. #define EPIT1_BASE_ADDR (AIPS2_BASE_ADDR + 0x00094000)
  97. #define EPIT2_BASE_ADDR (AIPS2_BASE_ADDR + 0x00098000)
  98. #define GPIO3_BASE_ADDR (AIPS2_BASE_ADDR + 0x000A4000)
  99. #define SCC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000AC000)
  100. #define RNGA_BASE_ADDR (AIPS2_BASE_ADDR + 0x000B0000)
  101. #define IPU_CTRL_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C0000)
  102. #define AUDMUX_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C4000)
  103. #define GPIO1_BASE_ADDR (AIPS2_BASE_ADDR + 0x000CC000)
  104. #define GPIO2_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D0000)
  105. #define SDMA_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D4000)
  106. #define RTC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D8000)
  107. #define WDOG_BASE_ADDR (AIPS2_BASE_ADDR + 0x000DC000)
  108. #define PWM_BASE_ADDR (AIPS2_BASE_ADDR + 0x000E0000)
  109. #define RTIC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000EC000)
  110. /*
  111. * ROMP and AVIC
  112. */
  113. #define ROMP_BASE_ADDR 0x60000000
  114. #define ROMP_BASE_ADDR_VIRT 0xFC500000
  115. #define ROMP_SIZE SZ_1M
  116. #define AVIC_BASE_ADDR 0x68000000
  117. #define AVIC_BASE_ADDR_VIRT 0xFC400000
  118. #define AVIC_SIZE SZ_1M
  119. /*
  120. * NAND, SDRAM, WEIM, M3IF, EMI controllers
  121. */
  122. #define X_MEMC_BASE_ADDR 0xB8000000
  123. #define X_MEMC_BASE_ADDR_VIRT 0xFC320000
  124. #define X_MEMC_SIZE SZ_64K
  125. #define ESDCTL_BASE_ADDR (X_MEMC_BASE_ADDR + 0x1000)
  126. #define WEIM_BASE_ADDR (X_MEMC_BASE_ADDR + 0x2000)
  127. #define M3IF_BASE_ADDR (X_MEMC_BASE_ADDR + 0x3000)
  128. #define EMI_CTL_BASE_ADDR (X_MEMC_BASE_ADDR + 0x4000)
  129. #define PCMCIA_CTL_BASE_ADDR EMI_CTL_BASE_ADDR
  130. /*
  131. * Memory regions and CS
  132. */
  133. #define IPU_MEM_BASE_ADDR 0x70000000
  134. #define CSD0_BASE_ADDR 0x80000000
  135. #define CSD1_BASE_ADDR 0x90000000
  136. /*!
  137. * This macro defines the physical to virtual address mapping for all the
  138. * peripheral modules. It is used by passing in the physical address as x
  139. * and returning the virtual address. If the physical address is not mapped,
  140. * it returns 0xDEADBEEF
  141. */
  142. #define IO_ADDRESS(x) \
  143. (void __force __iomem *) \
  144. (((x >= AIPS1_BASE_ADDR) && (x < (AIPS1_BASE_ADDR + AIPS1_SIZE))) ? AIPS1_IO_ADDRESS(x):\
  145. ((x >= SPBA0_BASE_ADDR) && (x < (SPBA0_BASE_ADDR + SPBA0_SIZE))) ? SPBA0_IO_ADDRESS(x):\
  146. ((x >= AIPS2_BASE_ADDR) && (x < (AIPS2_BASE_ADDR + AIPS2_SIZE))) ? AIPS2_IO_ADDRESS(x):\
  147. ((x >= ROMP_BASE_ADDR) && (x < (ROMP_BASE_ADDR + ROMP_SIZE))) ? ROMP_IO_ADDRESS(x):\
  148. ((x >= AVIC_BASE_ADDR) && (x < (AVIC_BASE_ADDR + AVIC_SIZE))) ? AVIC_IO_ADDRESS(x):\
  149. ((x >= CS4_BASE_ADDR) && (x < (CS4_BASE_ADDR + CS4_SIZE))) ? CS4_IO_ADDRESS(x):\
  150. ((x >= X_MEMC_BASE_ADDR) && (x < (X_MEMC_BASE_ADDR + X_MEMC_SIZE))) ? X_MEMC_IO_ADDRESS(x):\
  151. 0xDEADBEEF)
  152. /*
  153. * define the address mapping macros: in physical address order
  154. */
  155. #define L2CC_IO_ADDRESS(x) \
  156. (((x) - L2CC_BASE_ADDR) + L2CC_BASE_ADDR_VIRT)
  157. #define AIPS1_IO_ADDRESS(x) \
  158. (((x) - AIPS1_BASE_ADDR) + AIPS1_BASE_ADDR_VIRT)
  159. #define SPBA0_IO_ADDRESS(x) \
  160. (((x) - SPBA0_BASE_ADDR) + SPBA0_BASE_ADDR_VIRT)
  161. #define AIPS2_IO_ADDRESS(x) \
  162. (((x) - AIPS2_BASE_ADDR) + AIPS2_BASE_ADDR_VIRT)
  163. #define ROMP_IO_ADDRESS(x) \
  164. (((x) - ROMP_BASE_ADDR) + ROMP_BASE_ADDR_VIRT)
  165. #define AVIC_IO_ADDRESS(x) \
  166. (((x) - AVIC_BASE_ADDR) + AVIC_BASE_ADDR_VIRT)
  167. #define CS4_IO_ADDRESS(x) \
  168. (((x) - CS4_BASE_ADDR) + CS4_BASE_ADDR_VIRT)
  169. #define CS5_IO_ADDRESS(x) \
  170. (((x) - CS5_BASE_ADDR) + CS5_BASE_ADDR_VIRT)
  171. #define X_MEMC_IO_ADDRESS(x) \
  172. (((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT)
  173. #define PCMCIA_IO_ADDRESS(x) \
  174. (((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT)
  175. /*
  176. * Interrupt numbers
  177. */
  178. #define MXC_INT_I2C3 3
  179. #define MXC_INT_I2C2 4
  180. #define MXC_INT_RTIC 6
  181. #define MXC_INT_I2C 10
  182. #define MXC_INT_CSPI2 13
  183. #define MXC_INT_CSPI1 14
  184. #define MXC_INT_ATA 15
  185. #define MXC_INT_UART3 18
  186. #define MXC_INT_IIM 19
  187. #define MXC_INT_RNGA 22
  188. #define MXC_INT_EVTMON 23
  189. #define MXC_INT_KPP 24
  190. #define MXC_INT_RTC 25
  191. #define MXC_INT_PWM 26
  192. #define MXC_INT_EPIT2 27
  193. #define MXC_INT_EPIT1 28
  194. #define MXC_INT_GPT 29
  195. #define MXC_INT_POWER_FAIL 30
  196. #define MXC_INT_UART2 32
  197. #define MXC_INT_NANDFC 33
  198. #define MXC_INT_SDMA 34
  199. #define MXC_INT_MSHC1 39
  200. #define MXC_INT_IPU_ERR 41
  201. #define MXC_INT_IPU_SYN 42
  202. #define MXC_INT_UART1 45
  203. #define MXC_INT_ECT 48
  204. #define MXC_INT_SCC_SCM 49
  205. #define MXC_INT_SCC_SMN 50
  206. #define MXC_INT_GPIO2 51
  207. #define MXC_INT_GPIO1 52
  208. #define MXC_INT_WDOG 55
  209. #define MXC_INT_GPIO3 56
  210. #define MXC_INT_EXT_POWER 58
  211. #define MXC_INT_EXT_TEMPER 59
  212. #define MXC_INT_EXT_SENSOR60 60
  213. #define MXC_INT_EXT_SENSOR61 61
  214. #define MXC_INT_EXT_WDOG 62
  215. #define MXC_INT_EXT_TV 63
  216. #define PROD_SIGNATURE 0x1 /* For MX31 */
  217. /* silicon revisions specific to i.MX31 */
  218. #define CHIP_REV_1_0 0x10
  219. #define CHIP_REV_1_1 0x11
  220. #define CHIP_REV_1_2 0x12
  221. #define CHIP_REV_1_3 0x13
  222. #define CHIP_REV_2_0 0x20
  223. #define CHIP_REV_2_1 0x21
  224. #define CHIP_REV_2_2 0x22
  225. #define CHIP_REV_2_3 0x23
  226. #define CHIP_REV_3_0 0x30
  227. #define CHIP_REV_3_1 0x31
  228. #define CHIP_REV_3_2 0x32
  229. #define SYSTEM_REV_MIN CHIP_REV_1_0
  230. #define SYSTEM_REV_NUM 3
  231. /* gpio and gpio based interrupt handling */
  232. #define GPIO_DR 0x00
  233. #define GPIO_GDIR 0x04
  234. #define GPIO_PSR 0x08
  235. #define GPIO_ICR1 0x0C
  236. #define GPIO_ICR2 0x10
  237. #define GPIO_IMR 0x14
  238. #define GPIO_ISR 0x18
  239. #define GPIO_INT_LOW_LEV 0x0
  240. #define GPIO_INT_HIGH_LEV 0x1
  241. #define GPIO_INT_RISE_EDGE 0x2
  242. #define GPIO_INT_FALL_EDGE 0x3
  243. #define GPIO_INT_NONE 0x4
  244. /* Mandatory defines used globally */
  245. /* this CPU supports up to 96 GPIOs */
  246. #define ARCH_NR_GPIOS 96
  247. #if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS)
  248. extern unsigned int system_rev;
  249. static inline int mx31_revision(void)
  250. {
  251. return system_rev;
  252. }
  253. #endif
  254. #endif /* __ASM_ARCH_MXC_MX31_H__ */