mx31.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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. * defines the hardware clock tick rate
  16. */
  17. #define CLOCK_TICK_RATE 16625000
  18. /*
  19. * MX31 memory map:
  20. *
  21. * Virt Phys Size What
  22. * ---------------------------------------------------------------------------
  23. * F8000000 1FFC0000 16K IRAM
  24. * F9000000 30000000 256M L2CC
  25. * FC000000 43F00000 1M AIPS 1
  26. * FC100000 50000000 1M SPBA
  27. * FC200000 53F00000 1M AIPS 2
  28. * FC500000 60000000 128M ROMPATCH
  29. * FC400000 68000000 128M AVIC
  30. * 70000000 256M IPU (MAX M2)
  31. * 80000000 256M CSD0 SDRAM/DDR
  32. * 90000000 256M CSD1 SDRAM/DDR
  33. * A0000000 128M CS0 Flash
  34. * A8000000 128M CS1 Flash
  35. * B0000000 32M CS2
  36. * B2000000 32M CS3
  37. * F4000000 B4000000 32M CS4
  38. * B6000000 32M CS5
  39. * FC320000 B8000000 64K NAND, SDRAM, WEIM, M3IF, EMI controllers
  40. * C0000000 64M PCMCIA/CF
  41. */
  42. #define CS0_BASE_ADDR 0xA0000000
  43. #define CS1_BASE_ADDR 0xA8000000
  44. #define CS2_BASE_ADDR 0xB0000000
  45. #define CS3_BASE_ADDR 0xB2000000
  46. #define CS4_BASE_ADDR 0xB4000000
  47. #define CS4_BASE_ADDR_VIRT 0xF4000000
  48. #define CS4_SIZE SZ_32M
  49. #define CS5_BASE_ADDR 0xB6000000
  50. #define PCMCIA_MEM_BASE_ADDR 0xBC000000
  51. /*
  52. * IRAM
  53. */
  54. #define IRAM_BASE_ADDR 0x1FFC0000 /* internal ram */
  55. #define IRAM_BASE_ADDR_VIRT 0xF8000000
  56. #define IRAM_SIZE SZ_16K
  57. /*
  58. * L2CC
  59. */
  60. #define L2CC_BASE_ADDR 0x30000000
  61. #define L2CC_BASE_ADDR_VIRT 0xF9000000
  62. #define L2CC_SIZE SZ_1M
  63. /*
  64. * AIPS 1
  65. */
  66. #define AIPS1_BASE_ADDR 0x43F00000
  67. #define AIPS1_BASE_ADDR_VIRT 0xFC000000
  68. #define AIPS1_SIZE SZ_1M
  69. #define MAX_BASE_ADDR (AIPS1_BASE_ADDR + 0x00004000)
  70. #define EVTMON_BASE_ADDR (AIPS1_BASE_ADDR + 0x00008000)
  71. #define CLKCTL_BASE_ADDR (AIPS1_BASE_ADDR + 0x0000C000)
  72. #define ETB_SLOT4_BASE_ADDR (AIPS1_BASE_ADDR + 0x00010000)
  73. #define ETB_SLOT5_BASE_ADDR (AIPS1_BASE_ADDR + 0x00014000)
  74. #define ECT_CTIO_BASE_ADDR (AIPS1_BASE_ADDR + 0x00018000)
  75. #define I2C_BASE_ADDR (AIPS1_BASE_ADDR + 0x00080000)
  76. #define I2C3_BASE_ADDR (AIPS1_BASE_ADDR + 0x00084000)
  77. #define OTG_BASE_ADDR (AIPS1_BASE_ADDR + 0x00088000)
  78. #define ATA_BASE_ADDR (AIPS1_BASE_ADDR + 0x0008C000)
  79. #define UART1_BASE_ADDR (AIPS1_BASE_ADDR + 0x00090000)
  80. #define UART2_BASE_ADDR (AIPS1_BASE_ADDR + 0x00094000)
  81. #define I2C2_BASE_ADDR (AIPS1_BASE_ADDR + 0x00098000)
  82. #define OWIRE_BASE_ADDR (AIPS1_BASE_ADDR + 0x0009C000)
  83. #define SSI1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A0000)
  84. #define CSPI1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A4000)
  85. #define KPP_BASE_ADDR (AIPS1_BASE_ADDR + 0x000A8000)
  86. #define IOMUXC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000AC000)
  87. #define UART4_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B0000)
  88. #define UART5_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B4000)
  89. #define ECT_IP1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B8000)
  90. #define ECT_IP2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000BC000)
  91. /*
  92. * SPBA global module enabled #0
  93. */
  94. #define SPBA0_BASE_ADDR 0x50000000
  95. #define SPBA0_BASE_ADDR_VIRT 0xFC100000
  96. #define SPBA0_SIZE SZ_1M
  97. #define MMC_SDHC1_BASE_ADDR (SPBA0_BASE_ADDR + 0x00004000)
  98. #define MMC_SDHC2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00008000)
  99. #define UART3_BASE_ADDR (SPBA0_BASE_ADDR + 0x0000C000)
  100. #define CSPI2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00010000)
  101. #define SSI2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00014000)
  102. #define SIM1_BASE_ADDR (SPBA0_BASE_ADDR + 0x00018000)
  103. #define IIM_BASE_ADDR (SPBA0_BASE_ADDR + 0x0001C000)
  104. #define ATA_DMA_BASE_ADDR (SPBA0_BASE_ADDR + 0x00020000)
  105. #define MSHC1_BASE_ADDR (SPBA0_BASE_ADDR + 0x00024000)
  106. #define MSHC2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00024000)
  107. #define SPBA_CTRL_BASE_ADDR (SPBA0_BASE_ADDR + 0x0003C000)
  108. /*
  109. * AIPS 2
  110. */
  111. #define AIPS2_BASE_ADDR 0x53F00000
  112. #define AIPS2_BASE_ADDR_VIRT 0xFC200000
  113. #define AIPS2_SIZE SZ_1M
  114. #define CCM_BASE_ADDR (AIPS2_BASE_ADDR + 0x00080000)
  115. #define CSPI3_BASE_ADDR (AIPS2_BASE_ADDR + 0x00084000)
  116. #define FIRI_BASE_ADDR (AIPS2_BASE_ADDR + 0x0008C000)
  117. #define GPT1_BASE_ADDR (AIPS2_BASE_ADDR + 0x00090000)
  118. #define EPIT1_BASE_ADDR (AIPS2_BASE_ADDR + 0x00094000)
  119. #define EPIT2_BASE_ADDR (AIPS2_BASE_ADDR + 0x00098000)
  120. #define GPIO3_BASE_ADDR (AIPS2_BASE_ADDR + 0x000A4000)
  121. #define SCC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000AC000)
  122. #define SCM_BASE_ADDR (AIPS2_BASE_ADDR + 0x000AE000)
  123. #define SMN_BASE_ADDR (AIPS2_BASE_ADDR + 0x000AF000)
  124. #define RNGA_BASE_ADDR (AIPS2_BASE_ADDR + 0x000B0000)
  125. #define IPU_CTRL_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C0000)
  126. #define AUDMUX_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C4000)
  127. #define MPEG4_ENC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000C8000)
  128. #define GPIO1_BASE_ADDR (AIPS2_BASE_ADDR + 0x000CC000)
  129. #define GPIO2_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D0000)
  130. #define SDMA_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D4000)
  131. #define RTC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000D8000)
  132. #define WDOG_BASE_ADDR (AIPS2_BASE_ADDR + 0x000DC000)
  133. #define PWM_BASE_ADDR (AIPS2_BASE_ADDR + 0x000E0000)
  134. #define RTIC_BASE_ADDR (AIPS2_BASE_ADDR + 0x000EC000)
  135. /*
  136. * ROMP and AVIC
  137. */
  138. #define ROMP_BASE_ADDR 0x60000000
  139. #define ROMP_BASE_ADDR_VIRT 0xFC500000
  140. #define ROMP_SIZE SZ_1M
  141. #define AVIC_BASE_ADDR 0x68000000
  142. #define AVIC_BASE_ADDR_VIRT 0xFC400000
  143. #define AVIC_SIZE SZ_1M
  144. /*
  145. * NAND, SDRAM, WEIM, M3IF, EMI controllers
  146. */
  147. #define X_MEMC_BASE_ADDR 0xB8000000
  148. #define X_MEMC_BASE_ADDR_VIRT 0xFC320000
  149. #define X_MEMC_SIZE SZ_64K
  150. #define NFC_BASE_ADDR (X_MEMC_BASE_ADDR + 0x0000)
  151. #define ESDCTL_BASE_ADDR (X_MEMC_BASE_ADDR + 0x1000)
  152. #define WEIM_BASE_ADDR (X_MEMC_BASE_ADDR + 0x2000)
  153. #define M3IF_BASE_ADDR (X_MEMC_BASE_ADDR + 0x3000)
  154. #define EMI_CTL_BASE_ADDR (X_MEMC_BASE_ADDR + 0x4000)
  155. #define PCMCIA_CTL_BASE_ADDR EMI_CTL_BASE_ADDR
  156. /*
  157. * Memory regions and CS
  158. */
  159. #define IPU_MEM_BASE_ADDR 0x70000000
  160. #define CSD0_BASE_ADDR 0x80000000
  161. #define CSD1_BASE_ADDR 0x90000000
  162. #define CS0_BASE_ADDR 0xA0000000
  163. #define CS1_BASE_ADDR 0xA8000000
  164. #define CS2_BASE_ADDR 0xB0000000
  165. #define CS3_BASE_ADDR 0xB2000000
  166. #define CS4_BASE_ADDR 0xB4000000
  167. #define CS4_BASE_ADDR_VIRT 0xF4000000
  168. #define CS4_SIZE SZ_32M
  169. #define CS5_BASE_ADDR 0xB6000000
  170. #define PCMCIA_MEM_BASE_ADDR 0xBC000000
  171. /*!
  172. * This macro defines the physical to virtual address mapping for all the
  173. * peripheral modules. It is used by passing in the physical address as x
  174. * and returning the virtual address. If the physical address is not mapped,
  175. * it returns 0xDEADBEEF
  176. */
  177. #define IO_ADDRESS(x) \
  178. (void __iomem *) \
  179. (((x >= IRAM_BASE_ADDR) && (x < (IRAM_BASE_ADDR + IRAM_SIZE))) ? IRAM_IO_ADDRESS(x):\
  180. ((x >= L2CC_BASE_ADDR) && (x < (L2CC_BASE_ADDR + L2CC_SIZE))) ? L2CC_IO_ADDRESS(x):\
  181. ((x >= AIPS1_BASE_ADDR) && (x < (AIPS1_BASE_ADDR + AIPS1_SIZE))) ? AIPS1_IO_ADDRESS(x):\
  182. ((x >= SPBA0_BASE_ADDR) && (x < (SPBA0_BASE_ADDR + SPBA0_SIZE))) ? SPBA0_IO_ADDRESS(x):\
  183. ((x >= AIPS2_BASE_ADDR) && (x < (AIPS2_BASE_ADDR + AIPS2_SIZE))) ? AIPS2_IO_ADDRESS(x):\
  184. ((x >= ROMP_BASE_ADDR) && (x < (ROMP_BASE_ADDR + ROMP_SIZE))) ? ROMP_IO_ADDRESS(x):\
  185. ((x >= AVIC_BASE_ADDR) && (x < (AVIC_BASE_ADDR + AVIC_SIZE))) ? AVIC_IO_ADDRESS(x):\
  186. ((x >= CS4_BASE_ADDR) && (x < (CS4_BASE_ADDR + CS4_SIZE))) ? CS4_IO_ADDRESS(x):\
  187. ((x >= X_MEMC_BASE_ADDR) && (x < (X_MEMC_BASE_ADDR + X_MEMC_SIZE))) ? X_MEMC_IO_ADDRESS(x):\
  188. 0xDEADBEEF)
  189. /*
  190. * define the address mapping macros: in physical address order
  191. */
  192. #define IRAM_IO_ADDRESS(x) \
  193. (((x) - IRAM_BASE_ADDR) + IRAM_BASE_ADDR_VIRT)
  194. #define L2CC_IO_ADDRESS(x) \
  195. (((x) - L2CC_BASE_ADDR) + L2CC_BASE_ADDR_VIRT)
  196. #define AIPS1_IO_ADDRESS(x) \
  197. (((x) - AIPS1_BASE_ADDR) + AIPS1_BASE_ADDR_VIRT)
  198. #define SPBA0_IO_ADDRESS(x) \
  199. (((x) - SPBA0_BASE_ADDR) + SPBA0_BASE_ADDR_VIRT)
  200. #define AIPS2_IO_ADDRESS(x) \
  201. (((x) - AIPS2_BASE_ADDR) + AIPS2_BASE_ADDR_VIRT)
  202. #define ROMP_IO_ADDRESS(x) \
  203. (((x) - ROMP_BASE_ADDR) + ROMP_BASE_ADDR_VIRT)
  204. #define AVIC_IO_ADDRESS(x) \
  205. (((x) - AVIC_BASE_ADDR) + AVIC_BASE_ADDR_VIRT)
  206. #define CS4_IO_ADDRESS(x) \
  207. (((x) - CS4_BASE_ADDR) + CS4_BASE_ADDR_VIRT)
  208. #define X_MEMC_IO_ADDRESS(x) \
  209. (((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT)
  210. #define PCMCIA_IO_ADDRESS(x) \
  211. (((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT)
  212. /* Start of physical RAM - On many MX31 platforms, this is the first SDRAM bank (CSD0) */
  213. #define PHYS_OFFSET CSD0_BASE_ADDR
  214. /*
  215. * Interrupt numbers
  216. */
  217. #define MXC_INT_PEN_ADS7843 0
  218. #define MXC_INT_RESV1 1
  219. #define MXC_INT_CS8900A 2
  220. #define MXC_INT_I2C3 3
  221. #define MXC_INT_I2C2 4
  222. #define MXC_INT_MPEG4_ENCODER 5
  223. #define MXC_INT_RTIC 6
  224. #define MXC_INT_FIRI 7
  225. #define MXC_INT_MMC_SDHC2 8
  226. #define MXC_INT_MMC_SDHC1 9
  227. #define MXC_INT_I2C 10
  228. #define MXC_INT_SSI2 11
  229. #define MXC_INT_SSI1 12
  230. #define MXC_INT_CSPI2 13
  231. #define MXC_INT_CSPI1 14
  232. #define MXC_INT_ATA 15
  233. #define MXC_INT_MBX 16
  234. #define MXC_INT_CSPI3 17
  235. #define MXC_INT_UART3 18
  236. #define MXC_INT_IIM 19
  237. #define MXC_INT_SIM2 20
  238. #define MXC_INT_SIM1 21
  239. #define MXC_INT_RNGA 22
  240. #define MXC_INT_EVTMON 23
  241. #define MXC_INT_KPP 24
  242. #define MXC_INT_RTC 25
  243. #define MXC_INT_PWM 26
  244. #define MXC_INT_EPIT2 27
  245. #define MXC_INT_EPIT1 28
  246. #define MXC_INT_GPT 29
  247. #define MXC_INT_RESV30 30
  248. #define MXC_INT_RESV31 31
  249. #define MXC_INT_UART2 32
  250. #define MXC_INT_NANDFC 33
  251. #define MXC_INT_SDMA 34
  252. #define MXC_INT_USB1 35
  253. #define MXC_INT_USB2 36
  254. #define MXC_INT_USB3 37
  255. #define MXC_INT_USB4 38
  256. #define MXC_INT_MSHC1 39
  257. #define MXC_INT_MSHC2 40
  258. #define MXC_INT_IPU_ERR 41
  259. #define MXC_INT_IPU_SYN 42
  260. #define MXC_INT_RESV43 43
  261. #define MXC_INT_RESV44 44
  262. #define MXC_INT_UART1 45
  263. #define MXC_INT_UART4 46
  264. #define MXC_INT_UART5 47
  265. #define MXC_INT_ECT 48
  266. #define MXC_INT_SCC_SCM 49
  267. #define MXC_INT_SCC_SMN 50
  268. #define MXC_INT_GPIO2 51
  269. #define MXC_INT_GPIO1 52
  270. #define MXC_INT_CCM 53
  271. #define MXC_INT_PCMCIA 54
  272. #define MXC_INT_WDOG 55
  273. #define MXC_INT_GPIO3 56
  274. #define MXC_INT_RESV57 57
  275. #define MXC_INT_EXT_POWER 58
  276. #define MXC_INT_EXT_TEMPER 59
  277. #define MXC_INT_EXT_SENSOR60 60
  278. #define MXC_INT_EXT_SENSOR61 61
  279. #define MXC_INT_EXT_WDOG 62
  280. #define MXC_INT_EXT_TV 63
  281. #define MXC_MAX_INT_LINES 64
  282. #define MXC_GPIO_INT_BASE MXC_MAX_INT_LINES
  283. #define MXC_MAX_GPIO_LINES (GPIO_NUM_PIN * GPIO_PORT_NUM)
  284. #define MXC_MAX_VIRTUAL_INTS 16
  285. #define NR_IRQS (MXC_MAX_INT_LINES + MXC_MAX_GPIO_LINES + MXC_MAX_VIRTUAL_INTS)
  286. /*!
  287. * Number of GPIO port as defined in the IC Spec
  288. */
  289. #define GPIO_PORT_NUM 3
  290. /*!
  291. * Number of GPIO pins per port
  292. */
  293. #define GPIO_NUM_PIN 32
  294. #define PROD_SIGNATURE 0x1 /* For MX31 */
  295. /* silicon revisions specific to i.MX31 */
  296. #define CHIP_REV_1_0 0x10
  297. #define CHIP_REV_1_1 0x11
  298. #define CHIP_REV_1_2 0x12
  299. #define CHIP_REV_1_3 0x13
  300. #define CHIP_REV_2_0 0x20
  301. #define CHIP_REV_2_1 0x21
  302. #define CHIP_REV_2_2 0x22
  303. #define CHIP_REV_2_3 0x23
  304. #define CHIP_REV_3_0 0x30
  305. #define CHIP_REV_3_1 0x31
  306. #define CHIP_REV_3_2 0x32
  307. #define SYSTEM_REV_MIN CHIP_REV_1_0
  308. #define SYSTEM_REV_NUM 3
  309. /* gpio and gpio based interrupt handling */
  310. #define GPIO_DR 0x00
  311. #define GPIO_GDIR 0x04
  312. #define GPIO_PSR 0x08
  313. #define GPIO_ICR1 0x0C
  314. #define GPIO_ICR2 0x10
  315. #define GPIO_IMR 0x14
  316. #define GPIO_ISR 0x18
  317. #define GPIO_INT_LOW_LEV 0x0
  318. #define GPIO_INT_HIGH_LEV 0x1
  319. #define GPIO_INT_RISE_EDGE 0x2
  320. #define GPIO_INT_FALL_EDGE 0x3
  321. #define GPIO_INT_NONE 0x4
  322. /* Mandatory defines used globally */
  323. /* this CPU supports up to 96 GPIOs */
  324. #define ARCH_NR_GPIOS 96
  325. #if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS)
  326. /* this is a i.MX31 CPU */
  327. #define cpu_is_mx31() (1)
  328. extern unsigned int system_rev;
  329. static inline int mx31_revision(void)
  330. {
  331. return system_rev;
  332. }
  333. #endif
  334. #endif /* __ASM_ARCH_MXC_MX31_H__ */