board-mx27ads.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. /*
  2. * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  3. */
  4. /*
  5. * The code contained herein is licensed under the GNU General Public
  6. * License. You may obtain a copy of the GNU General Public License
  7. * Version 2 or later at the following locations:
  8. *
  9. * http://www.opensource.org/licenses/gpl-license.html
  10. * http://www.gnu.org/copyleft/gpl.html
  11. */
  12. #ifndef __ASM_ARCH_MXC_BOARD_MX27ADS_H__
  13. #define __ASM_ARCH_MXC_BOARD_MX27ADS_H__
  14. /* external interrupt multiplexer */
  15. #define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
  16. #define MXC_VIRTUAL_INTS_BASE (MXC_EXP_IO_BASE + MXC_MAX_EXP_IO_LINES)
  17. #define MXC_SDIO1_CARD_IRQ MXC_VIRTUAL_INTS_BASE
  18. #define MXC_SDIO2_CARD_IRQ (MXC_VIRTUAL_INTS_BASE + 1)
  19. #define MXC_SDIO3_CARD_IRQ (MXC_VIRTUAL_INTS_BASE + 2)
  20. #define MXC_MAX_BOARD_INTS (MXC_MAX_EXP_IO_LINES + \
  21. MXC_MAX_VIRTUAL_INTS)
  22. /*
  23. * MXC UART EVB board level configurations
  24. */
  25. #define MXC_LL_UART_PADDR UART1_BASE_ADDR
  26. #define MXC_LL_UART_VADDR AIPI_IO_ADDRESS(UART1_BASE_ADDR)
  27. /*
  28. * @name Memory Size parameters
  29. */
  30. /*
  31. * Size of SDRAM memory
  32. */
  33. #define SDRAM_MEM_SIZE SZ_128M
  34. /*
  35. * PBC Controller parameters
  36. */
  37. /*
  38. * Base address of PBC controller, CS4
  39. */
  40. #define PBC_BASE_ADDRESS 0xEB000000
  41. #define PBC_REG_ADDR(offset) (void __force __iomem *) \
  42. (PBC_BASE_ADDRESS + (offset))
  43. /*
  44. * PBC Interupt name definitions
  45. */
  46. #define PBC_GPIO1_0 0
  47. #define PBC_GPIO1_1 1
  48. #define PBC_GPIO1_2 2
  49. #define PBC_GPIO1_3 3
  50. #define PBC_GPIO1_4 4
  51. #define PBC_GPIO1_5 5
  52. #define PBC_INTR_MAX_NUM 6
  53. #define PBC_INTR_SHARED_MAX_NUM 8
  54. /* When the PBC address connection is fixed in h/w, defined as 1 */
  55. #define PBC_ADDR_SH 0
  56. /* Offsets for the PBC Controller register */
  57. /*
  58. * PBC Board version register offset
  59. */
  60. #define PBC_VERSION_REG PBC_REG_ADDR(0x00000 >> PBC_ADDR_SH)
  61. /*
  62. * PBC Board control register 1 set address.
  63. */
  64. #define PBC_BCTRL1_SET_REG PBC_REG_ADDR(0x00008 >> PBC_ADDR_SH)
  65. /*
  66. * PBC Board control register 1 clear address.
  67. */
  68. #define PBC_BCTRL1_CLEAR_REG PBC_REG_ADDR(0x0000C >> PBC_ADDR_SH)
  69. /*
  70. * PBC Board control register 2 set address.
  71. */
  72. #define PBC_BCTRL2_SET_REG PBC_REG_ADDR(0x00010 >> PBC_ADDR_SH)
  73. /*
  74. * PBC Board control register 2 clear address.
  75. */
  76. #define PBC_BCTRL2_CLEAR_REG PBC_REG_ADDR(0x00014 >> PBC_ADDR_SH)
  77. /*
  78. * PBC Board control register 3 set address.
  79. */
  80. #define PBC_BCTRL3_SET_REG PBC_REG_ADDR(0x00018 >> PBC_ADDR_SH)
  81. /*
  82. * PBC Board control register 3 clear address.
  83. */
  84. #define PBC_BCTRL3_CLEAR_REG PBC_REG_ADDR(0x0001C >> PBC_ADDR_SH)
  85. /*
  86. * PBC Board control register 3 set address.
  87. */
  88. #define PBC_BCTRL4_SET_REG PBC_REG_ADDR(0x00020 >> PBC_ADDR_SH)
  89. /*
  90. * PBC Board control register 4 clear address.
  91. */
  92. #define PBC_BCTRL4_CLEAR_REG PBC_REG_ADDR(0x00024 >> PBC_ADDR_SH)
  93. /*PBC_ADDR_SH
  94. * PBC Board status register 1.
  95. */
  96. #define PBC_BSTAT1_REG PBC_REG_ADDR(0x00028 >> PBC_ADDR_SH)
  97. /*
  98. * PBC Board interrupt status register.
  99. */
  100. #define PBC_INTSTATUS_REG PBC_REG_ADDR(0x0002C >> PBC_ADDR_SH)
  101. /*
  102. * PBC Board interrupt current status register.
  103. */
  104. #define PBC_INTCURR_STATUS_REG PBC_REG_ADDR(0x00034 >> PBC_ADDR_SH)
  105. /*
  106. * PBC Interrupt mask register set address.
  107. */
  108. #define PBC_INTMASK_SET_REG PBC_REG_ADDR(0x00038 >> PBC_ADDR_SH)
  109. /*
  110. * PBC Interrupt mask register clear address.
  111. */
  112. #define PBC_INTMASK_CLEAR_REG PBC_REG_ADDR(0x0003C >> PBC_ADDR_SH)
  113. /*
  114. * External UART A.
  115. */
  116. #define PBC_SC16C652_UARTA_REG PBC_REG_ADDR(0x20000 >> PBC_ADDR_SH)
  117. /*
  118. * UART 4 Expanding Signal Status.
  119. */
  120. #define PBC_UART_STATUS_REG PBC_REG_ADDR(0x22000 >> PBC_ADDR_SH)
  121. /*
  122. * UART 4 Expanding Signal Control Set.
  123. */
  124. #define PBC_UCTRL_SET_REG PBC_REG_ADDR(0x24000 >> PBC_ADDR_SH)
  125. /*
  126. * UART 4 Expanding Signal Control Clear.
  127. */
  128. #define PBC_UCTRL_CLR_REG PBC_REG_ADDR(0x26000 >> PBC_ADDR_SH)
  129. /*
  130. * Ethernet Controller IO base address.
  131. */
  132. #define PBC_CS8900A_IOBASE_REG PBC_REG_ADDR(0x40000 >> PBC_ADDR_SH)
  133. /*
  134. * Ethernet Controller Memory base address.
  135. */
  136. #define PBC_CS8900A_MEMBASE_REG PBC_REG_ADDR(0x42000 >> PBC_ADDR_SH)
  137. /*
  138. * Ethernet Controller DMA base address.
  139. */
  140. #define PBC_CS8900A_DMABASE_REG PBC_REG_ADDR(0x44000 >> PBC_ADDR_SH)
  141. /* PBC Board Version Register bit definition */
  142. #define PBC_VERSION_ADS 0x8000 /* Bit15=1 means version for ads */
  143. #define PBC_VERSION_EVB_REVB 0x4000 /* BIT14=1 means version for evb revb */
  144. /* PBC Board Control Register 1 bit definitions */
  145. #define PBC_BCTRL1_ERST 0x0001 /* Ethernet Reset */
  146. #define PBC_BCTRL1_URST 0x0002 /* Reset External UART controller */
  147. #define PBC_BCTRL1_FRST 0x0004 /* FEC Reset */
  148. #define PBC_BCTRL1_ESLEEP 0x0010 /* Enable ethernet Sleep */
  149. #define PBC_BCTRL1_LCDON 0x0800 /* Enable the LCD */
  150. /* PBC Board Control Register 2 bit definitions */
  151. #define PBC_BCTRL2_VCC_EN 0x0004 /* Enable VCC */
  152. #define PBC_BCTRL2_VPP_EN 0x0008 /* Enable Vpp */
  153. #define PBC_BCTRL2_ATAFEC_EN 0X0010
  154. #define PBC_BCTRL2_ATAFEC_SEL 0X0020
  155. #define PBC_BCTRL2_ATA_EN 0X0040
  156. #define PBC_BCTRL2_IRDA_SD 0X0080
  157. #define PBC_BCTRL2_IRDA_EN 0X0100
  158. #define PBC_BCTRL2_CCTL10 0X0200
  159. #define PBC_BCTRL2_CCTL11 0X0400
  160. /* PBC Board Control Register 3 bit definitions */
  161. #define PBC_BCTRL3_HSH_EN 0X0020
  162. #define PBC_BCTRL3_FSH_MOD 0X0040
  163. #define PBC_BCTRL3_OTG_HS_EN 0X0080
  164. #define PBC_BCTRL3_OTG_VBUS_EN 0X0100
  165. #define PBC_BCTRL3_FSH_VBUS_EN 0X0200
  166. #define PBC_BCTRL3_USB_OTG_ON 0X0800
  167. #define PBC_BCTRL3_USB_FSH_ON 0X1000
  168. /* PBC Board Control Register 4 bit definitions */
  169. #define PBC_BCTRL4_REGEN_SEL 0X0001
  170. #define PBC_BCTRL4_USER_OFF 0X0002
  171. #define PBC_BCTRL4_VIB_EN 0X0004
  172. #define PBC_BCTRL4_PWRGT1_EN 0X0008
  173. #define PBC_BCTRL4_PWRGT2_EN 0X0010
  174. #define PBC_BCTRL4_STDBY_PRI 0X0020
  175. #ifndef __ASSEMBLY__
  176. /*
  177. * Enumerations for SD cards and memory stick card. This corresponds to
  178. * the card EN bits in the IMR: SD1_EN | MS_EN | SD3_EN | SD2_EN.
  179. */
  180. enum mxc_card_no {
  181. MXC_CARD_SD2 = 0,
  182. MXC_CARD_SD3,
  183. MXC_CARD_MS,
  184. MXC_CARD_SD1,
  185. MXC_CARD_MIN = MXC_CARD_SD2,
  186. MXC_CARD_MAX = MXC_CARD_SD1,
  187. };
  188. #endif
  189. #define MXC_CPLD_VER_1_50 0x01
  190. /*
  191. * PBC BSTAT Register bit definitions
  192. */
  193. #define PBC_BSTAT_PRI_INT 0X0001
  194. #define PBC_BSTAT_USB_BYP 0X0002
  195. #define PBC_BSTAT_ATA_IOCS16 0X0004
  196. #define PBC_BSTAT_ATA_CBLID 0X0008
  197. #define PBC_BSTAT_ATA_DASP 0X0010
  198. #define PBC_BSTAT_PWR_RDY 0X0020
  199. #define PBC_BSTAT_SD3_WP 0X0100
  200. #define PBC_BSTAT_SD2_WP 0X0200
  201. #define PBC_BSTAT_SD1_WP 0X0400
  202. #define PBC_BSTAT_SD3_DET 0X0800
  203. #define PBC_BSTAT_SD2_DET 0X1000
  204. #define PBC_BSTAT_SD1_DET 0X2000
  205. #define PBC_BSTAT_MS_DET 0X4000
  206. #define PBC_BSTAT_SD3_DET_BIT 11
  207. #define PBC_BSTAT_SD2_DET_BIT 12
  208. #define PBC_BSTAT_SD1_DET_BIT 13
  209. #define PBC_BSTAT_MS_DET_BIT 14
  210. #define MXC_BSTAT_BIT(n) ((n == MXC_CARD_SD2) ? PBC_BSTAT_SD2_DET : \
  211. ((n == MXC_CARD_SD3) ? PBC_BSTAT_SD3_DET : \
  212. ((n == MXC_CARD_SD1) ? PBC_BSTAT_SD1_DET : \
  213. ((n == MXC_CARD_MS) ? PBC_BSTAT_MS_DET : \
  214. 0x0))))
  215. /*
  216. * PBC UART Control Register bit definitions
  217. */
  218. #define PBC_UCTRL_DCE_DCD 0X0001
  219. #define PBC_UCTRL_DCE_DSR 0X0002
  220. #define PBC_UCTRL_DCE_RI 0X0004
  221. #define PBC_UCTRL_DTE_DTR 0X0100
  222. /*
  223. * PBC UART Status Register bit definitions
  224. */
  225. #define PBC_USTAT_DTE_DCD 0X0001
  226. #define PBC_USTAT_DTE_DSR 0X0002
  227. #define PBC_USTAT_DTE_RI 0X0004
  228. #define PBC_USTAT_DCE_DTR 0X0100
  229. /*
  230. * PBC Interupt mask register bit definitions
  231. */
  232. #define PBC_INTR_SD3_R_EN_BIT 4
  233. #define PBC_INTR_SD2_R_EN_BIT 0
  234. #define PBC_INTR_SD1_R_EN_BIT 6
  235. #define PBC_INTR_MS_R_EN_BIT 5
  236. #define PBC_INTR_SD3_EN_BIT 13
  237. #define PBC_INTR_SD2_EN_BIT 12
  238. #define PBC_INTR_MS_EN_BIT 14
  239. #define PBC_INTR_SD1_EN_BIT 15
  240. #define PBC_INTR_SD2_R_EN 0x0001
  241. #define PBC_INTR_LOW_BAT 0X0002
  242. #define PBC_INTR_OTG_FSOVER 0X0004
  243. #define PBC_INTR_FSH_OVER 0X0008
  244. #define PBC_INTR_SD3_R_EN 0x0010
  245. #define PBC_INTR_MS_R_EN 0x0020
  246. #define PBC_INTR_SD1_R_EN 0x0040
  247. #define PBC_INTR_FEC_INT 0X0080
  248. #define PBC_INTR_ENET_INT 0X0100
  249. #define PBC_INTR_OTGFS_INT 0X0200
  250. #define PBC_INTR_XUART_INT 0X0400
  251. #define PBC_INTR_CCTL12 0X0800
  252. #define PBC_INTR_SD2_EN 0x1000
  253. #define PBC_INTR_SD3_EN 0x2000
  254. #define PBC_INTR_MS_EN 0x4000
  255. #define PBC_INTR_SD1_EN 0x8000
  256. /* For interrupts like xuart, enet etc */
  257. #define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX27_PIN_TIN)
  258. #define MXC_MAX_EXP_IO_LINES 16
  259. /*
  260. * This corresponds to PBC_INTMASK_SET_REG at offset 0x38.
  261. *
  262. */
  263. #define EXPIO_INT_LOW_BAT (MXC_EXP_IO_BASE + 1)
  264. #define EXPIO_INT_OTG_FS_OVR (MXC_EXP_IO_BASE + 2)
  265. #define EXPIO_INT_FSH_OVR (MXC_EXP_IO_BASE + 3)
  266. #define EXPIO_INT_RES4 (MXC_EXP_IO_BASE + 4)
  267. #define EXPIO_INT_RES5 (MXC_EXP_IO_BASE + 5)
  268. #define EXPIO_INT_RES6 (MXC_EXP_IO_BASE + 6)
  269. #define EXPIO_INT_FEC (MXC_EXP_IO_BASE + 7)
  270. #define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8)
  271. #define EXPIO_INT_OTG_FS_INT (MXC_EXP_IO_BASE + 9)
  272. #define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10)
  273. #define EXPIO_INT_CCTL12_INT (MXC_EXP_IO_BASE + 11)
  274. #define EXPIO_INT_SD2_EN (MXC_EXP_IO_BASE + 12)
  275. #define EXPIO_INT_SD3_EN (MXC_EXP_IO_BASE + 13)
  276. #define EXPIO_INT_MS_EN (MXC_EXP_IO_BASE + 14)
  277. #define EXPIO_INT_SD1_EN (MXC_EXP_IO_BASE + 15)
  278. /*
  279. * This is System IRQ used by CS8900A for interrupt generation
  280. * taken from platform.h
  281. */
  282. #define CS8900AIRQ EXPIO_INT_ENET_INT
  283. /* This is I/O Base address used to access registers of CS8900A on MXC ADS */
  284. #define CS8900A_BASE_ADDRESS (PBC_CS8900A_IOBASE_REG + 0x300)
  285. #define MXC_PMIC_INT_LINE IOMUX_TO_IRQ(MX27_PIN_TOUT)
  286. /*
  287. * This is used to detect if the CPLD version is for mx27 evb board rev-a
  288. */
  289. #define PBC_CPLD_VERSION_IS_REVA() \
  290. ((__raw_readw(PBC_VERSION_REG) & \
  291. (PBC_VERSION_ADS | PBC_VERSION_EVB_REVB))\
  292. == 0)
  293. /* This is used to active or inactive ata signal in CPLD .
  294. * It is dependent with hardware
  295. */
  296. #define PBC_ATA_SIGNAL_ACTIVE() \
  297. __raw_writew( \
  298. PBC_BCTRL2_ATAFEC_EN|PBC_BCTRL2_ATAFEC_SEL|PBC_BCTRL2_ATA_EN, \
  299. PBC_BCTRL2_CLEAR_REG)
  300. #define PBC_ATA_SIGNAL_INACTIVE() \
  301. __raw_writew( \
  302. PBC_BCTRL2_ATAFEC_EN|PBC_BCTRL2_ATAFEC_SEL|PBC_BCTRL2_ATA_EN, \
  303. PBC_BCTRL2_SET_REG)
  304. #define MXC_BD_LED1 (1 << 5)
  305. #define MXC_BD_LED2 (1 << 6)
  306. #define MXC_BD_LED_ON(led) \
  307. __raw_writew(led, PBC_BCTRL1_SET_REG)
  308. #define MXC_BD_LED_OFF(led) \
  309. __raw_writew(led, PBC_BCTRL1_CLEAR_REG)
  310. /* to determine the correct external crystal reference */
  311. #define CKIH_27MHZ_BIT_SET (1 << 3)
  312. #endif /* __ASM_ARCH_MXC_BOARD_MX27ADS_H__ */