qca9984def.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /*
  2. * Copyright (c) 2015,2016 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #if defined(QCA9984_HEADERS_DEF)
  19. #define QCA9984 1
  20. #define WLAN_HEADERS 1
  21. #include "common_drv.h"
  22. #include "QCA9984/soc_addrs.h"
  23. #include "QCA9984/extra/hw/apb_map.h"
  24. #include "QCA9984/hw/gpio_athr_wlan_reg.h"
  25. #ifdef WLAN_HEADERS
  26. #include "QCA9984/extra/hw/wifi_top_reg_map.h"
  27. #include "QCA9984/hw/rtc_soc_reg.h"
  28. #endif
  29. #include "QCA9984/hw/si_reg.h"
  30. #include "QCA9984/extra/hw/pcie_local_reg.h"
  31. #include "QCA9984/hw/ce_wrapper_reg_csr.h"
  32. #include "QCA9984/extra/hw/soc_core_reg.h"
  33. #include "QCA9984/hw/soc_pcie_reg.h"
  34. #include "QCA9984/extra/hw/ce_reg_csr.h"
  35. #include <QCA9984/hw/interface/rx_location_info.h>
  36. #include <QCA9984/hw/interface/rx_pkt_end.h>
  37. #include <QCA9984/hw/interface/rx_phy_ppdu_end.h>
  38. #include <QCA9984/hw/interface/rx_timing_offset.h>
  39. #include <QCA9984/hw/interface/rx_location_info.h>
  40. #include <QCA9984/hw/tlv/rx_ppdu_start.h>
  41. #include <QCA9984/hw/tlv/rx_ppdu_end.h>
  42. #include <QCA9984/hw/tlv/rx_mpdu_start.h>
  43. #include <QCA9984/hw/tlv/rx_mpdu_end.h>
  44. #include <QCA9984/hw/tlv/rx_msdu_start.h>
  45. #include <QCA9984/hw/tlv/rx_msdu_end.h>
  46. #include <QCA9984/hw/tlv/rx_attention.h>
  47. #include <QCA9984/hw/tlv/rx_frag_info.h>
  48. #include <QCA9984/hw/datastruct/msdu_link_ext.h>
  49. #include <QCA9984/hw/emu_phy_reg.h>
  50. /* Base address is defined in pcie_local_reg.h. Macros which access the
  51. * registers include the base address in their definition.
  52. */
  53. #define PCIE_LOCAL_BASE_ADDRESS 0
  54. #define FW_EVENT_PENDING_ADDRESS (WIFICMN_SCRATCH_3_ADDRESS)
  55. #define DRAM_BASE_ADDRESS TARG_DRAM_START
  56. /* Backwards compatibility -- TBDXXX */
  57. #define MISSING 0
  58. #define WLAN_SYSTEM_SLEEP_DISABLE_LSB WIFI_SYSTEM_SLEEP_DISABLE_LSB
  59. #define WLAN_SYSTEM_SLEEP_DISABLE_MASK WIFI_SYSTEM_SLEEP_DISABLE_MASK
  60. #define WLAN_RESET_CONTROL_COLD_RST_MASK WIFI_RESET_CONTROL_MAC_COLD_RST_MASK
  61. #define WLAN_RESET_CONTROL_WARM_RST_MASK WIFI_RESET_CONTROL_MAC_WARM_RST_MASK
  62. #define SOC_CLOCK_CONTROL_OFFSET SOC_CLOCK_CONTROL_ADDRESS
  63. #define SOC_RESET_CONTROL_OFFSET SOC_RESET_CONTROL_ADDRESS
  64. #define CPU_CLOCK_OFFSET SOC_CPU_CLOCK_ADDRESS
  65. #define SOC_LPO_CAL_OFFSET SOC_LPO_CAL_ADDRESS
  66. #define SOC_RESET_CONTROL_CE_RST_MASK WIFI_RESET_CONTROL_CE_RESET_MASK
  67. #define WLAN_SYSTEM_SLEEP_OFFSET WIFI_SYSTEM_SLEEP_ADDRESS
  68. #define WLAN_RESET_CONTROL_OFFSET WIFI_RESET_CONTROL_ADDRESS
  69. #define CLOCK_CONTROL_OFFSET SOC_CLOCK_CONTROL_OFFSET
  70. #define CLOCK_CONTROL_SI0_CLK_MASK SOC_CLOCK_CONTROL_SI0_CLK_MASK
  71. #define RESET_CONTROL_SI0_RST_MASK SOC_RESET_CONTROL_SI0_RST_MASK
  72. #define GPIO_BASE_ADDRESS WLAN_GPIO_BASE_ADDRESS
  73. #define GPIO_PIN0_OFFSET WLAN_GPIO_PIN0_ADDRESS
  74. #define GPIO_PIN1_OFFSET WLAN_GPIO_PIN1_ADDRESS
  75. #define GPIO_PIN0_CONFIG_MASK WLAN_GPIO_PIN0_CONFIG_MASK
  76. #define GPIO_PIN1_CONFIG_MASK WLAN_GPIO_PIN1_CONFIG_MASK
  77. #define SI_BASE_ADDRESS WLAN_SI_BASE_ADDRESS
  78. #define SCRATCH_BASE_ADDRESS SOC_CORE_BASE_ADDRESS
  79. #define LOCAL_SCRATCH_OFFSET 0x18
  80. #define GPIO_PIN10_OFFSET WLAN_GPIO_PIN10_ADDRESS
  81. #define GPIO_PIN11_OFFSET WLAN_GPIO_PIN11_ADDRESS
  82. #define GPIO_PIN12_OFFSET WLAN_GPIO_PIN12_ADDRESS
  83. #define GPIO_PIN13_OFFSET WLAN_GPIO_PIN13_ADDRESS
  84. #define SI_CONFIG_OFFSET SI_CONFIG_ADDRESS
  85. #define SI_TX_DATA0_OFFSET SI_TX_DATA0_ADDRESS
  86. #define SI_TX_DATA1_OFFSET SI_TX_DATA1_ADDRESS
  87. #define SI_RX_DATA0_OFFSET SI_RX_DATA0_ADDRESS
  88. #define SI_RX_DATA1_OFFSET SI_RX_DATA1_ADDRESS
  89. #define SI_CS_OFFSET SI_CS_ADDRESS
  90. #define CPU_CLOCK_STANDARD_LSB SOC_CPU_CLOCK_STANDARD_LSB
  91. #define CPU_CLOCK_STANDARD_MASK SOC_CPU_CLOCK_STANDARD_MASK
  92. #define LPO_CAL_ENABLE_LSB SOC_LPO_CAL_ENABLE_LSB
  93. #define LPO_CAL_ENABLE_MASK SOC_LPO_CAL_ENABLE_MASK
  94. #define ANALOG_INTF_BASE_ADDRESS WLAN_ANALOG_INTF_BASE_ADDRESS
  95. #define MBOX_BASE_ADDRESS MISSING
  96. #define INT_STATUS_ENABLE_ERROR_LSB MISSING
  97. #define INT_STATUS_ENABLE_ERROR_MASK MISSING
  98. #define INT_STATUS_ENABLE_CPU_LSB MISSING
  99. #define INT_STATUS_ENABLE_CPU_MASK MISSING
  100. #define INT_STATUS_ENABLE_COUNTER_LSB MISSING
  101. #define INT_STATUS_ENABLE_COUNTER_MASK MISSING
  102. #define INT_STATUS_ENABLE_MBOX_DATA_LSB MISSING
  103. #define INT_STATUS_ENABLE_MBOX_DATA_MASK MISSING
  104. #define ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB MISSING
  105. #define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK MISSING
  106. #define ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB MISSING
  107. #define ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK MISSING
  108. #define COUNTER_INT_STATUS_ENABLE_BIT_LSB MISSING
  109. #define COUNTER_INT_STATUS_ENABLE_BIT_MASK MISSING
  110. #define INT_STATUS_ENABLE_ADDRESS MISSING
  111. #define CPU_INT_STATUS_ENABLE_BIT_LSB MISSING
  112. #define CPU_INT_STATUS_ENABLE_BIT_MASK MISSING
  113. #define HOST_INT_STATUS_ADDRESS MISSING
  114. #define CPU_INT_STATUS_ADDRESS MISSING
  115. #define ERROR_INT_STATUS_ADDRESS MISSING
  116. #define ERROR_INT_STATUS_WAKEUP_MASK MISSING
  117. #define ERROR_INT_STATUS_WAKEUP_LSB MISSING
  118. #define ERROR_INT_STATUS_RX_UNDERFLOW_MASK MISSING
  119. #define ERROR_INT_STATUS_RX_UNDERFLOW_LSB MISSING
  120. #define ERROR_INT_STATUS_TX_OVERFLOW_MASK MISSING
  121. #define ERROR_INT_STATUS_TX_OVERFLOW_LSB MISSING
  122. #define COUNT_DEC_ADDRESS MISSING
  123. #define HOST_INT_STATUS_CPU_MASK MISSING
  124. #define HOST_INT_STATUS_CPU_LSB MISSING
  125. #define HOST_INT_STATUS_ERROR_MASK MISSING
  126. #define HOST_INT_STATUS_ERROR_LSB MISSING
  127. #define HOST_INT_STATUS_COUNTER_MASK MISSING
  128. #define HOST_INT_STATUS_COUNTER_LSB MISSING
  129. #define RX_LOOKAHEAD_VALID_ADDRESS MISSING
  130. #define WINDOW_DATA_ADDRESS MISSING
  131. #define WINDOW_READ_ADDR_ADDRESS MISSING
  132. #define WINDOW_WRITE_ADDR_ADDRESS MISSING
  133. /* MAC Descriptor */
  134. #define RX_PPDU_END_ANTENNA_OFFSET_DWORD (RX_PPDU_END_25_RX_ANTENNA_OFFSET >> 2)
  135. /* GPIO Register */
  136. #define GPIO_ENABLE_W1TS_LOW_ADDRESS WLAN_GPIO_ENABLE_W1TS_LOW_ADDRESS
  137. #define GPIO_PIN0_CONFIG_LSB WLAN_GPIO_PIN0_CONFIG_LSB
  138. #define GPIO_PIN0_PAD_PULL_LSB WLAN_GPIO_PIN0_PAD_PULL_LSB
  139. #define GPIO_PIN0_PAD_PULL_MASK WLAN_GPIO_PIN0_PAD_PULL_MASK
  140. /* CE descriptor */
  141. #define CE_SRC_DESC_SIZE_DWORD 2
  142. #define CE_DEST_DESC_SIZE_DWORD 2
  143. #define CE_SRC_DESC_SRC_PTR_OFFSET_DWORD 0
  144. #define CE_SRC_DESC_INFO_OFFSET_DWORD 1
  145. #define CE_DEST_DESC_DEST_PTR_OFFSET_DWORD 0
  146. #define CE_DEST_DESC_INFO_OFFSET_DWORD 1
  147. #if _BYTE_ORDER == _BIG_ENDIAN
  148. #define CE_SRC_DESC_INFO_NBYTES_MASK 0xFFFF0000
  149. #define CE_SRC_DESC_INFO_NBYTES_SHIFT 16
  150. #define CE_SRC_DESC_INFO_GATHER_MASK 0x00008000
  151. #define CE_SRC_DESC_INFO_GATHER_SHIFT 15
  152. #define CE_SRC_DESC_INFO_BYTE_SWAP_MASK 0x00004000
  153. #define CE_SRC_DESC_INFO_BYTE_SWAP_SHIFT 14
  154. #define CE_SRC_DESC_INFO_HOST_INT_DISABLE_MASK 0x00002000
  155. #define CE_SRC_DESC_INFO_HOST_INT_DISABLE_SHIFT 13
  156. #define CE_SRC_DESC_INFO_TARGET_INT_DISABLE_MASK 0x00001000
  157. #define CE_SRC_DESC_INFO_TARGET_INT_DISABLE_SHIFT 12
  158. #define CE_SRC_DESC_INFO_META_DATA_MASK 0x00000FFF
  159. #define CE_SRC_DESC_INFO_META_DATA_SHIFT 0
  160. #else
  161. #define CE_SRC_DESC_INFO_NBYTES_MASK 0x0000FFFF
  162. #define CE_SRC_DESC_INFO_NBYTES_SHIFT 0
  163. #define CE_SRC_DESC_INFO_GATHER_MASK 0x00010000
  164. #define CE_SRC_DESC_INFO_GATHER_SHIFT 16
  165. #define CE_SRC_DESC_INFO_BYTE_SWAP_MASK 0x00020000
  166. #define CE_SRC_DESC_INFO_BYTE_SWAP_SHIFT 17
  167. #define CE_SRC_DESC_INFO_HOST_INT_DISABLE_MASK 0x00040000
  168. #define CE_SRC_DESC_INFO_HOST_INT_DISABLE_SHIFT 18
  169. #define CE_SRC_DESC_INFO_TARGET_INT_DISABLE_MASK 0x00080000
  170. #define CE_SRC_DESC_INFO_TARGET_INT_DISABLE_SHIFT 19
  171. #define CE_SRC_DESC_INFO_META_DATA_MASK 0xFFF00000
  172. #define CE_SRC_DESC_INFO_META_DATA_SHIFT 20
  173. #endif
  174. #if _BYTE_ORDER == _BIG_ENDIAN
  175. #define CE_DEST_DESC_INFO_NBYTES_MASK 0xFFFF0000
  176. #define CE_DEST_DESC_INFO_NBYTES_SHIFT 16
  177. #define CE_DEST_DESC_INFO_GATHER_MASK 0x00008000
  178. #define CE_DEST_DESC_INFO_GATHER_SHIFT 15
  179. #define CE_DEST_DESC_INFO_BYTE_SWAP_MASK 0x00004000
  180. #define CE_DEST_DESC_INFO_BYTE_SWAP_SHIFT 14
  181. #define CE_DEST_DESC_INFO_HOST_INT_DISABLE_MASK 0x00002000
  182. #define CE_DEST_DESC_INFO_HOST_INT_DISABLE_SHIFT 13
  183. #define CE_DEST_DESC_INFO_TARGET_INT_DISABLE_MASK 0x00001000
  184. #define CE_DEST_DESC_INFO_TARGET_INT_DISABLE_SHIFT 12
  185. #define CE_DEST_DESC_INFO_META_DATA_MASK 0x00000FFF
  186. #define CE_DEST_DESC_INFO_META_DATA_SHIFT 0
  187. #else
  188. #define CE_DEST_DESC_INFO_NBYTES_MASK 0x0000FFFF
  189. #define CE_DEST_DESC_INFO_NBYTES_SHIFT 0
  190. #define CE_DEST_DESC_INFO_GATHER_MASK 0x00010000
  191. #define CE_DEST_DESC_INFO_GATHER_SHIFT 16
  192. #define CE_DEST_DESC_INFO_BYTE_SWAP_MASK 0x00020000
  193. #define CE_DEST_DESC_INFO_BYTE_SWAP_SHIFT 17
  194. #define CE_DEST_DESC_INFO_HOST_INT_DISABLE_MASK 0x00040000
  195. #define CE_DEST_DESC_INFO_HOST_INT_DISABLE_SHIFT 18
  196. #define CE_DEST_DESC_INFO_TARGET_INT_DISABLE_MASK 0x00080000
  197. #define CE_DEST_DESC_INFO_TARGET_INT_DISABLE_SHIFT 19
  198. #define CE_DEST_DESC_INFO_META_DATA_MASK 0xFFF00000
  199. #define CE_DEST_DESC_INFO_META_DATA_SHIFT 20
  200. #endif
  201. #define MY_TARGET_DEF QCA9984_TARGETdef
  202. #define MY_HOST_DEF QCA9984_HOSTdef
  203. #define MY_CEREG_DEF QCA9984_CE_TARGETdef
  204. #define MY_TARGET_BOARD_DATA_SZ QCA9984_BOARD_DATA_SZ
  205. #define MY_TARGET_BOARD_EXT_DATA_SZ QCA9984_BOARD_EXT_DATA_SZ
  206. #include "targetdef.h"
  207. #include "hostdef.h"
  208. #else
  209. #include "common_drv.h"
  210. #include "targetdef.h"
  211. #include "hostdef.h"
  212. struct targetdef_s *QCA9984_TARGETdef;
  213. struct hostdef_s *QCA9984_HOSTdef;
  214. #endif /* QCA9984_HEADERS_DEF */