swrm_registers.h 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015, 2018-2019 The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _SWRM_REGISTERS_H
  6. #define _SWRM_REGISTERS_H
  7. #define SWRM_BASE_ADDRESS 0x00
  8. #define SWRM_COMP_HW_VERSION SWRM_BASE_ADDRESS
  9. #define SWRM_COMP_CFG_ADDR (SWRM_BASE_ADDRESS+0x00000004)
  10. #define SWRM_COMP_CFG_RMSK 0x3
  11. #define SWRM_COMP_CFG_IRQ_LEVEL_OR_PULSE_BMSK 0x2
  12. #define SWRM_COMP_CFG_IRQ_LEVEL_OR_PULSE_SHFT 0x1
  13. #define SWRM_COMP_CFG_ENABLE_BMSK 0x1
  14. #define SWRM_COMP_CFG_ENABLE_SHFT 0x0
  15. #define SWRM_COMP_SW_RESET (SWRM_BASE_ADDRESS+0x00000008)
  16. #define SWRM_COMP_STATUS (SWRM_BASE_ADDRESS+0x00000014)
  17. #define SWRM_COMP_PARAMS (SWRM_BASE_ADDRESS+0x100)
  18. #define SWRM_COMP_PARAMS_DOUT_PORTS_MASK 0x0000001F
  19. #define SWRM_COMP_PARAMS_DIN_PORTS_MASK 0x000003E0
  20. #define SWRM_COMP_PARAMS_WR_FIFO_DEPTH 0x00007C00
  21. #define SWRM_COMP_PARAMS_RD_FIFO_DEPTH 0x000F8000
  22. #define SWRM_COMP_PARAMS_AUTO_ENUM_SLAVES 0x00F00000
  23. #define SWRM_COMP_PARAMS_DATA_LANES 0x07000000
  24. #define SWRM_COMP_MASTER_ID (SWRM_BASE_ADDRESS+0x104)
  25. #define SWRM_INTERRUPT_STATUS (SWRM_BASE_ADDRESS+0x00000200)
  26. #define SWRM_INTERRUPT_STATUS_RMSK 0x1FFFD
  27. #define SWRM_INTERRUPT_STATUS_SLAVE_PEND_IRQ 0x1
  28. #define SWRM_INTERRUPT_STATUS_NEW_SLAVE_ATTACHED 0x2
  29. #define SWRM_INTERRUPT_STATUS_CHANGE_ENUM_SLAVE_STATUS 0x4
  30. #define SWRM_INTERRUPT_STATUS_MASTER_CLASH_DET 0x8
  31. #define SWRM_INTERRUPT_STATUS_RD_FIFO_OVERFLOW 0x10
  32. #define SWRM_INTERRUPT_STATUS_RD_FIFO_UNDERFLOW 0x20
  33. #define SWRM_INTERRUPT_STATUS_WR_CMD_FIFO_OVERFLOW 0x40
  34. #define SWRM_INTERRUPT_STATUS_CMD_ERROR 0x80
  35. #define SWRM_INTERRUPT_STATUS_DOUT_PORT_COLLISION 0x100
  36. #define SWRM_INTERRUPT_STATUS_READ_EN_RD_VALID_MISMATCH 0x200
  37. #define SWRM_INTERRUPT_STATUS_SPECIAL_CMD_ID_FINISHED 0x400
  38. #define SWRM_INTERRUPT_STATUS_NEW_SLAVE_AUTO_ENUM_FINISHED 0x800
  39. #define SWRM_INTERRUPT_STATUS_AUTO_ENUM_FAILED 0x1000
  40. #define SWRM_INTERRUPT_STATUS_AUTO_ENUM_TABLE_IS_FULL 0x2000
  41. #define SWRM_INTERRUPT_STATUS_BUS_RESET_FINISHED 0x4000
  42. #define SWRM_INTERRUPT_STATUS_CLK_STOP_FINISHED 0x8000
  43. #define SWRM_INTERRUPT_STATUS_ERROR_PORT_TEST 0x10000
  44. #define SWRM_INTERRUPT_STATUS_AUTO_ENUM_FAILED_V2 0x800
  45. #define SWRM_INTERRUPT_STATUS_AUTO_ENUM_TABLE_IS_FULL_V2 0x1000
  46. #define SWRM_INTERRUPT_STATUS_BUS_RESET_FINISHED_V2 0x2000
  47. #define SWRM_INTERRUPT_STATUS_CLK_STOP_FINISHED_V2 0x4000
  48. #define SWRM_INTERRUPT_STATUS_ERROR_PORT_TEST_V2 0x8000
  49. #define SWRM_INTERRUPT_STATUS_EXT_CLK_STOP_WAKEUP 0x10000
  50. #define SWRM_INTERRUPT_MASK_ADDR (SWRM_BASE_ADDRESS+0x00000204)
  51. #define SWRM_INTERRUPT_MASK_RMSK 0x1FFFF
  52. #define SWRM_INTERRUPT_MASK_SLAVE_PEND_IRQ_BMSK 0x1
  53. #define SWRM_INTERRUPT_MASK_SLAVE_PEND_IRQ_SHFT 0x0
  54. #define SWRM_INTERRUPT_MASK_NEW_SLAVE_ATTACHED_BMSK 0x2
  55. #define SWRM_INTERRUPT_MASK_NEW_SLAVE_ATTACHED_SHFT 0x1
  56. #define SWRM_INTERRUPT_MASK_CHANGE_ENUM_SLAVE_STATUS_BMSK 0x4
  57. #define SWRM_INTERRUPT_MASK_CHANGE_ENUM_SLAVE_STATUS_SHFT 0x2
  58. #define SWRM_INTERRUPT_MASK_MASTER_CLASH_DET_BMSK 0x8
  59. #define SWRM_INTERRUPT_MASK_MASTER_CLASH_DET_SHFT 0x3
  60. #define SWRM_INTERRUPT_MASK_RD_FIFO_OVERFLOW_BMSK 0x10
  61. #define SWRM_INTERRUPT_MASK_RD_FIFO_OVERFLOW_SHFT 0x4
  62. #define SWRM_INTERRUPT_MASK_RD_FIFO_UNDERFLOW_BMSK 0x20
  63. #define SWRM_INTERRUPT_MASK_RD_FIFO_UNDERFLOW_SHFT 0x5
  64. #define SWRM_INTERRUPT_MASK_WR_CMD_FIFO_OVERFLOW_BMSK 0x40
  65. #define SWRM_INTERRUPT_MASK_WR_CMD_FIFO_OVERFLOW_SHFT 0x6
  66. #define SWRM_INTERRUPT_MASK_CMD_ERROR_BMSK 0x80
  67. #define SWRM_INTERRUPT_MASK_CMD_ERROR_SHFT 0x7
  68. #define SWRM_INTERRUPT_MASK_DOUT_PORT_COLLISION_BMSK 0x100
  69. #define SWRM_INTERRUPT_MASK_DOUT_PORT_COLLISION_SHFT 0x8
  70. #define SWRM_INTERRUPT_MASK_READ_EN_RD_VALID_MISMATCH_BMSK 0x200
  71. #define SWRM_INTERRUPT_MASK_READ_EN_RD_VALID_MISMATCH_SHFT 0x9
  72. #define SWRM_INTERRUPT_MASK_SPECIAL_CMD_ID_FINISHED_BMSK 0x400
  73. #define SWRM_INTERRUPT_MASK_SPECIAL_CMD_ID_FINISHED_SHFT 0xA
  74. #define SWRM_INTERRUPT_MASK_NEW_SLAVE_AUTO_ENUM_FINISHED_BMSK 0x800
  75. #define SWRM_INTERRUPT_MASK_NEW_SLAVE_AUTO_ENUM_FINISHED_SHFT 0xB
  76. #define SWRM_INTERRUPT_MASK_AUTO_ENUM_FAILED_BMSK 0x1000
  77. #define SWRM_INTERRUPT_MASK_AUTO_ENUM_FAILED_SHFT 0xC
  78. #define SWRM_INTERRUPT_MASK_AUTO_ENUM_TABLE_IS_FULL_BMSK 0x2000
  79. #define SWRM_INTERRUPT_MASK_AUTO_ENUM_TABLE_IS_FULL_SHFT 0xD
  80. #define SWRM_INTERRUPT_MASK_BUS_RESET_FINISHED_BMSK 0x4000
  81. #define SWRM_INTERRUPT_MASK_BUS_RESET_FINISHED_SHFT 0xE
  82. #define SWRM_INTERRUPT_MASK_CLK_STOP_FINISHED_BMSK 0x8000
  83. #define SWRM_INTERRUPT_MASK_CLK_STOP_FINISHED_SHFT 0xF
  84. #define SWRM_INTERRUPT_MASK_ERROR_PORT_TEST_BMSK 0x10000
  85. #define SWRM_INTERRUPT_MASK_ERROR_PORT_TEST_SHFT 0x10
  86. #define SWRM_INTERRUPT_MAX 0x11
  87. #define SWRM_INTERRUPT_CLEAR (SWRM_BASE_ADDRESS+0x00000208)
  88. #define SWR_MSTR_RX_SWRM_CPU_INTERRUPT_EN (SWRM_BASE_ADDRESS+0x00000210)
  89. #define SWRM_CMD_FIFO_WR_CMD (SWRM_BASE_ADDRESS + 0x00000300)
  90. #define SWRM_CMD_FIFO_WR_CMD_MASK 0xFFFFFFFF
  91. #define SWRM_CMD_FIFO_RD_CMD (SWRM_BASE_ADDRESS + 0x00000304)
  92. #define SWRM_CMD_FIFO_RD_CMD_MASK 0xFFFFFFF
  93. #define SWRM_CMD_FIFO_CMD (SWRM_BASE_ADDRESS + 0x00000308)
  94. #define SWRM_CMD_FIFO_STATUS (SWRM_BASE_ADDRESS + 0x0000030C)
  95. #define SWRM_CMD_FIFO_STATUS_WR_CMD_FIFO_CNT_MASK 0x1F00
  96. #define SWRM_CMD_FIFO_STATUS_RD_CMD_FIFO_CNT_MASK 0x7C00000
  97. #define SWRM_CMD_FIFO_CFG_ADDR (SWRM_BASE_ADDRESS+0x00000314)
  98. #define SWRM_CMD_FIFO_CFG_NUM_OF_CMD_RETRY_BMSK 0x7
  99. #define SWRM_CMD_FIFO_CFG_NUM_OF_CMD_RETRY_SHFT 0x0
  100. #define SWRM_CMD_FIFO_RD_FIFO_ADDR (SWRM_BASE_ADDRESS + 0x00000318)
  101. #define SWRM_ENUMERATOR_CFG_ADDR (SWRM_BASE_ADDRESS+0x00000500)
  102. #define SWRM_ENUMERATOR_CFG_AUTO_ENUM_EN_BMSK 0x1
  103. #define SWRM_ENUMERATOR_CFG_AUTO_ENUM_EN_SHFT 0x0
  104. #define SWRM_ENUMERATOR_STATUS (SWRM_BASE_ADDRESS+0x00000504)
  105. #define SWRM_ENUMERATOR_SLAVE_DEV_ID_1(m) (SWRM_BASE_ADDRESS+0x530+0x8*m)
  106. #define SWRM_ENUMERATOR_SLAVE_DEV_ID_2(m) (SWRM_BASE_ADDRESS+0x534+0x8*m)
  107. #define SWRM_MCP_FRAME_CTRL_BANK_ADDR(m) (SWRM_BASE_ADDRESS+0x101C+0x40*m)
  108. #define SWRM_MCP_FRAME_CTRL_BANK_RMSK 0x00ff07ff
  109. #define SWRM_MCP_FRAME_CTRL_BANK_SHFT 0
  110. #define SWRM_MCP_FRAME_CTRL_BANK_SSP_PERIOD_BMSK 0xff0000
  111. #define SWRM_MCP_FRAME_CTRL_BANK_SSP_PERIOD_SHFT 16
  112. #define SWRM_MCP_FRAME_CTRL_BANK_PHASE_BMSK 0xf800
  113. #define SWRM_MCP_FRAME_CTRL_BANK_PHASE_SHFT 11
  114. #define SWRM_MCP_FRAME_CTRL_BANK_CLK_DIV_VALUE_BMSK 0x700
  115. #define SWRM_MCP_FRAME_CTRL_BANK_CLK_DIV_VALUE_SHFT 8
  116. #define SWRM_MCP_FRAME_CTRL_BANK_ROW_CTRL_BMSK 0xF8
  117. #define SWRM_MCP_FRAME_CTRL_BANK_ROW_CTRL_SHFT 3
  118. #define SWRM_MCP_FRAME_CTRL_BANK_COL_CTRL_BMSK 0x7
  119. #define SWRM_MCP_FRAME_CTRL_BANK_COL_CTRL_SHFT 0
  120. #define SWRM_MCP_BUS_CTRL_ADDR (SWRM_BASE_ADDRESS+0x00001044)
  121. #define SWRM_MCP_BUS_CTRL_BUS_RESET_BMSK 0x1
  122. #define SWRM_MCP_BUS_CTRL_BUS_RESET_SHFT 0x0
  123. #define SWRM_MCP_BUS_CTRL_CLK_START_BMSK 0x2
  124. #define SWRM_MCP_BUS_CTRL_CLK_START_SHFT 0x1
  125. #define SWRM_MCP_CFG_ADDR (SWRM_BASE_ADDRESS+0x00001048)
  126. #define SWRM_MCP_CFG_MAX_NUM_OF_CMD_NO_PINGS_BMSK 0x3E0000
  127. #define SWRM_MCP_CFG_MAX_NUM_OF_CMD_NO_PINGS_SHFT 0x11
  128. #define SWRM_MCP_CFG_BUS_CLK_PAUSE_BMSK 0x02
  129. #define SWRM_MCP_STATUS (SWRM_BASE_ADDRESS+0x104C)
  130. #define SWRM_MCP_STATUS_BANK_NUM_MASK 0x01
  131. #define SWRM_MCP_SLV_STATUS (SWRM_BASE_ADDRESS+0x1090)
  132. #define SWRM_MCP_SLV_STATUS_MASK 0x03
  133. #define SWRM_DP_PORT_CTRL_BANK(n, m) (SWRM_BASE_ADDRESS + \
  134. 0x00001124 + \
  135. 0x100*(n-1) + \
  136. 0x40*m)
  137. #define SWRM_DP_PORT_CTRL_BANK_MASK 0xFFFFFFFF
  138. #define SWRM_DP_PORT_CTRL_EN_CHAN_MASK 0xFF000000
  139. #define SWRM_DP_PORT_CTRL_EN_CHAN_SHFT 0x18
  140. #define SWRM_DP_PORT_CTRL_OFFSET2_SHFT 0x10
  141. #define SWRM_DP_PORT_CTRL_OFFSET1_SHFT 0x08
  142. #define SWRM_DP_PORT_CTRL_SAMPLE_INTERVAL 0x00
  143. #define SWRM_DP_PORT_CTRL_2_BANK(n, m) (SWRM_BASE_ADDRESS + \
  144. 0x00001128 + \
  145. 0x100*(n-1) + \
  146. 0x40*m)
  147. #define SWRM_DP_BLOCK_CTRL_1(n) (SWRM_BASE_ADDRESS + \
  148. 0x0000112C + \
  149. 0x100*(n-1))
  150. #define SWRM_DP_BLOCK_CTRL2_BANK(n, m) (SWRM_BASE_ADDRESS + \
  151. 0x00001130 + \
  152. 0x100*(n-1) + \
  153. 0x40*m)
  154. #define SWRM_DP_PORT_HCTRL_BANK(n, m) (SWRM_BASE_ADDRESS + \
  155. 0x00001134 + \
  156. 0x100*(n-1) + \
  157. 0x40*m)
  158. #define SWRM_DP_BLOCK_CTRL3_BANK(n, m) (SWRM_BASE_ADDRESS + \
  159. 0x00001138 + \
  160. 0x100*(n-1) + \
  161. 0x40*m)
  162. #define SWRM_DIN_DPn_PCM_PORT_CTRL(n) (SWRM_BASE_ADDRESS + \
  163. 0x00001054 + 0x100*(n-1))
  164. #define SWRM_MAX_REGISTER SWRM_DIN_DPn_PCM_PORT_CTRL(7)
  165. /* Soundwire Slave Register definition */
  166. #define SWRS_BASE_ADDRESS 0x00
  167. #define SWRS_DP_REG_OFFSET(port, bank) ((0x100*port)+(0x10*bank))
  168. #define SWRS_SCP_INT_STATUS_CLEAR_1 0x40
  169. #define SWRS_SCP_INT_STATUS_MASK_1 0x41
  170. #define SWRS_SCP_CONTROL 0x44
  171. #define SWRS_DP_BLOCK_CONTROL_1(n) (SWRS_BASE_ADDRESS + 0x103 + \
  172. 0x100 * n)
  173. #define SWRS_DP_CHANNEL_ENABLE_BANK(n, m) (SWRS_BASE_ADDRESS + 0x120 + \
  174. SWRS_DP_REG_OFFSET(n, m))
  175. #define SWRS_DP_BLOCK_CONTROL_2_BANK(n, m) (SWRS_BASE_ADDRESS + 0x121 + \
  176. SWRS_DP_REG_OFFSET(n, m))
  177. #define SWRS_DP_SAMPLE_CONTROL_1_BANK(n, m) (SWRS_BASE_ADDRESS + 0x122 + \
  178. SWRS_DP_REG_OFFSET(n, m))
  179. #define SWRS_DP_SAMPLE_CONTROL_2_BANK(n, m) (SWRS_BASE_ADDRESS + 0x123 + \
  180. SWRS_DP_REG_OFFSET(n, m))
  181. #define SWRS_DP_OFFSET_CONTROL_1_BANK(n, m) (SWRS_BASE_ADDRESS + 0x124 + \
  182. SWRS_DP_REG_OFFSET(n, m))
  183. #define SWRS_DP_OFFSET_CONTROL_2_BANK(n, m) (SWRS_BASE_ADDRESS + 0x125 + \
  184. SWRS_DP_REG_OFFSET(n, m))
  185. #define SWRS_DP_HCONTROL_BANK(n, m) (SWRS_BASE_ADDRESS + 0x126 + \
  186. SWRS_DP_REG_OFFSET(n, m))
  187. #define SWRS_DP_BLOCK_CONTROL_3_BANK(n, m) (SWRS_BASE_ADDRESS + 0x127 + \
  188. SWRS_DP_REG_OFFSET(n, m))
  189. #define SWRS_DP_LANE_CONTROL_BANK(n, m) (SWRS_BASE_ADDRESS + 0x128 + \
  190. SWRS_DP_REG_OFFSET(n, m))
  191. #define SWRS_SCP_FRAME_CTRL_BANK(m) (SWRS_BASE_ADDRESS + 0x60 + \
  192. 0x10*m)
  193. #define SWRS_SCP_HOST_CLK_DIV2_CTL_BANK(m) (SWRS_BASE_ADDRESS + 0xE0 + \
  194. 0x10*m)
  195. #endif /* _SWRM_REGISTERS_H */