fsl_ssi.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /*
  2. * fsl_ssi.h - ALSA SSI interface for the Freescale MPC8610 SoC
  3. *
  4. * Author: Timur Tabi <timur@freescale.com>
  5. *
  6. * Copyright 2007-2008 Freescale Semiconductor, Inc. This file is licensed
  7. * under the terms of the GNU General Public License version 2. This
  8. * program is licensed "as is" without any warranty of any kind, whether
  9. * express or implied.
  10. */
  11. #ifndef _MPC8610_I2S_H
  12. #define _MPC8610_I2S_H
  13. /* SSI Register Map */
  14. struct ccsr_ssi {
  15. __be32 stx0; /* 0x.0000 - SSI Transmit Data Register 0 */
  16. __be32 stx1; /* 0x.0004 - SSI Transmit Data Register 1 */
  17. __be32 srx0; /* 0x.0008 - SSI Receive Data Register 0 */
  18. __be32 srx1; /* 0x.000C - SSI Receive Data Register 1 */
  19. __be32 scr; /* 0x.0010 - SSI Control Register */
  20. __be32 sisr; /* 0x.0014 - SSI Interrupt Status Register Mixed */
  21. __be32 sier; /* 0x.0018 - SSI Interrupt Enable Register */
  22. __be32 stcr; /* 0x.001C - SSI Transmit Configuration Register */
  23. __be32 srcr; /* 0x.0020 - SSI Receive Configuration Register */
  24. __be32 stccr; /* 0x.0024 - SSI Transmit Clock Control Register */
  25. __be32 srccr; /* 0x.0028 - SSI Receive Clock Control Register */
  26. __be32 sfcsr; /* 0x.002C - SSI FIFO Control/Status Register */
  27. __be32 str; /* 0x.0030 - SSI Test Register */
  28. __be32 sor; /* 0x.0034 - SSI Option Register */
  29. __be32 sacnt; /* 0x.0038 - SSI AC97 Control Register */
  30. __be32 sacadd; /* 0x.003C - SSI AC97 Command Address Register */
  31. __be32 sacdat; /* 0x.0040 - SSI AC97 Command Data Register */
  32. __be32 satag; /* 0x.0044 - SSI AC97 Tag Register */
  33. __be32 stmsk; /* 0x.0048 - SSI Transmit Time Slot Mask Register */
  34. __be32 srmsk; /* 0x.004C - SSI Receive Time Slot Mask Register */
  35. __be32 saccst; /* 0x.0050 - SSI AC97 Channel Status Register */
  36. __be32 saccen; /* 0x.0054 - SSI AC97 Channel Enable Register */
  37. __be32 saccdis; /* 0x.0058 - SSI AC97 Channel Disable Register */
  38. };
  39. #define CCSR_SSI_SCR_RFR_CLK_DIS 0x00000800
  40. #define CCSR_SSI_SCR_TFR_CLK_DIS 0x00000400
  41. #define CCSR_SSI_SCR_TCH_EN 0x00000100
  42. #define CCSR_SSI_SCR_SYS_CLK_EN 0x00000080
  43. #define CCSR_SSI_SCR_I2S_MODE_MASK 0x00000060
  44. #define CCSR_SSI_SCR_I2S_MODE_NORMAL 0x00000000
  45. #define CCSR_SSI_SCR_I2S_MODE_MASTER 0x00000020
  46. #define CCSR_SSI_SCR_I2S_MODE_SLAVE 0x00000040
  47. #define CCSR_SSI_SCR_SYN 0x00000010
  48. #define CCSR_SSI_SCR_NET 0x00000008
  49. #define CCSR_SSI_SCR_RE 0x00000004
  50. #define CCSR_SSI_SCR_TE 0x00000002
  51. #define CCSR_SSI_SCR_SSIEN 0x00000001
  52. #define CCSR_SSI_SISR_RFRC 0x01000000
  53. #define CCSR_SSI_SISR_TFRC 0x00800000
  54. #define CCSR_SSI_SISR_CMDAU 0x00040000
  55. #define CCSR_SSI_SISR_CMDDU 0x00020000
  56. #define CCSR_SSI_SISR_RXT 0x00010000
  57. #define CCSR_SSI_SISR_RDR1 0x00008000
  58. #define CCSR_SSI_SISR_RDR0 0x00004000
  59. #define CCSR_SSI_SISR_TDE1 0x00002000
  60. #define CCSR_SSI_SISR_TDE0 0x00001000
  61. #define CCSR_SSI_SISR_ROE1 0x00000800
  62. #define CCSR_SSI_SISR_ROE0 0x00000400
  63. #define CCSR_SSI_SISR_TUE1 0x00000200
  64. #define CCSR_SSI_SISR_TUE0 0x00000100
  65. #define CCSR_SSI_SISR_TFS 0x00000080
  66. #define CCSR_SSI_SISR_RFS 0x00000040
  67. #define CCSR_SSI_SISR_TLS 0x00000020
  68. #define CCSR_SSI_SISR_RLS 0x00000010
  69. #define CCSR_SSI_SISR_RFF1 0x00000008
  70. #define CCSR_SSI_SISR_RFF0 0x00000004
  71. #define CCSR_SSI_SISR_TFE1 0x00000002
  72. #define CCSR_SSI_SISR_TFE0 0x00000001
  73. #define CCSR_SSI_SIER_RFRC_EN 0x01000000
  74. #define CCSR_SSI_SIER_TFRC_EN 0x00800000
  75. #define CCSR_SSI_SIER_RDMAE 0x00400000
  76. #define CCSR_SSI_SIER_RIE 0x00200000
  77. #define CCSR_SSI_SIER_TDMAE 0x00100000
  78. #define CCSR_SSI_SIER_TIE 0x00080000
  79. #define CCSR_SSI_SIER_CMDAU_EN 0x00040000
  80. #define CCSR_SSI_SIER_CMDDU_EN 0x00020000
  81. #define CCSR_SSI_SIER_RXT_EN 0x00010000
  82. #define CCSR_SSI_SIER_RDR1_EN 0x00008000
  83. #define CCSR_SSI_SIER_RDR0_EN 0x00004000
  84. #define CCSR_SSI_SIER_TDE1_EN 0x00002000
  85. #define CCSR_SSI_SIER_TDE0_EN 0x00001000
  86. #define CCSR_SSI_SIER_ROE1_EN 0x00000800
  87. #define CCSR_SSI_SIER_ROE0_EN 0x00000400
  88. #define CCSR_SSI_SIER_TUE1_EN 0x00000200
  89. #define CCSR_SSI_SIER_TUE0_EN 0x00000100
  90. #define CCSR_SSI_SIER_TFS_EN 0x00000080
  91. #define CCSR_SSI_SIER_RFS_EN 0x00000040
  92. #define CCSR_SSI_SIER_TLS_EN 0x00000020
  93. #define CCSR_SSI_SIER_RLS_EN 0x00000010
  94. #define CCSR_SSI_SIER_RFF1_EN 0x00000008
  95. #define CCSR_SSI_SIER_RFF0_EN 0x00000004
  96. #define CCSR_SSI_SIER_TFE1_EN 0x00000002
  97. #define CCSR_SSI_SIER_TFE0_EN 0x00000001
  98. #define CCSR_SSI_STCR_TXBIT0 0x00000200
  99. #define CCSR_SSI_STCR_TFEN1 0x00000100
  100. #define CCSR_SSI_STCR_TFEN0 0x00000080
  101. #define CCSR_SSI_STCR_TFDIR 0x00000040
  102. #define CCSR_SSI_STCR_TXDIR 0x00000020
  103. #define CCSR_SSI_STCR_TSHFD 0x00000010
  104. #define CCSR_SSI_STCR_TSCKP 0x00000008
  105. #define CCSR_SSI_STCR_TFSI 0x00000004
  106. #define CCSR_SSI_STCR_TFSL 0x00000002
  107. #define CCSR_SSI_STCR_TEFS 0x00000001
  108. #define CCSR_SSI_SRCR_RXEXT 0x00000400
  109. #define CCSR_SSI_SRCR_RXBIT0 0x00000200
  110. #define CCSR_SSI_SRCR_RFEN1 0x00000100
  111. #define CCSR_SSI_SRCR_RFEN0 0x00000080
  112. #define CCSR_SSI_SRCR_RFDIR 0x00000040
  113. #define CCSR_SSI_SRCR_RXDIR 0x00000020
  114. #define CCSR_SSI_SRCR_RSHFD 0x00000010
  115. #define CCSR_SSI_SRCR_RSCKP 0x00000008
  116. #define CCSR_SSI_SRCR_RFSI 0x00000004
  117. #define CCSR_SSI_SRCR_RFSL 0x00000002
  118. #define CCSR_SSI_SRCR_REFS 0x00000001
  119. /* STCCR and SRCCR */
  120. #define CCSR_SSI_SxCCR_DIV2 0x00040000
  121. #define CCSR_SSI_SxCCR_PSR 0x00020000
  122. #define CCSR_SSI_SxCCR_WL_SHIFT 13
  123. #define CCSR_SSI_SxCCR_WL_MASK 0x0001E000
  124. #define CCSR_SSI_SxCCR_WL(x) \
  125. (((((x) / 2) - 1) << CCSR_SSI_SxCCR_WL_SHIFT) & CCSR_SSI_SxCCR_WL_MASK)
  126. #define CCSR_SSI_SxCCR_DC_SHIFT 8
  127. #define CCSR_SSI_SxCCR_DC_MASK 0x00001F00
  128. #define CCSR_SSI_SxCCR_DC(x) \
  129. ((((x) - 1) << CCSR_SSI_SxCCR_DC_SHIFT) & CCSR_SSI_SxCCR_DC_MASK)
  130. #define CCSR_SSI_SxCCR_PM_SHIFT 0
  131. #define CCSR_SSI_SxCCR_PM_MASK 0x000000FF
  132. #define CCSR_SSI_SxCCR_PM(x) \
  133. ((((x) - 1) << CCSR_SSI_SxCCR_PM_SHIFT) & CCSR_SSI_SxCCR_PM_MASK)
  134. /*
  135. * The xFCNT bits are read-only, and the xFWM bits are read/write. Use the
  136. * CCSR_SSI_SFCSR_xFCNTy() macros to read the FIFO counters, and use the
  137. * CCSR_SSI_SFCSR_xFWMy() macros to set the watermarks.
  138. */
  139. #define CCSR_SSI_SFCSR_RFCNT1_SHIFT 28
  140. #define CCSR_SSI_SFCSR_RFCNT1_MASK 0xF0000000
  141. #define CCSR_SSI_SFCSR_RFCNT1(x) \
  142. (((x) & CCSR_SSI_SFCSR_RFCNT1_MASK) >> CCSR_SSI_SFCSR_RFCNT1_SHIFT)
  143. #define CCSR_SSI_SFCSR_TFCNT1_SHIFT 24
  144. #define CCSR_SSI_SFCSR_TFCNT1_MASK 0x0F000000
  145. #define CCSR_SSI_SFCSR_TFCNT1(x) \
  146. (((x) & CCSR_SSI_SFCSR_TFCNT1_MASK) >> CCSR_SSI_SFCSR_TFCNT1_SHIFT)
  147. #define CCSR_SSI_SFCSR_RFWM1_SHIFT 20
  148. #define CCSR_SSI_SFCSR_RFWM1_MASK 0x00F00000
  149. #define CCSR_SSI_SFCSR_RFWM1(x) \
  150. (((x) << CCSR_SSI_SFCSR_RFWM1_SHIFT) & CCSR_SSI_SFCSR_RFWM1_MASK)
  151. #define CCSR_SSI_SFCSR_TFWM1_SHIFT 16
  152. #define CCSR_SSI_SFCSR_TFWM1_MASK 0x000F0000
  153. #define CCSR_SSI_SFCSR_TFWM1(x) \
  154. (((x) << CCSR_SSI_SFCSR_TFWM1_SHIFT) & CCSR_SSI_SFCSR_TFWM1_MASK)
  155. #define CCSR_SSI_SFCSR_RFCNT0_SHIFT 12
  156. #define CCSR_SSI_SFCSR_RFCNT0_MASK 0x0000F000
  157. #define CCSR_SSI_SFCSR_RFCNT0(x) \
  158. (((x) & CCSR_SSI_SFCSR_RFCNT0_MASK) >> CCSR_SSI_SFCSR_RFCNT0_SHIFT)
  159. #define CCSR_SSI_SFCSR_TFCNT0_SHIFT 8
  160. #define CCSR_SSI_SFCSR_TFCNT0_MASK 0x00000F00
  161. #define CCSR_SSI_SFCSR_TFCNT0(x) \
  162. (((x) & CCSR_SSI_SFCSR_TFCNT0_MASK) >> CCSR_SSI_SFCSR_TFCNT0_SHIFT)
  163. #define CCSR_SSI_SFCSR_RFWM0_SHIFT 4
  164. #define CCSR_SSI_SFCSR_RFWM0_MASK 0x000000F0
  165. #define CCSR_SSI_SFCSR_RFWM0(x) \
  166. (((x) << CCSR_SSI_SFCSR_RFWM0_SHIFT) & CCSR_SSI_SFCSR_RFWM0_MASK)
  167. #define CCSR_SSI_SFCSR_TFWM0_SHIFT 0
  168. #define CCSR_SSI_SFCSR_TFWM0_MASK 0x0000000F
  169. #define CCSR_SSI_SFCSR_TFWM0(x) \
  170. (((x) << CCSR_SSI_SFCSR_TFWM0_SHIFT) & CCSR_SSI_SFCSR_TFWM0_MASK)
  171. #define CCSR_SSI_STR_TEST 0x00008000
  172. #define CCSR_SSI_STR_RCK2TCK 0x00004000
  173. #define CCSR_SSI_STR_RFS2TFS 0x00002000
  174. #define CCSR_SSI_STR_RXSTATE(x) (((x) >> 8) & 0x1F)
  175. #define CCSR_SSI_STR_TXD2RXD 0x00000080
  176. #define CCSR_SSI_STR_TCK2RCK 0x00000040
  177. #define CCSR_SSI_STR_TFS2RFS 0x00000020
  178. #define CCSR_SSI_STR_TXSTATE(x) ((x) & 0x1F)
  179. #define CCSR_SSI_SOR_CLKOFF 0x00000040
  180. #define CCSR_SSI_SOR_RX_CLR 0x00000020
  181. #define CCSR_SSI_SOR_TX_CLR 0x00000010
  182. #define CCSR_SSI_SOR_INIT 0x00000008
  183. #define CCSR_SSI_SOR_WAIT_SHIFT 1
  184. #define CCSR_SSI_SOR_WAIT_MASK 0x00000006
  185. #define CCSR_SSI_SOR_WAIT(x) (((x) & 3) << CCSR_SSI_SOR_WAIT_SHIFT)
  186. #define CCSR_SSI_SOR_SYNRST 0x00000001
  187. #endif