ath9k.h 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057
  1. /*
  2. * Copyright (c) 2008 Atheros Communications Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef ATH9K_H
  17. #define ATH9K_H
  18. #include <linux/io.h>
  19. #define ATHEROS_VENDOR_ID 0x168c
  20. #define AR5416_DEVID_PCI 0x0023
  21. #define AR5416_DEVID_PCIE 0x0024
  22. #define AR9160_DEVID_PCI 0x0027
  23. #define AR9280_DEVID_PCI 0x0029
  24. #define AR9280_DEVID_PCIE 0x002a
  25. #define AR9285_DEVID_PCIE 0x002b
  26. #define AR5416_AR9100_DEVID 0x000b
  27. #define AR_SUBVENDOR_ID_NOG 0x0e11
  28. #define AR_SUBVENDOR_ID_NEW_A 0x7065
  29. #define ATH9K_TXERR_XRETRY 0x01
  30. #define ATH9K_TXERR_FILT 0x02
  31. #define ATH9K_TXERR_FIFO 0x04
  32. #define ATH9K_TXERR_XTXOP 0x08
  33. #define ATH9K_TXERR_TIMER_EXPIRED 0x10
  34. #define ATH9K_TX_BA 0x01
  35. #define ATH9K_TX_PWRMGMT 0x02
  36. #define ATH9K_TX_DESC_CFG_ERR 0x04
  37. #define ATH9K_TX_DATA_UNDERRUN 0x08
  38. #define ATH9K_TX_DELIM_UNDERRUN 0x10
  39. #define ATH9K_TX_SW_ABORTED 0x40
  40. #define ATH9K_TX_SW_FILTERED 0x80
  41. #define NBBY 8
  42. struct ath_tx_status {
  43. u32 ts_tstamp;
  44. u16 ts_seqnum;
  45. u8 ts_status;
  46. u8 ts_ratecode;
  47. u8 ts_rateindex;
  48. int8_t ts_rssi;
  49. u8 ts_shortretry;
  50. u8 ts_longretry;
  51. u8 ts_virtcol;
  52. u8 ts_antenna;
  53. u8 ts_flags;
  54. int8_t ts_rssi_ctl0;
  55. int8_t ts_rssi_ctl1;
  56. int8_t ts_rssi_ctl2;
  57. int8_t ts_rssi_ext0;
  58. int8_t ts_rssi_ext1;
  59. int8_t ts_rssi_ext2;
  60. u8 pad[3];
  61. u32 ba_low;
  62. u32 ba_high;
  63. u32 evm0;
  64. u32 evm1;
  65. u32 evm2;
  66. };
  67. struct ath_rx_status {
  68. u32 rs_tstamp;
  69. u16 rs_datalen;
  70. u8 rs_status;
  71. u8 rs_phyerr;
  72. int8_t rs_rssi;
  73. u8 rs_keyix;
  74. u8 rs_rate;
  75. u8 rs_antenna;
  76. u8 rs_more;
  77. int8_t rs_rssi_ctl0;
  78. int8_t rs_rssi_ctl1;
  79. int8_t rs_rssi_ctl2;
  80. int8_t rs_rssi_ext0;
  81. int8_t rs_rssi_ext1;
  82. int8_t rs_rssi_ext2;
  83. u8 rs_isaggr;
  84. u8 rs_moreaggr;
  85. u8 rs_num_delims;
  86. u8 rs_flags;
  87. u32 evm0;
  88. u32 evm1;
  89. u32 evm2;
  90. };
  91. #define ATH9K_RXERR_CRC 0x01
  92. #define ATH9K_RXERR_PHY 0x02
  93. #define ATH9K_RXERR_FIFO 0x04
  94. #define ATH9K_RXERR_DECRYPT 0x08
  95. #define ATH9K_RXERR_MIC 0x10
  96. #define ATH9K_RX_MORE 0x01
  97. #define ATH9K_RX_MORE_AGGR 0x02
  98. #define ATH9K_RX_GI 0x04
  99. #define ATH9K_RX_2040 0x08
  100. #define ATH9K_RX_DELIM_CRC_PRE 0x10
  101. #define ATH9K_RX_DELIM_CRC_POST 0x20
  102. #define ATH9K_RX_DECRYPT_BUSY 0x40
  103. #define ATH9K_RXKEYIX_INVALID ((u8)-1)
  104. #define ATH9K_TXKEYIX_INVALID ((u32)-1)
  105. struct ath_desc {
  106. u32 ds_link;
  107. u32 ds_data;
  108. u32 ds_ctl0;
  109. u32 ds_ctl1;
  110. u32 ds_hw[20];
  111. union {
  112. struct ath_tx_status tx;
  113. struct ath_rx_status rx;
  114. void *stats;
  115. } ds_us;
  116. void *ds_vdata;
  117. } __packed;
  118. #define ds_txstat ds_us.tx
  119. #define ds_rxstat ds_us.rx
  120. #define ds_stat ds_us.stats
  121. #define ATH9K_TXDESC_CLRDMASK 0x0001
  122. #define ATH9K_TXDESC_NOACK 0x0002
  123. #define ATH9K_TXDESC_RTSENA 0x0004
  124. #define ATH9K_TXDESC_CTSENA 0x0008
  125. /* ATH9K_TXDESC_INTREQ forces a tx interrupt to be generated for
  126. * the descriptor its marked on. We take a tx interrupt to reap
  127. * descriptors when the h/w hits an EOL condition or
  128. * when the descriptor is specifically marked to generate
  129. * an interrupt with this flag. Descriptors should be
  130. * marked periodically to insure timely replenishing of the
  131. * supply needed for sending frames. Defering interrupts
  132. * reduces system load and potentially allows more concurrent
  133. * work to be done but if done to aggressively can cause
  134. * senders to backup. When the hardware queue is left too
  135. * large rate control information may also be too out of
  136. * date. An Alternative for this is TX interrupt mitigation
  137. * but this needs more testing. */
  138. #define ATH9K_TXDESC_INTREQ 0x0010
  139. #define ATH9K_TXDESC_VEOL 0x0020
  140. #define ATH9K_TXDESC_EXT_ONLY 0x0040
  141. #define ATH9K_TXDESC_EXT_AND_CTL 0x0080
  142. #define ATH9K_TXDESC_VMF 0x0100
  143. #define ATH9K_TXDESC_FRAG_IS_ON 0x0200
  144. #define ATH9K_TXDESC_CAB 0x0400
  145. #define ATH9K_RXDESC_INTREQ 0x0020
  146. enum wireless_mode {
  147. ATH9K_MODE_11A = 0,
  148. ATH9K_MODE_11B = 2,
  149. ATH9K_MODE_11G = 3,
  150. ATH9K_MODE_11NA_HT20 = 6,
  151. ATH9K_MODE_11NG_HT20 = 7,
  152. ATH9K_MODE_11NA_HT40PLUS = 8,
  153. ATH9K_MODE_11NA_HT40MINUS = 9,
  154. ATH9K_MODE_11NG_HT40PLUS = 10,
  155. ATH9K_MODE_11NG_HT40MINUS = 11,
  156. ATH9K_MODE_MAX
  157. };
  158. enum ath9k_hw_caps {
  159. ATH9K_HW_CAP_CHAN_SPREAD = BIT(0),
  160. ATH9K_HW_CAP_MIC_AESCCM = BIT(1),
  161. ATH9K_HW_CAP_MIC_CKIP = BIT(2),
  162. ATH9K_HW_CAP_MIC_TKIP = BIT(3),
  163. ATH9K_HW_CAP_CIPHER_AESCCM = BIT(4),
  164. ATH9K_HW_CAP_CIPHER_CKIP = BIT(5),
  165. ATH9K_HW_CAP_CIPHER_TKIP = BIT(6),
  166. ATH9K_HW_CAP_VEOL = BIT(7),
  167. ATH9K_HW_CAP_BSSIDMASK = BIT(8),
  168. ATH9K_HW_CAP_MCAST_KEYSEARCH = BIT(9),
  169. ATH9K_HW_CAP_CHAN_HALFRATE = BIT(10),
  170. ATH9K_HW_CAP_CHAN_QUARTERRATE = BIT(11),
  171. ATH9K_HW_CAP_HT = BIT(12),
  172. ATH9K_HW_CAP_GTT = BIT(13),
  173. ATH9K_HW_CAP_FASTCC = BIT(14),
  174. ATH9K_HW_CAP_RFSILENT = BIT(15),
  175. ATH9K_HW_CAP_WOW = BIT(16),
  176. ATH9K_HW_CAP_CST = BIT(17),
  177. ATH9K_HW_CAP_ENHANCEDPM = BIT(18),
  178. ATH9K_HW_CAP_AUTOSLEEP = BIT(19),
  179. ATH9K_HW_CAP_4KB_SPLITTRANS = BIT(20),
  180. ATH9K_HW_CAP_WOW_MATCHPATTERN_EXACT = BIT(21),
  181. };
  182. enum ath9k_capability_type {
  183. ATH9K_CAP_CIPHER = 0,
  184. ATH9K_CAP_TKIP_MIC,
  185. ATH9K_CAP_TKIP_SPLIT,
  186. ATH9K_CAP_PHYCOUNTERS,
  187. ATH9K_CAP_DIVERSITY,
  188. ATH9K_CAP_TXPOW,
  189. ATH9K_CAP_PHYDIAG,
  190. ATH9K_CAP_MCAST_KEYSRCH,
  191. ATH9K_CAP_TSF_ADJUST,
  192. ATH9K_CAP_WME_TKIPMIC,
  193. ATH9K_CAP_RFSILENT,
  194. ATH9K_CAP_ANT_CFG_2GHZ,
  195. ATH9K_CAP_ANT_CFG_5GHZ
  196. };
  197. struct ath9k_hw_capabilities {
  198. u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */
  199. DECLARE_BITMAP(wireless_modes, ATH9K_MODE_MAX); /* ATH9K_MODE_* */
  200. u16 total_queues;
  201. u16 keycache_size;
  202. u16 low_5ghz_chan, high_5ghz_chan;
  203. u16 low_2ghz_chan, high_2ghz_chan;
  204. u16 num_mr_retries;
  205. u16 rts_aggr_limit;
  206. u8 tx_chainmask;
  207. u8 rx_chainmask;
  208. u16 tx_triglevel_max;
  209. u16 reg_cap;
  210. u8 num_gpio_pins;
  211. u8 num_antcfg_2ghz;
  212. u8 num_antcfg_5ghz;
  213. };
  214. struct ath9k_ops_config {
  215. int dma_beacon_response_time;
  216. int sw_beacon_response_time;
  217. int additional_swba_backoff;
  218. int ack_6mb;
  219. int cwm_ignore_extcca;
  220. u8 pcie_powersave_enable;
  221. u8 pcie_l1skp_enable;
  222. u8 pcie_clock_req;
  223. u32 pcie_waen;
  224. int pcie_power_reset;
  225. u8 pcie_restore;
  226. u8 analog_shiftreg;
  227. u8 ht_enable;
  228. u32 ofdm_trig_low;
  229. u32 ofdm_trig_high;
  230. u32 cck_trig_high;
  231. u32 cck_trig_low;
  232. u32 enable_ani;
  233. u8 noise_immunity_level;
  234. u32 ofdm_weaksignal_det;
  235. u32 cck_weaksignal_thr;
  236. u8 spur_immunity_level;
  237. u8 firstep_level;
  238. int8_t rssi_thr_high;
  239. int8_t rssi_thr_low;
  240. u16 diversity_control;
  241. u16 antenna_switch_swap;
  242. int serialize_regmode;
  243. int intr_mitigation;
  244. #define SPUR_DISABLE 0
  245. #define SPUR_ENABLE_IOCTL 1
  246. #define SPUR_ENABLE_EEPROM 2
  247. #define AR_EEPROM_MODAL_SPURS 5
  248. #define AR_SPUR_5413_1 1640
  249. #define AR_SPUR_5413_2 1200
  250. #define AR_NO_SPUR 0x8000
  251. #define AR_BASE_FREQ_2GHZ 2300
  252. #define AR_BASE_FREQ_5GHZ 4900
  253. #define AR_SPUR_FEEQ_BOUND_HT40 19
  254. #define AR_SPUR_FEEQ_BOUND_HT20 10
  255. int spurmode;
  256. u16 spurchans[AR_EEPROM_MODAL_SPURS][2];
  257. };
  258. enum ath9k_tx_queue {
  259. ATH9K_TX_QUEUE_INACTIVE = 0,
  260. ATH9K_TX_QUEUE_DATA,
  261. ATH9K_TX_QUEUE_BEACON,
  262. ATH9K_TX_QUEUE_CAB,
  263. ATH9K_TX_QUEUE_UAPSD,
  264. ATH9K_TX_QUEUE_PSPOLL
  265. };
  266. #define ATH9K_NUM_TX_QUEUES 10
  267. enum ath9k_tx_queue_subtype {
  268. ATH9K_WME_AC_BK = 0,
  269. ATH9K_WME_AC_BE,
  270. ATH9K_WME_AC_VI,
  271. ATH9K_WME_AC_VO,
  272. ATH9K_WME_UPSD
  273. };
  274. enum ath9k_tx_queue_flags {
  275. TXQ_FLAG_TXOKINT_ENABLE = 0x0001,
  276. TXQ_FLAG_TXERRINT_ENABLE = 0x0001,
  277. TXQ_FLAG_TXDESCINT_ENABLE = 0x0002,
  278. TXQ_FLAG_TXEOLINT_ENABLE = 0x0004,
  279. TXQ_FLAG_TXURNINT_ENABLE = 0x0008,
  280. TXQ_FLAG_BACKOFF_DISABLE = 0x0010,
  281. TXQ_FLAG_COMPRESSION_ENABLE = 0x0020,
  282. TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE = 0x0040,
  283. TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE = 0x0080,
  284. };
  285. #define ATH9K_TXQ_USEDEFAULT ((u32) -1)
  286. #define ATH9K_DECOMP_MASK_SIZE 128
  287. #define ATH9K_READY_TIME_LO_BOUND 50
  288. #define ATH9K_READY_TIME_HI_BOUND 96
  289. enum ath9k_pkt_type {
  290. ATH9K_PKT_TYPE_NORMAL = 0,
  291. ATH9K_PKT_TYPE_ATIM,
  292. ATH9K_PKT_TYPE_PSPOLL,
  293. ATH9K_PKT_TYPE_BEACON,
  294. ATH9K_PKT_TYPE_PROBE_RESP,
  295. ATH9K_PKT_TYPE_CHIRP,
  296. ATH9K_PKT_TYPE_GRP_POLL,
  297. };
  298. struct ath9k_tx_queue_info {
  299. u32 tqi_ver;
  300. enum ath9k_tx_queue tqi_type;
  301. enum ath9k_tx_queue_subtype tqi_subtype;
  302. enum ath9k_tx_queue_flags tqi_qflags;
  303. u32 tqi_priority;
  304. u32 tqi_aifs;
  305. u32 tqi_cwmin;
  306. u32 tqi_cwmax;
  307. u16 tqi_shretry;
  308. u16 tqi_lgretry;
  309. u32 tqi_cbrPeriod;
  310. u32 tqi_cbrOverflowLimit;
  311. u32 tqi_burstTime;
  312. u32 tqi_readyTime;
  313. u32 tqi_physCompBuf;
  314. u32 tqi_intFlags;
  315. };
  316. enum ath9k_rx_filter {
  317. ATH9K_RX_FILTER_UCAST = 0x00000001,
  318. ATH9K_RX_FILTER_MCAST = 0x00000002,
  319. ATH9K_RX_FILTER_BCAST = 0x00000004,
  320. ATH9K_RX_FILTER_CONTROL = 0x00000008,
  321. ATH9K_RX_FILTER_BEACON = 0x00000010,
  322. ATH9K_RX_FILTER_PROM = 0x00000020,
  323. ATH9K_RX_FILTER_PROBEREQ = 0x00000080,
  324. ATH9K_RX_FILTER_PSPOLL = 0x00004000,
  325. ATH9K_RX_FILTER_PHYERR = 0x00000100,
  326. ATH9K_RX_FILTER_PHYRADAR = 0x00002000,
  327. };
  328. enum ath9k_int {
  329. ATH9K_INT_RX = 0x00000001,
  330. ATH9K_INT_RXDESC = 0x00000002,
  331. ATH9K_INT_RXNOFRM = 0x00000008,
  332. ATH9K_INT_RXEOL = 0x00000010,
  333. ATH9K_INT_RXORN = 0x00000020,
  334. ATH9K_INT_TX = 0x00000040,
  335. ATH9K_INT_TXDESC = 0x00000080,
  336. ATH9K_INT_TIM_TIMER = 0x00000100,
  337. ATH9K_INT_TXURN = 0x00000800,
  338. ATH9K_INT_MIB = 0x00001000,
  339. ATH9K_INT_RXPHY = 0x00004000,
  340. ATH9K_INT_RXKCM = 0x00008000,
  341. ATH9K_INT_SWBA = 0x00010000,
  342. ATH9K_INT_BMISS = 0x00040000,
  343. ATH9K_INT_BNR = 0x00100000,
  344. ATH9K_INT_TIM = 0x00200000,
  345. ATH9K_INT_DTIM = 0x00400000,
  346. ATH9K_INT_DTIMSYNC = 0x00800000,
  347. ATH9K_INT_GPIO = 0x01000000,
  348. ATH9K_INT_CABEND = 0x02000000,
  349. ATH9K_INT_CST = 0x10000000,
  350. ATH9K_INT_GTT = 0x20000000,
  351. ATH9K_INT_FATAL = 0x40000000,
  352. ATH9K_INT_GLOBAL = 0x80000000,
  353. ATH9K_INT_BMISC = ATH9K_INT_TIM |
  354. ATH9K_INT_DTIM |
  355. ATH9K_INT_DTIMSYNC |
  356. ATH9K_INT_CABEND,
  357. ATH9K_INT_COMMON = ATH9K_INT_RXNOFRM |
  358. ATH9K_INT_RXDESC |
  359. ATH9K_INT_RXEOL |
  360. ATH9K_INT_RXORN |
  361. ATH9K_INT_TXURN |
  362. ATH9K_INT_TXDESC |
  363. ATH9K_INT_MIB |
  364. ATH9K_INT_RXPHY |
  365. ATH9K_INT_RXKCM |
  366. ATH9K_INT_SWBA |
  367. ATH9K_INT_BMISS |
  368. ATH9K_INT_GPIO,
  369. ATH9K_INT_NOCARD = 0xffffffff
  370. };
  371. #define ATH9K_RATESERIES_RTS_CTS 0x0001
  372. #define ATH9K_RATESERIES_2040 0x0002
  373. #define ATH9K_RATESERIES_HALFGI 0x0004
  374. struct ath9k_11n_rate_series {
  375. u32 Tries;
  376. u32 Rate;
  377. u32 PktDuration;
  378. u32 ChSel;
  379. u32 RateFlags;
  380. };
  381. #define CHANNEL_CW_INT 0x00002
  382. #define CHANNEL_CCK 0x00020
  383. #define CHANNEL_OFDM 0x00040
  384. #define CHANNEL_2GHZ 0x00080
  385. #define CHANNEL_5GHZ 0x00100
  386. #define CHANNEL_PASSIVE 0x00200
  387. #define CHANNEL_DYN 0x00400
  388. #define CHANNEL_HALF 0x04000
  389. #define CHANNEL_QUARTER 0x08000
  390. #define CHANNEL_HT20 0x10000
  391. #define CHANNEL_HT40PLUS 0x20000
  392. #define CHANNEL_HT40MINUS 0x40000
  393. #define CHANNEL_INTERFERENCE 0x01
  394. #define CHANNEL_DFS 0x02
  395. #define CHANNEL_4MS_LIMIT 0x04
  396. #define CHANNEL_DFS_CLEAR 0x08
  397. #define CHANNEL_DISALLOW_ADHOC 0x10
  398. #define CHANNEL_PER_11D_ADHOC 0x20
  399. #define CHANNEL_A (CHANNEL_5GHZ|CHANNEL_OFDM)
  400. #define CHANNEL_B (CHANNEL_2GHZ|CHANNEL_CCK)
  401. #define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_OFDM)
  402. #define CHANNEL_G_HT20 (CHANNEL_2GHZ|CHANNEL_HT20)
  403. #define CHANNEL_A_HT20 (CHANNEL_5GHZ|CHANNEL_HT20)
  404. #define CHANNEL_G_HT40PLUS (CHANNEL_2GHZ|CHANNEL_HT40PLUS)
  405. #define CHANNEL_G_HT40MINUS (CHANNEL_2GHZ|CHANNEL_HT40MINUS)
  406. #define CHANNEL_A_HT40PLUS (CHANNEL_5GHZ|CHANNEL_HT40PLUS)
  407. #define CHANNEL_A_HT40MINUS (CHANNEL_5GHZ|CHANNEL_HT40MINUS)
  408. #define CHANNEL_ALL \
  409. (CHANNEL_OFDM| \
  410. CHANNEL_CCK| \
  411. CHANNEL_2GHZ | \
  412. CHANNEL_5GHZ | \
  413. CHANNEL_HT20 | \
  414. CHANNEL_HT40PLUS | \
  415. CHANNEL_HT40MINUS)
  416. struct ath9k_channel {
  417. u16 channel;
  418. u32 channelFlags;
  419. u8 privFlags;
  420. int8_t maxRegTxPower;
  421. int8_t maxTxPower;
  422. int8_t minTxPower;
  423. u32 chanmode;
  424. int32_t CalValid;
  425. bool oneTimeCalsDone;
  426. int8_t iCoff;
  427. int8_t qCoff;
  428. int16_t rawNoiseFloor;
  429. int8_t antennaMax;
  430. u32 regDmnFlags;
  431. u32 conformanceTestLimit[3]; /* 0:11a, 1: 11b, 2:11g */
  432. #ifdef ATH_NF_PER_CHAN
  433. struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
  434. #endif
  435. };
  436. #define IS_CHAN_A(_c) ((((_c)->channelFlags & CHANNEL_A) == CHANNEL_A) || \
  437. (((_c)->channelFlags & CHANNEL_A_HT20) == CHANNEL_A_HT20) || \
  438. (((_c)->channelFlags & CHANNEL_A_HT40PLUS) == CHANNEL_A_HT40PLUS) || \
  439. (((_c)->channelFlags & CHANNEL_A_HT40MINUS) == CHANNEL_A_HT40MINUS))
  440. #define IS_CHAN_G(_c) ((((_c)->channelFlags & (CHANNEL_G)) == CHANNEL_G) || \
  441. (((_c)->channelFlags & CHANNEL_G_HT20) == CHANNEL_G_HT20) || \
  442. (((_c)->channelFlags & CHANNEL_G_HT40PLUS) == CHANNEL_G_HT40PLUS) || \
  443. (((_c)->channelFlags & CHANNEL_G_HT40MINUS) == CHANNEL_G_HT40MINUS))
  444. #define IS_CHAN_OFDM(_c) (((_c)->channelFlags & CHANNEL_OFDM) != 0)
  445. #define IS_CHAN_5GHZ(_c) (((_c)->channelFlags & CHANNEL_5GHZ) != 0)
  446. #define IS_CHAN_2GHZ(_c) (((_c)->channelFlags & CHANNEL_2GHZ) != 0)
  447. #define IS_CHAN_PASSIVE(_c) (((_c)->channelFlags & CHANNEL_PASSIVE) != 0)
  448. #define IS_CHAN_HALF_RATE(_c) (((_c)->channelFlags & CHANNEL_HALF) != 0)
  449. #define IS_CHAN_QUARTER_RATE(_c) (((_c)->channelFlags & CHANNEL_QUARTER) != 0)
  450. /* These macros check chanmode and not channelFlags */
  451. #define IS_CHAN_B(_c) ((_c)->chanmode == CHANNEL_B)
  452. #define IS_CHAN_HT20(_c) (((_c)->chanmode == CHANNEL_A_HT20) || \
  453. ((_c)->chanmode == CHANNEL_G_HT20))
  454. #define IS_CHAN_HT40(_c) (((_c)->chanmode == CHANNEL_A_HT40PLUS) || \
  455. ((_c)->chanmode == CHANNEL_A_HT40MINUS) || \
  456. ((_c)->chanmode == CHANNEL_G_HT40PLUS) || \
  457. ((_c)->chanmode == CHANNEL_G_HT40MINUS))
  458. #define IS_CHAN_HT(_c) (IS_CHAN_HT20((_c)) || IS_CHAN_HT40((_c)))
  459. #define IS_CHAN_IN_PUBLIC_SAFETY_BAND(_c) ((_c) > 4940 && (_c) < 4990)
  460. #define IS_CHAN_A_5MHZ_SPACED(_c) \
  461. ((((_c)->channelFlags & CHANNEL_5GHZ) != 0) && \
  462. (((_c)->channel % 20) != 0) && \
  463. (((_c)->channel % 10) != 0))
  464. struct ath9k_keyval {
  465. u8 kv_type;
  466. u8 kv_pad;
  467. u16 kv_len;
  468. u8 kv_val[16];
  469. u8 kv_mic[8];
  470. u8 kv_txmic[8];
  471. };
  472. enum ath9k_key_type {
  473. ATH9K_KEY_TYPE_CLEAR,
  474. ATH9K_KEY_TYPE_WEP,
  475. ATH9K_KEY_TYPE_AES,
  476. ATH9K_KEY_TYPE_TKIP,
  477. };
  478. enum ath9k_cipher {
  479. ATH9K_CIPHER_WEP = 0,
  480. ATH9K_CIPHER_AES_OCB = 1,
  481. ATH9K_CIPHER_AES_CCM = 2,
  482. ATH9K_CIPHER_CKIP = 3,
  483. ATH9K_CIPHER_TKIP = 4,
  484. ATH9K_CIPHER_CLR = 5,
  485. ATH9K_CIPHER_MIC = 127
  486. };
  487. #define AR_EEPROM_EEPCAP_COMPRESS_DIS 0x0001
  488. #define AR_EEPROM_EEPCAP_AES_DIS 0x0002
  489. #define AR_EEPROM_EEPCAP_FASTFRAME_DIS 0x0004
  490. #define AR_EEPROM_EEPCAP_BURST_DIS 0x0008
  491. #define AR_EEPROM_EEPCAP_MAXQCU 0x01F0
  492. #define AR_EEPROM_EEPCAP_MAXQCU_S 4
  493. #define AR_EEPROM_EEPCAP_HEAVY_CLIP_EN 0x0200
  494. #define AR_EEPROM_EEPCAP_KC_ENTRIES 0xF000
  495. #define AR_EEPROM_EEPCAP_KC_ENTRIES_S 12
  496. #define AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND 0x0040
  497. #define AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN 0x0080
  498. #define AR_EEPROM_EEREGCAP_EN_KK_U2 0x0100
  499. #define AR_EEPROM_EEREGCAP_EN_KK_MIDBAND 0x0200
  500. #define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD 0x0400
  501. #define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A 0x0800
  502. #define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD_PRE4_0 0x4000
  503. #define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A_PRE4_0 0x8000
  504. #define SD_NO_CTL 0xE0
  505. #define NO_CTL 0xff
  506. #define CTL_MODE_M 7
  507. #define CTL_11A 0
  508. #define CTL_11B 1
  509. #define CTL_11G 2
  510. #define CTL_2GHT20 5
  511. #define CTL_5GHT20 6
  512. #define CTL_2GHT40 7
  513. #define CTL_5GHT40 8
  514. #define AR_EEPROM_MAC(i) (0x1d+(i))
  515. #define AR_EEPROM_RFSILENT_GPIO_SEL 0x001c
  516. #define AR_EEPROM_RFSILENT_GPIO_SEL_S 2
  517. #define AR_EEPROM_RFSILENT_POLARITY 0x0002
  518. #define AR_EEPROM_RFSILENT_POLARITY_S 1
  519. #define CTRY_DEBUG 0x1ff
  520. #define CTRY_DEFAULT 0
  521. enum reg_ext_bitmap {
  522. REG_EXT_JAPAN_MIDBAND = 1,
  523. REG_EXT_FCC_DFS_HT40 = 2,
  524. REG_EXT_JAPAN_NONDFS_HT40 = 3,
  525. REG_EXT_JAPAN_DFS_HT40 = 4
  526. };
  527. struct ath9k_country_entry {
  528. u16 countryCode;
  529. u16 regDmnEnum;
  530. u16 regDmn5G;
  531. u16 regDmn2G;
  532. u8 isMultidomain;
  533. u8 iso[3];
  534. };
  535. #define REG_WRITE(_ah, _reg, _val) iowrite32(_val, _ah->ah_sh + _reg)
  536. #define REG_READ(_ah, _reg) ioread32(_ah->ah_sh + _reg)
  537. #define SM(_v, _f) (((_v) << _f##_S) & _f)
  538. #define MS(_v, _f) (((_v) & _f) >> _f##_S)
  539. #define REG_RMW(_a, _r, _set, _clr) \
  540. REG_WRITE(_a, _r, (REG_READ(_a, _r) & ~(_clr)) | (_set))
  541. #define REG_RMW_FIELD(_a, _r, _f, _v) \
  542. REG_WRITE(_a, _r, \
  543. (REG_READ(_a, _r) & ~_f) | (((_v) << _f##_S) & _f))
  544. #define REG_SET_BIT(_a, _r, _f) \
  545. REG_WRITE(_a, _r, REG_READ(_a, _r) | _f)
  546. #define REG_CLR_BIT(_a, _r, _f) \
  547. REG_WRITE(_a, _r, REG_READ(_a, _r) & ~_f)
  548. #define ATH9K_TXQ_USE_LOCKOUT_BKOFF_DIS 0x00000001
  549. #define INIT_AIFS 2
  550. #define INIT_CWMIN 15
  551. #define INIT_CWMIN_11B 31
  552. #define INIT_CWMAX 1023
  553. #define INIT_SH_RETRY 10
  554. #define INIT_LG_RETRY 10
  555. #define INIT_SSH_RETRY 32
  556. #define INIT_SLG_RETRY 32
  557. #define WLAN_CTRL_FRAME_SIZE (2+2+6+4)
  558. #define ATH_AMPDU_LIMIT_MAX (64 * 1024 - 1)
  559. #define ATH_AMPDU_LIMIT_DEFAULT ATH_AMPDU_LIMIT_MAX
  560. #define IEEE80211_WEP_IVLEN 3
  561. #define IEEE80211_WEP_KIDLEN 1
  562. #define IEEE80211_WEP_CRCLEN 4
  563. #define IEEE80211_MAX_MPDU_LEN (3840 + FCS_LEN + \
  564. (IEEE80211_WEP_IVLEN + \
  565. IEEE80211_WEP_KIDLEN + \
  566. IEEE80211_WEP_CRCLEN))
  567. #define MAX_RATE_POWER 63
  568. enum ath9k_power_mode {
  569. ATH9K_PM_AWAKE = 0,
  570. ATH9K_PM_FULL_SLEEP,
  571. ATH9K_PM_NETWORK_SLEEP,
  572. ATH9K_PM_UNDEFINED
  573. };
  574. struct ath9k_mib_stats {
  575. u32 ackrcv_bad;
  576. u32 rts_bad;
  577. u32 rts_good;
  578. u32 fcs_bad;
  579. u32 beacons;
  580. };
  581. enum ath9k_ant_setting {
  582. ATH9K_ANT_VARIABLE = 0,
  583. ATH9K_ANT_FIXED_A,
  584. ATH9K_ANT_FIXED_B
  585. };
  586. #define ATH9K_SLOT_TIME_6 6
  587. #define ATH9K_SLOT_TIME_9 9
  588. #define ATH9K_SLOT_TIME_20 20
  589. enum ath9k_ht_macmode {
  590. ATH9K_HT_MACMODE_20 = 0,
  591. ATH9K_HT_MACMODE_2040 = 1,
  592. };
  593. enum ath9k_ht_extprotspacing {
  594. ATH9K_HT_EXTPROTSPACING_20 = 0,
  595. ATH9K_HT_EXTPROTSPACING_25 = 1,
  596. };
  597. struct ath9k_ht_cwm {
  598. enum ath9k_ht_macmode ht_macmode;
  599. enum ath9k_ht_extprotspacing ht_extprotspacing;
  600. };
  601. enum ath9k_ani_cmd {
  602. ATH9K_ANI_PRESENT = 0x1,
  603. ATH9K_ANI_NOISE_IMMUNITY_LEVEL = 0x2,
  604. ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x4,
  605. ATH9K_ANI_CCK_WEAK_SIGNAL_THR = 0x8,
  606. ATH9K_ANI_FIRSTEP_LEVEL = 0x10,
  607. ATH9K_ANI_SPUR_IMMUNITY_LEVEL = 0x20,
  608. ATH9K_ANI_MODE = 0x40,
  609. ATH9K_ANI_PHYERR_RESET = 0x80,
  610. ATH9K_ANI_ALL = 0xff
  611. };
  612. enum {
  613. WLAN_RC_PHY_OFDM,
  614. WLAN_RC_PHY_CCK,
  615. WLAN_RC_PHY_HT_20_SS,
  616. WLAN_RC_PHY_HT_20_DS,
  617. WLAN_RC_PHY_HT_40_SS,
  618. WLAN_RC_PHY_HT_40_DS,
  619. WLAN_RC_PHY_HT_20_SS_HGI,
  620. WLAN_RC_PHY_HT_20_DS_HGI,
  621. WLAN_RC_PHY_HT_40_SS_HGI,
  622. WLAN_RC_PHY_HT_40_DS_HGI,
  623. WLAN_RC_PHY_MAX
  624. };
  625. enum ath9k_tp_scale {
  626. ATH9K_TP_SCALE_MAX = 0,
  627. ATH9K_TP_SCALE_50,
  628. ATH9K_TP_SCALE_25,
  629. ATH9K_TP_SCALE_12,
  630. ATH9K_TP_SCALE_MIN
  631. };
  632. enum ser_reg_mode {
  633. SER_REG_MODE_OFF = 0,
  634. SER_REG_MODE_ON = 1,
  635. SER_REG_MODE_AUTO = 2,
  636. };
  637. #define AR_PHY_CCA_MAX_GOOD_VALUE -85
  638. #define AR_PHY_CCA_MAX_HIGH_VALUE -62
  639. #define AR_PHY_CCA_MIN_BAD_VALUE -121
  640. #define AR_PHY_CCA_FILTERWINDOW_LENGTH_INIT 3
  641. #define AR_PHY_CCA_FILTERWINDOW_LENGTH 5
  642. #define ATH9K_NF_CAL_HIST_MAX 5
  643. #define NUM_NF_READINGS 6
  644. struct ath9k_nfcal_hist {
  645. int16_t nfCalBuffer[ATH9K_NF_CAL_HIST_MAX];
  646. u8 currIndex;
  647. int16_t privNF;
  648. u8 invalidNFcount;
  649. };
  650. struct ath9k_beacon_state {
  651. u32 bs_nexttbtt;
  652. u32 bs_nextdtim;
  653. u32 bs_intval;
  654. #define ATH9K_BEACON_PERIOD 0x0000ffff
  655. #define ATH9K_BEACON_ENA 0x00800000
  656. #define ATH9K_BEACON_RESET_TSF 0x01000000
  657. u32 bs_dtimperiod;
  658. u16 bs_cfpperiod;
  659. u16 bs_cfpmaxduration;
  660. u32 bs_cfpnext;
  661. u16 bs_timoffset;
  662. u16 bs_bmissthreshold;
  663. u32 bs_sleepduration;
  664. };
  665. struct ath9k_node_stats {
  666. u32 ns_avgbrssi;
  667. u32 ns_avgrssi;
  668. u32 ns_avgtxrssi;
  669. u32 ns_avgtxrate;
  670. };
  671. #define ATH9K_RSSI_EP_MULTIPLIER (1<<7)
  672. #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0
  673. #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1
  674. #define AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED 2
  675. #define AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED 5
  676. #define AR_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED 6
  677. enum {
  678. ATH9K_RESET_POWER_ON,
  679. ATH9K_RESET_WARM,
  680. ATH9K_RESET_COLD,
  681. };
  682. #define AH_USE_EEPROM 0x1
  683. struct ath_hal {
  684. u32 ah_magic;
  685. u16 ah_devid;
  686. u16 ah_subvendorid;
  687. u32 ah_macVersion;
  688. u16 ah_macRev;
  689. u16 ah_phyRev;
  690. u16 ah_analog5GhzRev;
  691. u16 ah_analog2GhzRev;
  692. void __iomem *ah_sh;
  693. struct ath_softc *ah_sc;
  694. enum nl80211_iftype ah_opmode;
  695. struct ath9k_ops_config ah_config;
  696. struct ath9k_hw_capabilities ah_caps;
  697. u16 ah_countryCode;
  698. u32 ah_flags;
  699. int16_t ah_powerLimit;
  700. u16 ah_maxPowerLevel;
  701. u32 ah_tpScale;
  702. u16 ah_currentRD;
  703. u16 ah_currentRDExt;
  704. u16 ah_currentRDInUse;
  705. u16 ah_currentRD5G;
  706. u16 ah_currentRD2G;
  707. char ah_iso[4];
  708. struct ath9k_channel ah_channels[150];
  709. struct ath9k_channel *ah_curchan;
  710. u32 ah_nchan;
  711. bool ah_isPciExpress;
  712. u16 ah_txTrigLevel;
  713. u16 ah_rfsilent;
  714. u32 ah_rfkill_gpio;
  715. u32 ah_rfkill_polarity;
  716. #ifndef ATH_NF_PER_CHAN
  717. struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
  718. #endif
  719. };
  720. struct chan_centers {
  721. u16 synth_center;
  722. u16 ctl_center;
  723. u16 ext_center;
  724. };
  725. struct ath_rate_table;
  726. /* Helpers */
  727. enum wireless_mode ath9k_hw_chan2wmode(struct ath_hal *ah,
  728. const struct ath9k_channel *chan);
  729. bool ath9k_hw_wait(struct ath_hal *ah, u32 reg, u32 mask, u32 val);
  730. u32 ath9k_hw_reverse_bits(u32 val, u32 n);
  731. bool ath9k_get_channel_edges(struct ath_hal *ah,
  732. u16 flags, u16 *low,
  733. u16 *high);
  734. u16 ath9k_hw_computetxtime(struct ath_hal *ah,
  735. struct ath_rate_table *rates,
  736. u32 frameLen, u16 rateix,
  737. bool shortPreamble);
  738. u32 ath9k_hw_mhz2ieee(struct ath_hal *ah, u32 freq, u32 flags);
  739. void ath9k_hw_get_channel_centers(struct ath_hal *ah,
  740. struct ath9k_channel *chan,
  741. struct chan_centers *centers);
  742. /* Attach, Detach */
  743. const char *ath9k_hw_probe(u16 vendorid, u16 devid);
  744. void ath9k_hw_detach(struct ath_hal *ah);
  745. struct ath_hal *ath9k_hw_attach(u16 devid, struct ath_softc *sc,
  746. void __iomem *mem, int *error);
  747. void ath9k_hw_rfdetach(struct ath_hal *ah);
  748. /* HW Reset */
  749. bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
  750. enum ath9k_ht_macmode macmode,
  751. u8 txchainmask, u8 rxchainmask,
  752. enum ath9k_ht_extprotspacing extprotspacing,
  753. bool bChannelChange, int *status);
  754. /* Key Cache Management */
  755. bool ath9k_hw_keyreset(struct ath_hal *ah, u16 entry);
  756. bool ath9k_hw_keysetmac(struct ath_hal *ah, u16 entry, const u8 *mac);
  757. bool ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry,
  758. const struct ath9k_keyval *k,
  759. const u8 *mac, int xorKey);
  760. bool ath9k_hw_keyisvalid(struct ath_hal *ah, u16 entry);
  761. /* Power Management */
  762. bool ath9k_hw_setpower(struct ath_hal *ah,
  763. enum ath9k_power_mode mode);
  764. void ath9k_hw_configpcipowersave(struct ath_hal *ah, int restore);
  765. /* Beacon timers */
  766. void ath9k_hw_beaconinit(struct ath_hal *ah, u32 next_beacon, u32 beacon_period);
  767. void ath9k_hw_set_sta_beacon_timers(struct ath_hal *ah,
  768. const struct ath9k_beacon_state *bs);
  769. /* HW Capabilities */
  770. bool ath9k_hw_fill_cap_info(struct ath_hal *ah);
  771. bool ath9k_hw_getcapability(struct ath_hal *ah, enum ath9k_capability_type type,
  772. u32 capability, u32 *result);
  773. bool ath9k_hw_setcapability(struct ath_hal *ah, enum ath9k_capability_type type,
  774. u32 capability, u32 setting, int *status);
  775. /* GPIO / RFKILL / Antennae */
  776. void ath9k_hw_cfg_gpio_input(struct ath_hal *ah, u32 gpio);
  777. u32 ath9k_hw_gpio_get(struct ath_hal *ah, u32 gpio);
  778. void ath9k_hw_cfg_output(struct ath_hal *ah, u32 gpio,
  779. u32 ah_signal_type);
  780. void ath9k_hw_set_gpio(struct ath_hal *ah, u32 gpio, u32 val);
  781. #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
  782. void ath9k_enable_rfkill(struct ath_hal *ah);
  783. #endif
  784. int ath9k_hw_select_antconfig(struct ath_hal *ah, u32 cfg);
  785. u32 ath9k_hw_getdefantenna(struct ath_hal *ah);
  786. void ath9k_hw_setantenna(struct ath_hal *ah, u32 antenna);
  787. bool ath9k_hw_setantennaswitch(struct ath_hal *ah,
  788. enum ath9k_ant_setting settings,
  789. struct ath9k_channel *chan,
  790. u8 *tx_chainmask,
  791. u8 *rx_chainmask,
  792. u8 *antenna_cfgd);
  793. /* General Operation */
  794. u32 ath9k_hw_getrxfilter(struct ath_hal *ah);
  795. void ath9k_hw_setrxfilter(struct ath_hal *ah, u32 bits);
  796. bool ath9k_hw_phy_disable(struct ath_hal *ah);
  797. bool ath9k_hw_disable(struct ath_hal *ah);
  798. bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u32 limit);
  799. void ath9k_hw_getmac(struct ath_hal *ah, u8 *mac);
  800. bool ath9k_hw_setmac(struct ath_hal *ah, const u8 *mac);
  801. void ath9k_hw_setopmode(struct ath_hal *ah);
  802. void ath9k_hw_setmcastfilter(struct ath_hal *ah, u32 filter0, u32 filter1);
  803. void ath9k_hw_getbssidmask(struct ath_hal *ah, u8 *mask);
  804. bool ath9k_hw_setbssidmask(struct ath_hal *ah, const u8 *mask);
  805. void ath9k_hw_write_associd(struct ath_hal *ah, const u8 *bssid, u16 assocId);
  806. u64 ath9k_hw_gettsf64(struct ath_hal *ah);
  807. void ath9k_hw_reset_tsf(struct ath_hal *ah);
  808. bool ath9k_hw_set_tsfadjust(struct ath_hal *ah, u32 setting);
  809. bool ath9k_hw_setslottime(struct ath_hal *ah, u32 us);
  810. void ath9k_hw_set11nmac2040(struct ath_hal *ah, enum ath9k_ht_macmode mode);
  811. /* Regulatory */
  812. bool ath9k_regd_is_public_safety_sku(struct ath_hal *ah);
  813. struct ath9k_channel* ath9k_regd_check_channel(struct ath_hal *ah,
  814. const struct ath9k_channel *c);
  815. u32 ath9k_regd_get_ctl(struct ath_hal *ah, struct ath9k_channel *chan);
  816. u32 ath9k_regd_get_antenna_allowed(struct ath_hal *ah,
  817. struct ath9k_channel *chan);
  818. bool ath9k_regd_init_channels(struct ath_hal *ah,
  819. u32 maxchans, u32 *nchans, u8 *regclassids,
  820. u32 maxregids, u32 *nregids, u16 cc,
  821. bool enableOutdoor, bool enableExtendedChannels);
  822. /* ANI */
  823. void ath9k_ani_reset(struct ath_hal *ah);
  824. void ath9k_hw_ani_monitor(struct ath_hal *ah,
  825. const struct ath9k_node_stats *stats,
  826. struct ath9k_channel *chan);
  827. bool ath9k_hw_phycounters(struct ath_hal *ah);
  828. void ath9k_enable_mib_counters(struct ath_hal *ah);
  829. void ath9k_hw_disable_mib_counters(struct ath_hal *ah);
  830. u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hal *ah,
  831. u32 *rxc_pcnt,
  832. u32 *rxf_pcnt,
  833. u32 *txf_pcnt);
  834. void ath9k_hw_procmibevent(struct ath_hal *ah,
  835. const struct ath9k_node_stats *stats);
  836. void ath9k_hw_ani_setup(struct ath_hal *ah);
  837. void ath9k_hw_ani_attach(struct ath_hal *ah);
  838. void ath9k_hw_ani_detach(struct ath_hal *ah);
  839. /* Calibration */
  840. void ath9k_hw_reset_calvalid(struct ath_hal *ah, struct ath9k_channel *chan,
  841. bool *isCalDone);
  842. void ath9k_hw_start_nfcal(struct ath_hal *ah);
  843. void ath9k_hw_loadnf(struct ath_hal *ah, struct ath9k_channel *chan);
  844. int16_t ath9k_hw_getnf(struct ath_hal *ah,
  845. struct ath9k_channel *chan);
  846. void ath9k_init_nfcal_hist_buffer(struct ath_hal *ah);
  847. s16 ath9k_hw_getchan_noise(struct ath_hal *ah, struct ath9k_channel *chan);
  848. bool ath9k_hw_calibrate(struct ath_hal *ah, struct ath9k_channel *chan,
  849. u8 rxchainmask, bool longcal,
  850. bool *isCalDone);
  851. bool ath9k_hw_init_cal(struct ath_hal *ah,
  852. struct ath9k_channel *chan);
  853. /* EEPROM */
  854. int ath9k_hw_set_txpower(struct ath_hal *ah,
  855. struct ath9k_channel *chan,
  856. u16 cfgCtl,
  857. u8 twiceAntennaReduction,
  858. u8 twiceMaxRegulatoryPower,
  859. u8 powerLimit);
  860. void ath9k_hw_set_addac(struct ath_hal *ah, struct ath9k_channel *chan);
  861. bool ath9k_hw_set_power_per_rate_table(struct ath_hal *ah,
  862. struct ath9k_channel *chan,
  863. int16_t *ratesArray,
  864. u16 cfgCtl,
  865. u8 AntennaReduction,
  866. u8 twiceMaxRegulatoryPower,
  867. u8 powerLimit);
  868. bool ath9k_hw_set_power_cal_table(struct ath_hal *ah,
  869. struct ath9k_channel *chan,
  870. int16_t *pTxPowerIndexOffset);
  871. bool ath9k_hw_eeprom_set_board_values(struct ath_hal *ah,
  872. struct ath9k_channel *chan);
  873. int ath9k_hw_get_eeprom_antenna_cfg(struct ath_hal *ah,
  874. struct ath9k_channel *chan,
  875. u8 index, u16 *config);
  876. u8 ath9k_hw_get_num_ant_config(struct ath_hal *ah,
  877. enum ieee80211_band freq_band);
  878. u16 ath9k_hw_eeprom_get_spur_chan(struct ath_hal *ah, u16 i, bool is2GHz);
  879. int ath9k_hw_eeprom_attach(struct ath_hal *ah);
  880. /* Interrupt Handling */
  881. bool ath9k_hw_intrpend(struct ath_hal *ah);
  882. bool ath9k_hw_getisr(struct ath_hal *ah, enum ath9k_int *masked);
  883. enum ath9k_int ath9k_hw_intrget(struct ath_hal *ah);
  884. enum ath9k_int ath9k_hw_set_interrupts(struct ath_hal *ah, enum ath9k_int ints);
  885. /* MAC (PCU/QCU) */
  886. u32 ath9k_hw_gettxbuf(struct ath_hal *ah, u32 q);
  887. bool ath9k_hw_puttxbuf(struct ath_hal *ah, u32 q, u32 txdp);
  888. bool ath9k_hw_txstart(struct ath_hal *ah, u32 q);
  889. u32 ath9k_hw_numtxpending(struct ath_hal *ah, u32 q);
  890. bool ath9k_hw_updatetxtriglevel(struct ath_hal *ah, bool bIncTrigLevel);
  891. bool ath9k_hw_stoptxdma(struct ath_hal *ah, u32 q);
  892. bool ath9k_hw_filltxdesc(struct ath_hal *ah, struct ath_desc *ds,
  893. u32 segLen, bool firstSeg,
  894. bool lastSeg, const struct ath_desc *ds0);
  895. void ath9k_hw_cleartxdesc(struct ath_hal *ah, struct ath_desc *ds);
  896. int ath9k_hw_txprocdesc(struct ath_hal *ah, struct ath_desc *ds);
  897. void ath9k_hw_set11n_txdesc(struct ath_hal *ah, struct ath_desc *ds,
  898. u32 pktLen, enum ath9k_pkt_type type, u32 txPower,
  899. u32 keyIx, enum ath9k_key_type keyType, u32 flags);
  900. void ath9k_hw_set11n_ratescenario(struct ath_hal *ah, struct ath_desc *ds,
  901. struct ath_desc *lastds,
  902. u32 durUpdateEn, u32 rtsctsRate,
  903. u32 rtsctsDuration,
  904. struct ath9k_11n_rate_series series[],
  905. u32 nseries, u32 flags);
  906. void ath9k_hw_set11n_aggr_first(struct ath_hal *ah, struct ath_desc *ds,
  907. u32 aggrLen);
  908. void ath9k_hw_set11n_aggr_middle(struct ath_hal *ah, struct ath_desc *ds,
  909. u32 numDelims);
  910. void ath9k_hw_set11n_aggr_last(struct ath_hal *ah, struct ath_desc *ds);
  911. void ath9k_hw_clr11n_aggr(struct ath_hal *ah, struct ath_desc *ds);
  912. void ath9k_hw_set11n_burstduration(struct ath_hal *ah, struct ath_desc *ds,
  913. u32 burstDuration);
  914. void ath9k_hw_set11n_virtualmorefrag(struct ath_hal *ah, struct ath_desc *ds,
  915. u32 vmf);
  916. void ath9k_hw_gettxintrtxqs(struct ath_hal *ah, u32 *txqs);
  917. bool ath9k_hw_set_txq_props(struct ath_hal *ah, int q,
  918. const struct ath9k_tx_queue_info *qinfo);
  919. bool ath9k_hw_get_txq_props(struct ath_hal *ah, int q,
  920. struct ath9k_tx_queue_info *qinfo);
  921. int ath9k_hw_setuptxqueue(struct ath_hal *ah, enum ath9k_tx_queue type,
  922. const struct ath9k_tx_queue_info *qinfo);
  923. bool ath9k_hw_releasetxqueue(struct ath_hal *ah, u32 q);
  924. bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q);
  925. int ath9k_hw_rxprocdesc(struct ath_hal *ah, struct ath_desc *ds,
  926. u32 pa, struct ath_desc *nds, u64 tsf);
  927. bool ath9k_hw_setuprxdesc(struct ath_hal *ah, struct ath_desc *ds,
  928. u32 size, u32 flags);
  929. bool ath9k_hw_setrxabort(struct ath_hal *ah, bool set);
  930. void ath9k_hw_putrxbuf(struct ath_hal *ah, u32 rxdp);
  931. void ath9k_hw_rxena(struct ath_hal *ah);
  932. void ath9k_hw_startpcureceive(struct ath_hal *ah);
  933. void ath9k_hw_stoppcurecv(struct ath_hal *ah);
  934. bool ath9k_hw_stopdmarecv(struct ath_hal *ah);
  935. #endif