hw.h 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105
  1. /*
  2. * Copyright (c) 2005-2011 Atheros Communications Inc.
  3. * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. #ifndef _HW_H_
  18. #define _HW_H_
  19. #include "targaddrs.h"
  20. #define ATH10K_FW_DIR "ath10k"
  21. #define QCA988X_2_0_DEVICE_ID_UBNT (0x11ac)
  22. #define QCA988X_2_0_DEVICE_ID (0x003c)
  23. #define QCA6164_2_1_DEVICE_ID (0x0041)
  24. #define QCA6174_2_1_DEVICE_ID (0x003e)
  25. #define QCA99X0_2_0_DEVICE_ID (0x0040)
  26. #define QCA9888_2_0_DEVICE_ID (0x0056)
  27. #define QCA9984_1_0_DEVICE_ID (0x0046)
  28. #define QCA9377_1_0_DEVICE_ID (0x0042)
  29. #define QCA9887_1_0_DEVICE_ID (0x0050)
  30. /* QCA988X 1.0 definitions (unsupported) */
  31. #define QCA988X_HW_1_0_CHIP_ID_REV 0x0
  32. /* QCA988X 2.0 definitions */
  33. #define QCA988X_HW_2_0_VERSION 0x4100016c
  34. #define QCA988X_HW_2_0_CHIP_ID_REV 0x2
  35. #define QCA988X_HW_2_0_FW_DIR ATH10K_FW_DIR "/QCA988X/hw2.0"
  36. #define QCA988X_HW_2_0_BOARD_DATA_FILE "board.bin"
  37. #define QCA988X_HW_2_0_PATCH_LOAD_ADDR 0x1234
  38. /* QCA9887 1.0 definitions */
  39. #define QCA9887_HW_1_0_VERSION 0x4100016d
  40. #define QCA9887_HW_1_0_CHIP_ID_REV 0
  41. #define QCA9887_HW_1_0_FW_DIR ATH10K_FW_DIR "/QCA9887/hw1.0"
  42. #define QCA9887_HW_1_0_BOARD_DATA_FILE "board.bin"
  43. #define QCA9887_HW_1_0_PATCH_LOAD_ADDR 0x1234
  44. /* QCA6174 target BMI version signatures */
  45. #define QCA6174_HW_1_0_VERSION 0x05000000
  46. #define QCA6174_HW_1_1_VERSION 0x05000001
  47. #define QCA6174_HW_1_3_VERSION 0x05000003
  48. #define QCA6174_HW_2_1_VERSION 0x05010000
  49. #define QCA6174_HW_3_0_VERSION 0x05020000
  50. #define QCA6174_HW_3_2_VERSION 0x05030000
  51. /* QCA9377 target BMI version signatures */
  52. #define QCA9377_HW_1_0_DEV_VERSION 0x05020000
  53. #define QCA9377_HW_1_1_DEV_VERSION 0x05020001
  54. enum qca6174_pci_rev {
  55. QCA6174_PCI_REV_1_1 = 0x11,
  56. QCA6174_PCI_REV_1_3 = 0x13,
  57. QCA6174_PCI_REV_2_0 = 0x20,
  58. QCA6174_PCI_REV_3_0 = 0x30,
  59. };
  60. enum qca6174_chip_id_rev {
  61. QCA6174_HW_1_0_CHIP_ID_REV = 0,
  62. QCA6174_HW_1_1_CHIP_ID_REV = 1,
  63. QCA6174_HW_1_3_CHIP_ID_REV = 2,
  64. QCA6174_HW_2_1_CHIP_ID_REV = 4,
  65. QCA6174_HW_2_2_CHIP_ID_REV = 5,
  66. QCA6174_HW_3_0_CHIP_ID_REV = 8,
  67. QCA6174_HW_3_1_CHIP_ID_REV = 9,
  68. QCA6174_HW_3_2_CHIP_ID_REV = 10,
  69. };
  70. enum qca9377_chip_id_rev {
  71. QCA9377_HW_1_0_CHIP_ID_REV = 0x0,
  72. QCA9377_HW_1_1_CHIP_ID_REV = 0x1,
  73. };
  74. #define QCA6174_HW_2_1_FW_DIR "ath10k/QCA6174/hw2.1"
  75. #define QCA6174_HW_2_1_BOARD_DATA_FILE "board.bin"
  76. #define QCA6174_HW_2_1_PATCH_LOAD_ADDR 0x1234
  77. #define QCA6174_HW_3_0_FW_DIR "ath10k/QCA6174/hw3.0"
  78. #define QCA6174_HW_3_0_BOARD_DATA_FILE "board.bin"
  79. #define QCA6174_HW_3_0_PATCH_LOAD_ADDR 0x1234
  80. /* QCA99X0 1.0 definitions (unsupported) */
  81. #define QCA99X0_HW_1_0_CHIP_ID_REV 0x0
  82. /* QCA99X0 2.0 definitions */
  83. #define QCA99X0_HW_2_0_DEV_VERSION 0x01000000
  84. #define QCA99X0_HW_2_0_CHIP_ID_REV 0x1
  85. #define QCA99X0_HW_2_0_FW_DIR ATH10K_FW_DIR "/QCA99X0/hw2.0"
  86. #define QCA99X0_HW_2_0_BOARD_DATA_FILE "board.bin"
  87. #define QCA99X0_HW_2_0_PATCH_LOAD_ADDR 0x1234
  88. /* QCA9984 1.0 defines */
  89. #define QCA9984_HW_1_0_DEV_VERSION 0x1000000
  90. #define QCA9984_HW_DEV_TYPE 0xa
  91. #define QCA9984_HW_1_0_CHIP_ID_REV 0x0
  92. #define QCA9984_HW_1_0_FW_DIR ATH10K_FW_DIR "/QCA9984/hw1.0"
  93. #define QCA9984_HW_1_0_BOARD_DATA_FILE "board.bin"
  94. #define QCA9984_HW_1_0_PATCH_LOAD_ADDR 0x1234
  95. /* QCA9888 2.0 defines */
  96. #define QCA9888_HW_2_0_DEV_VERSION 0x1000000
  97. #define QCA9888_HW_DEV_TYPE 0xc
  98. #define QCA9888_HW_2_0_CHIP_ID_REV 0x0
  99. #define QCA9888_HW_2_0_FW_DIR ATH10K_FW_DIR "/QCA9888/hw2.0"
  100. #define QCA9888_HW_2_0_BOARD_DATA_FILE "board.bin"
  101. #define QCA9888_HW_2_0_PATCH_LOAD_ADDR 0x1234
  102. /* QCA9377 1.0 definitions */
  103. #define QCA9377_HW_1_0_FW_DIR ATH10K_FW_DIR "/QCA9377/hw1.0"
  104. #define QCA9377_HW_1_0_BOARD_DATA_FILE "board.bin"
  105. #define QCA9377_HW_1_0_PATCH_LOAD_ADDR 0x1234
  106. /* QCA4019 1.0 definitions */
  107. #define QCA4019_HW_1_0_DEV_VERSION 0x01000000
  108. #define QCA4019_HW_1_0_FW_DIR ATH10K_FW_DIR "/QCA4019/hw1.0"
  109. #define QCA4019_HW_1_0_BOARD_DATA_FILE "board.bin"
  110. #define QCA4019_HW_1_0_PATCH_LOAD_ADDR 0x1234
  111. /* WCN3990 1.0 definitions */
  112. #define WCN3990_HW_1_0_DEV_VERSION ATH10K_HW_WCN3990
  113. #define WCN3990_HW_1_0_FW_DIR ATH10K_FW_DIR "/WCN3990/hw3.0"
  114. #define ATH10K_FW_FILE_BASE "firmware"
  115. #define ATH10K_FW_API_MAX 6
  116. #define ATH10K_FW_API_MIN 2
  117. #define ATH10K_FW_API2_FILE "firmware-2.bin"
  118. #define ATH10K_FW_API3_FILE "firmware-3.bin"
  119. /* added support for ATH10K_FW_IE_WMI_OP_VERSION */
  120. #define ATH10K_FW_API4_FILE "firmware-4.bin"
  121. /* HTT id conflict fix for management frames over HTT */
  122. #define ATH10K_FW_API5_FILE "firmware-5.bin"
  123. /* the firmware-6.bin blob */
  124. #define ATH10K_FW_API6_FILE "firmware-6.bin"
  125. #define ATH10K_FW_UTF_FILE "utf.bin"
  126. #define ATH10K_FW_UTF_API2_FILE "utf-2.bin"
  127. /* includes also the null byte */
  128. #define ATH10K_FIRMWARE_MAGIC "QCA-ATH10K"
  129. #define ATH10K_BOARD_MAGIC "QCA-ATH10K-BOARD"
  130. #define ATH10K_BOARD_API2_FILE "board-2.bin"
  131. #define REG_DUMP_COUNT_QCA988X 60
  132. struct ath10k_fw_ie {
  133. __le32 id;
  134. __le32 len;
  135. u8 data[0];
  136. };
  137. enum ath10k_fw_ie_type {
  138. ATH10K_FW_IE_FW_VERSION = 0,
  139. ATH10K_FW_IE_TIMESTAMP = 1,
  140. ATH10K_FW_IE_FEATURES = 2,
  141. ATH10K_FW_IE_FW_IMAGE = 3,
  142. ATH10K_FW_IE_OTP_IMAGE = 4,
  143. /* WMI "operations" interface version, 32 bit value. Supported from
  144. * FW API 4 and above.
  145. */
  146. ATH10K_FW_IE_WMI_OP_VERSION = 5,
  147. /* HTT "operations" interface version, 32 bit value. Supported from
  148. * FW API 5 and above.
  149. */
  150. ATH10K_FW_IE_HTT_OP_VERSION = 6,
  151. /* Code swap image for firmware binary */
  152. ATH10K_FW_IE_FW_CODE_SWAP_IMAGE = 7,
  153. };
  154. enum ath10k_fw_wmi_op_version {
  155. ATH10K_FW_WMI_OP_VERSION_UNSET = 0,
  156. ATH10K_FW_WMI_OP_VERSION_MAIN = 1,
  157. ATH10K_FW_WMI_OP_VERSION_10_1 = 2,
  158. ATH10K_FW_WMI_OP_VERSION_10_2 = 3,
  159. ATH10K_FW_WMI_OP_VERSION_TLV = 4,
  160. ATH10K_FW_WMI_OP_VERSION_10_2_4 = 5,
  161. ATH10K_FW_WMI_OP_VERSION_10_4 = 6,
  162. /* keep last */
  163. ATH10K_FW_WMI_OP_VERSION_MAX,
  164. };
  165. enum ath10k_fw_htt_op_version {
  166. ATH10K_FW_HTT_OP_VERSION_UNSET = 0,
  167. ATH10K_FW_HTT_OP_VERSION_MAIN = 1,
  168. /* also used in 10.2 and 10.2.4 branches */
  169. ATH10K_FW_HTT_OP_VERSION_10_1 = 2,
  170. ATH10K_FW_HTT_OP_VERSION_TLV = 3,
  171. ATH10K_FW_HTT_OP_VERSION_10_4 = 4,
  172. /* keep last */
  173. ATH10K_FW_HTT_OP_VERSION_MAX,
  174. };
  175. enum ath10k_bd_ie_type {
  176. /* contains sub IEs of enum ath10k_bd_ie_board_type */
  177. ATH10K_BD_IE_BOARD = 0,
  178. };
  179. enum ath10k_bd_ie_board_type {
  180. ATH10K_BD_IE_BOARD_NAME = 0,
  181. ATH10K_BD_IE_BOARD_DATA = 1,
  182. };
  183. enum ath10k_hw_rev {
  184. ATH10K_HW_QCA988X,
  185. ATH10K_HW_QCA6174,
  186. ATH10K_HW_QCA99X0,
  187. ATH10K_HW_QCA9888,
  188. ATH10K_HW_QCA9984,
  189. ATH10K_HW_QCA9377,
  190. ATH10K_HW_QCA4019,
  191. ATH10K_HW_QCA9887,
  192. ATH10K_HW_WCN3990,
  193. };
  194. struct ath10k_hw_regs {
  195. u32 rtc_soc_base_address;
  196. u32 rtc_wmac_base_address;
  197. u32 soc_core_base_address;
  198. u32 wlan_mac_base_address;
  199. u32 ce_wrapper_base_address;
  200. u32 ce0_base_address;
  201. u32 ce1_base_address;
  202. u32 ce2_base_address;
  203. u32 ce3_base_address;
  204. u32 ce4_base_address;
  205. u32 ce5_base_address;
  206. u32 ce6_base_address;
  207. u32 ce7_base_address;
  208. u32 ce8_base_address;
  209. u32 ce9_base_address;
  210. u32 ce10_base_address;
  211. u32 ce11_base_address;
  212. u32 soc_reset_control_si0_rst_mask;
  213. u32 soc_reset_control_ce_rst_mask;
  214. u32 soc_chip_id_address;
  215. u32 scratch_3_address;
  216. u32 fw_indicator_address;
  217. u32 pcie_local_base_address;
  218. u32 ce_wrap_intr_sum_host_msi_lsb;
  219. u32 ce_wrap_intr_sum_host_msi_mask;
  220. u32 pcie_intr_fw_mask;
  221. u32 pcie_intr_ce_mask_all;
  222. u32 pcie_intr_clr_address;
  223. u32 cpu_pll_init_address;
  224. u32 cpu_speed_address;
  225. u32 core_clk_div_address;
  226. };
  227. extern const struct ath10k_hw_regs qca988x_regs;
  228. extern const struct ath10k_hw_regs qca6174_regs;
  229. extern const struct ath10k_hw_regs qca99x0_regs;
  230. extern const struct ath10k_hw_regs qca4019_regs;
  231. extern const struct ath10k_hw_regs wcn3990_regs;
  232. struct ath10k_hw_ce_regs_addr_map {
  233. u32 msb;
  234. u32 lsb;
  235. u32 mask;
  236. };
  237. struct ath10k_hw_ce_ctrl1 {
  238. u32 addr;
  239. u32 hw_mask;
  240. u32 sw_mask;
  241. u32 hw_wr_mask;
  242. u32 sw_wr_mask;
  243. u32 reset_mask;
  244. u32 reset;
  245. struct ath10k_hw_ce_regs_addr_map *src_ring;
  246. struct ath10k_hw_ce_regs_addr_map *dst_ring;
  247. struct ath10k_hw_ce_regs_addr_map *dmax; };
  248. struct ath10k_hw_ce_cmd_halt {
  249. u32 status_reset;
  250. u32 msb;
  251. u32 mask;
  252. struct ath10k_hw_ce_regs_addr_map *status; };
  253. struct ath10k_hw_ce_host_ie {
  254. u32 copy_complete_reset;
  255. struct ath10k_hw_ce_regs_addr_map *copy_complete; };
  256. struct ath10k_hw_ce_host_wm_regs {
  257. u32 dstr_lmask;
  258. u32 dstr_hmask;
  259. u32 srcr_lmask;
  260. u32 srcr_hmask;
  261. u32 cc_mask;
  262. u32 wm_mask;
  263. u32 addr;
  264. };
  265. struct ath10k_hw_ce_misc_regs {
  266. u32 axi_err;
  267. u32 dstr_add_err;
  268. u32 srcr_len_err;
  269. u32 dstr_mlen_vio;
  270. u32 dstr_overflow;
  271. u32 srcr_overflow;
  272. u32 err_mask;
  273. u32 addr;
  274. };
  275. struct ath10k_hw_ce_dst_src_wm_regs {
  276. u32 addr;
  277. u32 low_rst;
  278. u32 high_rst;
  279. struct ath10k_hw_ce_regs_addr_map *wm_low;
  280. struct ath10k_hw_ce_regs_addr_map *wm_high; };
  281. struct ath10k_hw_ce_regs {
  282. u32 sr_base_addr;
  283. u32 sr_size_addr;
  284. u32 dr_base_addr;
  285. u32 dr_size_addr;
  286. u32 ce_cmd_addr;
  287. u32 misc_ie_addr;
  288. u32 sr_wr_index_addr;
  289. u32 dst_wr_index_addr;
  290. u32 current_srri_addr;
  291. u32 current_drri_addr;
  292. u32 ddr_addr_for_rri_low;
  293. u32 ddr_addr_for_rri_high;
  294. u32 ce_rri_low;
  295. u32 ce_rri_high;
  296. u32 host_ie_addr;
  297. struct ath10k_hw_ce_host_wm_regs *wm_regs;
  298. struct ath10k_hw_ce_misc_regs *misc_regs;
  299. struct ath10k_hw_ce_ctrl1 *ctrl1_regs;
  300. struct ath10k_hw_ce_cmd_halt *cmd_halt;
  301. struct ath10k_hw_ce_host_ie *host_ie;
  302. struct ath10k_hw_ce_dst_src_wm_regs *wm_srcr;
  303. struct ath10k_hw_ce_dst_src_wm_regs *wm_dstr; };
  304. struct ath10k_hw_values {
  305. u32 rtc_state_val_on;
  306. u8 ce_count;
  307. u8 msi_assign_ce_max;
  308. u8 num_target_ce_config_wlan;
  309. u16 ce_desc_meta_data_mask;
  310. u8 ce_desc_meta_data_lsb;
  311. };
  312. extern const struct ath10k_hw_values qca988x_values;
  313. extern const struct ath10k_hw_values qca6174_values;
  314. extern const struct ath10k_hw_values qca99x0_values;
  315. extern const struct ath10k_hw_values qca9888_values;
  316. extern const struct ath10k_hw_values qca4019_values;
  317. extern const struct ath10k_hw_values wcn3990_values;
  318. extern const struct ath10k_hw_ce_regs wcn3990_ce_regs;
  319. extern const struct ath10k_hw_ce_regs qcax_ce_regs;
  320. void ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey,
  321. u32 cc, u32 rcc, u32 cc_prev, u32 rcc_prev);
  322. #define QCA_REV_988X(ar) ((ar)->hw_rev == ATH10K_HW_QCA988X)
  323. #define QCA_REV_9887(ar) ((ar)->hw_rev == ATH10K_HW_QCA9887)
  324. #define QCA_REV_6174(ar) ((ar)->hw_rev == ATH10K_HW_QCA6174)
  325. #define QCA_REV_99X0(ar) ((ar)->hw_rev == ATH10K_HW_QCA99X0)
  326. #define QCA_REV_9888(ar) ((ar)->hw_rev == ATH10K_HW_QCA9888)
  327. #define QCA_REV_9984(ar) ((ar)->hw_rev == ATH10K_HW_QCA9984)
  328. #define QCA_REV_9377(ar) ((ar)->hw_rev == ATH10K_HW_QCA9377)
  329. #define QCA_REV_40XX(ar) ((ar)->hw_rev == ATH10K_HW_QCA4019)
  330. #define QCA_REV_WCN3990(ar) ((ar)->hw_rev == ATH10K_HW_WCN3990)
  331. /* Known peculiarities:
  332. * - raw appears in nwifi decap, raw and nwifi appear in ethernet decap
  333. * - raw have FCS, nwifi doesn't
  334. * - ethernet frames have 802.11 header decapped and parts (base hdr, cipher
  335. * param, llc/snap) are aligned to 4byte boundaries each
  336. */
  337. enum ath10k_hw_txrx_mode {
  338. ATH10K_HW_TXRX_RAW = 0,
  339. /* Native Wifi decap mode is used to align IP frames to 4-byte
  340. * boundaries and avoid a very expensive re-alignment in mac80211.
  341. */
  342. ATH10K_HW_TXRX_NATIVE_WIFI = 1,
  343. ATH10K_HW_TXRX_ETHERNET = 2,
  344. /* Valid for HTT >= 3.0. Used for management frames in TX_FRM. */
  345. ATH10K_HW_TXRX_MGMT = 3,
  346. };
  347. enum ath10k_mcast2ucast_mode {
  348. ATH10K_MCAST2UCAST_DISABLED = 0,
  349. ATH10K_MCAST2UCAST_ENABLED = 1,
  350. };
  351. enum ath10k_hw_rate_ofdm {
  352. ATH10K_HW_RATE_OFDM_48M = 0,
  353. ATH10K_HW_RATE_OFDM_24M,
  354. ATH10K_HW_RATE_OFDM_12M,
  355. ATH10K_HW_RATE_OFDM_6M,
  356. ATH10K_HW_RATE_OFDM_54M,
  357. ATH10K_HW_RATE_OFDM_36M,
  358. ATH10K_HW_RATE_OFDM_18M,
  359. ATH10K_HW_RATE_OFDM_9M,
  360. };
  361. enum ath10k_hw_rate_cck {
  362. ATH10K_HW_RATE_CCK_LP_11M = 0,
  363. ATH10K_HW_RATE_CCK_LP_5_5M,
  364. ATH10K_HW_RATE_CCK_LP_2M,
  365. ATH10K_HW_RATE_CCK_LP_1M,
  366. ATH10K_HW_RATE_CCK_SP_11M,
  367. ATH10K_HW_RATE_CCK_SP_5_5M,
  368. ATH10K_HW_RATE_CCK_SP_2M,
  369. };
  370. enum ath10k_hw_rate_rev2_cck {
  371. ATH10K_HW_RATE_REV2_CCK_LP_1M = 1,
  372. ATH10K_HW_RATE_REV2_CCK_LP_2M,
  373. ATH10K_HW_RATE_REV2_CCK_LP_5_5M,
  374. ATH10K_HW_RATE_REV2_CCK_LP_11M,
  375. ATH10K_HW_RATE_REV2_CCK_SP_2M,
  376. ATH10K_HW_RATE_REV2_CCK_SP_5_5M,
  377. ATH10K_HW_RATE_REV2_CCK_SP_11M,
  378. };
  379. enum ath10k_hw_cc_wraparound_type {
  380. ATH10K_HW_CC_WRAP_DISABLED = 0,
  381. /* This type is when the HW chip has a quirky Cycle Counter
  382. * wraparound which resets to 0x7fffffff instead of 0. All
  383. * other CC related counters (e.g. Rx Clear Count) are divided
  384. * by 2 so they never wraparound themselves.
  385. */
  386. ATH10K_HW_CC_WRAP_SHIFTED_ALL = 1,
  387. /* Each hw counter wrapsaround independently. When the
  388. * counter overflows the repestive counter is right shifted
  389. * by 1, i.e reset to 0x7fffffff, and other counters will be
  390. * running unaffected. In this type of wraparound, it should
  391. * be possible to report accurate Rx busy time unlike the
  392. * first type.
  393. */
  394. ATH10K_HW_CC_WRAP_SHIFTED_EACH = 2,
  395. };
  396. enum ath10k_hw_refclk_speed {
  397. ATH10K_HW_REFCLK_UNKNOWN = -1,
  398. ATH10K_HW_REFCLK_48_MHZ = 0,
  399. ATH10K_HW_REFCLK_19_2_MHZ = 1,
  400. ATH10K_HW_REFCLK_24_MHZ = 2,
  401. ATH10K_HW_REFCLK_26_MHZ = 3,
  402. ATH10K_HW_REFCLK_37_4_MHZ = 4,
  403. ATH10K_HW_REFCLK_38_4_MHZ = 5,
  404. ATH10K_HW_REFCLK_40_MHZ = 6,
  405. ATH10K_HW_REFCLK_52_MHZ = 7,
  406. /* must be the last one */
  407. ATH10K_HW_REFCLK_COUNT,
  408. };
  409. struct ath10k_hw_clk_params {
  410. u32 refclk;
  411. u32 div;
  412. u32 rnfrac;
  413. u32 settle_time;
  414. u32 refdiv;
  415. u32 outdiv;
  416. };
  417. struct ath10k_hw_params {
  418. u32 id;
  419. u16 dev_id;
  420. const char *name;
  421. u32 patch_load_addr;
  422. int uart_pin;
  423. u32 otp_exe_param;
  424. /* Type of hw cycle counter wraparound logic, for more info
  425. * refer enum ath10k_hw_cc_wraparound_type.
  426. */
  427. enum ath10k_hw_cc_wraparound_type cc_wraparound_type;
  428. /* Some of chip expects fragment descriptor to be continuous
  429. * memory for any TX operation. Set continuous_frag_desc flag
  430. * for the hardware which have such requirement.
  431. */
  432. bool continuous_frag_desc;
  433. /* CCK hardware rate table mapping for the newer chipsets
  434. * like QCA99X0, QCA4019 got revised. The CCK h/w rate values
  435. * are in a proper order with respect to the rate/preamble
  436. */
  437. bool cck_rate_map_rev2;
  438. u32 channel_counters_freq_hz;
  439. /* Mgmt tx descriptors threshold for limiting probe response
  440. * frames.
  441. */
  442. u32 max_probe_resp_desc_thres;
  443. u32 tx_chain_mask;
  444. u32 rx_chain_mask;
  445. u32 max_spatial_stream;
  446. u32 cal_data_len;
  447. struct ath10k_hw_params_fw {
  448. const char *dir;
  449. const char *board;
  450. size_t board_size;
  451. size_t board_ext_size;
  452. } fw;
  453. /* qca99x0 family chips deliver broadcast/multicast management
  454. * frames encrypted and expect software do decryption.
  455. */
  456. bool sw_decrypt_mcast_mgmt;
  457. const struct ath10k_hw_ops *hw_ops;
  458. /* Number of bytes used for alignment in rx_hdr_status of rx desc. */
  459. int decap_align_bytes;
  460. /* hw specific clock control parameters */
  461. const struct ath10k_hw_clk_params *hw_clk;
  462. int target_cpu_freq;
  463. /* Number of bytes to be discarded for each FFT sample */
  464. int spectral_bin_discard;
  465. /* The board may have a restricted NSS for 160 or 80+80 vs what it
  466. * can do for 80Mhz.
  467. */
  468. int vht160_mcs_rx_highest;
  469. int vht160_mcs_tx_highest;
  470. /* Number of ciphers supported (i.e First N) in cipher_suites array */
  471. int n_cipher_suites;
  472. u32 num_peers;
  473. u32 ast_skid_limit;
  474. u32 num_wds_entries;
  475. /* Targets supporting physical addressing capability above 32-bits */
  476. bool target_64bit;
  477. /* Target rx ring fill level */
  478. u32 rx_ring_fill_level;
  479. };
  480. struct htt_rx_desc;
  481. /* Defines needed for Rx descriptor abstraction */
  482. struct ath10k_hw_ops {
  483. int (*rx_desc_get_l3_pad_bytes)(struct htt_rx_desc *rxd);
  484. void (*set_coverage_class)(struct ath10k *ar, s16 value);
  485. int (*enable_pll_clk)(struct ath10k *ar);
  486. };
  487. extern const struct ath10k_hw_ops qca988x_ops;
  488. extern const struct ath10k_hw_ops qca99x0_ops;
  489. extern const struct ath10k_hw_ops qca6174_ops;
  490. extern const struct ath10k_hw_ops wcn3990_ops;
  491. extern const struct ath10k_hw_clk_params qca6174_clk[];
  492. static inline int
  493. ath10k_rx_desc_get_l3_pad_bytes(struct ath10k_hw_params *hw,
  494. struct htt_rx_desc *rxd)
  495. {
  496. if (hw->hw_ops->rx_desc_get_l3_pad_bytes)
  497. return hw->hw_ops->rx_desc_get_l3_pad_bytes(rxd);
  498. return 0;
  499. }
  500. /* Target specific defines for MAIN firmware */
  501. #define TARGET_NUM_VDEVS 8
  502. #define TARGET_NUM_PEER_AST 2
  503. #define TARGET_NUM_WDS_ENTRIES 32
  504. #define TARGET_DMA_BURST_SIZE 0
  505. #define TARGET_MAC_AGGR_DELIM 0
  506. #define TARGET_AST_SKID_LIMIT 16
  507. #define TARGET_NUM_STATIONS 16
  508. #define TARGET_NUM_PEERS ((TARGET_NUM_STATIONS) + \
  509. (TARGET_NUM_VDEVS))
  510. #define TARGET_NUM_OFFLOAD_PEERS 0
  511. #define TARGET_NUM_OFFLOAD_REORDER_BUFS 0
  512. #define TARGET_NUM_PEER_KEYS 2
  513. #define TARGET_NUM_TIDS ((TARGET_NUM_PEERS) * 2)
  514. #define TARGET_TX_CHAIN_MASK (BIT(0) | BIT(1) | BIT(2))
  515. #define TARGET_RX_CHAIN_MASK (BIT(0) | BIT(1) | BIT(2))
  516. #define TARGET_RX_TIMEOUT_LO_PRI 100
  517. #define TARGET_RX_TIMEOUT_HI_PRI 40
  518. #define TARGET_SCAN_MAX_PENDING_REQS 4
  519. #define TARGET_BMISS_OFFLOAD_MAX_VDEV 3
  520. #define TARGET_ROAM_OFFLOAD_MAX_VDEV 3
  521. #define TARGET_ROAM_OFFLOAD_MAX_AP_PROFILES 8
  522. #define TARGET_GTK_OFFLOAD_MAX_VDEV 3
  523. #define TARGET_NUM_MCAST_GROUPS 0
  524. #define TARGET_NUM_MCAST_TABLE_ELEMS 0
  525. #define TARGET_MCAST2UCAST_MODE ATH10K_MCAST2UCAST_DISABLED
  526. #define TARGET_TX_DBG_LOG_SIZE 1024
  527. #define TARGET_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 0
  528. #define TARGET_VOW_CONFIG 0
  529. #define TARGET_NUM_MSDU_DESC (1024 + 400)
  530. #define TARGET_MAX_FRAG_ENTRIES 0
  531. /* Target specific defines for 10.X firmware */
  532. #define TARGET_10X_NUM_VDEVS 16
  533. #define TARGET_10X_NUM_PEER_AST 2
  534. #define TARGET_10X_NUM_WDS_ENTRIES 32
  535. #define TARGET_10X_DMA_BURST_SIZE 0
  536. #define TARGET_10X_MAC_AGGR_DELIM 0
  537. #define TARGET_10X_AST_SKID_LIMIT 128
  538. #define TARGET_10X_NUM_STATIONS 128
  539. #define TARGET_10X_TX_STATS_NUM_STATIONS 118
  540. #define TARGET_10X_NUM_PEERS ((TARGET_10X_NUM_STATIONS) + \
  541. (TARGET_10X_NUM_VDEVS))
  542. #define TARGET_10X_TX_STATS_NUM_PEERS ((TARGET_10X_TX_STATS_NUM_STATIONS) + \
  543. (TARGET_10X_NUM_VDEVS))
  544. #define TARGET_10X_NUM_OFFLOAD_PEERS 0
  545. #define TARGET_10X_NUM_OFFLOAD_REORDER_BUFS 0
  546. #define TARGET_10X_NUM_PEER_KEYS 2
  547. #define TARGET_10X_NUM_TIDS_MAX 256
  548. #define TARGET_10X_NUM_TIDS min((TARGET_10X_NUM_TIDS_MAX), \
  549. (TARGET_10X_NUM_PEERS) * 2)
  550. #define TARGET_10X_TX_STATS_NUM_TIDS min((TARGET_10X_NUM_TIDS_MAX), \
  551. (TARGET_10X_TX_STATS_NUM_PEERS) * 2)
  552. #define TARGET_10X_TX_CHAIN_MASK (BIT(0) | BIT(1) | BIT(2))
  553. #define TARGET_10X_RX_CHAIN_MASK (BIT(0) | BIT(1) | BIT(2))
  554. #define TARGET_10X_RX_TIMEOUT_LO_PRI 100
  555. #define TARGET_10X_RX_TIMEOUT_HI_PRI 40
  556. #define TARGET_10X_SCAN_MAX_PENDING_REQS 4
  557. #define TARGET_10X_BMISS_OFFLOAD_MAX_VDEV 2
  558. #define TARGET_10X_ROAM_OFFLOAD_MAX_VDEV 2
  559. #define TARGET_10X_ROAM_OFFLOAD_MAX_AP_PROFILES 8
  560. #define TARGET_10X_GTK_OFFLOAD_MAX_VDEV 3
  561. #define TARGET_10X_NUM_MCAST_GROUPS 0
  562. #define TARGET_10X_NUM_MCAST_TABLE_ELEMS 0
  563. #define TARGET_10X_MCAST2UCAST_MODE ATH10K_MCAST2UCAST_DISABLED
  564. #define TARGET_10X_TX_DBG_LOG_SIZE 1024
  565. #define TARGET_10X_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
  566. #define TARGET_10X_VOW_CONFIG 0
  567. #define TARGET_10X_NUM_MSDU_DESC (1024 + 400)
  568. #define TARGET_10X_MAX_FRAG_ENTRIES 0
  569. /* 10.2 parameters */
  570. #define TARGET_10_2_DMA_BURST_SIZE 0
  571. /* Target specific defines for WMI-TLV firmware */
  572. #define TARGET_TLV_NUM_VDEVS 4
  573. #define TARGET_TLV_NUM_STATIONS 32
  574. #define TARGET_TLV_NUM_PEERS 33
  575. #define TARGET_TLV_NUM_TDLS_VDEVS 1
  576. #define TARGET_TLV_NUM_TIDS ((TARGET_TLV_NUM_PEERS) * 2)
  577. #define TARGET_TLV_NUM_MSDU_DESC (1024 + 32)
  578. #define TARGET_TLV_NUM_WOW_PATTERNS 22
  579. /* Target specific defines for WMI-HL-1.0 firmware */
  580. #define TARGET_HL_10_TLV_NUM_PEERS 14
  581. #define TARGET_HL_10_TLV_AST_SKID_LIMIT 6
  582. #define TARGET_HL_10_TLV_NUM_WDS_ENTRIES 2
  583. /* Diagnostic Window */
  584. #define CE_DIAG_PIPE 7
  585. #define NUM_TARGET_CE_CONFIG_WLAN ar->hw_values->num_target_ce_config_wlan
  586. /* Target specific defines for 10.4 firmware */
  587. #define TARGET_10_4_NUM_VDEVS 16
  588. #define TARGET_10_4_NUM_STATIONS 32
  589. #define TARGET_10_4_NUM_PEERS ((TARGET_10_4_NUM_STATIONS) + \
  590. (TARGET_10_4_NUM_VDEVS))
  591. #define TARGET_10_4_ACTIVE_PEERS 0
  592. #define TARGET_10_4_NUM_QCACHE_PEERS_MAX 512
  593. #define TARGET_10_4_QCACHE_ACTIVE_PEERS 50
  594. #define TARGET_10_4_QCACHE_ACTIVE_PEERS_PFC 35
  595. #define TARGET_10_4_NUM_OFFLOAD_PEERS 0
  596. #define TARGET_10_4_NUM_OFFLOAD_REORDER_BUFFS 0
  597. #define TARGET_10_4_NUM_PEER_KEYS 2
  598. #define TARGET_10_4_TGT_NUM_TIDS ((TARGET_10_4_NUM_PEERS) * 2)
  599. #define TARGET_10_4_NUM_MSDU_DESC (1024 + 400)
  600. #define TARGET_10_4_NUM_MSDU_DESC_PFC 2500
  601. #define TARGET_10_4_AST_SKID_LIMIT 32
  602. /* 100 ms for video, best-effort, and background */
  603. #define TARGET_10_4_RX_TIMEOUT_LO_PRI 100
  604. /* 40 ms for voice */
  605. #define TARGET_10_4_RX_TIMEOUT_HI_PRI 40
  606. #define TARGET_10_4_RX_DECAP_MODE ATH10K_HW_TXRX_NATIVE_WIFI
  607. #define TARGET_10_4_SCAN_MAX_REQS 4
  608. #define TARGET_10_4_BMISS_OFFLOAD_MAX_VDEV 3
  609. #define TARGET_10_4_ROAM_OFFLOAD_MAX_VDEV 3
  610. #define TARGET_10_4_ROAM_OFFLOAD_MAX_PROFILES 8
  611. /* Note: mcast to ucast is disabled by default */
  612. #define TARGET_10_4_NUM_MCAST_GROUPS 0
  613. #define TARGET_10_4_NUM_MCAST_TABLE_ELEMS 0
  614. #define TARGET_10_4_MCAST2UCAST_MODE 0
  615. #define TARGET_10_4_TX_DBG_LOG_SIZE 1024
  616. #define TARGET_10_4_NUM_WDS_ENTRIES 32
  617. #define TARGET_10_4_DMA_BURST_SIZE 0
  618. #define TARGET_10_4_MAC_AGGR_DELIM 0
  619. #define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
  620. #define TARGET_10_4_VOW_CONFIG 0
  621. #define TARGET_10_4_GTK_OFFLOAD_MAX_VDEV 3
  622. #define TARGET_10_4_11AC_TX_MAX_FRAGS 2
  623. #define TARGET_10_4_MAX_PEER_EXT_STATS 16
  624. #define TARGET_10_4_SMART_ANT_CAP 0
  625. #define TARGET_10_4_BK_MIN_FREE 0
  626. #define TARGET_10_4_BE_MIN_FREE 0
  627. #define TARGET_10_4_VI_MIN_FREE 0
  628. #define TARGET_10_4_VO_MIN_FREE 0
  629. #define TARGET_10_4_RX_BATCH_MODE 1
  630. #define TARGET_10_4_THERMAL_THROTTLING_CONFIG 0
  631. #define TARGET_10_4_ATF_CONFIG 0
  632. #define TARGET_10_4_IPHDR_PAD_CONFIG 1
  633. #define TARGET_10_4_QWRAP_CONFIG 0
  634. /* TDLS config */
  635. #define TARGET_10_4_NUM_TDLS_VDEVS 1
  636. #define TARGET_10_4_NUM_TDLS_BUFFER_STA 1
  637. #define TARGET_10_4_NUM_TDLS_SLEEP_STA 1
  638. /* Maximum number of Copy Engine's supported */
  639. #define CE_COUNT_MAX 12
  640. /* Number of Copy Engines supported */
  641. #define CE_COUNT ar->hw_values->ce_count
  642. /*
  643. * Granted MSIs are assigned as follows:
  644. * Firmware uses the first
  645. * Remaining MSIs, if any, are used by Copy Engines
  646. * This mapping is known to both Target firmware and Host software.
  647. * It may be changed as long as Host and Target are kept in sync.
  648. */
  649. /* MSI for firmware (errors, etc.) */
  650. #define MSI_ASSIGN_FW 0
  651. /* MSIs for Copy Engines */
  652. #define MSI_ASSIGN_CE_INITIAL 1
  653. #define MSI_ASSIGN_CE_MAX ar->hw_values->msi_assign_ce_max
  654. /* as of IP3.7.1 */
  655. #define RTC_STATE_V_ON ar->hw_values->rtc_state_val_on
  656. #define RTC_STATE_V_LSB 0
  657. #define RTC_STATE_V_MASK 0x00000007
  658. #define RTC_STATE_ADDRESS 0x0000
  659. #define PCIE_SOC_WAKE_V_MASK 0x00000001
  660. #define PCIE_SOC_WAKE_ADDRESS 0x0004
  661. #define PCIE_SOC_WAKE_RESET 0x00000000
  662. #define SOC_GLOBAL_RESET_ADDRESS 0x0008
  663. #define RTC_SOC_BASE_ADDRESS ar->regs->rtc_soc_base_address
  664. #define RTC_WMAC_BASE_ADDRESS ar->regs->rtc_wmac_base_address
  665. #define MAC_COEX_BASE_ADDRESS 0x00006000
  666. #define BT_COEX_BASE_ADDRESS 0x00007000
  667. #define SOC_PCIE_BASE_ADDRESS 0x00008000
  668. #define SOC_CORE_BASE_ADDRESS ar->regs->soc_core_base_address
  669. #define WLAN_UART_BASE_ADDRESS 0x0000c000
  670. #define WLAN_SI_BASE_ADDRESS 0x00010000
  671. #define WLAN_GPIO_BASE_ADDRESS 0x00014000
  672. #define WLAN_ANALOG_INTF_BASE_ADDRESS 0x0001c000
  673. #define WLAN_MAC_BASE_ADDRESS ar->regs->wlan_mac_base_address
  674. #define EFUSE_BASE_ADDRESS 0x00030000
  675. #define FPGA_REG_BASE_ADDRESS 0x00039000
  676. #define WLAN_UART2_BASE_ADDRESS 0x00054c00
  677. #define CE_WRAPPER_BASE_ADDRESS ar->regs->ce_wrapper_base_address
  678. #define CE0_BASE_ADDRESS ar->regs->ce0_base_address
  679. #define CE1_BASE_ADDRESS ar->regs->ce1_base_address
  680. #define CE2_BASE_ADDRESS ar->regs->ce2_base_address
  681. #define CE3_BASE_ADDRESS ar->regs->ce3_base_address
  682. #define CE4_BASE_ADDRESS ar->regs->ce4_base_address
  683. #define CE5_BASE_ADDRESS ar->regs->ce5_base_address
  684. #define CE6_BASE_ADDRESS ar->regs->ce6_base_address
  685. #define CE7_BASE_ADDRESS ar->regs->ce7_base_address
  686. #define DBI_BASE_ADDRESS 0x00060000
  687. #define WLAN_ANALOG_INTF_PCIE_BASE_ADDRESS 0x0006c000
  688. #define PCIE_LOCAL_BASE_ADDRESS ar->regs->pcie_local_base_address
  689. #define SOC_RESET_CONTROL_ADDRESS 0x00000000
  690. #define SOC_RESET_CONTROL_OFFSET 0x00000000
  691. #define SOC_RESET_CONTROL_SI0_RST_MASK ar->regs->soc_reset_control_si0_rst_mask
  692. #define SOC_RESET_CONTROL_CE_RST_MASK ar->regs->soc_reset_control_ce_rst_mask
  693. #define SOC_RESET_CONTROL_CPU_WARM_RST_MASK 0x00000040
  694. #define SOC_CPU_CLOCK_OFFSET 0x00000020
  695. #define SOC_CPU_CLOCK_STANDARD_LSB 0
  696. #define SOC_CPU_CLOCK_STANDARD_MASK 0x00000003
  697. #define SOC_CLOCK_CONTROL_OFFSET 0x00000028
  698. #define SOC_CLOCK_CONTROL_SI0_CLK_MASK 0x00000001
  699. #define SOC_SYSTEM_SLEEP_OFFSET 0x000000c4
  700. #define SOC_LPO_CAL_OFFSET 0x000000e0
  701. #define SOC_LPO_CAL_ENABLE_LSB 20
  702. #define SOC_LPO_CAL_ENABLE_MASK 0x00100000
  703. #define SOC_LF_TIMER_CONTROL0_ADDRESS 0x00000050
  704. #define SOC_LF_TIMER_CONTROL0_ENABLE_MASK 0x00000004
  705. #define SOC_CHIP_ID_ADDRESS ar->regs->soc_chip_id_address
  706. #define SOC_CHIP_ID_REV_LSB 8
  707. #define SOC_CHIP_ID_REV_MASK 0x00000f00
  708. #define WLAN_RESET_CONTROL_COLD_RST_MASK 0x00000008
  709. #define WLAN_RESET_CONTROL_WARM_RST_MASK 0x00000004
  710. #define WLAN_SYSTEM_SLEEP_DISABLE_LSB 0
  711. #define WLAN_SYSTEM_SLEEP_DISABLE_MASK 0x00000001
  712. #define WLAN_GPIO_PIN0_ADDRESS 0x00000028
  713. #define WLAN_GPIO_PIN0_CONFIG_LSB 11
  714. #define WLAN_GPIO_PIN0_CONFIG_MASK 0x00007800
  715. #define WLAN_GPIO_PIN0_PAD_PULL_LSB 5
  716. #define WLAN_GPIO_PIN0_PAD_PULL_MASK 0x00000060
  717. #define WLAN_GPIO_PIN1_ADDRESS 0x0000002c
  718. #define WLAN_GPIO_PIN1_CONFIG_MASK 0x00007800
  719. #define WLAN_GPIO_PIN10_ADDRESS 0x00000050
  720. #define WLAN_GPIO_PIN11_ADDRESS 0x00000054
  721. #define WLAN_GPIO_PIN12_ADDRESS 0x00000058
  722. #define WLAN_GPIO_PIN13_ADDRESS 0x0000005c
  723. #define CLOCK_GPIO_OFFSET 0xffffffff
  724. #define CLOCK_GPIO_BT_CLK_OUT_EN_LSB 0
  725. #define CLOCK_GPIO_BT_CLK_OUT_EN_MASK 0
  726. #define SI_CONFIG_OFFSET 0x00000000
  727. #define SI_CONFIG_ERR_INT_LSB 19
  728. #define SI_CONFIG_ERR_INT_MASK 0x00080000
  729. #define SI_CONFIG_BIDIR_OD_DATA_LSB 18
  730. #define SI_CONFIG_BIDIR_OD_DATA_MASK 0x00040000
  731. #define SI_CONFIG_I2C_LSB 16
  732. #define SI_CONFIG_I2C_MASK 0x00010000
  733. #define SI_CONFIG_POS_SAMPLE_LSB 7
  734. #define SI_CONFIG_POS_SAMPLE_MASK 0x00000080
  735. #define SI_CONFIG_INACTIVE_DATA_LSB 5
  736. #define SI_CONFIG_INACTIVE_DATA_MASK 0x00000020
  737. #define SI_CONFIG_INACTIVE_CLK_LSB 4
  738. #define SI_CONFIG_INACTIVE_CLK_MASK 0x00000010
  739. #define SI_CONFIG_DIVIDER_LSB 0
  740. #define SI_CONFIG_DIVIDER_MASK 0x0000000f
  741. #define SI_CS_OFFSET 0x00000004
  742. #define SI_CS_DONE_ERR_LSB 10
  743. #define SI_CS_DONE_ERR_MASK 0x00000400
  744. #define SI_CS_DONE_INT_LSB 9
  745. #define SI_CS_DONE_INT_MASK 0x00000200
  746. #define SI_CS_START_LSB 8
  747. #define SI_CS_START_MASK 0x00000100
  748. #define SI_CS_RX_CNT_LSB 4
  749. #define SI_CS_RX_CNT_MASK 0x000000f0
  750. #define SI_CS_TX_CNT_LSB 0
  751. #define SI_CS_TX_CNT_MASK 0x0000000f
  752. #define SI_TX_DATA0_OFFSET 0x00000008
  753. #define SI_TX_DATA1_OFFSET 0x0000000c
  754. #define SI_RX_DATA0_OFFSET 0x00000010
  755. #define SI_RX_DATA1_OFFSET 0x00000014
  756. #define CORE_CTRL_CPU_INTR_MASK 0x00002000
  757. #define CORE_CTRL_PCIE_REG_31_MASK 0x00000800
  758. #define CORE_CTRL_ADDRESS 0x0000
  759. #define PCIE_INTR_ENABLE_ADDRESS 0x0008
  760. #define PCIE_INTR_CAUSE_ADDRESS 0x000c
  761. #define PCIE_INTR_CLR_ADDRESS ar->regs->pcie_intr_clr_address
  762. #define SCRATCH_3_ADDRESS ar->regs->scratch_3_address
  763. #define CPU_INTR_ADDRESS 0x0010
  764. #define FW_RAM_CONFIG_ADDRESS 0x0018
  765. #define CCNT_TO_MSEC(ar, x) ((x) / ar->hw_params.channel_counters_freq_hz)
  766. /* Firmware indications to the Host via SCRATCH_3 register. */
  767. #define FW_INDICATOR_ADDRESS ar->regs->fw_indicator_address
  768. #define FW_IND_EVENT_PENDING 1
  769. #define FW_IND_INITIALIZED 2
  770. #define FW_IND_HOST_READY 0x80000000
  771. /* HOST_REG interrupt from firmware */
  772. #define PCIE_INTR_FIRMWARE_MASK ar->regs->pcie_intr_fw_mask
  773. #define PCIE_INTR_CE_MASK_ALL ar->regs->pcie_intr_ce_mask_all
  774. #define DRAM_BASE_ADDRESS 0x00400000
  775. #define PCIE_BAR_REG_ADDRESS 0x40030
  776. #define MISSING 0
  777. #define SYSTEM_SLEEP_OFFSET SOC_SYSTEM_SLEEP_OFFSET
  778. #define WLAN_SYSTEM_SLEEP_OFFSET SOC_SYSTEM_SLEEP_OFFSET
  779. #define WLAN_RESET_CONTROL_OFFSET SOC_RESET_CONTROL_OFFSET
  780. #define CLOCK_CONTROL_OFFSET SOC_CLOCK_CONTROL_OFFSET
  781. #define CLOCK_CONTROL_SI0_CLK_MASK SOC_CLOCK_CONTROL_SI0_CLK_MASK
  782. #define RESET_CONTROL_MBOX_RST_MASK MISSING
  783. #define RESET_CONTROL_SI0_RST_MASK SOC_RESET_CONTROL_SI0_RST_MASK
  784. #define GPIO_BASE_ADDRESS WLAN_GPIO_BASE_ADDRESS
  785. #define GPIO_PIN0_OFFSET WLAN_GPIO_PIN0_ADDRESS
  786. #define GPIO_PIN1_OFFSET WLAN_GPIO_PIN1_ADDRESS
  787. #define GPIO_PIN0_CONFIG_LSB WLAN_GPIO_PIN0_CONFIG_LSB
  788. #define GPIO_PIN0_CONFIG_MASK WLAN_GPIO_PIN0_CONFIG_MASK
  789. #define GPIO_PIN0_PAD_PULL_LSB WLAN_GPIO_PIN0_PAD_PULL_LSB
  790. #define GPIO_PIN0_PAD_PULL_MASK WLAN_GPIO_PIN0_PAD_PULL_MASK
  791. #define GPIO_PIN1_CONFIG_MASK WLAN_GPIO_PIN1_CONFIG_MASK
  792. #define SI_BASE_ADDRESS WLAN_SI_BASE_ADDRESS
  793. #define SCRATCH_BASE_ADDRESS SOC_CORE_BASE_ADDRESS
  794. #define LOCAL_SCRATCH_OFFSET 0x18
  795. #define CPU_CLOCK_OFFSET SOC_CPU_CLOCK_OFFSET
  796. #define LPO_CAL_OFFSET SOC_LPO_CAL_OFFSET
  797. #define GPIO_PIN10_OFFSET WLAN_GPIO_PIN10_ADDRESS
  798. #define GPIO_PIN11_OFFSET WLAN_GPIO_PIN11_ADDRESS
  799. #define GPIO_PIN12_OFFSET WLAN_GPIO_PIN12_ADDRESS
  800. #define GPIO_PIN13_OFFSET WLAN_GPIO_PIN13_ADDRESS
  801. #define CPU_CLOCK_STANDARD_LSB SOC_CPU_CLOCK_STANDARD_LSB
  802. #define CPU_CLOCK_STANDARD_MASK SOC_CPU_CLOCK_STANDARD_MASK
  803. #define LPO_CAL_ENABLE_LSB SOC_LPO_CAL_ENABLE_LSB
  804. #define LPO_CAL_ENABLE_MASK SOC_LPO_CAL_ENABLE_MASK
  805. #define ANALOG_INTF_BASE_ADDRESS WLAN_ANALOG_INTF_BASE_ADDRESS
  806. #define MBOX_BASE_ADDRESS MISSING
  807. #define INT_STATUS_ENABLE_ERROR_LSB MISSING
  808. #define INT_STATUS_ENABLE_ERROR_MASK MISSING
  809. #define INT_STATUS_ENABLE_CPU_LSB MISSING
  810. #define INT_STATUS_ENABLE_CPU_MASK MISSING
  811. #define INT_STATUS_ENABLE_COUNTER_LSB MISSING
  812. #define INT_STATUS_ENABLE_COUNTER_MASK MISSING
  813. #define INT_STATUS_ENABLE_MBOX_DATA_LSB MISSING
  814. #define INT_STATUS_ENABLE_MBOX_DATA_MASK MISSING
  815. #define ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB MISSING
  816. #define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK MISSING
  817. #define ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB MISSING
  818. #define ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK MISSING
  819. #define COUNTER_INT_STATUS_ENABLE_BIT_LSB MISSING
  820. #define COUNTER_INT_STATUS_ENABLE_BIT_MASK MISSING
  821. #define INT_STATUS_ENABLE_ADDRESS MISSING
  822. #define CPU_INT_STATUS_ENABLE_BIT_LSB MISSING
  823. #define CPU_INT_STATUS_ENABLE_BIT_MASK MISSING
  824. #define HOST_INT_STATUS_ADDRESS MISSING
  825. #define CPU_INT_STATUS_ADDRESS MISSING
  826. #define ERROR_INT_STATUS_ADDRESS MISSING
  827. #define ERROR_INT_STATUS_WAKEUP_MASK MISSING
  828. #define ERROR_INT_STATUS_WAKEUP_LSB MISSING
  829. #define ERROR_INT_STATUS_RX_UNDERFLOW_MASK MISSING
  830. #define ERROR_INT_STATUS_RX_UNDERFLOW_LSB MISSING
  831. #define ERROR_INT_STATUS_TX_OVERFLOW_MASK MISSING
  832. #define ERROR_INT_STATUS_TX_OVERFLOW_LSB MISSING
  833. #define COUNT_DEC_ADDRESS MISSING
  834. #define HOST_INT_STATUS_CPU_MASK MISSING
  835. #define HOST_INT_STATUS_CPU_LSB MISSING
  836. #define HOST_INT_STATUS_ERROR_MASK MISSING
  837. #define HOST_INT_STATUS_ERROR_LSB MISSING
  838. #define HOST_INT_STATUS_COUNTER_MASK MISSING
  839. #define HOST_INT_STATUS_COUNTER_LSB MISSING
  840. #define RX_LOOKAHEAD_VALID_ADDRESS MISSING
  841. #define WINDOW_DATA_ADDRESS MISSING
  842. #define WINDOW_READ_ADDR_ADDRESS MISSING
  843. #define WINDOW_WRITE_ADDR_ADDRESS MISSING
  844. #define QCA9887_1_0_I2C_SDA_GPIO_PIN 5
  845. #define QCA9887_1_0_I2C_SDA_PIN_CONFIG 3
  846. #define QCA9887_1_0_SI_CLK_GPIO_PIN 17
  847. #define QCA9887_1_0_SI_CLK_PIN_CONFIG 3
  848. #define QCA9887_1_0_GPIO_ENABLE_W1TS_LOW_ADDRESS 0x00000010
  849. #define QCA9887_EEPROM_SELECT_READ 0xa10000a0
  850. #define QCA9887_EEPROM_ADDR_HI_MASK 0x0000ff00
  851. #define QCA9887_EEPROM_ADDR_HI_LSB 8
  852. #define QCA9887_EEPROM_ADDR_LO_MASK 0x00ff0000
  853. #define QCA9887_EEPROM_ADDR_LO_LSB 16
  854. #define MBOX_RESET_CONTROL_ADDRESS 0x00000000
  855. #define MBOX_HOST_INT_STATUS_ADDRESS 0x00000800
  856. #define MBOX_HOST_INT_STATUS_ERROR_LSB 7
  857. #define MBOX_HOST_INT_STATUS_ERROR_MASK 0x00000080
  858. #define MBOX_HOST_INT_STATUS_CPU_LSB 6
  859. #define MBOX_HOST_INT_STATUS_CPU_MASK 0x00000040
  860. #define MBOX_HOST_INT_STATUS_COUNTER_LSB 4
  861. #define MBOX_HOST_INT_STATUS_COUNTER_MASK 0x00000010
  862. #define MBOX_CPU_INT_STATUS_ADDRESS 0x00000801
  863. #define MBOX_ERROR_INT_STATUS_ADDRESS 0x00000802
  864. #define MBOX_ERROR_INT_STATUS_WAKEUP_LSB 2
  865. #define MBOX_ERROR_INT_STATUS_WAKEUP_MASK 0x00000004
  866. #define MBOX_ERROR_INT_STATUS_RX_UNDERFLOW_LSB 1
  867. #define MBOX_ERROR_INT_STATUS_RX_UNDERFLOW_MASK 0x00000002
  868. #define MBOX_ERROR_INT_STATUS_TX_OVERFLOW_LSB 0
  869. #define MBOX_ERROR_INT_STATUS_TX_OVERFLOW_MASK 0x00000001
  870. #define MBOX_COUNTER_INT_STATUS_ADDRESS 0x00000803
  871. #define MBOX_COUNTER_INT_STATUS_COUNTER_LSB 0
  872. #define MBOX_COUNTER_INT_STATUS_COUNTER_MASK 0x000000ff
  873. #define MBOX_RX_LOOKAHEAD_VALID_ADDRESS 0x00000805
  874. #define MBOX_INT_STATUS_ENABLE_ADDRESS 0x00000828
  875. #define MBOX_INT_STATUS_ENABLE_ERROR_LSB 7
  876. #define MBOX_INT_STATUS_ENABLE_ERROR_MASK 0x00000080
  877. #define MBOX_INT_STATUS_ENABLE_CPU_LSB 6
  878. #define MBOX_INT_STATUS_ENABLE_CPU_MASK 0x00000040
  879. #define MBOX_INT_STATUS_ENABLE_INT_LSB 5
  880. #define MBOX_INT_STATUS_ENABLE_INT_MASK 0x00000020
  881. #define MBOX_INT_STATUS_ENABLE_COUNTER_LSB 4
  882. #define MBOX_INT_STATUS_ENABLE_COUNTER_MASK 0x00000010
  883. #define MBOX_INT_STATUS_ENABLE_MBOX_DATA_LSB 0
  884. #define MBOX_INT_STATUS_ENABLE_MBOX_DATA_MASK 0x0000000f
  885. #define MBOX_CPU_INT_STATUS_ENABLE_ADDRESS 0x00000819
  886. #define MBOX_CPU_INT_STATUS_ENABLE_BIT_LSB 0
  887. #define MBOX_CPU_INT_STATUS_ENABLE_BIT_MASK 0x000000ff
  888. #define MBOX_ERROR_STATUS_ENABLE_ADDRESS 0x0000081a
  889. #define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB 1
  890. #define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK 0x00000002
  891. #define MBOX_ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB 0
  892. #define MBOX_ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK 0x00000001
  893. #define MBOX_COUNTER_INT_STATUS_ENABLE_ADDRESS 0x0000081b
  894. #define MBOX_COUNTER_INT_STATUS_ENABLE_BIT_LSB 0
  895. #define MBOX_COUNTER_INT_STATUS_ENABLE_BIT_MASK 0x000000ff
  896. #define MBOX_COUNT_ADDRESS 0x00000820
  897. #define MBOX_COUNT_DEC_ADDRESS 0x00000840
  898. #define MBOX_WINDOW_DATA_ADDRESS 0x00000874
  899. #define MBOX_WINDOW_WRITE_ADDR_ADDRESS 0x00000878
  900. #define MBOX_WINDOW_READ_ADDR_ADDRESS 0x0000087c
  901. #define MBOX_CPU_DBG_SEL_ADDRESS 0x00000883
  902. #define MBOX_CPU_DBG_ADDRESS 0x00000884
  903. #define MBOX_RTC_BASE_ADDRESS 0x00000000
  904. #define MBOX_GPIO_BASE_ADDRESS 0x00005000
  905. #define MBOX_MBOX_BASE_ADDRESS 0x00008000
  906. #define RTC_STATE_V_GET(x) (((x) & RTC_STATE_V_MASK) >> RTC_STATE_V_LSB)
  907. /* Register definitions for first generation ath10k cards. These cards include
  908. * a mac thich has a register allocation similar to ath9k and at least some
  909. * registers including the ones relevant for modifying the coverage class are
  910. * identical to the ath9k definitions.
  911. * These registers are usually managed by the ath10k firmware. However by
  912. * overriding them it is possible to support coverage class modifications.
  913. */
  914. #define WAVE1_PCU_ACK_CTS_TIMEOUT 0x8014
  915. #define WAVE1_PCU_ACK_CTS_TIMEOUT_MAX 0x00003FFF
  916. #define WAVE1_PCU_ACK_CTS_TIMEOUT_ACK_MASK 0x00003FFF
  917. #define WAVE1_PCU_ACK_CTS_TIMEOUT_ACK_LSB 0
  918. #define WAVE1_PCU_ACK_CTS_TIMEOUT_CTS_MASK 0x3FFF0000
  919. #define WAVE1_PCU_ACK_CTS_TIMEOUT_CTS_LSB 16
  920. #define WAVE1_PCU_GBL_IFS_SLOT 0x1070
  921. #define WAVE1_PCU_GBL_IFS_SLOT_MASK 0x0000FFFF
  922. #define WAVE1_PCU_GBL_IFS_SLOT_MAX 0x0000FFFF
  923. #define WAVE1_PCU_GBL_IFS_SLOT_LSB 0
  924. #define WAVE1_PCU_GBL_IFS_SLOT_RESV0 0xFFFF0000
  925. #define WAVE1_PHYCLK 0x801C
  926. #define WAVE1_PHYCLK_USEC_MASK 0x0000007F
  927. #define WAVE1_PHYCLK_USEC_LSB 0
  928. /* qca6174 PLL offset/mask */
  929. #define SOC_CORE_CLK_CTRL_OFFSET 0x00000114
  930. #define SOC_CORE_CLK_CTRL_DIV_LSB 0
  931. #define SOC_CORE_CLK_CTRL_DIV_MASK 0x00000007
  932. #define EFUSE_OFFSET 0x0000032c
  933. #define EFUSE_XTAL_SEL_LSB 8
  934. #define EFUSE_XTAL_SEL_MASK 0x00000700
  935. #define BB_PLL_CONFIG_OFFSET 0x000002f4
  936. #define BB_PLL_CONFIG_FRAC_LSB 0
  937. #define BB_PLL_CONFIG_FRAC_MASK 0x0003ffff
  938. #define BB_PLL_CONFIG_OUTDIV_LSB 18
  939. #define BB_PLL_CONFIG_OUTDIV_MASK 0x001c0000
  940. #define WLAN_PLL_SETTLE_OFFSET 0x0018
  941. #define WLAN_PLL_SETTLE_TIME_LSB 0
  942. #define WLAN_PLL_SETTLE_TIME_MASK 0x000007ff
  943. #define WLAN_PLL_CONTROL_OFFSET 0x0014
  944. #define WLAN_PLL_CONTROL_DIV_LSB 0
  945. #define WLAN_PLL_CONTROL_DIV_MASK 0x000003ff
  946. #define WLAN_PLL_CONTROL_REFDIV_LSB 10
  947. #define WLAN_PLL_CONTROL_REFDIV_MASK 0x00003c00
  948. #define WLAN_PLL_CONTROL_BYPASS_LSB 16
  949. #define WLAN_PLL_CONTROL_BYPASS_MASK 0x00010000
  950. #define WLAN_PLL_CONTROL_NOPWD_LSB 18
  951. #define WLAN_PLL_CONTROL_NOPWD_MASK 0x00040000
  952. #define RTC_SYNC_STATUS_OFFSET 0x0244
  953. #define RTC_SYNC_STATUS_PLL_CHANGING_LSB 5
  954. #define RTC_SYNC_STATUS_PLL_CHANGING_MASK 0x00000020
  955. /* qca6174 PLL offset/mask end */
  956. #endif /* _HW_H_ */