hw.h 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127
  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. /* Number of bytes to be the offset for each FFT sample */
  494. int spectral_bin_offset;
  495. };
  496. struct htt_rx_desc;
  497. /* Defines needed for Rx descriptor abstraction */
  498. struct ath10k_hw_ops {
  499. int (*rx_desc_get_l3_pad_bytes)(struct htt_rx_desc *rxd);
  500. void (*set_coverage_class)(struct ath10k *ar, s16 value);
  501. int (*enable_pll_clk)(struct ath10k *ar);
  502. };
  503. extern const struct ath10k_hw_ops qca988x_ops;
  504. extern const struct ath10k_hw_ops qca99x0_ops;
  505. extern const struct ath10k_hw_ops qca6174_ops;
  506. extern const struct ath10k_hw_ops wcn3990_ops;
  507. extern const struct ath10k_hw_clk_params qca6174_clk[];
  508. static inline int
  509. ath10k_rx_desc_get_l3_pad_bytes(struct ath10k_hw_params *hw,
  510. struct htt_rx_desc *rxd)
  511. {
  512. if (hw->hw_ops->rx_desc_get_l3_pad_bytes)
  513. return hw->hw_ops->rx_desc_get_l3_pad_bytes(rxd);
  514. return 0;
  515. }
  516. /* Target specific defines for MAIN firmware */
  517. #define TARGET_NUM_VDEVS 8
  518. #define TARGET_NUM_PEER_AST 2
  519. #define TARGET_NUM_WDS_ENTRIES 32
  520. #define TARGET_DMA_BURST_SIZE 0
  521. #define TARGET_MAC_AGGR_DELIM 0
  522. #define TARGET_AST_SKID_LIMIT 16
  523. #define TARGET_NUM_STATIONS 16
  524. #define TARGET_NUM_PEERS ((TARGET_NUM_STATIONS) + \
  525. (TARGET_NUM_VDEVS))
  526. #define TARGET_NUM_OFFLOAD_PEERS 0
  527. #define TARGET_NUM_OFFLOAD_REORDER_BUFS 0
  528. #define TARGET_NUM_PEER_KEYS 2
  529. #define TARGET_NUM_TIDS ((TARGET_NUM_PEERS) * 2)
  530. #define TARGET_TX_CHAIN_MASK (BIT(0) | BIT(1) | BIT(2))
  531. #define TARGET_RX_CHAIN_MASK (BIT(0) | BIT(1) | BIT(2))
  532. #define TARGET_RX_TIMEOUT_LO_PRI 100
  533. #define TARGET_RX_TIMEOUT_HI_PRI 40
  534. #define TARGET_SCAN_MAX_PENDING_REQS 4
  535. #define TARGET_BMISS_OFFLOAD_MAX_VDEV 3
  536. #define TARGET_ROAM_OFFLOAD_MAX_VDEV 3
  537. #define TARGET_ROAM_OFFLOAD_MAX_AP_PROFILES 8
  538. #define TARGET_GTK_OFFLOAD_MAX_VDEV 3
  539. #define TARGET_NUM_MCAST_GROUPS 0
  540. #define TARGET_NUM_MCAST_TABLE_ELEMS 0
  541. #define TARGET_MCAST2UCAST_MODE ATH10K_MCAST2UCAST_DISABLED
  542. #define TARGET_TX_DBG_LOG_SIZE 1024
  543. #define TARGET_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 0
  544. #define TARGET_VOW_CONFIG 0
  545. #define TARGET_NUM_MSDU_DESC (1024 + 400)
  546. #define TARGET_MAX_FRAG_ENTRIES 0
  547. /* Target specific defines for 10.X firmware */
  548. #define TARGET_10X_NUM_VDEVS 16
  549. #define TARGET_10X_NUM_PEER_AST 2
  550. #define TARGET_10X_NUM_WDS_ENTRIES 32
  551. #define TARGET_10X_DMA_BURST_SIZE 0
  552. #define TARGET_10X_MAC_AGGR_DELIM 0
  553. #define TARGET_10X_AST_SKID_LIMIT 128
  554. #define TARGET_10X_NUM_STATIONS 128
  555. #define TARGET_10X_TX_STATS_NUM_STATIONS 118
  556. #define TARGET_10X_NUM_PEERS ((TARGET_10X_NUM_STATIONS) + \
  557. (TARGET_10X_NUM_VDEVS))
  558. #define TARGET_10X_TX_STATS_NUM_PEERS ((TARGET_10X_TX_STATS_NUM_STATIONS) + \
  559. (TARGET_10X_NUM_VDEVS))
  560. #define TARGET_10X_NUM_OFFLOAD_PEERS 0
  561. #define TARGET_10X_NUM_OFFLOAD_REORDER_BUFS 0
  562. #define TARGET_10X_NUM_PEER_KEYS 2
  563. #define TARGET_10X_NUM_TIDS_MAX 256
  564. #define TARGET_10X_NUM_TIDS min((TARGET_10X_NUM_TIDS_MAX), \
  565. (TARGET_10X_NUM_PEERS) * 2)
  566. #define TARGET_10X_TX_STATS_NUM_TIDS min((TARGET_10X_NUM_TIDS_MAX), \
  567. (TARGET_10X_TX_STATS_NUM_PEERS) * 2)
  568. #define TARGET_10X_TX_CHAIN_MASK (BIT(0) | BIT(1) | BIT(2))
  569. #define TARGET_10X_RX_CHAIN_MASK (BIT(0) | BIT(1) | BIT(2))
  570. #define TARGET_10X_RX_TIMEOUT_LO_PRI 100
  571. #define TARGET_10X_RX_TIMEOUT_HI_PRI 40
  572. #define TARGET_10X_SCAN_MAX_PENDING_REQS 4
  573. #define TARGET_10X_BMISS_OFFLOAD_MAX_VDEV 2
  574. #define TARGET_10X_ROAM_OFFLOAD_MAX_VDEV 2
  575. #define TARGET_10X_ROAM_OFFLOAD_MAX_AP_PROFILES 8
  576. #define TARGET_10X_GTK_OFFLOAD_MAX_VDEV 3
  577. #define TARGET_10X_NUM_MCAST_GROUPS 0
  578. #define TARGET_10X_NUM_MCAST_TABLE_ELEMS 0
  579. #define TARGET_10X_MCAST2UCAST_MODE ATH10K_MCAST2UCAST_DISABLED
  580. #define TARGET_10X_TX_DBG_LOG_SIZE 1024
  581. #define TARGET_10X_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
  582. #define TARGET_10X_VOW_CONFIG 0
  583. #define TARGET_10X_NUM_MSDU_DESC (1024 + 400)
  584. #define TARGET_10X_MAX_FRAG_ENTRIES 0
  585. /* 10.2 parameters */
  586. #define TARGET_10_2_DMA_BURST_SIZE 0
  587. /* Target specific defines for WMI-TLV firmware */
  588. #define TARGET_TLV_NUM_VDEVS 4
  589. #define TARGET_TLV_NUM_STATIONS 32
  590. #define TARGET_TLV_NUM_PEERS 33
  591. #define TARGET_TLV_NUM_TDLS_VDEVS 1
  592. #define TARGET_TLV_NUM_TIDS ((TARGET_TLV_NUM_PEERS) * 2)
  593. #define TARGET_TLV_NUM_MSDU_DESC (1024 + 32)
  594. #define TARGET_TLV_NUM_WOW_PATTERNS 22
  595. #define TARGET_TLV_MGMT_NUM_MSDU_DESC (50)
  596. /* Target specific defines for WMI-HL-1.0 firmware */
  597. #define TARGET_HL_10_TLV_NUM_PEERS 14
  598. #define TARGET_HL_10_TLV_AST_SKID_LIMIT 6
  599. #define TARGET_HL_10_TLV_NUM_WDS_ENTRIES 2
  600. /* Diagnostic Window */
  601. #define CE_DIAG_PIPE 7
  602. #define NUM_TARGET_CE_CONFIG_WLAN ar->hw_values->num_target_ce_config_wlan
  603. /* Target specific defines for 10.4 firmware */
  604. #define TARGET_10_4_NUM_VDEVS 16
  605. #define TARGET_10_4_NUM_STATIONS 32
  606. #define TARGET_10_4_NUM_PEERS ((TARGET_10_4_NUM_STATIONS) + \
  607. (TARGET_10_4_NUM_VDEVS))
  608. #define TARGET_10_4_ACTIVE_PEERS 0
  609. #define TARGET_10_4_NUM_QCACHE_PEERS_MAX 512
  610. #define TARGET_10_4_QCACHE_ACTIVE_PEERS 50
  611. #define TARGET_10_4_QCACHE_ACTIVE_PEERS_PFC 35
  612. #define TARGET_10_4_NUM_OFFLOAD_PEERS 0
  613. #define TARGET_10_4_NUM_OFFLOAD_REORDER_BUFFS 0
  614. #define TARGET_10_4_NUM_PEER_KEYS 2
  615. #define TARGET_10_4_TGT_NUM_TIDS ((TARGET_10_4_NUM_PEERS) * 2)
  616. #define TARGET_10_4_NUM_MSDU_DESC (1024 + 400)
  617. #define TARGET_10_4_NUM_MSDU_DESC_PFC 2500
  618. #define TARGET_10_4_AST_SKID_LIMIT 32
  619. /* 100 ms for video, best-effort, and background */
  620. #define TARGET_10_4_RX_TIMEOUT_LO_PRI 100
  621. /* 40 ms for voice */
  622. #define TARGET_10_4_RX_TIMEOUT_HI_PRI 40
  623. #define TARGET_10_4_RX_DECAP_MODE ATH10K_HW_TXRX_NATIVE_WIFI
  624. #define TARGET_10_4_SCAN_MAX_REQS 4
  625. #define TARGET_10_4_BMISS_OFFLOAD_MAX_VDEV 3
  626. #define TARGET_10_4_ROAM_OFFLOAD_MAX_VDEV 3
  627. #define TARGET_10_4_ROAM_OFFLOAD_MAX_PROFILES 8
  628. /* Note: mcast to ucast is disabled by default */
  629. #define TARGET_10_4_NUM_MCAST_GROUPS 0
  630. #define TARGET_10_4_NUM_MCAST_TABLE_ELEMS 0
  631. #define TARGET_10_4_MCAST2UCAST_MODE 0
  632. #define TARGET_10_4_TX_DBG_LOG_SIZE 1024
  633. #define TARGET_10_4_NUM_WDS_ENTRIES 32
  634. #define TARGET_10_4_DMA_BURST_SIZE 0
  635. #define TARGET_10_4_MAC_AGGR_DELIM 0
  636. #define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
  637. #define TARGET_10_4_VOW_CONFIG 0
  638. #define TARGET_10_4_GTK_OFFLOAD_MAX_VDEV 3
  639. #define TARGET_10_4_11AC_TX_MAX_FRAGS 2
  640. #define TARGET_10_4_MAX_PEER_EXT_STATS 16
  641. #define TARGET_10_4_SMART_ANT_CAP 0
  642. #define TARGET_10_4_BK_MIN_FREE 0
  643. #define TARGET_10_4_BE_MIN_FREE 0
  644. #define TARGET_10_4_VI_MIN_FREE 0
  645. #define TARGET_10_4_VO_MIN_FREE 0
  646. #define TARGET_10_4_RX_BATCH_MODE 1
  647. #define TARGET_10_4_THERMAL_THROTTLING_CONFIG 0
  648. #define TARGET_10_4_ATF_CONFIG 0
  649. #define TARGET_10_4_IPHDR_PAD_CONFIG 1
  650. #define TARGET_10_4_QWRAP_CONFIG 0
  651. /* TDLS config */
  652. #define TARGET_10_4_NUM_TDLS_VDEVS 1
  653. #define TARGET_10_4_NUM_TDLS_BUFFER_STA 1
  654. #define TARGET_10_4_NUM_TDLS_SLEEP_STA 1
  655. /* Maximum number of Copy Engine's supported */
  656. #define CE_COUNT_MAX 12
  657. /* Number of Copy Engines supported */
  658. #define CE_COUNT ar->hw_values->ce_count
  659. /*
  660. * Granted MSIs are assigned as follows:
  661. * Firmware uses the first
  662. * Remaining MSIs, if any, are used by Copy Engines
  663. * This mapping is known to both Target firmware and Host software.
  664. * It may be changed as long as Host and Target are kept in sync.
  665. */
  666. /* MSI for firmware (errors, etc.) */
  667. #define MSI_ASSIGN_FW 0
  668. /* MSIs for Copy Engines */
  669. #define MSI_ASSIGN_CE_INITIAL 1
  670. #define MSI_ASSIGN_CE_MAX ar->hw_values->msi_assign_ce_max
  671. /* as of IP3.7.1 */
  672. #define RTC_STATE_V_ON ar->hw_values->rtc_state_val_on
  673. #define RTC_STATE_V_LSB 0
  674. #define RTC_STATE_V_MASK 0x00000007
  675. #define RTC_STATE_ADDRESS 0x0000
  676. #define PCIE_SOC_WAKE_V_MASK 0x00000001
  677. #define PCIE_SOC_WAKE_ADDRESS 0x0004
  678. #define PCIE_SOC_WAKE_RESET 0x00000000
  679. #define SOC_GLOBAL_RESET_ADDRESS 0x0008
  680. #define RTC_SOC_BASE_ADDRESS ar->regs->rtc_soc_base_address
  681. #define RTC_WMAC_BASE_ADDRESS ar->regs->rtc_wmac_base_address
  682. #define MAC_COEX_BASE_ADDRESS 0x00006000
  683. #define BT_COEX_BASE_ADDRESS 0x00007000
  684. #define SOC_PCIE_BASE_ADDRESS 0x00008000
  685. #define SOC_CORE_BASE_ADDRESS ar->regs->soc_core_base_address
  686. #define WLAN_UART_BASE_ADDRESS 0x0000c000
  687. #define WLAN_SI_BASE_ADDRESS 0x00010000
  688. #define WLAN_GPIO_BASE_ADDRESS 0x00014000
  689. #define WLAN_ANALOG_INTF_BASE_ADDRESS 0x0001c000
  690. #define WLAN_MAC_BASE_ADDRESS ar->regs->wlan_mac_base_address
  691. #define EFUSE_BASE_ADDRESS 0x00030000
  692. #define FPGA_REG_BASE_ADDRESS 0x00039000
  693. #define WLAN_UART2_BASE_ADDRESS 0x00054c00
  694. #define CE_WRAPPER_BASE_ADDRESS ar->regs->ce_wrapper_base_address
  695. #define CE0_BASE_ADDRESS ar->regs->ce0_base_address
  696. #define CE1_BASE_ADDRESS ar->regs->ce1_base_address
  697. #define CE2_BASE_ADDRESS ar->regs->ce2_base_address
  698. #define CE3_BASE_ADDRESS ar->regs->ce3_base_address
  699. #define CE4_BASE_ADDRESS ar->regs->ce4_base_address
  700. #define CE5_BASE_ADDRESS ar->regs->ce5_base_address
  701. #define CE6_BASE_ADDRESS ar->regs->ce6_base_address
  702. #define CE7_BASE_ADDRESS ar->regs->ce7_base_address
  703. #define DBI_BASE_ADDRESS 0x00060000
  704. #define WLAN_ANALOG_INTF_PCIE_BASE_ADDRESS 0x0006c000
  705. #define PCIE_LOCAL_BASE_ADDRESS ar->regs->pcie_local_base_address
  706. #define SOC_RESET_CONTROL_ADDRESS 0x00000000
  707. #define SOC_RESET_CONTROL_OFFSET 0x00000000
  708. #define SOC_RESET_CONTROL_SI0_RST_MASK ar->regs->soc_reset_control_si0_rst_mask
  709. #define SOC_RESET_CONTROL_CE_RST_MASK ar->regs->soc_reset_control_ce_rst_mask
  710. #define SOC_RESET_CONTROL_CPU_WARM_RST_MASK 0x00000040
  711. #define SOC_CPU_CLOCK_OFFSET 0x00000020
  712. #define SOC_CPU_CLOCK_STANDARD_LSB 0
  713. #define SOC_CPU_CLOCK_STANDARD_MASK 0x00000003
  714. #define SOC_CLOCK_CONTROL_OFFSET 0x00000028
  715. #define SOC_CLOCK_CONTROL_SI0_CLK_MASK 0x00000001
  716. #define SOC_SYSTEM_SLEEP_OFFSET 0x000000c4
  717. #define SOC_LPO_CAL_OFFSET 0x000000e0
  718. #define SOC_LPO_CAL_ENABLE_LSB 20
  719. #define SOC_LPO_CAL_ENABLE_MASK 0x00100000
  720. #define SOC_LF_TIMER_CONTROL0_ADDRESS 0x00000050
  721. #define SOC_LF_TIMER_CONTROL0_ENABLE_MASK 0x00000004
  722. #define SOC_CHIP_ID_ADDRESS ar->regs->soc_chip_id_address
  723. #define SOC_CHIP_ID_REV_LSB 8
  724. #define SOC_CHIP_ID_REV_MASK 0x00000f00
  725. #define WLAN_RESET_CONTROL_COLD_RST_MASK 0x00000008
  726. #define WLAN_RESET_CONTROL_WARM_RST_MASK 0x00000004
  727. #define WLAN_SYSTEM_SLEEP_DISABLE_LSB 0
  728. #define WLAN_SYSTEM_SLEEP_DISABLE_MASK 0x00000001
  729. #define WLAN_GPIO_PIN0_ADDRESS 0x00000028
  730. #define WLAN_GPIO_PIN0_CONFIG_LSB 11
  731. #define WLAN_GPIO_PIN0_CONFIG_MASK 0x00007800
  732. #define WLAN_GPIO_PIN0_PAD_PULL_LSB 5
  733. #define WLAN_GPIO_PIN0_PAD_PULL_MASK 0x00000060
  734. #define WLAN_GPIO_PIN1_ADDRESS 0x0000002c
  735. #define WLAN_GPIO_PIN1_CONFIG_MASK 0x00007800
  736. #define WLAN_GPIO_PIN10_ADDRESS 0x00000050
  737. #define WLAN_GPIO_PIN11_ADDRESS 0x00000054
  738. #define WLAN_GPIO_PIN12_ADDRESS 0x00000058
  739. #define WLAN_GPIO_PIN13_ADDRESS 0x0000005c
  740. #define CLOCK_GPIO_OFFSET 0xffffffff
  741. #define CLOCK_GPIO_BT_CLK_OUT_EN_LSB 0
  742. #define CLOCK_GPIO_BT_CLK_OUT_EN_MASK 0
  743. #define SI_CONFIG_OFFSET 0x00000000
  744. #define SI_CONFIG_ERR_INT_LSB 19
  745. #define SI_CONFIG_ERR_INT_MASK 0x00080000
  746. #define SI_CONFIG_BIDIR_OD_DATA_LSB 18
  747. #define SI_CONFIG_BIDIR_OD_DATA_MASK 0x00040000
  748. #define SI_CONFIG_I2C_LSB 16
  749. #define SI_CONFIG_I2C_MASK 0x00010000
  750. #define SI_CONFIG_POS_SAMPLE_LSB 7
  751. #define SI_CONFIG_POS_SAMPLE_MASK 0x00000080
  752. #define SI_CONFIG_INACTIVE_DATA_LSB 5
  753. #define SI_CONFIG_INACTIVE_DATA_MASK 0x00000020
  754. #define SI_CONFIG_INACTIVE_CLK_LSB 4
  755. #define SI_CONFIG_INACTIVE_CLK_MASK 0x00000010
  756. #define SI_CONFIG_DIVIDER_LSB 0
  757. #define SI_CONFIG_DIVIDER_MASK 0x0000000f
  758. #define SI_CS_OFFSET 0x00000004
  759. #define SI_CS_DONE_ERR_LSB 10
  760. #define SI_CS_DONE_ERR_MASK 0x00000400
  761. #define SI_CS_DONE_INT_LSB 9
  762. #define SI_CS_DONE_INT_MASK 0x00000200
  763. #define SI_CS_START_LSB 8
  764. #define SI_CS_START_MASK 0x00000100
  765. #define SI_CS_RX_CNT_LSB 4
  766. #define SI_CS_RX_CNT_MASK 0x000000f0
  767. #define SI_CS_TX_CNT_LSB 0
  768. #define SI_CS_TX_CNT_MASK 0x0000000f
  769. #define SI_TX_DATA0_OFFSET 0x00000008
  770. #define SI_TX_DATA1_OFFSET 0x0000000c
  771. #define SI_RX_DATA0_OFFSET 0x00000010
  772. #define SI_RX_DATA1_OFFSET 0x00000014
  773. #define CORE_CTRL_CPU_INTR_MASK 0x00002000
  774. #define CORE_CTRL_PCIE_REG_31_MASK 0x00000800
  775. #define CORE_CTRL_ADDRESS 0x0000
  776. #define PCIE_INTR_ENABLE_ADDRESS 0x0008
  777. #define PCIE_INTR_CAUSE_ADDRESS 0x000c
  778. #define PCIE_INTR_CLR_ADDRESS ar->regs->pcie_intr_clr_address
  779. #define SCRATCH_3_ADDRESS ar->regs->scratch_3_address
  780. #define CPU_INTR_ADDRESS 0x0010
  781. #define FW_RAM_CONFIG_ADDRESS 0x0018
  782. #define CCNT_TO_MSEC(ar, x) ((x) / ar->hw_params.channel_counters_freq_hz)
  783. /* Firmware indications to the Host via SCRATCH_3 register. */
  784. #define FW_INDICATOR_ADDRESS ar->regs->fw_indicator_address
  785. #define FW_IND_EVENT_PENDING 1
  786. #define FW_IND_INITIALIZED 2
  787. #define FW_IND_HOST_READY 0x80000000
  788. /* HOST_REG interrupt from firmware */
  789. #define PCIE_INTR_FIRMWARE_MASK ar->regs->pcie_intr_fw_mask
  790. #define PCIE_INTR_CE_MASK_ALL ar->regs->pcie_intr_ce_mask_all
  791. #define DRAM_BASE_ADDRESS 0x00400000
  792. #define PCIE_BAR_REG_ADDRESS 0x40030
  793. #define MISSING 0
  794. #define SYSTEM_SLEEP_OFFSET SOC_SYSTEM_SLEEP_OFFSET
  795. #define WLAN_SYSTEM_SLEEP_OFFSET SOC_SYSTEM_SLEEP_OFFSET
  796. #define WLAN_RESET_CONTROL_OFFSET SOC_RESET_CONTROL_OFFSET
  797. #define CLOCK_CONTROL_OFFSET SOC_CLOCK_CONTROL_OFFSET
  798. #define CLOCK_CONTROL_SI0_CLK_MASK SOC_CLOCK_CONTROL_SI0_CLK_MASK
  799. #define RESET_CONTROL_MBOX_RST_MASK MISSING
  800. #define RESET_CONTROL_SI0_RST_MASK SOC_RESET_CONTROL_SI0_RST_MASK
  801. #define GPIO_BASE_ADDRESS WLAN_GPIO_BASE_ADDRESS
  802. #define GPIO_PIN0_OFFSET WLAN_GPIO_PIN0_ADDRESS
  803. #define GPIO_PIN1_OFFSET WLAN_GPIO_PIN1_ADDRESS
  804. #define GPIO_PIN0_CONFIG_LSB WLAN_GPIO_PIN0_CONFIG_LSB
  805. #define GPIO_PIN0_CONFIG_MASK WLAN_GPIO_PIN0_CONFIG_MASK
  806. #define GPIO_PIN0_PAD_PULL_LSB WLAN_GPIO_PIN0_PAD_PULL_LSB
  807. #define GPIO_PIN0_PAD_PULL_MASK WLAN_GPIO_PIN0_PAD_PULL_MASK
  808. #define GPIO_PIN1_CONFIG_MASK WLAN_GPIO_PIN1_CONFIG_MASK
  809. #define SI_BASE_ADDRESS WLAN_SI_BASE_ADDRESS
  810. #define SCRATCH_BASE_ADDRESS SOC_CORE_BASE_ADDRESS
  811. #define LOCAL_SCRATCH_OFFSET 0x18
  812. #define CPU_CLOCK_OFFSET SOC_CPU_CLOCK_OFFSET
  813. #define LPO_CAL_OFFSET SOC_LPO_CAL_OFFSET
  814. #define GPIO_PIN10_OFFSET WLAN_GPIO_PIN10_ADDRESS
  815. #define GPIO_PIN11_OFFSET WLAN_GPIO_PIN11_ADDRESS
  816. #define GPIO_PIN12_OFFSET WLAN_GPIO_PIN12_ADDRESS
  817. #define GPIO_PIN13_OFFSET WLAN_GPIO_PIN13_ADDRESS
  818. #define CPU_CLOCK_STANDARD_LSB SOC_CPU_CLOCK_STANDARD_LSB
  819. #define CPU_CLOCK_STANDARD_MASK SOC_CPU_CLOCK_STANDARD_MASK
  820. #define LPO_CAL_ENABLE_LSB SOC_LPO_CAL_ENABLE_LSB
  821. #define LPO_CAL_ENABLE_MASK SOC_LPO_CAL_ENABLE_MASK
  822. #define ANALOG_INTF_BASE_ADDRESS WLAN_ANALOG_INTF_BASE_ADDRESS
  823. #define MBOX_BASE_ADDRESS MISSING
  824. #define INT_STATUS_ENABLE_ERROR_LSB MISSING
  825. #define INT_STATUS_ENABLE_ERROR_MASK MISSING
  826. #define INT_STATUS_ENABLE_CPU_LSB MISSING
  827. #define INT_STATUS_ENABLE_CPU_MASK MISSING
  828. #define INT_STATUS_ENABLE_COUNTER_LSB MISSING
  829. #define INT_STATUS_ENABLE_COUNTER_MASK MISSING
  830. #define INT_STATUS_ENABLE_MBOX_DATA_LSB MISSING
  831. #define INT_STATUS_ENABLE_MBOX_DATA_MASK MISSING
  832. #define ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB MISSING
  833. #define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK MISSING
  834. #define ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB MISSING
  835. #define ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK MISSING
  836. #define COUNTER_INT_STATUS_ENABLE_BIT_LSB MISSING
  837. #define COUNTER_INT_STATUS_ENABLE_BIT_MASK MISSING
  838. #define INT_STATUS_ENABLE_ADDRESS MISSING
  839. #define CPU_INT_STATUS_ENABLE_BIT_LSB MISSING
  840. #define CPU_INT_STATUS_ENABLE_BIT_MASK MISSING
  841. #define HOST_INT_STATUS_ADDRESS MISSING
  842. #define CPU_INT_STATUS_ADDRESS MISSING
  843. #define ERROR_INT_STATUS_ADDRESS MISSING
  844. #define ERROR_INT_STATUS_WAKEUP_MASK MISSING
  845. #define ERROR_INT_STATUS_WAKEUP_LSB MISSING
  846. #define ERROR_INT_STATUS_RX_UNDERFLOW_MASK MISSING
  847. #define ERROR_INT_STATUS_RX_UNDERFLOW_LSB MISSING
  848. #define ERROR_INT_STATUS_TX_OVERFLOW_MASK MISSING
  849. #define ERROR_INT_STATUS_TX_OVERFLOW_LSB MISSING
  850. #define COUNT_DEC_ADDRESS MISSING
  851. #define HOST_INT_STATUS_CPU_MASK MISSING
  852. #define HOST_INT_STATUS_CPU_LSB MISSING
  853. #define HOST_INT_STATUS_ERROR_MASK MISSING
  854. #define HOST_INT_STATUS_ERROR_LSB MISSING
  855. #define HOST_INT_STATUS_COUNTER_MASK MISSING
  856. #define HOST_INT_STATUS_COUNTER_LSB MISSING
  857. #define RX_LOOKAHEAD_VALID_ADDRESS MISSING
  858. #define WINDOW_DATA_ADDRESS MISSING
  859. #define WINDOW_READ_ADDR_ADDRESS MISSING
  860. #define WINDOW_WRITE_ADDR_ADDRESS MISSING
  861. #define QCA9887_1_0_I2C_SDA_GPIO_PIN 5
  862. #define QCA9887_1_0_I2C_SDA_PIN_CONFIG 3
  863. #define QCA9887_1_0_SI_CLK_GPIO_PIN 17
  864. #define QCA9887_1_0_SI_CLK_PIN_CONFIG 3
  865. #define QCA9887_1_0_GPIO_ENABLE_W1TS_LOW_ADDRESS 0x00000010
  866. #define QCA9887_EEPROM_SELECT_READ 0xa10000a0
  867. #define QCA9887_EEPROM_ADDR_HI_MASK 0x0000ff00
  868. #define QCA9887_EEPROM_ADDR_HI_LSB 8
  869. #define QCA9887_EEPROM_ADDR_LO_MASK 0x00ff0000
  870. #define QCA9887_EEPROM_ADDR_LO_LSB 16
  871. #define MBOX_RESET_CONTROL_ADDRESS 0x00000000
  872. #define MBOX_HOST_INT_STATUS_ADDRESS 0x00000800
  873. #define MBOX_HOST_INT_STATUS_ERROR_LSB 7
  874. #define MBOX_HOST_INT_STATUS_ERROR_MASK 0x00000080
  875. #define MBOX_HOST_INT_STATUS_CPU_LSB 6
  876. #define MBOX_HOST_INT_STATUS_CPU_MASK 0x00000040
  877. #define MBOX_HOST_INT_STATUS_COUNTER_LSB 4
  878. #define MBOX_HOST_INT_STATUS_COUNTER_MASK 0x00000010
  879. #define MBOX_CPU_INT_STATUS_ADDRESS 0x00000801
  880. #define MBOX_ERROR_INT_STATUS_ADDRESS 0x00000802
  881. #define MBOX_ERROR_INT_STATUS_WAKEUP_LSB 2
  882. #define MBOX_ERROR_INT_STATUS_WAKEUP_MASK 0x00000004
  883. #define MBOX_ERROR_INT_STATUS_RX_UNDERFLOW_LSB 1
  884. #define MBOX_ERROR_INT_STATUS_RX_UNDERFLOW_MASK 0x00000002
  885. #define MBOX_ERROR_INT_STATUS_TX_OVERFLOW_LSB 0
  886. #define MBOX_ERROR_INT_STATUS_TX_OVERFLOW_MASK 0x00000001
  887. #define MBOX_COUNTER_INT_STATUS_ADDRESS 0x00000803
  888. #define MBOX_COUNTER_INT_STATUS_COUNTER_LSB 0
  889. #define MBOX_COUNTER_INT_STATUS_COUNTER_MASK 0x000000ff
  890. #define MBOX_RX_LOOKAHEAD_VALID_ADDRESS 0x00000805
  891. #define MBOX_INT_STATUS_ENABLE_ADDRESS 0x00000828
  892. #define MBOX_INT_STATUS_ENABLE_ERROR_LSB 7
  893. #define MBOX_INT_STATUS_ENABLE_ERROR_MASK 0x00000080
  894. #define MBOX_INT_STATUS_ENABLE_CPU_LSB 6
  895. #define MBOX_INT_STATUS_ENABLE_CPU_MASK 0x00000040
  896. #define MBOX_INT_STATUS_ENABLE_INT_LSB 5
  897. #define MBOX_INT_STATUS_ENABLE_INT_MASK 0x00000020
  898. #define MBOX_INT_STATUS_ENABLE_COUNTER_LSB 4
  899. #define MBOX_INT_STATUS_ENABLE_COUNTER_MASK 0x00000010
  900. #define MBOX_INT_STATUS_ENABLE_MBOX_DATA_LSB 0
  901. #define MBOX_INT_STATUS_ENABLE_MBOX_DATA_MASK 0x0000000f
  902. #define MBOX_CPU_INT_STATUS_ENABLE_ADDRESS 0x00000819
  903. #define MBOX_CPU_INT_STATUS_ENABLE_BIT_LSB 0
  904. #define MBOX_CPU_INT_STATUS_ENABLE_BIT_MASK 0x000000ff
  905. #define MBOX_ERROR_STATUS_ENABLE_ADDRESS 0x0000081a
  906. #define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB 1
  907. #define MBOX_ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK 0x00000002
  908. #define MBOX_ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB 0
  909. #define MBOX_ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK 0x00000001
  910. #define MBOX_COUNTER_INT_STATUS_ENABLE_ADDRESS 0x0000081b
  911. #define MBOX_COUNTER_INT_STATUS_ENABLE_BIT_LSB 0
  912. #define MBOX_COUNTER_INT_STATUS_ENABLE_BIT_MASK 0x000000ff
  913. #define MBOX_COUNT_ADDRESS 0x00000820
  914. #define MBOX_COUNT_DEC_ADDRESS 0x00000840
  915. #define MBOX_WINDOW_DATA_ADDRESS 0x00000874
  916. #define MBOX_WINDOW_WRITE_ADDR_ADDRESS 0x00000878
  917. #define MBOX_WINDOW_READ_ADDR_ADDRESS 0x0000087c
  918. #define MBOX_CPU_DBG_SEL_ADDRESS 0x00000883
  919. #define MBOX_CPU_DBG_ADDRESS 0x00000884
  920. #define MBOX_RTC_BASE_ADDRESS 0x00000000
  921. #define MBOX_GPIO_BASE_ADDRESS 0x00005000
  922. #define MBOX_MBOX_BASE_ADDRESS 0x00008000
  923. #define RTC_STATE_V_GET(x) (((x) & RTC_STATE_V_MASK) >> RTC_STATE_V_LSB)
  924. /* Register definitions for first generation ath10k cards. These cards include
  925. * a mac thich has a register allocation similar to ath9k and at least some
  926. * registers including the ones relevant for modifying the coverage class are
  927. * identical to the ath9k definitions.
  928. * These registers are usually managed by the ath10k firmware. However by
  929. * overriding them it is possible to support coverage class modifications.
  930. */
  931. #define WAVE1_PCU_ACK_CTS_TIMEOUT 0x8014
  932. #define WAVE1_PCU_ACK_CTS_TIMEOUT_MAX 0x00003FFF
  933. #define WAVE1_PCU_ACK_CTS_TIMEOUT_ACK_MASK 0x00003FFF
  934. #define WAVE1_PCU_ACK_CTS_TIMEOUT_ACK_LSB 0
  935. #define WAVE1_PCU_ACK_CTS_TIMEOUT_CTS_MASK 0x3FFF0000
  936. #define WAVE1_PCU_ACK_CTS_TIMEOUT_CTS_LSB 16
  937. #define WAVE1_PCU_GBL_IFS_SLOT 0x1070
  938. #define WAVE1_PCU_GBL_IFS_SLOT_MASK 0x0000FFFF
  939. #define WAVE1_PCU_GBL_IFS_SLOT_MAX 0x0000FFFF
  940. #define WAVE1_PCU_GBL_IFS_SLOT_LSB 0
  941. #define WAVE1_PCU_GBL_IFS_SLOT_RESV0 0xFFFF0000
  942. #define WAVE1_PHYCLK 0x801C
  943. #define WAVE1_PHYCLK_USEC_MASK 0x0000007F
  944. #define WAVE1_PHYCLK_USEC_LSB 0
  945. /* qca6174 PLL offset/mask */
  946. #define SOC_CORE_CLK_CTRL_OFFSET 0x00000114
  947. #define SOC_CORE_CLK_CTRL_DIV_LSB 0
  948. #define SOC_CORE_CLK_CTRL_DIV_MASK 0x00000007
  949. #define EFUSE_OFFSET 0x0000032c
  950. #define EFUSE_XTAL_SEL_LSB 8
  951. #define EFUSE_XTAL_SEL_MASK 0x00000700
  952. #define BB_PLL_CONFIG_OFFSET 0x000002f4
  953. #define BB_PLL_CONFIG_FRAC_LSB 0
  954. #define BB_PLL_CONFIG_FRAC_MASK 0x0003ffff
  955. #define BB_PLL_CONFIG_OUTDIV_LSB 18
  956. #define BB_PLL_CONFIG_OUTDIV_MASK 0x001c0000
  957. #define WLAN_PLL_SETTLE_OFFSET 0x0018
  958. #define WLAN_PLL_SETTLE_TIME_LSB 0
  959. #define WLAN_PLL_SETTLE_TIME_MASK 0x000007ff
  960. #define WLAN_PLL_CONTROL_OFFSET 0x0014
  961. #define WLAN_PLL_CONTROL_DIV_LSB 0
  962. #define WLAN_PLL_CONTROL_DIV_MASK 0x000003ff
  963. #define WLAN_PLL_CONTROL_REFDIV_LSB 10
  964. #define WLAN_PLL_CONTROL_REFDIV_MASK 0x00003c00
  965. #define WLAN_PLL_CONTROL_BYPASS_LSB 16
  966. #define WLAN_PLL_CONTROL_BYPASS_MASK 0x00010000
  967. #define WLAN_PLL_CONTROL_NOPWD_LSB 18
  968. #define WLAN_PLL_CONTROL_NOPWD_MASK 0x00040000
  969. #define RTC_SYNC_STATUS_OFFSET 0x0244
  970. #define RTC_SYNC_STATUS_PLL_CHANGING_LSB 5
  971. #define RTC_SYNC_STATUS_PLL_CHANGING_MASK 0x00000020
  972. /* qca6174 PLL offset/mask end */
  973. #endif /* _HW_H_ */