imx-regs.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. #ifndef _IMX_REGS_H
  2. #define _IMX_REGS_H
  3. /* ------------------------------------------------------------------------
  4. * Motorola IMX system registers
  5. * ------------------------------------------------------------------------
  6. *
  7. */
  8. /*
  9. * Register BASEs, based on OFFSETs
  10. *
  11. */
  12. #define IMX_AIPI1_BASE (0x00000 + IMX_IO_BASE)
  13. #define IMX_WDT_BASE (0x01000 + IMX_IO_BASE)
  14. #define IMX_TIM1_BASE (0x02000 + IMX_IO_BASE)
  15. #define IMX_TIM2_BASE (0x03000 + IMX_IO_BASE)
  16. #define IMX_RTC_BASE (0x04000 + IMX_IO_BASE)
  17. #define IMX_LCDC_BASE (0x05000 + IMX_IO_BASE)
  18. #define IMX_UART1_BASE (0x06000 + IMX_IO_BASE)
  19. #define IMX_UART2_BASE (0x07000 + IMX_IO_BASE)
  20. #define IMX_PWM_BASE (0x08000 + IMX_IO_BASE)
  21. #define IMX_DMAC_BASE (0x09000 + IMX_IO_BASE)
  22. #define IMX_AIPI2_BASE (0x10000 + IMX_IO_BASE)
  23. #define IMX_SIM_BASE (0x11000 + IMX_IO_BASE)
  24. #define IMX_USBD_BASE (0x12000 + IMX_IO_BASE)
  25. #define IMX_SPI1_BASE (0x13000 + IMX_IO_BASE)
  26. #define IMX_MMC_BASE (0x14000 + IMX_IO_BASE)
  27. #define IMX_ASP_BASE (0x15000 + IMX_IO_BASE)
  28. #define IMX_BTA_BASE (0x16000 + IMX_IO_BASE)
  29. #define IMX_I2C_BASE (0x17000 + IMX_IO_BASE)
  30. #define IMX_SSI_BASE (0x18000 + IMX_IO_BASE)
  31. #define IMX_SPI2_BASE (0x19000 + IMX_IO_BASE)
  32. #define IMX_MSHC_BASE (0x1A000 + IMX_IO_BASE)
  33. #define IMX_PLL_BASE (0x1B000 + IMX_IO_BASE)
  34. #define IMX_GPIO_BASE (0x1C000 + IMX_IO_BASE)
  35. #define IMX_EIM_BASE (0x20000 + IMX_IO_BASE)
  36. #define IMX_SDRAMC_BASE (0x21000 + IMX_IO_BASE)
  37. #define IMX_MMA_BASE (0x22000 + IMX_IO_BASE)
  38. #define IMX_AITC_BASE (0x23000 + IMX_IO_BASE)
  39. #define IMX_CSI_BASE (0x24000 + IMX_IO_BASE)
  40. /* PLL registers */
  41. #define CSCR __REG(IMX_PLL_BASE) /* Clock Source Control Register */
  42. #define CSCR_SPLL_RESTART (1<<22)
  43. #define CSCR_MPLL_RESTART (1<<21)
  44. #define CSCR_SYSTEM_SEL (1<<16)
  45. #define CSCR_BCLK_DIV (0xf<<10)
  46. #define CSCR_MPU_PRESC (1<<15)
  47. #define CSCR_SPEN (1<<1)
  48. #define CSCR_MPEN (1<<0)
  49. #define MPCTL0 __REG(IMX_PLL_BASE + 0x4) /* MCU PLL Control Register 0 */
  50. #define MPCTL1 __REG(IMX_PLL_BASE + 0x8) /* MCU PLL and System Clock Register 1 */
  51. #define SPCTL0 __REG(IMX_PLL_BASE + 0xc) /* System PLL Control Register 0 */
  52. #define SPCTL1 __REG(IMX_PLL_BASE + 0x10) /* System PLL Control Register 1 */
  53. #define PCDR __REG(IMX_PLL_BASE + 0x20) /* Peripheral Clock Divider Register */
  54. /*
  55. * GPIO Module and I/O Multiplexer
  56. * x = 0..3 for reg_A, reg_B, reg_C, reg_D
  57. */
  58. #define DDIR(x) __REG2(IMX_GPIO_BASE + 0x00, ((x) & 3) << 8)
  59. #define OCR1(x) __REG2(IMX_GPIO_BASE + 0x04, ((x) & 3) << 8)
  60. #define OCR2(x) __REG2(IMX_GPIO_BASE + 0x08, ((x) & 3) << 8)
  61. #define ICONFA1(x) __REG2(IMX_GPIO_BASE + 0x0c, ((x) & 3) << 8)
  62. #define ICONFA2(x) __REG2(IMX_GPIO_BASE + 0x10, ((x) & 3) << 8)
  63. #define ICONFB1(x) __REG2(IMX_GPIO_BASE + 0x14, ((x) & 3) << 8)
  64. #define ICONFB2(x) __REG2(IMX_GPIO_BASE + 0x18, ((x) & 3) << 8)
  65. #define DR(x) __REG2(IMX_GPIO_BASE + 0x1c, ((x) & 3) << 8)
  66. #define GIUS(x) __REG2(IMX_GPIO_BASE + 0x20, ((x) & 3) << 8)
  67. #define SSR(x) __REG2(IMX_GPIO_BASE + 0x24, ((x) & 3) << 8)
  68. #define ICR1(x) __REG2(IMX_GPIO_BASE + 0x28, ((x) & 3) << 8)
  69. #define ICR2(x) __REG2(IMX_GPIO_BASE + 0x2c, ((x) & 3) << 8)
  70. #define IMR(x) __REG2(IMX_GPIO_BASE + 0x30, ((x) & 3) << 8)
  71. #define ISR(x) __REG2(IMX_GPIO_BASE + 0x34, ((x) & 3) << 8)
  72. #define GPR(x) __REG2(IMX_GPIO_BASE + 0x38, ((x) & 3) << 8)
  73. #define SWR(x) __REG2(IMX_GPIO_BASE + 0x3c, ((x) & 3) << 8)
  74. #define PUEN(x) __REG2(IMX_GPIO_BASE + 0x40, ((x) & 3) << 8)
  75. #define GPIO_PORT_MAX 3
  76. #define GPIO_PIN_MASK 0x1f
  77. #define GPIO_PORT_MASK (0x3 << 5)
  78. #define GPIO_PORT_SHIFT 5
  79. #define GPIO_PORTA (0<<5)
  80. #define GPIO_PORTB (1<<5)
  81. #define GPIO_PORTC (2<<5)
  82. #define GPIO_PORTD (3<<5)
  83. #define GPIO_OUT (1<<7)
  84. #define GPIO_IN (0<<7)
  85. #define GPIO_PUEN (1<<8)
  86. #define GPIO_PF (0<<9)
  87. #define GPIO_AF (1<<9)
  88. #define GPIO_OCR_SHIFT 10
  89. #define GPIO_OCR_MASK (3<<10)
  90. #define GPIO_AIN (0<<10)
  91. #define GPIO_BIN (1<<10)
  92. #define GPIO_CIN (2<<10)
  93. #define GPIO_DR (3<<10)
  94. #define GPIO_AOUT_SHIFT 12
  95. #define GPIO_AOUT_MASK (3<<12)
  96. #define GPIO_AOUT (0<<12)
  97. #define GPIO_AOUT_ISR (1<<12)
  98. #define GPIO_AOUT_0 (2<<12)
  99. #define GPIO_AOUT_1 (3<<12)
  100. #define GPIO_BOUT_SHIFT 14
  101. #define GPIO_BOUT_MASK (3<<14)
  102. #define GPIO_BOUT (0<<14)
  103. #define GPIO_BOUT_ISR (1<<14)
  104. #define GPIO_BOUT_0 (2<<14)
  105. #define GPIO_BOUT_1 (3<<14)
  106. #define GPIO_GIUS (1<<16)
  107. /* assignements for GPIO alternate/primary functions */
  108. /* FIXME: This list is not completed. The correct directions are
  109. * missing on some (many) pins
  110. */
  111. #define PA0_AIN_SPI2_CLK ( GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 0 )
  112. #define PA0_AF_ETMTRACESYNC ( GPIO_PORTA | GPIO_AF | 0 )
  113. #define PA1_AOUT_SPI2_RXD ( GPIO_GIUS | GPIO_PORTA | GPIO_IN | 1 )
  114. #define PA1_PF_TIN ( GPIO_PORTA | GPIO_PF | 1 )
  115. #define PA2_PF_PWM0 ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 2 )
  116. #define PA3_PF_CSI_MCLK ( GPIO_PORTA | GPIO_PF | 3 )
  117. #define PA4_PF_CSI_D0 ( GPIO_PORTA | GPIO_PF | 4 )
  118. #define PA5_PF_CSI_D1 ( GPIO_PORTA | GPIO_PF | 5 )
  119. #define PA6_PF_CSI_D2 ( GPIO_PORTA | GPIO_PF | 6 )
  120. #define PA7_PF_CSI_D3 ( GPIO_PORTA | GPIO_PF | 7 )
  121. #define PA8_PF_CSI_D4 ( GPIO_PORTA | GPIO_PF | 8 )
  122. #define PA9_PF_CSI_D5 ( GPIO_PORTA | GPIO_PF | 9 )
  123. #define PA10_PF_CSI_D6 ( GPIO_PORTA | GPIO_PF | 10 )
  124. #define PA11_PF_CSI_D7 ( GPIO_PORTA | GPIO_PF | 11 )
  125. #define PA12_PF_CSI_VSYNC ( GPIO_PORTA | GPIO_PF | 12 )
  126. #define PA13_PF_CSI_HSYNC ( GPIO_PORTA | GPIO_PF | 13 )
  127. #define PA14_PF_CSI_PIXCLK ( GPIO_PORTA | GPIO_PF | 14 )
  128. #define PA15_PF_I2C_SDA ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 15 )
  129. #define PA16_PF_I2C_SCL ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 16 )
  130. #define PA17_AF_ETMTRACEPKT4 ( GPIO_PORTA | GPIO_AF | 17 )
  131. #define PA17_AIN_SPI2_SS ( GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 17 )
  132. #define PA18_AF_ETMTRACEPKT5 ( GPIO_PORTA | GPIO_AF | 18 )
  133. #define PA19_AF_ETMTRACEPKT6 ( GPIO_PORTA | GPIO_AF | 19 )
  134. #define PA20_AF_ETMTRACEPKT7 ( GPIO_PORTA | GPIO_AF | 20 )
  135. #define PA21_PF_A0 ( GPIO_PORTA | GPIO_PF | 21 )
  136. #define PA22_PF_CS4 ( GPIO_PORTA | GPIO_PF | 22 )
  137. #define PA23_PF_CS5 ( GPIO_PORTA | GPIO_PF | 23 )
  138. #define PA24_PF_A16 ( GPIO_PORTA | GPIO_PF | 24 )
  139. #define PA24_AF_ETMTRACEPKT0 ( GPIO_PORTA | GPIO_AF | 24 )
  140. #define PA25_PF_A17 ( GPIO_PORTA | GPIO_PF | 25 )
  141. #define PA25_AF_ETMTRACEPKT1 ( GPIO_PORTA | GPIO_AF | 25 )
  142. #define PA26_PF_A18 ( GPIO_PORTA | GPIO_PF | 26 )
  143. #define PA26_AF_ETMTRACEPKT2 ( GPIO_PORTA | GPIO_AF | 26 )
  144. #define PA27_PF_A19 ( GPIO_PORTA | GPIO_PF | 27 )
  145. #define PA27_AF_ETMTRACEPKT3 ( GPIO_PORTA | GPIO_AF | 27 )
  146. #define PA28_PF_A20 ( GPIO_PORTA | GPIO_PF | 28 )
  147. #define PA28_AF_ETMPIPESTAT0 ( GPIO_PORTA | GPIO_AF | 28 )
  148. #define PA29_PF_A21 ( GPIO_PORTA | GPIO_PF | 29 )
  149. #define PA29_AF_ETMPIPESTAT1 ( GPIO_PORTA | GPIO_AF | 29 )
  150. #define PA30_PF_A22 ( GPIO_PORTA | GPIO_PF | 30 )
  151. #define PA30_AF_ETMPIPESTAT2 ( GPIO_PORTA | GPIO_AF | 30 )
  152. #define PA31_PF_A23 ( GPIO_PORTA | GPIO_PF | 31 )
  153. #define PA31_AF_ETMTRACECLK ( GPIO_PORTA | GPIO_AF | 31 )
  154. #define PB8_PF_SD_DAT0 ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 8 )
  155. #define PB8_AF_MS_PIO ( GPIO_PORTB | GPIO_AF | 8 )
  156. #define PB9_PF_SD_DAT1 ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 9 )
  157. #define PB9_AF_MS_PI1 ( GPIO_PORTB | GPIO_AF | 9 )
  158. #define PB10_PF_SD_DAT2 ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 10 )
  159. #define PB10_AF_MS_SCLKI ( GPIO_PORTB | GPIO_AF | 10 )
  160. #define PB11_PF_SD_DAT3 ( GPIO_PORTB | GPIO_PF | 11 )
  161. #define PB11_AF_MS_SDIO ( GPIO_PORTB | GPIO_AF | 11 )
  162. #define PB12_PF_SD_CLK ( GPIO_PORTB | GPIO_PF | 12 )
  163. #define PB12_AF_MS_SCLK0 ( GPIO_PORTB | GPIO_AF | 12 )
  164. #define PB13_PF_SD_CMD ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 13 )
  165. #define PB13_AF_MS_BS ( GPIO_PORTB | GPIO_AF | 13 )
  166. #define PB14_AF_SSI_RXFS ( GPIO_PORTB | GPIO_AF | 14 )
  167. #define PB15_AF_SSI_RXCLK ( GPIO_PORTB | GPIO_AF | 15 )
  168. #define PB16_AF_SSI_RXDAT ( GPIO_PORTB | GPIO_IN | GPIO_AF | 16 )
  169. #define PB17_AF_SSI_TXDAT ( GPIO_PORTB | GPIO_OUT | GPIO_AF | 17 )
  170. #define PB18_AF_SSI_TXFS ( GPIO_PORTB | GPIO_AF | 18 )
  171. #define PB19_AF_SSI_TXCLK ( GPIO_PORTB | GPIO_AF | 19 )
  172. #define PB20_PF_USBD_AFE ( GPIO_PORTB | GPIO_PF | 20 )
  173. #define PB21_PF_USBD_OE ( GPIO_PORTB | GPIO_PF | 21 )
  174. #define PB22_PFUSBD_RCV ( GPIO_PORTB | GPIO_PF | 22 )
  175. #define PB23_PF_USBD_SUSPND ( GPIO_PORTB | GPIO_PF | 23 )
  176. #define PB24_PF_USBD_VP ( GPIO_PORTB | GPIO_PF | 24 )
  177. #define PB25_PF_USBD_VM ( GPIO_PORTB | GPIO_PF | 25 )
  178. #define PB26_PF_USBD_VPO ( GPIO_PORTB | GPIO_PF | 26 )
  179. #define PB27_PF_USBD_VMO ( GPIO_PORTB | GPIO_PF | 27 )
  180. #define PB28_PF_UART2_CTS ( GPIO_PORTB | GPIO_OUT | GPIO_PF | 28 )
  181. #define PB29_PF_UART2_RTS ( GPIO_PORTB | GPIO_IN | GPIO_PF | 29 )
  182. #define PB30_PF_UART2_TXD ( GPIO_PORTB | GPIO_OUT | GPIO_PF | 30 )
  183. #define PB31_PF_UART2_RXD ( GPIO_PORTB | GPIO_IN | GPIO_PF | 31 )
  184. #define PC3_PF_SSI_RXFS ( GPIO_PORTC | GPIO_PF | 3 )
  185. #define PC4_PF_SSI_RXCLK ( GPIO_PORTC | GPIO_PF | 4 )
  186. #define PC5_PF_SSI_RXDAT ( GPIO_PORTC | GPIO_IN | GPIO_PF | 5 )
  187. #define PC6_PF_SSI_TXDAT ( GPIO_PORTC | GPIO_OUT | GPIO_PF | 6 )
  188. #define PC7_PF_SSI_TXFS ( GPIO_PORTC | GPIO_PF | 7 )
  189. #define PC8_PF_SSI_TXCLK ( GPIO_PORTC | GPIO_PF | 8 )
  190. #define PC9_PF_UART1_CTS ( GPIO_PORTC | GPIO_OUT | GPIO_PF | 9 )
  191. #define PC10_PF_UART1_RTS ( GPIO_PORTC | GPIO_IN | GPIO_PF | 10 )
  192. #define PC11_PF_UART1_TXD ( GPIO_PORTC | GPIO_OUT | GPIO_PF | 11 )
  193. #define PC12_PF_UART1_RXD ( GPIO_PORTC | GPIO_IN | GPIO_PF | 12 )
  194. #define PC13_PF_SPI1_SPI_RDY ( GPIO_PORTC | GPIO_PF | 13 )
  195. #define PC14_PF_SPI1_SCLK ( GPIO_PORTC | GPIO_PF | 14 )
  196. #define PC15_PF_SPI1_SS ( GPIO_PORTC | GPIO_PF | 15 )
  197. #define PC16_PF_SPI1_MISO ( GPIO_PORTC | GPIO_PF | 16 )
  198. #define PC17_PF_SPI1_MOSI ( GPIO_PORTC | GPIO_PF | 17 )
  199. #define PC24_BIN_UART3_RI ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 24 )
  200. #define PC25_BIN_UART3_DSR ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 25 )
  201. #define PC26_AOUT_UART3_DTR ( GPIO_GIUS | GPIO_PORTC | GPIO_IN | 26 )
  202. #define PC27_BIN_UART3_DCD ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 27 )
  203. #define PC28_BIN_UART3_CTS ( GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 28 )
  204. #define PC29_AOUT_UART3_RTS ( GPIO_GIUS | GPIO_PORTC | GPIO_IN | 29 )
  205. #define PC30_BIN_UART3_TX ( GPIO_GIUS | GPIO_PORTC | GPIO_BIN | 30 )
  206. #define PC31_AOUT_UART3_RX ( GPIO_GIUS | GPIO_PORTC | GPIO_IN | 31)
  207. #define PD6_PF_LSCLK ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 6 )
  208. #define PD7_PF_REV ( GPIO_PORTD | GPIO_PF | 7 )
  209. #define PD7_AF_UART2_DTR ( GPIO_GIUS | GPIO_PORTD | GPIO_IN | GPIO_AF | 7 )
  210. #define PD7_AIN_SPI2_SCLK ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 7 )
  211. #define PD8_PF_CLS ( GPIO_PORTD | GPIO_PF | 8 )
  212. #define PD8_AF_UART2_DCD ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 8 )
  213. #define PD8_AIN_SPI2_SS ( GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 8 )
  214. #define PD9_PF_PS ( GPIO_PORTD | GPIO_PF | 9 )
  215. #define PD9_AF_UART2_RI ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 9 )
  216. #define PD9_AOUT_SPI2_RXD ( GPIO_GIUS | GPIO_PORTD | GPIO_IN | 9 )
  217. #define PD10_PF_SPL_SPR ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 10 )
  218. #define PD10_AF_UART2_DSR ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 10 )
  219. #define PD10_AIN_SPI2_TXD ( GPIO_GIUS | GPIO_PORTD | GPIO_OUT | 10 )
  220. #define PD11_PF_CONTRAST ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 11 )
  221. #define PD12_PF_ACD_OE ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 12 )
  222. #define PD13_PF_LP_HSYNC ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 13 )
  223. #define PD14_PF_FLM_VSYNC ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 14 )
  224. #define PD15_PF_LD0 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 15 )
  225. #define PD16_PF_LD1 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 16 )
  226. #define PD17_PF_LD2 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 17 )
  227. #define PD18_PF_LD3 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 18 )
  228. #define PD19_PF_LD4 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 19 )
  229. #define PD20_PF_LD5 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 20 )
  230. #define PD21_PF_LD6 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 21 )
  231. #define PD22_PF_LD7 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 22 )
  232. #define PD23_PF_LD8 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 23 )
  233. #define PD24_PF_LD9 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 24 )
  234. #define PD25_PF_LD10 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 25 )
  235. #define PD26_PF_LD11 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 26 )
  236. #define PD27_PF_LD12 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 27 )
  237. #define PD28_PF_LD13 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 28 )
  238. #define PD29_PF_LD14 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 29 )
  239. #define PD30_PF_LD15 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 30 )
  240. #define PD31_PF_TMR2OUT ( GPIO_PORTD | GPIO_PF | 31 )
  241. #define PD31_BIN_SPI2_TXD ( GPIO_GIUS | GPIO_PORTD | GPIO_BIN | 31 )
  242. /*
  243. * PWM controller
  244. */
  245. #define PWMC __REG(IMX_PWM_BASE + 0x00) /* PWM Control Register */
  246. #define PWMS __REG(IMX_PWM_BASE + 0x04) /* PWM Sample Register */
  247. #define PWMP __REG(IMX_PWM_BASE + 0x08) /* PWM Period Register */
  248. #define PWMCNT __REG(IMX_PWM_BASE + 0x0C) /* PWM Counter Register */
  249. #define PWMC_HCTR (0x01<<18) /* Halfword FIFO Data Swapping */
  250. #define PWMC_BCTR (0x01<<17) /* Byte FIFO Data Swapping */
  251. #define PWMC_SWR (0x01<<16) /* Software Reset */
  252. #define PWMC_CLKSRC (0x01<<15) /* Clock Source */
  253. #define PWMC_PRESCALER(x) (((x-1) & 0x7F) << 8) /* PRESCALER */
  254. #define PWMC_IRQ (0x01<< 7) /* Interrupt Request */
  255. #define PWMC_IRQEN (0x01<< 6) /* Interrupt Request Enable */
  256. #define PWMC_FIFOAV (0x01<< 5) /* FIFO Available */
  257. #define PWMC_EN (0x01<< 4) /* Enables/Disables the PWM */
  258. #define PWMC_REPEAT(x) (((x) & 0x03) << 2) /* Sample Repeats */
  259. #define PWMC_CLKSEL(x) (((x) & 0x03) << 0) /* Clock Selection */
  260. #define PWMS_SAMPLE(x) ((x) & 0xFFFF) /* Contains a two-sample word */
  261. #define PWMP_PERIOD(x) ((x) & 0xFFFF) /* Represents the PWM's period */
  262. #define PWMC_COUNTER(x) ((x) & 0xFFFF) /* Represents the current count value */
  263. /*
  264. * DMA Controller
  265. */
  266. #define DCR __REG(IMX_DMAC_BASE +0x00) /* DMA Control Register */
  267. #define DISR __REG(IMX_DMAC_BASE +0x04) /* DMA Interrupt status Register */
  268. #define DIMR __REG(IMX_DMAC_BASE +0x08) /* DMA Interrupt mask Register */
  269. #define DBTOSR __REG(IMX_DMAC_BASE +0x0c) /* DMA Burst timeout status Register */
  270. #define DRTOSR __REG(IMX_DMAC_BASE +0x10) /* DMA Request timeout Register */
  271. #define DSESR __REG(IMX_DMAC_BASE +0x14) /* DMA Transfer Error Status Register */
  272. #define DBOSR __REG(IMX_DMAC_BASE +0x18) /* DMA Buffer overflow status Register */
  273. #define DBTOCR __REG(IMX_DMAC_BASE +0x1c) /* DMA Burst timeout control Register */
  274. #define WSRA __REG(IMX_DMAC_BASE +0x40) /* W-Size Register A */
  275. #define XSRA __REG(IMX_DMAC_BASE +0x44) /* X-Size Register A */
  276. #define YSRA __REG(IMX_DMAC_BASE +0x48) /* Y-Size Register A */
  277. #define WSRB __REG(IMX_DMAC_BASE +0x4c) /* W-Size Register B */
  278. #define XSRB __REG(IMX_DMAC_BASE +0x50) /* X-Size Register B */
  279. #define YSRB __REG(IMX_DMAC_BASE +0x54) /* Y-Size Register B */
  280. #define SAR(x) __REG2( IMX_DMAC_BASE + 0x80, (x) << 6) /* Source Address Registers */
  281. #define DAR(x) __REG2( IMX_DMAC_BASE + 0x84, (x) << 6) /* Destination Address Registers */
  282. #define CNTR(x) __REG2( IMX_DMAC_BASE + 0x88, (x) << 6) /* Count Registers */
  283. #define CCR(x) __REG2( IMX_DMAC_BASE + 0x8c, (x) << 6) /* Control Registers */
  284. #define RSSR(x) __REG2( IMX_DMAC_BASE + 0x90, (x) << 6) /* Request source select Registers */
  285. #define BLR(x) __REG2( IMX_DMAC_BASE + 0x94, (x) << 6) /* Burst length Registers */
  286. #define RTOR(x) __REG2( IMX_DMAC_BASE + 0x98, (x) << 6) /* Request timeout Registers */
  287. #define BUCR(x) __REG2( IMX_DMAC_BASE + 0x98, (x) << 6) /* Bus Utilization Registers */
  288. #define DCR_DRST (1<<1)
  289. #define DCR_DEN (1<<0)
  290. #define DBTOCR_EN (1<<15)
  291. #define DBTOCR_CNT(x) ((x) & 0x7fff )
  292. #define CNTR_CNT(x) ((x) & 0xffffff )
  293. #define CCR_DMOD_LINEAR ( 0x0 << 12 )
  294. #define CCR_DMOD_2D ( 0x1 << 12 )
  295. #define CCR_DMOD_FIFO ( 0x2 << 12 )
  296. #define CCR_DMOD_EOBFIFO ( 0x3 << 12 )
  297. #define CCR_SMOD_LINEAR ( 0x0 << 10 )
  298. #define CCR_SMOD_2D ( 0x1 << 10 )
  299. #define CCR_SMOD_FIFO ( 0x2 << 10 )
  300. #define CCR_SMOD_EOBFIFO ( 0x3 << 10 )
  301. #define CCR_MDIR_DEC (1<<9)
  302. #define CCR_MSEL_B (1<<8)
  303. #define CCR_DSIZ_32 ( 0x0 << 6 )
  304. #define CCR_DSIZ_8 ( 0x1 << 6 )
  305. #define CCR_DSIZ_16 ( 0x2 << 6 )
  306. #define CCR_SSIZ_32 ( 0x0 << 4 )
  307. #define CCR_SSIZ_8 ( 0x1 << 4 )
  308. #define CCR_SSIZ_16 ( 0x2 << 4 )
  309. #define CCR_REN (1<<3)
  310. #define CCR_RPT (1<<2)
  311. #define CCR_FRC (1<<1)
  312. #define CCR_CEN (1<<0)
  313. #define RTOR_EN (1<<15)
  314. #define RTOR_CLK (1<<14)
  315. #define RTOR_PSC (1<<13)
  316. /*
  317. * Interrupt controller
  318. */
  319. #define IMX_INTCNTL __REG(IMX_AITC_BASE+0x00)
  320. #define INTCNTL_FIAD (1<<19)
  321. #define INTCNTL_NIAD (1<<20)
  322. #define IMX_NIMASK __REG(IMX_AITC_BASE+0x04)
  323. #define IMX_INTENNUM __REG(IMX_AITC_BASE+0x08)
  324. #define IMX_INTDISNUM __REG(IMX_AITC_BASE+0x0c)
  325. #define IMX_INTENABLEH __REG(IMX_AITC_BASE+0x10)
  326. #define IMX_INTENABLEL __REG(IMX_AITC_BASE+0x14)
  327. /*
  328. * General purpose timers
  329. */
  330. #define IMX_TCTL(x) __REG( 0x00 + (x))
  331. #define TCTL_SWR (1<<15)
  332. #define TCTL_FRR (1<<8)
  333. #define TCTL_CAP_RIS (1<<6)
  334. #define TCTL_CAP_FAL (2<<6)
  335. #define TCTL_CAP_RIS_FAL (3<<6)
  336. #define TCTL_OM (1<<5)
  337. #define TCTL_IRQEN (1<<4)
  338. #define TCTL_CLK_PCLK1 (1<<1)
  339. #define TCTL_CLK_PCLK1_16 (2<<1)
  340. #define TCTL_CLK_TIN (3<<1)
  341. #define TCTL_CLK_32 (4<<1)
  342. #define TCTL_TEN (1<<0)
  343. #define IMX_TPRER(x) __REG( 0x04 + (x))
  344. #define IMX_TCMP(x) __REG( 0x08 + (x))
  345. #define IMX_TCR(x) __REG( 0x0C + (x))
  346. #define IMX_TCN(x) __REG( 0x10 + (x))
  347. #define IMX_TSTAT(x) __REG( 0x14 + (x))
  348. #define TSTAT_CAPT (1<<1)
  349. #define TSTAT_COMP (1<<0)
  350. #endif // _IMX_REGS_H