hw.h 36 KB

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