btfm_slim_slave.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef BTFM_SLIM_SLAVE_H
  7. #define BTFM_SLIM_SLAVE_H
  8. #include "btfm_slim.h"
  9. /* Registers Address */
  10. #define SLAVE_SB_COMP_TEST 0x00000000
  11. #define SLAVE_SB_SLAVE_HW_REV_MSB 0x00000001
  12. #define SLAVE_SB_SLAVE_HW_REV_LSB 0x00000002
  13. #define SLAVE_SB_DEBUG_FEATURES 0x00000005
  14. #define SLAVE_SB_INTF_INT_EN 0x00000010
  15. #define SLAVE_SB_INTF_INT_STATUS 0x00000011
  16. #define SLAVE_SB_INTF_INT_CLR 0x00000012
  17. #define SLAVE_SB_FRM_CFG 0x00000013
  18. #define SLAVE_SB_FRM_STATUS 0x00000014
  19. #define SLAVE_SB_FRM_INT_EN 0x00000015
  20. #define SLAVE_SB_FRM_INT_STATUS 0x00000016
  21. #define SLAVE_SB_FRM_INT_CLR 0x00000017
  22. #define SLAVE_SB_FRM_WAKEUP 0x00000018
  23. #define SLAVE_SB_FRM_CLKCTL_DONE 0x00000019
  24. #define SLAVE_SB_FRM_IE_STATUS 0x0000001A
  25. #define SLAVE_SB_FRM_VE_STATUS 0x0000001B
  26. #define SLAVE_SB_PGD_TX_CFG_STATUS 0x00000020
  27. #define SLAVE_SB_PGD_RX_CFG_STATUS 0x00000021
  28. #define SLAVE_SB_PGD_DEV_INT_EN 0x00000022
  29. #define SLAVE_SB_PGD_DEV_INT_STATUS 0x00000023
  30. #define SLAVE_SB_PGD_DEV_INT_CLR 0x00000024
  31. #define SLAVE_SB_PGD_PORT_INT_EN_RX_0 0x00000030
  32. #define SLAVE_SB_PGD_PORT_INT_EN_RX_1 0x00000031
  33. #define SLAVE_SB_PGD_PORT_INT_EN_TX_0 0x00000032
  34. #define SLAVE_SB_PGD_PORT_INT_EN_TX_1 0x00000033
  35. #define SLAVE_SB_PGD_PORT_INT_STATUS_RX_0 0x00000034
  36. #define SLAVE_SB_PGD_PORT_INT_STATUS_RX_1 0x00000035
  37. #define SLAVE_SB_PGD_PORT_INT_STATUS_TX_0 0x00000036
  38. #define SLAVE_SB_PGD_PORT_INT_STATUS_TX_1 0x00000037
  39. #define SLAVE_SB_PGD_PORT_INT_CLR_RX_0 0x00000038
  40. #define SLAVE_SB_PGD_PORT_INT_CLR_RX_1 0x00000039
  41. #define SLAVE_SB_PGD_PORT_INT_CLR_TX_0 0x0000003A
  42. #define SLAVE_SB_PGD_PORT_INT_CLR_TX_1 0x0000003B
  43. #define SLAVE_SB_PGD_PORT_RX_CFGN(n) (0x00000040 + n)
  44. #define SLAVE_SB_PGD_PORT_TX_CFGN(n) (0x00000050 + n)
  45. #define SLAVE_SB_PGD_PORT_INT_RX_SOURCEN(n) (0x00000060 + n)
  46. #define SLAVE_SB_PGD_PORT_INT_TX_SOURCEN(n) (0x00000070 + n)
  47. #define SLAVE_SB_PGD_PORT_RX_STATUSN(n) (0x00000080 + n)
  48. #define SLAVE_SB_PGD_PORT_TX_STATUSN(n) (0x00000090 + n)
  49. #define SLAVE_SB_PGD_TX_PORTn_MULTI_CHNL_0(n) (0x00000100 + 0x4*n)
  50. #define SLAVE_SB_PGD_TX_PORTn_MULTI_CHNL_1(n) (0x00000101 + 0x4*n)
  51. #define SLAVE_SB_PGD_RX_PORTn_MULTI_CHNL_0(n) (0x00000180 + 0x4*n)
  52. #define SLAVE_SB_PGD_RX_PORTn_MULTI_CHNL_1(n) (0x00000181 + 0x4*n)
  53. #define SLAVE_SB_PGD_PORT_TX_OR_UR_CFGN(n) (0x000001F0 + n)
  54. /* Register Bit Setting */
  55. #define SLAVE_ENABLE_OVERRUN_AUTO_RECOVERY (0x1 << 1)
  56. #define SLAVE_ENABLE_UNDERRUN_AUTO_RECOVERY (0x1 << 0)
  57. #define SLAVE_SB_PGD_PORT_ENABLE (0x1 << 0)
  58. #define SLAVE_SB_PGD_PORT_DISABLE (0x0 << 0)
  59. #define SLAVE_SB_PGD_PORT_WM_L1 (0x1 << 1)
  60. #define SLAVE_SB_PGD_PORT_WM_L2 (0x2 << 1)
  61. #define SLAVE_SB_PGD_PORT_WM_L3 (0x3 << 1)
  62. #define SLAVE_SB_PGD_PORT_WM_L8 (0x8 << 1)
  63. #define SLAVE_SB_PGD_PORT_WM_LB (0xB << 1)
  64. #define SLAVE_SB_PGD_PORT_RX_NUM 16
  65. #define SLAVE_SB_PGD_PORT_TX_NUM 16
  66. /* PGD Port Map */
  67. #define SLAVE_SB_PGD_PORT_TX_SCO 0
  68. #define SLAVE_SB_PGD_PORT_TX1_FM 1
  69. #define SLAVE_SB_PGD_PORT_TX2_FM 2
  70. #define CHRKVER3_SB_PGD_PORT_TX1_FM 5
  71. #define CHRKVER3_SB_PGD_PORT_TX2_FM 4
  72. #define SLAVE_SB_PGD_PORT_RX_SCO 16
  73. #define SLAVE_SB_PGD_PORT_RX_A2P 17
  74. enum {
  75. QCA_CHEROKEE_SOC_ID_0200 = 0x40010200,
  76. QCA_CHEROKEE_SOC_ID_0201 = 0x40010201,
  77. QCA_CHEROKEE_SOC_ID_0210 = 0x40010214,
  78. QCA_CHEROKEE_SOC_ID_0211 = 0x40010224,
  79. QCA_CHEROKEE_SOC_ID_0310 = 0x40010310,
  80. QCA_CHEROKEE_SOC_ID_0320 = 0x40010320,
  81. QCA_CHEROKEE_SOC_ID_0320_UMC = 0x40014320,
  82. };
  83. enum {
  84. QCA_APACHE_SOC_ID_0100 = 0x40020120,
  85. QCA_APACHE_SOC_ID_0110 = 0x40020130,
  86. QCA_APACHE_SOC_ID_0120 = 0x40020140,
  87. QCA_APACHE_SOC_ID_0121 = 0x40020150,
  88. };
  89. enum {
  90. QCA_COMANCHE_SOC_ID_0101 = 0x40070101,
  91. QCA_COMANCHE_SOC_ID_0110 = 0x40070110,
  92. QCA_COMANCHE_SOC_ID_0120 = 0x40070120,
  93. QCA_COMANCHE_SOC_ID_0130 = 0x40070130,
  94. QCA_COMANCHE_SOC_ID_4130 = 0x40074130,
  95. QCA_COMANCHE_SOC_ID_5120 = 0x40075120,
  96. QCA_COMANCHE_SOC_ID_5130 = 0x40075130,
  97. };
  98. enum {
  99. QCA_HASTINGS_SOC_ID_0200 = 0x400A0200,
  100. };
  101. enum {
  102. QCA_HSP_SOC_ID_0100 = 0x400C0100,
  103. QCA_HSP_SOC_ID_0110 = 0x400C0110,
  104. QCA_HSP_SOC_ID_0200 = 0x400C0200,
  105. QCA_HSP_SOC_ID_0210 = 0x400C0210,
  106. QCA_HSP_SOC_ID_1201 = 0x400C1201,
  107. QCA_HSP_SOC_ID_1211 = 0x400C1211,
  108. };
  109. enum {
  110. QCA_MOSELLE_SOC_ID_0100 = 0x40140100,
  111. QCA_MOSELLE_SOC_ID_0110 = 0x40140110,
  112. QCA_MOSELLE_SOC_ID_0120 = 0x40140120,
  113. };
  114. enum {
  115. QCA_HAMILTON_SOC_ID_0100 = 0x40170100,
  116. QCA_HAMILTON_SOC_ID_0101 = 0x40170101,
  117. QCA_HAMILTON_SOC_ID_0200 = 0x40170200,
  118. };
  119. /* Function Prototype */
  120. /*
  121. * btfm_slim_slave_hw_init: Initialize slave specific slimbus slave device
  122. * @btfmslim: slimbus slave device data pointer.
  123. * Returns:
  124. * 0: Success
  125. * else: Fail
  126. */
  127. int btfm_slim_slave_hw_init(struct btfmslim *btfmslim);
  128. /*
  129. * btfm_slim_slave_enable_rxport: Enable slave Rx port by given port number
  130. * @btfmslim: slimbus slave device data pointer.
  131. * @portNum: slimbus slave port number to enable
  132. * @rxport: rxport or txport
  133. * @enable: enable port or disable port
  134. * Returns:
  135. * 0: Success
  136. * else: Fail
  137. */
  138. int btfm_slim_slave_enable_port(struct btfmslim *btfmslim, uint8_t portNum,
  139. uint8_t rxport, uint8_t enable);
  140. /* Specific defines for slave slimbus device */
  141. #define SLAVE_SLIM_REG_OFFSET 0x0800
  142. #ifdef SLIM_SLAVE_REG_OFFSET
  143. #undef SLIM_SLAVE_REG_OFFSET
  144. #define SLIM_SLAVE_REG_OFFSET SLAVE_SLIM_REG_OFFSET
  145. #endif
  146. /* Assign vendor specific function */
  147. extern struct btfmslim_ch slave_txport[];
  148. extern struct btfmslim_ch slave_rxport[];
  149. #ifdef SLIM_SLAVE_RXPORT
  150. #undef SLIM_SLAVE_RXPORT
  151. #define SLIM_SLAVE_RXPORT (&slave_rxport[0])
  152. #endif
  153. #ifdef SLIM_SLAVE_TXPORT
  154. #undef SLIM_SLAVE_TXPORT
  155. #define SLIM_SLAVE_TXPORT (&slave_txport[0])
  156. #endif
  157. #ifdef SLIM_SLAVE_INIT
  158. #undef SLIM_SLAVE_INIT
  159. #define SLIM_SLAVE_INIT btfm_slim_slave_hw_init
  160. #endif
  161. #ifdef SLIM_SLAVE_PORT_EN
  162. #undef SLIM_SLAVE_PORT_EN
  163. #define SLIM_SLAVE_PORT_EN btfm_slim_slave_enable_port
  164. #endif
  165. #endif