davinci-mcasp.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. /*
  2. * ALSA SoC McASP Audio Layer for TI DAVINCI processor
  3. *
  4. * MCASP related definitions
  5. *
  6. * Author: Nirmal Pandey <n-pandey@ti.com>,
  7. * Suresh Rajashekara <suresh.r@ti.com>
  8. * Steve Chen <schen@.mvista.com>
  9. *
  10. * Copyright: (C) 2009 MontaVista Software, Inc., <source@mvista.com>
  11. * Copyright: (C) 2009 Texas Instruments, India
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License version 2 as
  15. * published by the Free Software Foundation.
  16. */
  17. #ifndef DAVINCI_MCASP_H
  18. #define DAVINCI_MCASP_H
  19. /*
  20. * McASP register definitions
  21. */
  22. #define DAVINCI_MCASP_PID_REG 0x00
  23. #define DAVINCI_MCASP_PWREMUMGT_REG 0x04
  24. #define DAVINCI_MCASP_PFUNC_REG 0x10
  25. #define DAVINCI_MCASP_PDIR_REG 0x14
  26. #define DAVINCI_MCASP_PDOUT_REG 0x18
  27. #define DAVINCI_MCASP_PDSET_REG 0x1c
  28. #define DAVINCI_MCASP_PDCLR_REG 0x20
  29. #define DAVINCI_MCASP_TLGC_REG 0x30
  30. #define DAVINCI_MCASP_TLMR_REG 0x34
  31. #define DAVINCI_MCASP_GBLCTL_REG 0x44
  32. #define DAVINCI_MCASP_AMUTE_REG 0x48
  33. #define DAVINCI_MCASP_LBCTL_REG 0x4c
  34. #define DAVINCI_MCASP_TXDITCTL_REG 0x50
  35. #define DAVINCI_MCASP_GBLCTLR_REG 0x60
  36. #define DAVINCI_MCASP_RXMASK_REG 0x64
  37. #define DAVINCI_MCASP_RXFMT_REG 0x68
  38. #define DAVINCI_MCASP_RXFMCTL_REG 0x6c
  39. #define DAVINCI_MCASP_ACLKRCTL_REG 0x70
  40. #define DAVINCI_MCASP_AHCLKRCTL_REG 0x74
  41. #define DAVINCI_MCASP_RXTDM_REG 0x78
  42. #define DAVINCI_MCASP_EVTCTLR_REG 0x7c
  43. #define DAVINCI_MCASP_RXSTAT_REG 0x80
  44. #define DAVINCI_MCASP_RXTDMSLOT_REG 0x84
  45. #define DAVINCI_MCASP_RXCLKCHK_REG 0x88
  46. #define DAVINCI_MCASP_REVTCTL_REG 0x8c
  47. #define DAVINCI_MCASP_GBLCTLX_REG 0xa0
  48. #define DAVINCI_MCASP_TXMASK_REG 0xa4
  49. #define DAVINCI_MCASP_TXFMT_REG 0xa8
  50. #define DAVINCI_MCASP_TXFMCTL_REG 0xac
  51. #define DAVINCI_MCASP_ACLKXCTL_REG 0xb0
  52. #define DAVINCI_MCASP_AHCLKXCTL_REG 0xb4
  53. #define DAVINCI_MCASP_TXTDM_REG 0xb8
  54. #define DAVINCI_MCASP_EVTCTLX_REG 0xbc
  55. #define DAVINCI_MCASP_TXSTAT_REG 0xc0
  56. #define DAVINCI_MCASP_TXTDMSLOT_REG 0xc4
  57. #define DAVINCI_MCASP_TXCLKCHK_REG 0xc8
  58. #define DAVINCI_MCASP_XEVTCTL_REG 0xcc
  59. /* Left(even TDM Slot) Channel Status Register File */
  60. #define DAVINCI_MCASP_DITCSRA_REG 0x100
  61. /* Right(odd TDM slot) Channel Status Register File */
  62. #define DAVINCI_MCASP_DITCSRB_REG 0x118
  63. /* Left(even TDM slot) User Data Register File */
  64. #define DAVINCI_MCASP_DITUDRA_REG 0x130
  65. /* Right(odd TDM Slot) User Data Register File */
  66. #define DAVINCI_MCASP_DITUDRB_REG 0x148
  67. /* Serializer n Control Register */
  68. #define DAVINCI_MCASP_XRSRCTL_BASE_REG 0x180
  69. #define DAVINCI_MCASP_XRSRCTL_REG(n) (DAVINCI_MCASP_XRSRCTL_BASE_REG + \
  70. (n << 2))
  71. /* Transmit Buffer for Serializer n */
  72. #define DAVINCI_MCASP_TXBUF_REG 0x200
  73. /* Receive Buffer for Serializer n */
  74. #define DAVINCI_MCASP_RXBUF_REG 0x280
  75. /* McASP FIFO Registers */
  76. #define DAVINCI_MCASP_V2_AFIFO_BASE (0x1010)
  77. #define DAVINCI_MCASP_V3_AFIFO_BASE (0x1000)
  78. /* FIFO register offsets from AFIFO base */
  79. #define MCASP_WFIFOCTL_OFFSET (0x0)
  80. #define MCASP_WFIFOSTS_OFFSET (0x4)
  81. #define MCASP_RFIFOCTL_OFFSET (0x8)
  82. #define MCASP_RFIFOSTS_OFFSET (0xc)
  83. /*
  84. * DAVINCI_MCASP_PWREMUMGT_REG - Power Down and Emulation Management
  85. * Register Bits
  86. */
  87. #define MCASP_FREE BIT(0)
  88. #define MCASP_SOFT BIT(1)
  89. /*
  90. * DAVINCI_MCASP_PFUNC_REG - Pin Function / GPIO Enable Register Bits
  91. */
  92. #define AXR(n) (1<<n)
  93. #define PFUNC_AMUTE BIT(25)
  94. #define ACLKX BIT(26)
  95. #define AHCLKX BIT(27)
  96. #define AFSX BIT(28)
  97. #define ACLKR BIT(29)
  98. #define AHCLKR BIT(30)
  99. #define AFSR BIT(31)
  100. /*
  101. * DAVINCI_MCASP_PDIR_REG - Pin Direction Register Bits
  102. */
  103. #define AXR(n) (1<<n)
  104. #define PDIR_AMUTE BIT(25)
  105. #define ACLKX BIT(26)
  106. #define AHCLKX BIT(27)
  107. #define AFSX BIT(28)
  108. #define ACLKR BIT(29)
  109. #define AHCLKR BIT(30)
  110. #define AFSR BIT(31)
  111. /*
  112. * DAVINCI_MCASP_TXDITCTL_REG - Transmit DIT Control Register Bits
  113. */
  114. #define DITEN BIT(0) /* Transmit DIT mode enable/disable */
  115. #define VA BIT(2)
  116. #define VB BIT(3)
  117. /*
  118. * DAVINCI_MCASP_TXFMT_REG - Transmit Bitstream Format Register Bits
  119. */
  120. #define TXROT(val) (val)
  121. #define TXSEL BIT(3)
  122. #define TXSSZ(val) (val<<4)
  123. #define TXPBIT(val) (val<<8)
  124. #define TXPAD(val) (val<<13)
  125. #define TXORD BIT(15)
  126. #define FSXDLY(val) (val<<16)
  127. /*
  128. * DAVINCI_MCASP_RXFMT_REG - Receive Bitstream Format Register Bits
  129. */
  130. #define RXROT(val) (val)
  131. #define RXSEL BIT(3)
  132. #define RXSSZ(val) (val<<4)
  133. #define RXPBIT(val) (val<<8)
  134. #define RXPAD(val) (val<<13)
  135. #define RXORD BIT(15)
  136. #define FSRDLY(val) (val<<16)
  137. /*
  138. * DAVINCI_MCASP_TXFMCTL_REG - Transmit Frame Control Register Bits
  139. */
  140. #define FSXPOL BIT(0)
  141. #define AFSXE BIT(1)
  142. #define FSXDUR BIT(4)
  143. #define FSXMOD(val) (val<<7)
  144. /*
  145. * DAVINCI_MCASP_RXFMCTL_REG - Receive Frame Control Register Bits
  146. */
  147. #define FSRPOL BIT(0)
  148. #define AFSRE BIT(1)
  149. #define FSRDUR BIT(4)
  150. #define FSRMOD(val) (val<<7)
  151. /*
  152. * DAVINCI_MCASP_ACLKXCTL_REG - Transmit Clock Control Register Bits
  153. */
  154. #define ACLKXDIV(val) (val)
  155. #define ACLKXE BIT(5)
  156. #define TX_ASYNC BIT(6)
  157. #define ACLKXPOL BIT(7)
  158. #define ACLKXDIV_MASK 0x1f
  159. /*
  160. * DAVINCI_MCASP_ACLKRCTL_REG Receive Clock Control Register Bits
  161. */
  162. #define ACLKRDIV(val) (val)
  163. #define ACLKRE BIT(5)
  164. #define RX_ASYNC BIT(6)
  165. #define ACLKRPOL BIT(7)
  166. #define ACLKRDIV_MASK 0x1f
  167. /*
  168. * DAVINCI_MCASP_AHCLKXCTL_REG - High Frequency Transmit Clock Control
  169. * Register Bits
  170. */
  171. #define AHCLKXDIV(val) (val)
  172. #define AHCLKXPOL BIT(14)
  173. #define AHCLKXE BIT(15)
  174. #define AHCLKXDIV_MASK 0xfff
  175. /*
  176. * DAVINCI_MCASP_AHCLKRCTL_REG - High Frequency Receive Clock Control
  177. * Register Bits
  178. */
  179. #define AHCLKRDIV(val) (val)
  180. #define AHCLKRPOL BIT(14)
  181. #define AHCLKRE BIT(15)
  182. #define AHCLKRDIV_MASK 0xfff
  183. /*
  184. * DAVINCI_MCASP_XRSRCTL_BASE_REG - Serializer Control Register Bits
  185. */
  186. #define MODE(val) (val)
  187. #define DISMOD (val)(val<<2)
  188. #define TXSTATE BIT(4)
  189. #define RXSTATE BIT(5)
  190. #define SRMOD_MASK 3
  191. #define SRMOD_INACTIVE 0
  192. /*
  193. * DAVINCI_MCASP_LBCTL_REG - Loop Back Control Register Bits
  194. */
  195. #define LBEN BIT(0)
  196. #define LBORD BIT(1)
  197. #define LBGENMODE(val) (val<<2)
  198. /*
  199. * DAVINCI_MCASP_TXTDMSLOT_REG - Transmit TDM Slot Register configuration
  200. */
  201. #define TXTDMS(n) (1<<n)
  202. /*
  203. * DAVINCI_MCASP_RXTDMSLOT_REG - Receive TDM Slot Register configuration
  204. */
  205. #define RXTDMS(n) (1<<n)
  206. /*
  207. * DAVINCI_MCASP_GBLCTL_REG - Global Control Register Bits
  208. */
  209. #define RXCLKRST BIT(0) /* Receiver Clock Divider Reset */
  210. #define RXHCLKRST BIT(1) /* Receiver High Frequency Clock Divider */
  211. #define RXSERCLR BIT(2) /* Receiver Serializer Clear */
  212. #define RXSMRST BIT(3) /* Receiver State Machine Reset */
  213. #define RXFSRST BIT(4) /* Frame Sync Generator Reset */
  214. #define TXCLKRST BIT(8) /* Transmitter Clock Divider Reset */
  215. #define TXHCLKRST BIT(9) /* Transmitter High Frequency Clock Divider*/
  216. #define TXSERCLR BIT(10) /* Transmit Serializer Clear */
  217. #define TXSMRST BIT(11) /* Transmitter State Machine Reset */
  218. #define TXFSRST BIT(12) /* Frame Sync Generator Reset */
  219. /*
  220. * DAVINCI_MCASP_TXSTAT_REG - Transmitter Status Register Bits
  221. * DAVINCI_MCASP_RXSTAT_REG - Receiver Status Register Bits
  222. */
  223. #define XRERR BIT(8) /* Transmit/Receive error */
  224. #define XRDATA BIT(5) /* Transmit/Receive data ready */
  225. /*
  226. * DAVINCI_MCASP_AMUTE_REG - Mute Control Register Bits
  227. */
  228. #define MUTENA(val) (val)
  229. #define MUTEINPOL BIT(2)
  230. #define MUTEINENA BIT(3)
  231. #define MUTEIN BIT(4)
  232. #define MUTER BIT(5)
  233. #define MUTEX BIT(6)
  234. #define MUTEFSR BIT(7)
  235. #define MUTEFSX BIT(8)
  236. #define MUTEBADCLKR BIT(9)
  237. #define MUTEBADCLKX BIT(10)
  238. #define MUTERXDMAERR BIT(11)
  239. #define MUTETXDMAERR BIT(12)
  240. /*
  241. * DAVINCI_MCASP_REVTCTL_REG - Receiver DMA Event Control Register bits
  242. */
  243. #define RXDATADMADIS BIT(0)
  244. /*
  245. * DAVINCI_MCASP_XEVTCTL_REG - Transmitter DMA Event Control Register bits
  246. */
  247. #define TXDATADMADIS BIT(0)
  248. /*
  249. * DAVINCI_MCASP_EVTCTLR_REG - Receiver Interrupt Control Register Bits
  250. */
  251. #define ROVRN BIT(0)
  252. /*
  253. * DAVINCI_MCASP_EVTCTLX_REG - Transmitter Interrupt Control Register Bits
  254. */
  255. #define XUNDRN BIT(0)
  256. /*
  257. * DAVINCI_MCASP_W[R]FIFOCTL - Write/Read FIFO Control Register bits
  258. */
  259. #define FIFO_ENABLE BIT(16)
  260. #define NUMEVT_MASK (0xFF << 8)
  261. #define NUMEVT(x) (((x) & 0xFF) << 8)
  262. #define NUMDMA_MASK (0xFF)
  263. #endif /* DAVINCI_MCASP_H */