ath9k.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044
  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. ATH9K_HW_CAP_BT_COEX = BIT(22)
  182. };
  183. enum ath9k_capability_type {
  184. ATH9K_CAP_CIPHER = 0,
  185. ATH9K_CAP_TKIP_MIC,
  186. ATH9K_CAP_TKIP_SPLIT,
  187. ATH9K_CAP_PHYCOUNTERS,
  188. ATH9K_CAP_DIVERSITY,
  189. ATH9K_CAP_TXPOW,
  190. ATH9K_CAP_PHYDIAG,
  191. ATH9K_CAP_MCAST_KEYSRCH,
  192. ATH9K_CAP_TSF_ADJUST,
  193. ATH9K_CAP_WME_TKIPMIC,
  194. ATH9K_CAP_RFSILENT,
  195. ATH9K_CAP_ANT_CFG_2GHZ,
  196. ATH9K_CAP_ANT_CFG_5GHZ
  197. };
  198. struct ath9k_hw_capabilities {
  199. u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */
  200. DECLARE_BITMAP(wireless_modes, ATH9K_MODE_MAX); /* ATH9K_MODE_* */
  201. u16 total_queues;
  202. u16 keycache_size;
  203. u16 low_5ghz_chan, high_5ghz_chan;
  204. u16 low_2ghz_chan, high_2ghz_chan;
  205. u16 num_mr_retries;
  206. u16 rts_aggr_limit;
  207. u8 tx_chainmask;
  208. u8 rx_chainmask;
  209. u16 tx_triglevel_max;
  210. u16 reg_cap;
  211. u8 num_gpio_pins;
  212. u8 num_antcfg_2ghz;
  213. u8 num_antcfg_5ghz;
  214. };
  215. struct ath9k_ops_config {
  216. int dma_beacon_response_time;
  217. int sw_beacon_response_time;
  218. int additional_swba_backoff;
  219. int ack_6mb;
  220. int cwm_ignore_extcca;
  221. u8 pcie_powersave_enable;
  222. u8 pcie_l1skp_enable;
  223. u8 pcie_clock_req;
  224. u32 pcie_waen;
  225. int pcie_power_reset;
  226. u8 pcie_restore;
  227. u8 analog_shiftreg;
  228. u8 ht_enable;
  229. u32 ofdm_trig_low;
  230. u32 ofdm_trig_high;
  231. u32 cck_trig_high;
  232. u32 cck_trig_low;
  233. u32 enable_ani;
  234. u8 noise_immunity_level;
  235. u32 ofdm_weaksignal_det;
  236. u32 cck_weaksignal_thr;
  237. u8 spur_immunity_level;
  238. u8 firstep_level;
  239. int8_t rssi_thr_high;
  240. int8_t rssi_thr_low;
  241. u16 diversity_control;
  242. u16 antenna_switch_swap;
  243. int serialize_regmode;
  244. int intr_mitigation;
  245. #define SPUR_DISABLE 0
  246. #define SPUR_ENABLE_IOCTL 1
  247. #define SPUR_ENABLE_EEPROM 2
  248. #define AR_EEPROM_MODAL_SPURS 5
  249. #define AR_SPUR_5413_1 1640
  250. #define AR_SPUR_5413_2 1200
  251. #define AR_NO_SPUR 0x8000
  252. #define AR_BASE_FREQ_2GHZ 2300
  253. #define AR_BASE_FREQ_5GHZ 4900
  254. #define AR_SPUR_FEEQ_BOUND_HT40 19
  255. #define AR_SPUR_FEEQ_BOUND_HT20 10
  256. int spurmode;
  257. u16 spurchans[AR_EEPROM_MODAL_SPURS][2];
  258. };
  259. enum ath9k_tx_queue {
  260. ATH9K_TX_QUEUE_INACTIVE = 0,
  261. ATH9K_TX_QUEUE_DATA,
  262. ATH9K_TX_QUEUE_BEACON,
  263. ATH9K_TX_QUEUE_CAB,
  264. ATH9K_TX_QUEUE_UAPSD,
  265. ATH9K_TX_QUEUE_PSPOLL
  266. };
  267. #define ATH9K_NUM_TX_QUEUES 10
  268. enum ath9k_tx_queue_subtype {
  269. ATH9K_WME_AC_BK = 0,
  270. ATH9K_WME_AC_BE,
  271. ATH9K_WME_AC_VI,
  272. ATH9K_WME_AC_VO,
  273. ATH9K_WME_UPSD
  274. };
  275. enum ath9k_tx_queue_flags {
  276. TXQ_FLAG_TXOKINT_ENABLE = 0x0001,
  277. TXQ_FLAG_TXERRINT_ENABLE = 0x0001,
  278. TXQ_FLAG_TXDESCINT_ENABLE = 0x0002,
  279. TXQ_FLAG_TXEOLINT_ENABLE = 0x0004,
  280. TXQ_FLAG_TXURNINT_ENABLE = 0x0008,
  281. TXQ_FLAG_BACKOFF_DISABLE = 0x0010,
  282. TXQ_FLAG_COMPRESSION_ENABLE = 0x0020,
  283. TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE = 0x0040,
  284. TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE = 0x0080,
  285. };
  286. #define ATH9K_TXQ_USEDEFAULT ((u32) -1)
  287. #define ATH9K_DECOMP_MASK_SIZE 128
  288. #define ATH9K_READY_TIME_LO_BOUND 50
  289. #define ATH9K_READY_TIME_HI_BOUND 96
  290. enum ath9k_pkt_type {
  291. ATH9K_PKT_TYPE_NORMAL = 0,
  292. ATH9K_PKT_TYPE_ATIM,
  293. ATH9K_PKT_TYPE_PSPOLL,
  294. ATH9K_PKT_TYPE_BEACON,
  295. ATH9K_PKT_TYPE_PROBE_RESP,
  296. ATH9K_PKT_TYPE_CHIRP,
  297. ATH9K_PKT_TYPE_GRP_POLL,
  298. };
  299. struct ath9k_tx_queue_info {
  300. u32 tqi_ver;
  301. enum ath9k_tx_queue tqi_type;
  302. enum ath9k_tx_queue_subtype tqi_subtype;
  303. enum ath9k_tx_queue_flags tqi_qflags;
  304. u32 tqi_priority;
  305. u32 tqi_aifs;
  306. u32 tqi_cwmin;
  307. u32 tqi_cwmax;
  308. u16 tqi_shretry;
  309. u16 tqi_lgretry;
  310. u32 tqi_cbrPeriod;
  311. u32 tqi_cbrOverflowLimit;
  312. u32 tqi_burstTime;
  313. u32 tqi_readyTime;
  314. u32 tqi_physCompBuf;
  315. u32 tqi_intFlags;
  316. };
  317. enum ath9k_rx_filter {
  318. ATH9K_RX_FILTER_UCAST = 0x00000001,
  319. ATH9K_RX_FILTER_MCAST = 0x00000002,
  320. ATH9K_RX_FILTER_BCAST = 0x00000004,
  321. ATH9K_RX_FILTER_CONTROL = 0x00000008,
  322. ATH9K_RX_FILTER_BEACON = 0x00000010,
  323. ATH9K_RX_FILTER_PROM = 0x00000020,
  324. ATH9K_RX_FILTER_PROBEREQ = 0x00000080,
  325. ATH9K_RX_FILTER_PSPOLL = 0x00004000,
  326. ATH9K_RX_FILTER_PHYERR = 0x00000100,
  327. ATH9K_RX_FILTER_PHYRADAR = 0x00002000,
  328. };
  329. enum ath9k_int {
  330. ATH9K_INT_RX = 0x00000001,
  331. ATH9K_INT_RXDESC = 0x00000002,
  332. ATH9K_INT_RXNOFRM = 0x00000008,
  333. ATH9K_INT_RXEOL = 0x00000010,
  334. ATH9K_INT_RXORN = 0x00000020,
  335. ATH9K_INT_TX = 0x00000040,
  336. ATH9K_INT_TXDESC = 0x00000080,
  337. ATH9K_INT_TIM_TIMER = 0x00000100,
  338. ATH9K_INT_TXURN = 0x00000800,
  339. ATH9K_INT_MIB = 0x00001000,
  340. ATH9K_INT_RXPHY = 0x00004000,
  341. ATH9K_INT_RXKCM = 0x00008000,
  342. ATH9K_INT_SWBA = 0x00010000,
  343. ATH9K_INT_BMISS = 0x00040000,
  344. ATH9K_INT_BNR = 0x00100000,
  345. ATH9K_INT_TIM = 0x00200000,
  346. ATH9K_INT_DTIM = 0x00400000,
  347. ATH9K_INT_DTIMSYNC = 0x00800000,
  348. ATH9K_INT_GPIO = 0x01000000,
  349. ATH9K_INT_CABEND = 0x02000000,
  350. ATH9K_INT_CST = 0x10000000,
  351. ATH9K_INT_GTT = 0x20000000,
  352. ATH9K_INT_FATAL = 0x40000000,
  353. ATH9K_INT_GLOBAL = 0x80000000,
  354. ATH9K_INT_BMISC = ATH9K_INT_TIM |
  355. ATH9K_INT_DTIM |
  356. ATH9K_INT_DTIMSYNC |
  357. ATH9K_INT_CABEND,
  358. ATH9K_INT_COMMON = ATH9K_INT_RXNOFRM |
  359. ATH9K_INT_RXDESC |
  360. ATH9K_INT_RXEOL |
  361. ATH9K_INT_RXORN |
  362. ATH9K_INT_TXURN |
  363. ATH9K_INT_TXDESC |
  364. ATH9K_INT_MIB |
  365. ATH9K_INT_RXPHY |
  366. ATH9K_INT_RXKCM |
  367. ATH9K_INT_SWBA |
  368. ATH9K_INT_BMISS |
  369. ATH9K_INT_GPIO,
  370. ATH9K_INT_NOCARD = 0xffffffff
  371. };
  372. #define ATH9K_RATESERIES_RTS_CTS 0x0001
  373. #define ATH9K_RATESERIES_2040 0x0002
  374. #define ATH9K_RATESERIES_HALFGI 0x0004
  375. struct ath9k_11n_rate_series {
  376. u32 Tries;
  377. u32 Rate;
  378. u32 PktDuration;
  379. u32 ChSel;
  380. u32 RateFlags;
  381. };
  382. #define CHANNEL_CW_INT 0x00002
  383. #define CHANNEL_CCK 0x00020
  384. #define CHANNEL_OFDM 0x00040
  385. #define CHANNEL_2GHZ 0x00080
  386. #define CHANNEL_5GHZ 0x00100
  387. #define CHANNEL_PASSIVE 0x00200
  388. #define CHANNEL_DYN 0x00400
  389. #define CHANNEL_HALF 0x04000
  390. #define CHANNEL_QUARTER 0x08000
  391. #define CHANNEL_HT20 0x10000
  392. #define CHANNEL_HT40PLUS 0x20000
  393. #define CHANNEL_HT40MINUS 0x40000
  394. #define CHANNEL_INTERFERENCE 0x01
  395. #define CHANNEL_DFS 0x02
  396. #define CHANNEL_4MS_LIMIT 0x04
  397. #define CHANNEL_DFS_CLEAR 0x08
  398. #define CHANNEL_DISALLOW_ADHOC 0x10
  399. #define CHANNEL_PER_11D_ADHOC 0x20
  400. #define CHANNEL_A (CHANNEL_5GHZ|CHANNEL_OFDM)
  401. #define CHANNEL_B (CHANNEL_2GHZ|CHANNEL_CCK)
  402. #define CHANNEL_G (CHANNEL_2GHZ|CHANNEL_OFDM)
  403. #define CHANNEL_G_HT20 (CHANNEL_2GHZ|CHANNEL_HT20)
  404. #define CHANNEL_A_HT20 (CHANNEL_5GHZ|CHANNEL_HT20)
  405. #define CHANNEL_G_HT40PLUS (CHANNEL_2GHZ|CHANNEL_HT40PLUS)
  406. #define CHANNEL_G_HT40MINUS (CHANNEL_2GHZ|CHANNEL_HT40MINUS)
  407. #define CHANNEL_A_HT40PLUS (CHANNEL_5GHZ|CHANNEL_HT40PLUS)
  408. #define CHANNEL_A_HT40MINUS (CHANNEL_5GHZ|CHANNEL_HT40MINUS)
  409. #define CHANNEL_ALL \
  410. (CHANNEL_OFDM| \
  411. CHANNEL_CCK| \
  412. CHANNEL_2GHZ | \
  413. CHANNEL_5GHZ | \
  414. CHANNEL_HT20 | \
  415. CHANNEL_HT40PLUS | \
  416. CHANNEL_HT40MINUS)
  417. struct ath9k_channel {
  418. struct ieee80211_channel *chan;
  419. u16 channel;
  420. u32 channelFlags;
  421. u32 chanmode;
  422. int32_t CalValid;
  423. bool oneTimeCalsDone;
  424. int8_t iCoff;
  425. int8_t qCoff;
  426. int16_t rawNoiseFloor;
  427. };
  428. #define IS_CHAN_A(_c) ((((_c)->channelFlags & CHANNEL_A) == CHANNEL_A) || \
  429. (((_c)->channelFlags & CHANNEL_A_HT20) == CHANNEL_A_HT20) || \
  430. (((_c)->channelFlags & CHANNEL_A_HT40PLUS) == CHANNEL_A_HT40PLUS) || \
  431. (((_c)->channelFlags & CHANNEL_A_HT40MINUS) == CHANNEL_A_HT40MINUS))
  432. #define IS_CHAN_G(_c) ((((_c)->channelFlags & (CHANNEL_G)) == CHANNEL_G) || \
  433. (((_c)->channelFlags & CHANNEL_G_HT20) == CHANNEL_G_HT20) || \
  434. (((_c)->channelFlags & CHANNEL_G_HT40PLUS) == CHANNEL_G_HT40PLUS) || \
  435. (((_c)->channelFlags & CHANNEL_G_HT40MINUS) == CHANNEL_G_HT40MINUS))
  436. #define IS_CHAN_OFDM(_c) (((_c)->channelFlags & CHANNEL_OFDM) != 0)
  437. #define IS_CHAN_5GHZ(_c) (((_c)->channelFlags & CHANNEL_5GHZ) != 0)
  438. #define IS_CHAN_2GHZ(_c) (((_c)->channelFlags & CHANNEL_2GHZ) != 0)
  439. #define IS_CHAN_PASSIVE(_c) (((_c)->channelFlags & CHANNEL_PASSIVE) != 0)
  440. #define IS_CHAN_HALF_RATE(_c) (((_c)->channelFlags & CHANNEL_HALF) != 0)
  441. #define IS_CHAN_QUARTER_RATE(_c) (((_c)->channelFlags & CHANNEL_QUARTER) != 0)
  442. /* These macros check chanmode and not channelFlags */
  443. #define IS_CHAN_B(_c) ((_c)->chanmode == CHANNEL_B)
  444. #define IS_CHAN_HT20(_c) (((_c)->chanmode == CHANNEL_A_HT20) || \
  445. ((_c)->chanmode == CHANNEL_G_HT20))
  446. #define IS_CHAN_HT40(_c) (((_c)->chanmode == CHANNEL_A_HT40PLUS) || \
  447. ((_c)->chanmode == CHANNEL_A_HT40MINUS) || \
  448. ((_c)->chanmode == CHANNEL_G_HT40PLUS) || \
  449. ((_c)->chanmode == CHANNEL_G_HT40MINUS))
  450. #define IS_CHAN_HT(_c) (IS_CHAN_HT20((_c)) || IS_CHAN_HT40((_c)))
  451. #define IS_CHAN_A_5MHZ_SPACED(_c) \
  452. ((((_c)->channelFlags & CHANNEL_5GHZ) != 0) && \
  453. (((_c)->channel % 20) != 0) && \
  454. (((_c)->channel % 10) != 0))
  455. struct ath9k_keyval {
  456. u8 kv_type;
  457. u8 kv_pad;
  458. u16 kv_len;
  459. u8 kv_val[16];
  460. u8 kv_mic[8];
  461. u8 kv_txmic[8];
  462. };
  463. enum ath9k_key_type {
  464. ATH9K_KEY_TYPE_CLEAR,
  465. ATH9K_KEY_TYPE_WEP,
  466. ATH9K_KEY_TYPE_AES,
  467. ATH9K_KEY_TYPE_TKIP,
  468. };
  469. enum ath9k_cipher {
  470. ATH9K_CIPHER_WEP = 0,
  471. ATH9K_CIPHER_AES_OCB = 1,
  472. ATH9K_CIPHER_AES_CCM = 2,
  473. ATH9K_CIPHER_CKIP = 3,
  474. ATH9K_CIPHER_TKIP = 4,
  475. ATH9K_CIPHER_CLR = 5,
  476. ATH9K_CIPHER_MIC = 127
  477. };
  478. #define AR_EEPROM_EEPCAP_COMPRESS_DIS 0x0001
  479. #define AR_EEPROM_EEPCAP_AES_DIS 0x0002
  480. #define AR_EEPROM_EEPCAP_FASTFRAME_DIS 0x0004
  481. #define AR_EEPROM_EEPCAP_BURST_DIS 0x0008
  482. #define AR_EEPROM_EEPCAP_MAXQCU 0x01F0
  483. #define AR_EEPROM_EEPCAP_MAXQCU_S 4
  484. #define AR_EEPROM_EEPCAP_HEAVY_CLIP_EN 0x0200
  485. #define AR_EEPROM_EEPCAP_KC_ENTRIES 0xF000
  486. #define AR_EEPROM_EEPCAP_KC_ENTRIES_S 12
  487. #define AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND 0x0040
  488. #define AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN 0x0080
  489. #define AR_EEPROM_EEREGCAP_EN_KK_U2 0x0100
  490. #define AR_EEPROM_EEREGCAP_EN_KK_MIDBAND 0x0200
  491. #define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD 0x0400
  492. #define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A 0x0800
  493. #define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD_PRE4_0 0x4000
  494. #define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A_PRE4_0 0x8000
  495. #define SD_NO_CTL 0xE0
  496. #define NO_CTL 0xff
  497. #define CTL_MODE_M 7
  498. #define CTL_11A 0
  499. #define CTL_11B 1
  500. #define CTL_11G 2
  501. #define CTL_2GHT20 5
  502. #define CTL_5GHT20 6
  503. #define CTL_2GHT40 7
  504. #define CTL_5GHT40 8
  505. #define AR_EEPROM_MAC(i) (0x1d+(i))
  506. #define AR_EEPROM_RFSILENT_GPIO_SEL 0x001c
  507. #define AR_EEPROM_RFSILENT_GPIO_SEL_S 2
  508. #define AR_EEPROM_RFSILENT_POLARITY 0x0002
  509. #define AR_EEPROM_RFSILENT_POLARITY_S 1
  510. #define CTRY_DEBUG 0x1ff
  511. #define CTRY_DEFAULT 0
  512. enum reg_ext_bitmap {
  513. REG_EXT_JAPAN_MIDBAND = 1,
  514. REG_EXT_FCC_DFS_HT40 = 2,
  515. REG_EXT_JAPAN_NONDFS_HT40 = 3,
  516. REG_EXT_JAPAN_DFS_HT40 = 4
  517. };
  518. struct ath9k_country_entry {
  519. u16 countryCode;
  520. u16 regDmnEnum;
  521. u16 regDmn5G;
  522. u16 regDmn2G;
  523. u8 isMultidomain;
  524. u8 iso[3];
  525. };
  526. #define REG_WRITE(_ah, _reg, _val) iowrite32(_val, _ah->ah_sh + _reg)
  527. #define REG_READ(_ah, _reg) ioread32(_ah->ah_sh + _reg)
  528. #define SM(_v, _f) (((_v) << _f##_S) & _f)
  529. #define MS(_v, _f) (((_v) & _f) >> _f##_S)
  530. #define REG_RMW(_a, _r, _set, _clr) \
  531. REG_WRITE(_a, _r, (REG_READ(_a, _r) & ~(_clr)) | (_set))
  532. #define REG_RMW_FIELD(_a, _r, _f, _v) \
  533. REG_WRITE(_a, _r, \
  534. (REG_READ(_a, _r) & ~_f) | (((_v) << _f##_S) & _f))
  535. #define REG_SET_BIT(_a, _r, _f) \
  536. REG_WRITE(_a, _r, REG_READ(_a, _r) | _f)
  537. #define REG_CLR_BIT(_a, _r, _f) \
  538. REG_WRITE(_a, _r, REG_READ(_a, _r) & ~_f)
  539. #define ATH9K_TXQ_USE_LOCKOUT_BKOFF_DIS 0x00000001
  540. #define INIT_AIFS 2
  541. #define INIT_CWMIN 15
  542. #define INIT_CWMIN_11B 31
  543. #define INIT_CWMAX 1023
  544. #define INIT_SH_RETRY 10
  545. #define INIT_LG_RETRY 10
  546. #define INIT_SSH_RETRY 32
  547. #define INIT_SLG_RETRY 32
  548. #define WLAN_CTRL_FRAME_SIZE (2+2+6+4)
  549. #define ATH_AMPDU_LIMIT_MAX (64 * 1024 - 1)
  550. #define ATH_AMPDU_LIMIT_DEFAULT ATH_AMPDU_LIMIT_MAX
  551. #define IEEE80211_WEP_IVLEN 3
  552. #define IEEE80211_WEP_KIDLEN 1
  553. #define IEEE80211_WEP_CRCLEN 4
  554. #define IEEE80211_MAX_MPDU_LEN (3840 + FCS_LEN + \
  555. (IEEE80211_WEP_IVLEN + \
  556. IEEE80211_WEP_KIDLEN + \
  557. IEEE80211_WEP_CRCLEN))
  558. #define MAX_RATE_POWER 63
  559. enum ath9k_power_mode {
  560. ATH9K_PM_AWAKE = 0,
  561. ATH9K_PM_FULL_SLEEP,
  562. ATH9K_PM_NETWORK_SLEEP,
  563. ATH9K_PM_UNDEFINED
  564. };
  565. struct ath9k_mib_stats {
  566. u32 ackrcv_bad;
  567. u32 rts_bad;
  568. u32 rts_good;
  569. u32 fcs_bad;
  570. u32 beacons;
  571. };
  572. enum ath9k_ant_setting {
  573. ATH9K_ANT_VARIABLE = 0,
  574. ATH9K_ANT_FIXED_A,
  575. ATH9K_ANT_FIXED_B
  576. };
  577. #define ATH9K_SLOT_TIME_6 6
  578. #define ATH9K_SLOT_TIME_9 9
  579. #define ATH9K_SLOT_TIME_20 20
  580. enum ath9k_ht_macmode {
  581. ATH9K_HT_MACMODE_20 = 0,
  582. ATH9K_HT_MACMODE_2040 = 1,
  583. };
  584. enum ath9k_ht_extprotspacing {
  585. ATH9K_HT_EXTPROTSPACING_20 = 0,
  586. ATH9K_HT_EXTPROTSPACING_25 = 1,
  587. };
  588. struct ath9k_ht_cwm {
  589. enum ath9k_ht_macmode ht_macmode;
  590. enum ath9k_ht_extprotspacing ht_extprotspacing;
  591. };
  592. enum ath9k_ani_cmd {
  593. ATH9K_ANI_PRESENT = 0x1,
  594. ATH9K_ANI_NOISE_IMMUNITY_LEVEL = 0x2,
  595. ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x4,
  596. ATH9K_ANI_CCK_WEAK_SIGNAL_THR = 0x8,
  597. ATH9K_ANI_FIRSTEP_LEVEL = 0x10,
  598. ATH9K_ANI_SPUR_IMMUNITY_LEVEL = 0x20,
  599. ATH9K_ANI_MODE = 0x40,
  600. ATH9K_ANI_PHYERR_RESET = 0x80,
  601. ATH9K_ANI_ALL = 0xff
  602. };
  603. enum {
  604. WLAN_RC_PHY_OFDM,
  605. WLAN_RC_PHY_CCK,
  606. WLAN_RC_PHY_HT_20_SS,
  607. WLAN_RC_PHY_HT_20_DS,
  608. WLAN_RC_PHY_HT_40_SS,
  609. WLAN_RC_PHY_HT_40_DS,
  610. WLAN_RC_PHY_HT_20_SS_HGI,
  611. WLAN_RC_PHY_HT_20_DS_HGI,
  612. WLAN_RC_PHY_HT_40_SS_HGI,
  613. WLAN_RC_PHY_HT_40_DS_HGI,
  614. WLAN_RC_PHY_MAX
  615. };
  616. enum ath9k_tp_scale {
  617. ATH9K_TP_SCALE_MAX = 0,
  618. ATH9K_TP_SCALE_50,
  619. ATH9K_TP_SCALE_25,
  620. ATH9K_TP_SCALE_12,
  621. ATH9K_TP_SCALE_MIN
  622. };
  623. enum ser_reg_mode {
  624. SER_REG_MODE_OFF = 0,
  625. SER_REG_MODE_ON = 1,
  626. SER_REG_MODE_AUTO = 2,
  627. };
  628. #define AR_PHY_CCA_MAX_GOOD_VALUE -85
  629. #define AR_PHY_CCA_MAX_HIGH_VALUE -62
  630. #define AR_PHY_CCA_MIN_BAD_VALUE -121
  631. #define AR_PHY_CCA_FILTERWINDOW_LENGTH_INIT 3
  632. #define AR_PHY_CCA_FILTERWINDOW_LENGTH 5
  633. #define ATH9K_NF_CAL_HIST_MAX 5
  634. #define NUM_NF_READINGS 6
  635. struct ath9k_nfcal_hist {
  636. int16_t nfCalBuffer[ATH9K_NF_CAL_HIST_MAX];
  637. u8 currIndex;
  638. int16_t privNF;
  639. u8 invalidNFcount;
  640. };
  641. struct ath9k_beacon_state {
  642. u32 bs_nexttbtt;
  643. u32 bs_nextdtim;
  644. u32 bs_intval;
  645. #define ATH9K_BEACON_PERIOD 0x0000ffff
  646. #define ATH9K_BEACON_ENA 0x00800000
  647. #define ATH9K_BEACON_RESET_TSF 0x01000000
  648. u32 bs_dtimperiod;
  649. u16 bs_cfpperiod;
  650. u16 bs_cfpmaxduration;
  651. u32 bs_cfpnext;
  652. u16 bs_timoffset;
  653. u16 bs_bmissthreshold;
  654. u32 bs_sleepduration;
  655. };
  656. struct ath9k_node_stats {
  657. u32 ns_avgbrssi;
  658. u32 ns_avgrssi;
  659. u32 ns_avgtxrssi;
  660. u32 ns_avgtxrate;
  661. };
  662. #define ATH9K_RSSI_EP_MULTIPLIER (1<<7)
  663. #define AR_GPIO_OUTPUT_MUX_AS_OUTPUT 0
  664. #define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1
  665. #define AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED 2
  666. #define AR_GPIO_OUTPUT_MUX_AS_TX_FRAME 3
  667. #define AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED 5
  668. #define AR_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED 6
  669. enum {
  670. ATH9K_RESET_POWER_ON,
  671. ATH9K_RESET_WARM,
  672. ATH9K_RESET_COLD,
  673. };
  674. #define AH_USE_EEPROM 0x1
  675. struct ath_hal {
  676. u32 ah_magic;
  677. u16 ah_devid;
  678. u16 ah_subvendorid;
  679. u32 ah_macVersion;
  680. u16 ah_macRev;
  681. u16 ah_phyRev;
  682. u16 ah_analog5GhzRev;
  683. u16 ah_analog2GhzRev;
  684. void __iomem *ah_sh;
  685. struct ath_softc *ah_sc;
  686. enum nl80211_iftype ah_opmode;
  687. struct ath9k_ops_config ah_config;
  688. struct ath9k_hw_capabilities ah_caps;
  689. u16 ah_countryCode;
  690. u32 ah_flags;
  691. int16_t ah_powerLimit;
  692. u16 ah_maxPowerLevel;
  693. u32 ah_tpScale;
  694. u16 ah_currentRD;
  695. u16 ah_currentRDExt;
  696. u16 ah_currentRDInUse;
  697. char alpha2[2];
  698. struct reg_dmn_pair_mapping *regpair;
  699. enum ath9k_power_mode ah_power_mode;
  700. enum ath9k_power_mode ah_restore_mode;
  701. struct ath9k_channel ah_channels[38];
  702. struct ath9k_channel *ah_curchan;
  703. bool ah_isPciExpress;
  704. u16 ah_txTrigLevel;
  705. u16 ah_rfsilent;
  706. u32 ah_rfkill_gpio;
  707. u32 ah_rfkill_polarity;
  708. u32 ah_btactive_gpio;
  709. u32 ah_wlanactive_gpio;
  710. struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
  711. bool sw_mgmt_crypto;
  712. };
  713. struct chan_centers {
  714. u16 synth_center;
  715. u16 ctl_center;
  716. u16 ext_center;
  717. };
  718. struct ath_rate_table;
  719. /* Helpers */
  720. bool ath9k_hw_wait(struct ath_hal *ah, u32 reg, u32 mask, u32 val);
  721. u32 ath9k_hw_reverse_bits(u32 val, u32 n);
  722. bool ath9k_get_channel_edges(struct ath_hal *ah,
  723. u16 flags, u16 *low,
  724. u16 *high);
  725. u16 ath9k_hw_computetxtime(struct ath_hal *ah,
  726. struct ath_rate_table *rates,
  727. u32 frameLen, u16 rateix,
  728. bool shortPreamble);
  729. void ath9k_hw_get_channel_centers(struct ath_hal *ah,
  730. struct ath9k_channel *chan,
  731. struct chan_centers *centers);
  732. /* Attach, Detach */
  733. const char *ath9k_hw_probe(u16 vendorid, u16 devid);
  734. void ath9k_hw_detach(struct ath_hal *ah);
  735. struct ath_hal *ath9k_hw_attach(u16 devid, struct ath_softc *sc,
  736. void __iomem *mem, int *error);
  737. void ath9k_hw_rfdetach(struct ath_hal *ah);
  738. /* HW Reset */
  739. int ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
  740. bool bChannelChange);
  741. /* Key Cache Management */
  742. bool ath9k_hw_keyreset(struct ath_hal *ah, u16 entry);
  743. bool ath9k_hw_keysetmac(struct ath_hal *ah, u16 entry, const u8 *mac);
  744. bool ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry,
  745. const struct ath9k_keyval *k,
  746. const u8 *mac, int xorKey);
  747. bool ath9k_hw_keyisvalid(struct ath_hal *ah, u16 entry);
  748. /* Power Management */
  749. bool ath9k_hw_setpower(struct ath_hal *ah,
  750. enum ath9k_power_mode mode);
  751. void ath9k_hw_configpcipowersave(struct ath_hal *ah, int restore);
  752. /* Beacon timers */
  753. void ath9k_hw_beaconinit(struct ath_hal *ah, u32 next_beacon, u32 beacon_period);
  754. void ath9k_hw_set_sta_beacon_timers(struct ath_hal *ah,
  755. const struct ath9k_beacon_state *bs);
  756. /* HW Capabilities */
  757. bool ath9k_hw_fill_cap_info(struct ath_hal *ah);
  758. bool ath9k_hw_getcapability(struct ath_hal *ah, enum ath9k_capability_type type,
  759. u32 capability, u32 *result);
  760. bool ath9k_hw_setcapability(struct ath_hal *ah, enum ath9k_capability_type type,
  761. u32 capability, u32 setting, int *status);
  762. /* GPIO / RFKILL / Antennae */
  763. void ath9k_hw_cfg_gpio_input(struct ath_hal *ah, u32 gpio);
  764. u32 ath9k_hw_gpio_get(struct ath_hal *ah, u32 gpio);
  765. void ath9k_hw_cfg_output(struct ath_hal *ah, u32 gpio,
  766. u32 ah_signal_type);
  767. void ath9k_hw_set_gpio(struct ath_hal *ah, u32 gpio, u32 val);
  768. #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
  769. void ath9k_enable_rfkill(struct ath_hal *ah);
  770. #endif
  771. u32 ath9k_hw_getdefantenna(struct ath_hal *ah);
  772. void ath9k_hw_setantenna(struct ath_hal *ah, u32 antenna);
  773. bool ath9k_hw_setantennaswitch(struct ath_hal *ah,
  774. enum ath9k_ant_setting settings,
  775. struct ath9k_channel *chan,
  776. u8 *tx_chainmask,
  777. u8 *rx_chainmask,
  778. u8 *antenna_cfgd);
  779. /* General Operation */
  780. u32 ath9k_hw_getrxfilter(struct ath_hal *ah);
  781. void ath9k_hw_setrxfilter(struct ath_hal *ah, u32 bits);
  782. bool ath9k_hw_phy_disable(struct ath_hal *ah);
  783. bool ath9k_hw_disable(struct ath_hal *ah);
  784. bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u32 limit);
  785. void ath9k_hw_getmac(struct ath_hal *ah, u8 *mac);
  786. bool ath9k_hw_setmac(struct ath_hal *ah, const u8 *mac);
  787. void ath9k_hw_setopmode(struct ath_hal *ah);
  788. void ath9k_hw_setmcastfilter(struct ath_hal *ah, u32 filter0, u32 filter1);
  789. void ath9k_hw_getbssidmask(struct ath_hal *ah, u8 *mask);
  790. bool ath9k_hw_setbssidmask(struct ath_hal *ah, const u8 *mask);
  791. void ath9k_hw_write_associd(struct ath_hal *ah, const u8 *bssid, u16 assocId);
  792. u64 ath9k_hw_gettsf64(struct ath_hal *ah);
  793. void ath9k_hw_settsf64(struct ath_hal *ah, u64 tsf64);
  794. void ath9k_hw_reset_tsf(struct ath_hal *ah);
  795. bool ath9k_hw_set_tsfadjust(struct ath_hal *ah, u32 setting);
  796. bool ath9k_hw_setslottime(struct ath_hal *ah, u32 us);
  797. void ath9k_hw_set11nmac2040(struct ath_hal *ah, enum ath9k_ht_macmode mode);
  798. /* Regulatory */
  799. u16 ath9k_regd_get_rd(struct ath_hal *ah);
  800. bool ath9k_is_world_regd(struct ath_hal *ah);
  801. const struct ieee80211_regdomain *ath9k_world_regdomain(struct ath_hal *ah);
  802. const struct ieee80211_regdomain *ath9k_default_world_regdomain(void);
  803. void ath9k_reg_apply_world_flags(struct wiphy *wiphy, enum reg_set_by setby);
  804. void ath9k_reg_apply_radar_flags(struct wiphy *wiphy);
  805. int ath9k_regd_init(struct ath_hal *ah);
  806. bool ath9k_regd_is_eeprom_valid(struct ath_hal *ah);
  807. u32 ath9k_regd_get_ctl(struct ath_hal *ah, struct ath9k_channel *chan);
  808. int ath9k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request);
  809. /* ANI */
  810. void ath9k_ani_reset(struct ath_hal *ah);
  811. void ath9k_hw_ani_monitor(struct ath_hal *ah,
  812. const struct ath9k_node_stats *stats,
  813. struct ath9k_channel *chan);
  814. bool ath9k_hw_phycounters(struct ath_hal *ah);
  815. void ath9k_enable_mib_counters(struct ath_hal *ah);
  816. void ath9k_hw_disable_mib_counters(struct ath_hal *ah);
  817. u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hal *ah,
  818. u32 *rxc_pcnt,
  819. u32 *rxf_pcnt,
  820. u32 *txf_pcnt);
  821. void ath9k_hw_procmibevent(struct ath_hal *ah,
  822. const struct ath9k_node_stats *stats);
  823. void ath9k_hw_ani_setup(struct ath_hal *ah);
  824. void ath9k_hw_ani_attach(struct ath_hal *ah);
  825. void ath9k_hw_ani_detach(struct ath_hal *ah);
  826. /* Calibration */
  827. bool ath9k_hw_reset_calvalid(struct ath_hal *ah);
  828. void ath9k_hw_start_nfcal(struct ath_hal *ah);
  829. void ath9k_hw_loadnf(struct ath_hal *ah, struct ath9k_channel *chan);
  830. int16_t ath9k_hw_getnf(struct ath_hal *ah,
  831. struct ath9k_channel *chan);
  832. void ath9k_init_nfcal_hist_buffer(struct ath_hal *ah);
  833. s16 ath9k_hw_getchan_noise(struct ath_hal *ah, struct ath9k_channel *chan);
  834. bool ath9k_hw_calibrate(struct ath_hal *ah, struct ath9k_channel *chan,
  835. u8 rxchainmask, bool longcal,
  836. bool *isCalDone);
  837. bool ath9k_hw_init_cal(struct ath_hal *ah,
  838. struct ath9k_channel *chan);
  839. /* EEPROM */
  840. int ath9k_hw_set_txpower(struct ath_hal *ah,
  841. struct ath9k_channel *chan,
  842. u16 cfgCtl,
  843. u8 twiceAntennaReduction,
  844. u8 twiceMaxRegulatoryPower,
  845. u8 powerLimit);
  846. void ath9k_hw_set_addac(struct ath_hal *ah, struct ath9k_channel *chan);
  847. bool ath9k_hw_set_power_per_rate_table(struct ath_hal *ah,
  848. struct ath9k_channel *chan,
  849. int16_t *ratesArray,
  850. u16 cfgCtl,
  851. u8 AntennaReduction,
  852. u8 twiceMaxRegulatoryPower,
  853. u8 powerLimit);
  854. bool ath9k_hw_set_power_cal_table(struct ath_hal *ah,
  855. struct ath9k_channel *chan,
  856. int16_t *pTxPowerIndexOffset);
  857. bool ath9k_hw_eeprom_set_board_values(struct ath_hal *ah,
  858. struct ath9k_channel *chan);
  859. u16 ath9k_hw_get_eeprom_antenna_cfg(struct ath_hal *ah,
  860. struct ath9k_channel *chan);
  861. u8 ath9k_hw_get_num_ant_config(struct ath_hal *ah,
  862. enum ieee80211_band freq_band);
  863. u16 ath9k_hw_eeprom_get_spur_chan(struct ath_hal *ah, u16 i, bool is2GHz);
  864. int ath9k_hw_eeprom_attach(struct ath_hal *ah);
  865. /* Interrupt Handling */
  866. bool ath9k_hw_intrpend(struct ath_hal *ah);
  867. bool ath9k_hw_getisr(struct ath_hal *ah, enum ath9k_int *masked);
  868. enum ath9k_int ath9k_hw_intrget(struct ath_hal *ah);
  869. enum ath9k_int ath9k_hw_set_interrupts(struct ath_hal *ah, enum ath9k_int ints);
  870. /* MAC (PCU/QCU) */
  871. u32 ath9k_hw_gettxbuf(struct ath_hal *ah, u32 q);
  872. bool ath9k_hw_puttxbuf(struct ath_hal *ah, u32 q, u32 txdp);
  873. bool ath9k_hw_txstart(struct ath_hal *ah, u32 q);
  874. u32 ath9k_hw_numtxpending(struct ath_hal *ah, u32 q);
  875. bool ath9k_hw_updatetxtriglevel(struct ath_hal *ah, bool bIncTrigLevel);
  876. bool ath9k_hw_stoptxdma(struct ath_hal *ah, u32 q);
  877. bool ath9k_hw_filltxdesc(struct ath_hal *ah, struct ath_desc *ds,
  878. u32 segLen, bool firstSeg,
  879. bool lastSeg, const struct ath_desc *ds0);
  880. void ath9k_hw_cleartxdesc(struct ath_hal *ah, struct ath_desc *ds);
  881. int ath9k_hw_txprocdesc(struct ath_hal *ah, struct ath_desc *ds);
  882. void ath9k_hw_set11n_txdesc(struct ath_hal *ah, struct ath_desc *ds,
  883. u32 pktLen, enum ath9k_pkt_type type, u32 txPower,
  884. u32 keyIx, enum ath9k_key_type keyType, u32 flags);
  885. void ath9k_hw_set11n_ratescenario(struct ath_hal *ah, struct ath_desc *ds,
  886. struct ath_desc *lastds,
  887. u32 durUpdateEn, u32 rtsctsRate,
  888. u32 rtsctsDuration,
  889. struct ath9k_11n_rate_series series[],
  890. u32 nseries, u32 flags);
  891. void ath9k_hw_set11n_aggr_first(struct ath_hal *ah, struct ath_desc *ds,
  892. u32 aggrLen);
  893. void ath9k_hw_set11n_aggr_middle(struct ath_hal *ah, struct ath_desc *ds,
  894. u32 numDelims);
  895. void ath9k_hw_set11n_aggr_last(struct ath_hal *ah, struct ath_desc *ds);
  896. void ath9k_hw_clr11n_aggr(struct ath_hal *ah, struct ath_desc *ds);
  897. void ath9k_hw_set11n_burstduration(struct ath_hal *ah, struct ath_desc *ds,
  898. u32 burstDuration);
  899. void ath9k_hw_set11n_virtualmorefrag(struct ath_hal *ah, struct ath_desc *ds,
  900. u32 vmf);
  901. void ath9k_hw_gettxintrtxqs(struct ath_hal *ah, u32 *txqs);
  902. bool ath9k_hw_set_txq_props(struct ath_hal *ah, int q,
  903. const struct ath9k_tx_queue_info *qinfo);
  904. bool ath9k_hw_get_txq_props(struct ath_hal *ah, int q,
  905. struct ath9k_tx_queue_info *qinfo);
  906. int ath9k_hw_setuptxqueue(struct ath_hal *ah, enum ath9k_tx_queue type,
  907. const struct ath9k_tx_queue_info *qinfo);
  908. bool ath9k_hw_releasetxqueue(struct ath_hal *ah, u32 q);
  909. bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q);
  910. int ath9k_hw_rxprocdesc(struct ath_hal *ah, struct ath_desc *ds,
  911. u32 pa, struct ath_desc *nds, u64 tsf);
  912. bool ath9k_hw_setuprxdesc(struct ath_hal *ah, struct ath_desc *ds,
  913. u32 size, u32 flags);
  914. bool ath9k_hw_setrxabort(struct ath_hal *ah, bool set);
  915. void ath9k_hw_putrxbuf(struct ath_hal *ah, u32 rxdp);
  916. void ath9k_hw_rxena(struct ath_hal *ah);
  917. void ath9k_hw_startpcureceive(struct ath_hal *ah);
  918. void ath9k_hw_stoppcurecv(struct ath_hal *ah);
  919. bool ath9k_hw_stopdmarecv(struct ath_hal *ah);
  920. void ath9k_hw_btcoex_enable(struct ath_hal *ah);
  921. #endif