hw.h 37 KB

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