mac.c 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  1. /*
  2. * Copyright (c) 2008-2009 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. #include "hw.h"
  17. #include "hw-ops.h"
  18. static void ath9k_hw_set_txq_interrupts(struct ath_hw *ah,
  19. struct ath9k_tx_queue_info *qi)
  20. {
  21. ath_dbg(ath9k_hw_common(ah), ATH_DBG_INTERRUPT,
  22. "tx ok 0x%x err 0x%x desc 0x%x eol 0x%x urn 0x%x\n",
  23. ah->txok_interrupt_mask, ah->txerr_interrupt_mask,
  24. ah->txdesc_interrupt_mask, ah->txeol_interrupt_mask,
  25. ah->txurn_interrupt_mask);
  26. ENABLE_REGWRITE_BUFFER(ah);
  27. REG_WRITE(ah, AR_IMR_S0,
  28. SM(ah->txok_interrupt_mask, AR_IMR_S0_QCU_TXOK)
  29. | SM(ah->txdesc_interrupt_mask, AR_IMR_S0_QCU_TXDESC));
  30. REG_WRITE(ah, AR_IMR_S1,
  31. SM(ah->txerr_interrupt_mask, AR_IMR_S1_QCU_TXERR)
  32. | SM(ah->txeol_interrupt_mask, AR_IMR_S1_QCU_TXEOL));
  33. ah->imrs2_reg &= ~AR_IMR_S2_QCU_TXURN;
  34. ah->imrs2_reg |= (ah->txurn_interrupt_mask & AR_IMR_S2_QCU_TXURN);
  35. REG_WRITE(ah, AR_IMR_S2, ah->imrs2_reg);
  36. REGWRITE_BUFFER_FLUSH(ah);
  37. }
  38. u32 ath9k_hw_gettxbuf(struct ath_hw *ah, u32 q)
  39. {
  40. return REG_READ(ah, AR_QTXDP(q));
  41. }
  42. EXPORT_SYMBOL(ath9k_hw_gettxbuf);
  43. void ath9k_hw_puttxbuf(struct ath_hw *ah, u32 q, u32 txdp)
  44. {
  45. REG_WRITE(ah, AR_QTXDP(q), txdp);
  46. }
  47. EXPORT_SYMBOL(ath9k_hw_puttxbuf);
  48. void ath9k_hw_txstart(struct ath_hw *ah, u32 q)
  49. {
  50. ath_dbg(ath9k_hw_common(ah), ATH_DBG_QUEUE,
  51. "Enable TXE on queue: %u\n", q);
  52. REG_WRITE(ah, AR_Q_TXE, 1 << q);
  53. }
  54. EXPORT_SYMBOL(ath9k_hw_txstart);
  55. void ath9k_hw_cleartxdesc(struct ath_hw *ah, void *ds)
  56. {
  57. struct ar5416_desc *ads = AR5416DESC(ds);
  58. ads->ds_txstatus0 = ads->ds_txstatus1 = 0;
  59. ads->ds_txstatus2 = ads->ds_txstatus3 = 0;
  60. ads->ds_txstatus4 = ads->ds_txstatus5 = 0;
  61. ads->ds_txstatus6 = ads->ds_txstatus7 = 0;
  62. ads->ds_txstatus8 = ads->ds_txstatus9 = 0;
  63. }
  64. EXPORT_SYMBOL(ath9k_hw_cleartxdesc);
  65. u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q)
  66. {
  67. u32 npend;
  68. npend = REG_READ(ah, AR_QSTS(q)) & AR_Q_STS_PEND_FR_CNT;
  69. if (npend == 0) {
  70. if (REG_READ(ah, AR_Q_TXE) & (1 << q))
  71. npend = 1;
  72. }
  73. return npend;
  74. }
  75. EXPORT_SYMBOL(ath9k_hw_numtxpending);
  76. /**
  77. * ath9k_hw_updatetxtriglevel - adjusts the frame trigger level
  78. *
  79. * @ah: atheros hardware struct
  80. * @bIncTrigLevel: whether or not the frame trigger level should be updated
  81. *
  82. * The frame trigger level specifies the minimum number of bytes,
  83. * in units of 64 bytes, that must be DMA'ed into the PCU TX FIFO
  84. * before the PCU will initiate sending the frame on the air. This can
  85. * mean we initiate transmit before a full frame is on the PCU TX FIFO.
  86. * Resets to 0x1 (meaning 64 bytes or a full frame, whichever occurs
  87. * first)
  88. *
  89. * Caution must be taken to ensure to set the frame trigger level based
  90. * on the DMA request size. For example if the DMA request size is set to
  91. * 128 bytes the trigger level cannot exceed 6 * 64 = 384. This is because
  92. * there need to be enough space in the tx FIFO for the requested transfer
  93. * size. Hence the tx FIFO will stop with 512 - 128 = 384 bytes. If we set
  94. * the threshold to a value beyond 6, then the transmit will hang.
  95. *
  96. * Current dual stream devices have a PCU TX FIFO size of 8 KB.
  97. * Current single stream devices have a PCU TX FIFO size of 4 KB, however,
  98. * there is a hardware issue which forces us to use 2 KB instead so the
  99. * frame trigger level must not exceed 2 KB for these chipsets.
  100. */
  101. bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel)
  102. {
  103. u32 txcfg, curLevel, newLevel;
  104. if (ah->tx_trig_level >= ah->config.max_txtrig_level)
  105. return false;
  106. ath9k_hw_disable_interrupts(ah);
  107. txcfg = REG_READ(ah, AR_TXCFG);
  108. curLevel = MS(txcfg, AR_FTRIG);
  109. newLevel = curLevel;
  110. if (bIncTrigLevel) {
  111. if (curLevel < ah->config.max_txtrig_level)
  112. newLevel++;
  113. } else if (curLevel > MIN_TX_FIFO_THRESHOLD)
  114. newLevel--;
  115. if (newLevel != curLevel)
  116. REG_WRITE(ah, AR_TXCFG,
  117. (txcfg & ~AR_FTRIG) | SM(newLevel, AR_FTRIG));
  118. ath9k_hw_enable_interrupts(ah);
  119. ah->tx_trig_level = newLevel;
  120. return newLevel != curLevel;
  121. }
  122. EXPORT_SYMBOL(ath9k_hw_updatetxtriglevel);
  123. void ath9k_hw_abort_tx_dma(struct ath_hw *ah)
  124. {
  125. int i, q;
  126. REG_WRITE(ah, AR_Q_TXD, AR_Q_TXD_M);
  127. REG_SET_BIT(ah, AR_PCU_MISC, AR_PCU_FORCE_QUIET_COLL | AR_PCU_CLEAR_VMF);
  128. REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_CH_IDLE_HIGH);
  129. REG_SET_BIT(ah, AR_D_GBL_IFS_MISC, AR_D_GBL_IFS_MISC_IGNORE_BACKOFF);
  130. for (q = 0; q < AR_NUM_QCU; q++) {
  131. for (i = 0; i < 1000; i++) {
  132. if (i)
  133. udelay(5);
  134. if (!ath9k_hw_numtxpending(ah, q))
  135. break;
  136. }
  137. }
  138. REG_CLR_BIT(ah, AR_PCU_MISC, AR_PCU_FORCE_QUIET_COLL | AR_PCU_CLEAR_VMF);
  139. REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_CH_IDLE_HIGH);
  140. REG_CLR_BIT(ah, AR_D_GBL_IFS_MISC, AR_D_GBL_IFS_MISC_IGNORE_BACKOFF);
  141. REG_WRITE(ah, AR_Q_TXD, 0);
  142. }
  143. EXPORT_SYMBOL(ath9k_hw_abort_tx_dma);
  144. bool ath9k_hw_stop_dma_queue(struct ath_hw *ah, u32 q)
  145. {
  146. #define ATH9K_TX_STOP_DMA_TIMEOUT 1000 /* usec */
  147. #define ATH9K_TIME_QUANTUM 100 /* usec */
  148. int wait_time = ATH9K_TX_STOP_DMA_TIMEOUT / ATH9K_TIME_QUANTUM;
  149. int wait;
  150. REG_WRITE(ah, AR_Q_TXD, 1 << q);
  151. for (wait = wait_time; wait != 0; wait--) {
  152. if (wait != wait_time)
  153. udelay(ATH9K_TIME_QUANTUM);
  154. if (ath9k_hw_numtxpending(ah, q) == 0)
  155. break;
  156. }
  157. REG_WRITE(ah, AR_Q_TXD, 0);
  158. return wait != 0;
  159. #undef ATH9K_TX_STOP_DMA_TIMEOUT
  160. #undef ATH9K_TIME_QUANTUM
  161. }
  162. EXPORT_SYMBOL(ath9k_hw_stop_dma_queue);
  163. void ath9k_hw_gettxintrtxqs(struct ath_hw *ah, u32 *txqs)
  164. {
  165. *txqs &= ah->intr_txqs;
  166. ah->intr_txqs &= ~(*txqs);
  167. }
  168. EXPORT_SYMBOL(ath9k_hw_gettxintrtxqs);
  169. bool ath9k_hw_set_txq_props(struct ath_hw *ah, int q,
  170. const struct ath9k_tx_queue_info *qinfo)
  171. {
  172. u32 cw;
  173. struct ath_common *common = ath9k_hw_common(ah);
  174. struct ath9k_hw_capabilities *pCap = &ah->caps;
  175. struct ath9k_tx_queue_info *qi;
  176. if (q >= pCap->total_queues) {
  177. ath_dbg(common, ATH_DBG_QUEUE,
  178. "Set TXQ properties, invalid queue: %u\n", q);
  179. return false;
  180. }
  181. qi = &ah->txq[q];
  182. if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) {
  183. ath_dbg(common, ATH_DBG_QUEUE,
  184. "Set TXQ properties, inactive queue: %u\n", q);
  185. return false;
  186. }
  187. ath_dbg(common, ATH_DBG_QUEUE, "Set queue properties for: %u\n", q);
  188. qi->tqi_ver = qinfo->tqi_ver;
  189. qi->tqi_subtype = qinfo->tqi_subtype;
  190. qi->tqi_qflags = qinfo->tqi_qflags;
  191. qi->tqi_priority = qinfo->tqi_priority;
  192. if (qinfo->tqi_aifs != ATH9K_TXQ_USEDEFAULT)
  193. qi->tqi_aifs = min(qinfo->tqi_aifs, 255U);
  194. else
  195. qi->tqi_aifs = INIT_AIFS;
  196. if (qinfo->tqi_cwmin != ATH9K_TXQ_USEDEFAULT) {
  197. cw = min(qinfo->tqi_cwmin, 1024U);
  198. qi->tqi_cwmin = 1;
  199. while (qi->tqi_cwmin < cw)
  200. qi->tqi_cwmin = (qi->tqi_cwmin << 1) | 1;
  201. } else
  202. qi->tqi_cwmin = qinfo->tqi_cwmin;
  203. if (qinfo->tqi_cwmax != ATH9K_TXQ_USEDEFAULT) {
  204. cw = min(qinfo->tqi_cwmax, 1024U);
  205. qi->tqi_cwmax = 1;
  206. while (qi->tqi_cwmax < cw)
  207. qi->tqi_cwmax = (qi->tqi_cwmax << 1) | 1;
  208. } else
  209. qi->tqi_cwmax = INIT_CWMAX;
  210. if (qinfo->tqi_shretry != 0)
  211. qi->tqi_shretry = min((u32) qinfo->tqi_shretry, 15U);
  212. else
  213. qi->tqi_shretry = INIT_SH_RETRY;
  214. if (qinfo->tqi_lgretry != 0)
  215. qi->tqi_lgretry = min((u32) qinfo->tqi_lgretry, 15U);
  216. else
  217. qi->tqi_lgretry = INIT_LG_RETRY;
  218. qi->tqi_cbrPeriod = qinfo->tqi_cbrPeriod;
  219. qi->tqi_cbrOverflowLimit = qinfo->tqi_cbrOverflowLimit;
  220. qi->tqi_burstTime = qinfo->tqi_burstTime;
  221. qi->tqi_readyTime = qinfo->tqi_readyTime;
  222. switch (qinfo->tqi_subtype) {
  223. case ATH9K_WME_UPSD:
  224. if (qi->tqi_type == ATH9K_TX_QUEUE_DATA)
  225. qi->tqi_intFlags = ATH9K_TXQ_USE_LOCKOUT_BKOFF_DIS;
  226. break;
  227. default:
  228. break;
  229. }
  230. return true;
  231. }
  232. EXPORT_SYMBOL(ath9k_hw_set_txq_props);
  233. bool ath9k_hw_get_txq_props(struct ath_hw *ah, int q,
  234. struct ath9k_tx_queue_info *qinfo)
  235. {
  236. struct ath_common *common = ath9k_hw_common(ah);
  237. struct ath9k_hw_capabilities *pCap = &ah->caps;
  238. struct ath9k_tx_queue_info *qi;
  239. if (q >= pCap->total_queues) {
  240. ath_dbg(common, ATH_DBG_QUEUE,
  241. "Get TXQ properties, invalid queue: %u\n", q);
  242. return false;
  243. }
  244. qi = &ah->txq[q];
  245. if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) {
  246. ath_dbg(common, ATH_DBG_QUEUE,
  247. "Get TXQ properties, inactive queue: %u\n", q);
  248. return false;
  249. }
  250. qinfo->tqi_qflags = qi->tqi_qflags;
  251. qinfo->tqi_ver = qi->tqi_ver;
  252. qinfo->tqi_subtype = qi->tqi_subtype;
  253. qinfo->tqi_qflags = qi->tqi_qflags;
  254. qinfo->tqi_priority = qi->tqi_priority;
  255. qinfo->tqi_aifs = qi->tqi_aifs;
  256. qinfo->tqi_cwmin = qi->tqi_cwmin;
  257. qinfo->tqi_cwmax = qi->tqi_cwmax;
  258. qinfo->tqi_shretry = qi->tqi_shretry;
  259. qinfo->tqi_lgretry = qi->tqi_lgretry;
  260. qinfo->tqi_cbrPeriod = qi->tqi_cbrPeriod;
  261. qinfo->tqi_cbrOverflowLimit = qi->tqi_cbrOverflowLimit;
  262. qinfo->tqi_burstTime = qi->tqi_burstTime;
  263. qinfo->tqi_readyTime = qi->tqi_readyTime;
  264. return true;
  265. }
  266. EXPORT_SYMBOL(ath9k_hw_get_txq_props);
  267. int ath9k_hw_setuptxqueue(struct ath_hw *ah, enum ath9k_tx_queue type,
  268. const struct ath9k_tx_queue_info *qinfo)
  269. {
  270. struct ath_common *common = ath9k_hw_common(ah);
  271. struct ath9k_tx_queue_info *qi;
  272. struct ath9k_hw_capabilities *pCap = &ah->caps;
  273. int q;
  274. switch (type) {
  275. case ATH9K_TX_QUEUE_BEACON:
  276. q = pCap->total_queues - 1;
  277. break;
  278. case ATH9K_TX_QUEUE_CAB:
  279. q = pCap->total_queues - 2;
  280. break;
  281. case ATH9K_TX_QUEUE_PSPOLL:
  282. q = 1;
  283. break;
  284. case ATH9K_TX_QUEUE_UAPSD:
  285. q = pCap->total_queues - 3;
  286. break;
  287. case ATH9K_TX_QUEUE_DATA:
  288. for (q = 0; q < pCap->total_queues; q++)
  289. if (ah->txq[q].tqi_type ==
  290. ATH9K_TX_QUEUE_INACTIVE)
  291. break;
  292. if (q == pCap->total_queues) {
  293. ath_err(common, "No available TX queue\n");
  294. return -1;
  295. }
  296. break;
  297. default:
  298. ath_err(common, "Invalid TX queue type: %u\n", type);
  299. return -1;
  300. }
  301. ath_dbg(common, ATH_DBG_QUEUE, "Setup TX queue: %u\n", q);
  302. qi = &ah->txq[q];
  303. if (qi->tqi_type != ATH9K_TX_QUEUE_INACTIVE) {
  304. ath_err(common, "TX queue: %u already active\n", q);
  305. return -1;
  306. }
  307. memset(qi, 0, sizeof(struct ath9k_tx_queue_info));
  308. qi->tqi_type = type;
  309. if (qinfo == NULL) {
  310. qi->tqi_qflags =
  311. TXQ_FLAG_TXOKINT_ENABLE
  312. | TXQ_FLAG_TXERRINT_ENABLE
  313. | TXQ_FLAG_TXDESCINT_ENABLE | TXQ_FLAG_TXURNINT_ENABLE;
  314. qi->tqi_aifs = INIT_AIFS;
  315. qi->tqi_cwmin = ATH9K_TXQ_USEDEFAULT;
  316. qi->tqi_cwmax = INIT_CWMAX;
  317. qi->tqi_shretry = INIT_SH_RETRY;
  318. qi->tqi_lgretry = INIT_LG_RETRY;
  319. qi->tqi_physCompBuf = 0;
  320. } else {
  321. qi->tqi_physCompBuf = qinfo->tqi_physCompBuf;
  322. (void) ath9k_hw_set_txq_props(ah, q, qinfo);
  323. }
  324. return q;
  325. }
  326. EXPORT_SYMBOL(ath9k_hw_setuptxqueue);
  327. bool ath9k_hw_releasetxqueue(struct ath_hw *ah, u32 q)
  328. {
  329. struct ath9k_hw_capabilities *pCap = &ah->caps;
  330. struct ath_common *common = ath9k_hw_common(ah);
  331. struct ath9k_tx_queue_info *qi;
  332. if (q >= pCap->total_queues) {
  333. ath_dbg(common, ATH_DBG_QUEUE,
  334. "Release TXQ, invalid queue: %u\n", q);
  335. return false;
  336. }
  337. qi = &ah->txq[q];
  338. if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) {
  339. ath_dbg(common, ATH_DBG_QUEUE,
  340. "Release TXQ, inactive queue: %u\n", q);
  341. return false;
  342. }
  343. ath_dbg(common, ATH_DBG_QUEUE, "Release TX queue: %u\n", q);
  344. qi->tqi_type = ATH9K_TX_QUEUE_INACTIVE;
  345. ah->txok_interrupt_mask &= ~(1 << q);
  346. ah->txerr_interrupt_mask &= ~(1 << q);
  347. ah->txdesc_interrupt_mask &= ~(1 << q);
  348. ah->txeol_interrupt_mask &= ~(1 << q);
  349. ah->txurn_interrupt_mask &= ~(1 << q);
  350. ath9k_hw_set_txq_interrupts(ah, qi);
  351. return true;
  352. }
  353. EXPORT_SYMBOL(ath9k_hw_releasetxqueue);
  354. bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q)
  355. {
  356. struct ath9k_hw_capabilities *pCap = &ah->caps;
  357. struct ath_common *common = ath9k_hw_common(ah);
  358. struct ath9k_channel *chan = ah->curchan;
  359. struct ath9k_tx_queue_info *qi;
  360. u32 cwMin, chanCwMin, value;
  361. if (q >= pCap->total_queues) {
  362. ath_dbg(common, ATH_DBG_QUEUE,
  363. "Reset TXQ, invalid queue: %u\n", q);
  364. return false;
  365. }
  366. qi = &ah->txq[q];
  367. if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) {
  368. ath_dbg(common, ATH_DBG_QUEUE,
  369. "Reset TXQ, inactive queue: %u\n", q);
  370. return true;
  371. }
  372. ath_dbg(common, ATH_DBG_QUEUE, "Reset TX queue: %u\n", q);
  373. if (qi->tqi_cwmin == ATH9K_TXQ_USEDEFAULT) {
  374. if (chan && IS_CHAN_B(chan))
  375. chanCwMin = INIT_CWMIN_11B;
  376. else
  377. chanCwMin = INIT_CWMIN;
  378. for (cwMin = 1; cwMin < chanCwMin; cwMin = (cwMin << 1) | 1);
  379. } else
  380. cwMin = qi->tqi_cwmin;
  381. ENABLE_REGWRITE_BUFFER(ah);
  382. REG_WRITE(ah, AR_DLCL_IFS(q),
  383. SM(cwMin, AR_D_LCL_IFS_CWMIN) |
  384. SM(qi->tqi_cwmax, AR_D_LCL_IFS_CWMAX) |
  385. SM(qi->tqi_aifs, AR_D_LCL_IFS_AIFS));
  386. REG_WRITE(ah, AR_DRETRY_LIMIT(q),
  387. SM(INIT_SSH_RETRY, AR_D_RETRY_LIMIT_STA_SH) |
  388. SM(INIT_SLG_RETRY, AR_D_RETRY_LIMIT_STA_LG) |
  389. SM(qi->tqi_shretry, AR_D_RETRY_LIMIT_FR_SH));
  390. REG_WRITE(ah, AR_QMISC(q), AR_Q_MISC_DCU_EARLY_TERM_REQ);
  391. REG_WRITE(ah, AR_DMISC(q),
  392. AR_D_MISC_CW_BKOFF_EN | AR_D_MISC_FRAG_WAIT_EN | 0x2);
  393. if (qi->tqi_cbrPeriod) {
  394. REG_WRITE(ah, AR_QCBRCFG(q),
  395. SM(qi->tqi_cbrPeriod, AR_Q_CBRCFG_INTERVAL) |
  396. SM(qi->tqi_cbrOverflowLimit, AR_Q_CBRCFG_OVF_THRESH));
  397. REG_WRITE(ah, AR_QMISC(q),
  398. REG_READ(ah, AR_QMISC(q)) | AR_Q_MISC_FSP_CBR |
  399. (qi->tqi_cbrOverflowLimit ?
  400. AR_Q_MISC_CBR_EXP_CNTR_LIMIT_EN : 0));
  401. }
  402. if (qi->tqi_readyTime && (qi->tqi_type != ATH9K_TX_QUEUE_CAB)) {
  403. REG_WRITE(ah, AR_QRDYTIMECFG(q),
  404. SM(qi->tqi_readyTime, AR_Q_RDYTIMECFG_DURATION) |
  405. AR_Q_RDYTIMECFG_EN);
  406. }
  407. REG_WRITE(ah, AR_DCHNTIME(q),
  408. SM(qi->tqi_burstTime, AR_D_CHNTIME_DUR) |
  409. (qi->tqi_burstTime ? AR_D_CHNTIME_EN : 0));
  410. if (qi->tqi_burstTime
  411. && (qi->tqi_qflags & TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE)) {
  412. REG_WRITE(ah, AR_QMISC(q),
  413. REG_READ(ah, AR_QMISC(q)) |
  414. AR_Q_MISC_RDYTIME_EXP_POLICY);
  415. }
  416. if (qi->tqi_qflags & TXQ_FLAG_BACKOFF_DISABLE) {
  417. REG_WRITE(ah, AR_DMISC(q),
  418. REG_READ(ah, AR_DMISC(q)) |
  419. AR_D_MISC_POST_FR_BKOFF_DIS);
  420. }
  421. REGWRITE_BUFFER_FLUSH(ah);
  422. if (qi->tqi_qflags & TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE) {
  423. REG_WRITE(ah, AR_DMISC(q),
  424. REG_READ(ah, AR_DMISC(q)) |
  425. AR_D_MISC_FRAG_BKOFF_EN);
  426. }
  427. switch (qi->tqi_type) {
  428. case ATH9K_TX_QUEUE_BEACON:
  429. ENABLE_REGWRITE_BUFFER(ah);
  430. REG_WRITE(ah, AR_QMISC(q), REG_READ(ah, AR_QMISC(q))
  431. | AR_Q_MISC_FSP_DBA_GATED
  432. | AR_Q_MISC_BEACON_USE
  433. | AR_Q_MISC_CBR_INCR_DIS1);
  434. REG_WRITE(ah, AR_DMISC(q), REG_READ(ah, AR_DMISC(q))
  435. | (AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL <<
  436. AR_D_MISC_ARB_LOCKOUT_CNTRL_S)
  437. | AR_D_MISC_BEACON_USE
  438. | AR_D_MISC_POST_FR_BKOFF_DIS);
  439. REGWRITE_BUFFER_FLUSH(ah);
  440. /*
  441. * cwmin and cwmax should be 0 for beacon queue
  442. * but not for IBSS as we would create an imbalance
  443. * on beaconing fairness for participating nodes.
  444. */
  445. if (AR_SREV_9300_20_OR_LATER(ah) &&
  446. ah->opmode != NL80211_IFTYPE_ADHOC) {
  447. REG_WRITE(ah, AR_DLCL_IFS(q), SM(0, AR_D_LCL_IFS_CWMIN)
  448. | SM(0, AR_D_LCL_IFS_CWMAX)
  449. | SM(qi->tqi_aifs, AR_D_LCL_IFS_AIFS));
  450. }
  451. break;
  452. case ATH9K_TX_QUEUE_CAB:
  453. ENABLE_REGWRITE_BUFFER(ah);
  454. REG_WRITE(ah, AR_QMISC(q), REG_READ(ah, AR_QMISC(q))
  455. | AR_Q_MISC_FSP_DBA_GATED
  456. | AR_Q_MISC_CBR_INCR_DIS1
  457. | AR_Q_MISC_CBR_INCR_DIS0);
  458. value = (qi->tqi_readyTime -
  459. (ah->config.sw_beacon_response_time -
  460. ah->config.dma_beacon_response_time) -
  461. ah->config.additional_swba_backoff) * 1024;
  462. REG_WRITE(ah, AR_QRDYTIMECFG(q),
  463. value | AR_Q_RDYTIMECFG_EN);
  464. REG_WRITE(ah, AR_DMISC(q), REG_READ(ah, AR_DMISC(q))
  465. | (AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL <<
  466. AR_D_MISC_ARB_LOCKOUT_CNTRL_S));
  467. REGWRITE_BUFFER_FLUSH(ah);
  468. break;
  469. case ATH9K_TX_QUEUE_PSPOLL:
  470. REG_WRITE(ah, AR_QMISC(q),
  471. REG_READ(ah, AR_QMISC(q)) | AR_Q_MISC_CBR_INCR_DIS1);
  472. break;
  473. case ATH9K_TX_QUEUE_UAPSD:
  474. REG_WRITE(ah, AR_DMISC(q), REG_READ(ah, AR_DMISC(q)) |
  475. AR_D_MISC_POST_FR_BKOFF_DIS);
  476. break;
  477. default:
  478. break;
  479. }
  480. if (qi->tqi_intFlags & ATH9K_TXQ_USE_LOCKOUT_BKOFF_DIS) {
  481. REG_WRITE(ah, AR_DMISC(q),
  482. REG_READ(ah, AR_DMISC(q)) |
  483. SM(AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL,
  484. AR_D_MISC_ARB_LOCKOUT_CNTRL) |
  485. AR_D_MISC_POST_FR_BKOFF_DIS);
  486. }
  487. if (AR_SREV_9300_20_OR_LATER(ah))
  488. REG_WRITE(ah, AR_Q_DESC_CRCCHK, AR_Q_DESC_CRCCHK_EN);
  489. if (qi->tqi_qflags & TXQ_FLAG_TXOKINT_ENABLE)
  490. ah->txok_interrupt_mask |= 1 << q;
  491. else
  492. ah->txok_interrupt_mask &= ~(1 << q);
  493. if (qi->tqi_qflags & TXQ_FLAG_TXERRINT_ENABLE)
  494. ah->txerr_interrupt_mask |= 1 << q;
  495. else
  496. ah->txerr_interrupt_mask &= ~(1 << q);
  497. if (qi->tqi_qflags & TXQ_FLAG_TXDESCINT_ENABLE)
  498. ah->txdesc_interrupt_mask |= 1 << q;
  499. else
  500. ah->txdesc_interrupt_mask &= ~(1 << q);
  501. if (qi->tqi_qflags & TXQ_FLAG_TXEOLINT_ENABLE)
  502. ah->txeol_interrupt_mask |= 1 << q;
  503. else
  504. ah->txeol_interrupt_mask &= ~(1 << q);
  505. if (qi->tqi_qflags & TXQ_FLAG_TXURNINT_ENABLE)
  506. ah->txurn_interrupt_mask |= 1 << q;
  507. else
  508. ah->txurn_interrupt_mask &= ~(1 << q);
  509. ath9k_hw_set_txq_interrupts(ah, qi);
  510. return true;
  511. }
  512. EXPORT_SYMBOL(ath9k_hw_resettxqueue);
  513. int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
  514. struct ath_rx_status *rs, u64 tsf)
  515. {
  516. struct ar5416_desc ads;
  517. struct ar5416_desc *adsp = AR5416DESC(ds);
  518. u32 phyerr;
  519. if ((adsp->ds_rxstatus8 & AR_RxDone) == 0)
  520. return -EINPROGRESS;
  521. ads.u.rx = adsp->u.rx;
  522. rs->rs_status = 0;
  523. rs->rs_flags = 0;
  524. rs->rs_datalen = ads.ds_rxstatus1 & AR_DataLen;
  525. rs->rs_tstamp = ads.AR_RcvTimestamp;
  526. if (ads.ds_rxstatus8 & AR_PostDelimCRCErr) {
  527. rs->rs_rssi = ATH9K_RSSI_BAD;
  528. rs->rs_rssi_ctl0 = ATH9K_RSSI_BAD;
  529. rs->rs_rssi_ctl1 = ATH9K_RSSI_BAD;
  530. rs->rs_rssi_ctl2 = ATH9K_RSSI_BAD;
  531. rs->rs_rssi_ext0 = ATH9K_RSSI_BAD;
  532. rs->rs_rssi_ext1 = ATH9K_RSSI_BAD;
  533. rs->rs_rssi_ext2 = ATH9K_RSSI_BAD;
  534. } else {
  535. rs->rs_rssi = MS(ads.ds_rxstatus4, AR_RxRSSICombined);
  536. rs->rs_rssi_ctl0 = MS(ads.ds_rxstatus0,
  537. AR_RxRSSIAnt00);
  538. rs->rs_rssi_ctl1 = MS(ads.ds_rxstatus0,
  539. AR_RxRSSIAnt01);
  540. rs->rs_rssi_ctl2 = MS(ads.ds_rxstatus0,
  541. AR_RxRSSIAnt02);
  542. rs->rs_rssi_ext0 = MS(ads.ds_rxstatus4,
  543. AR_RxRSSIAnt10);
  544. rs->rs_rssi_ext1 = MS(ads.ds_rxstatus4,
  545. AR_RxRSSIAnt11);
  546. rs->rs_rssi_ext2 = MS(ads.ds_rxstatus4,
  547. AR_RxRSSIAnt12);
  548. }
  549. if (ads.ds_rxstatus8 & AR_RxKeyIdxValid)
  550. rs->rs_keyix = MS(ads.ds_rxstatus8, AR_KeyIdx);
  551. else
  552. rs->rs_keyix = ATH9K_RXKEYIX_INVALID;
  553. rs->rs_rate = RXSTATUS_RATE(ah, (&ads));
  554. rs->rs_more = (ads.ds_rxstatus1 & AR_RxMore) ? 1 : 0;
  555. rs->rs_isaggr = (ads.ds_rxstatus8 & AR_RxAggr) ? 1 : 0;
  556. rs->rs_moreaggr =
  557. (ads.ds_rxstatus8 & AR_RxMoreAggr) ? 1 : 0;
  558. rs->rs_antenna = MS(ads.ds_rxstatus3, AR_RxAntenna);
  559. rs->rs_flags =
  560. (ads.ds_rxstatus3 & AR_GI) ? ATH9K_RX_GI : 0;
  561. rs->rs_flags |=
  562. (ads.ds_rxstatus3 & AR_2040) ? ATH9K_RX_2040 : 0;
  563. if (ads.ds_rxstatus8 & AR_PreDelimCRCErr)
  564. rs->rs_flags |= ATH9K_RX_DELIM_CRC_PRE;
  565. if (ads.ds_rxstatus8 & AR_PostDelimCRCErr)
  566. rs->rs_flags |= ATH9K_RX_DELIM_CRC_POST;
  567. if (ads.ds_rxstatus8 & AR_DecryptBusyErr)
  568. rs->rs_flags |= ATH9K_RX_DECRYPT_BUSY;
  569. if ((ads.ds_rxstatus8 & AR_RxFrameOK) == 0) {
  570. /*
  571. * Treat these errors as mutually exclusive to avoid spurious
  572. * extra error reports from the hardware. If a CRC error is
  573. * reported, then decryption and MIC errors are irrelevant,
  574. * the frame is going to be dropped either way
  575. */
  576. if (ads.ds_rxstatus8 & AR_CRCErr)
  577. rs->rs_status |= ATH9K_RXERR_CRC;
  578. else if (ads.ds_rxstatus8 & AR_PHYErr) {
  579. rs->rs_status |= ATH9K_RXERR_PHY;
  580. phyerr = MS(ads.ds_rxstatus8, AR_PHYErrCode);
  581. rs->rs_phyerr = phyerr;
  582. } else if (ads.ds_rxstatus8 & AR_DecryptCRCErr)
  583. rs->rs_status |= ATH9K_RXERR_DECRYPT;
  584. else if (ads.ds_rxstatus8 & AR_MichaelErr)
  585. rs->rs_status |= ATH9K_RXERR_MIC;
  586. if (ads.ds_rxstatus8 & AR_KeyMiss)
  587. rs->rs_status |= ATH9K_RXERR_DECRYPT;
  588. }
  589. return 0;
  590. }
  591. EXPORT_SYMBOL(ath9k_hw_rxprocdesc);
  592. /*
  593. * This can stop or re-enables RX.
  594. *
  595. * If bool is set this will kill any frame which is currently being
  596. * transferred between the MAC and baseband and also prevent any new
  597. * frames from getting started.
  598. */
  599. bool ath9k_hw_setrxabort(struct ath_hw *ah, bool set)
  600. {
  601. u32 reg;
  602. if (set) {
  603. REG_SET_BIT(ah, AR_DIAG_SW,
  604. (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
  605. if (!ath9k_hw_wait(ah, AR_OBS_BUS_1, AR_OBS_BUS_1_RX_STATE,
  606. 0, AH_WAIT_TIMEOUT)) {
  607. REG_CLR_BIT(ah, AR_DIAG_SW,
  608. (AR_DIAG_RX_DIS |
  609. AR_DIAG_RX_ABORT));
  610. reg = REG_READ(ah, AR_OBS_BUS_1);
  611. ath_err(ath9k_hw_common(ah),
  612. "RX failed to go idle in 10 ms RXSM=0x%x\n",
  613. reg);
  614. return false;
  615. }
  616. } else {
  617. REG_CLR_BIT(ah, AR_DIAG_SW,
  618. (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
  619. }
  620. return true;
  621. }
  622. EXPORT_SYMBOL(ath9k_hw_setrxabort);
  623. void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp)
  624. {
  625. REG_WRITE(ah, AR_RXDP, rxdp);
  626. }
  627. EXPORT_SYMBOL(ath9k_hw_putrxbuf);
  628. void ath9k_hw_startpcureceive(struct ath_hw *ah, bool is_scanning)
  629. {
  630. ath9k_enable_mib_counters(ah);
  631. ath9k_ani_reset(ah, is_scanning);
  632. REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
  633. }
  634. EXPORT_SYMBOL(ath9k_hw_startpcureceive);
  635. void ath9k_hw_abortpcurecv(struct ath_hw *ah)
  636. {
  637. REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_ABORT | AR_DIAG_RX_DIS);
  638. ath9k_hw_disable_mib_counters(ah);
  639. }
  640. EXPORT_SYMBOL(ath9k_hw_abortpcurecv);
  641. bool ath9k_hw_stopdmarecv(struct ath_hw *ah)
  642. {
  643. #define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */
  644. #define AH_RX_TIME_QUANTUM 100 /* usec */
  645. struct ath_common *common = ath9k_hw_common(ah);
  646. int i;
  647. REG_WRITE(ah, AR_CR, AR_CR_RXD);
  648. /* Wait for rx enable bit to go low */
  649. for (i = AH_RX_STOP_DMA_TIMEOUT / AH_TIME_QUANTUM; i != 0; i--) {
  650. if ((REG_READ(ah, AR_CR) & AR_CR_RXE) == 0)
  651. break;
  652. udelay(AH_TIME_QUANTUM);
  653. }
  654. if (i == 0) {
  655. ath_err(common,
  656. "DMA failed to stop in %d ms AR_CR=0x%08x AR_DIAG_SW=0x%08x\n",
  657. AH_RX_STOP_DMA_TIMEOUT / 1000,
  658. REG_READ(ah, AR_CR),
  659. REG_READ(ah, AR_DIAG_SW));
  660. return false;
  661. } else {
  662. return true;
  663. }
  664. #undef AH_RX_TIME_QUANTUM
  665. #undef AH_RX_STOP_DMA_TIMEOUT
  666. }
  667. EXPORT_SYMBOL(ath9k_hw_stopdmarecv);
  668. int ath9k_hw_beaconq_setup(struct ath_hw *ah)
  669. {
  670. struct ath9k_tx_queue_info qi;
  671. memset(&qi, 0, sizeof(qi));
  672. qi.tqi_aifs = 1;
  673. qi.tqi_cwmin = 0;
  674. qi.tqi_cwmax = 0;
  675. /* NB: don't enable any interrupts */
  676. return ath9k_hw_setuptxqueue(ah, ATH9K_TX_QUEUE_BEACON, &qi);
  677. }
  678. EXPORT_SYMBOL(ath9k_hw_beaconq_setup);
  679. bool ath9k_hw_intrpend(struct ath_hw *ah)
  680. {
  681. u32 host_isr;
  682. if (AR_SREV_9100(ah))
  683. return true;
  684. host_isr = REG_READ(ah, AR_INTR_ASYNC_CAUSE);
  685. if ((host_isr & AR_INTR_MAC_IRQ) && (host_isr != AR_INTR_SPURIOUS))
  686. return true;
  687. host_isr = REG_READ(ah, AR_INTR_SYNC_CAUSE);
  688. if ((host_isr & AR_INTR_SYNC_DEFAULT)
  689. && (host_isr != AR_INTR_SPURIOUS))
  690. return true;
  691. return false;
  692. }
  693. EXPORT_SYMBOL(ath9k_hw_intrpend);
  694. void ath9k_hw_disable_interrupts(struct ath_hw *ah)
  695. {
  696. struct ath_common *common = ath9k_hw_common(ah);
  697. ath_dbg(common, ATH_DBG_INTERRUPT, "disable IER\n");
  698. REG_WRITE(ah, AR_IER, AR_IER_DISABLE);
  699. (void) REG_READ(ah, AR_IER);
  700. if (!AR_SREV_9100(ah)) {
  701. REG_WRITE(ah, AR_INTR_ASYNC_ENABLE, 0);
  702. (void) REG_READ(ah, AR_INTR_ASYNC_ENABLE);
  703. REG_WRITE(ah, AR_INTR_SYNC_ENABLE, 0);
  704. (void) REG_READ(ah, AR_INTR_SYNC_ENABLE);
  705. }
  706. }
  707. EXPORT_SYMBOL(ath9k_hw_disable_interrupts);
  708. void ath9k_hw_enable_interrupts(struct ath_hw *ah)
  709. {
  710. struct ath_common *common = ath9k_hw_common(ah);
  711. if (!(ah->imask & ATH9K_INT_GLOBAL))
  712. return;
  713. ath_dbg(common, ATH_DBG_INTERRUPT, "enable IER\n");
  714. REG_WRITE(ah, AR_IER, AR_IER_ENABLE);
  715. if (!AR_SREV_9100(ah)) {
  716. REG_WRITE(ah, AR_INTR_ASYNC_ENABLE,
  717. AR_INTR_MAC_IRQ);
  718. REG_WRITE(ah, AR_INTR_ASYNC_MASK, AR_INTR_MAC_IRQ);
  719. REG_WRITE(ah, AR_INTR_SYNC_ENABLE,
  720. AR_INTR_SYNC_DEFAULT);
  721. REG_WRITE(ah, AR_INTR_SYNC_MASK,
  722. AR_INTR_SYNC_DEFAULT);
  723. }
  724. ath_dbg(common, ATH_DBG_INTERRUPT, "AR_IMR 0x%x IER 0x%x\n",
  725. REG_READ(ah, AR_IMR), REG_READ(ah, AR_IER));
  726. }
  727. EXPORT_SYMBOL(ath9k_hw_enable_interrupts);
  728. void ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints)
  729. {
  730. enum ath9k_int omask = ah->imask;
  731. u32 mask, mask2;
  732. struct ath9k_hw_capabilities *pCap = &ah->caps;
  733. struct ath_common *common = ath9k_hw_common(ah);
  734. if (!(ints & ATH9K_INT_GLOBAL))
  735. ath9k_hw_disable_interrupts(ah);
  736. ath_dbg(common, ATH_DBG_INTERRUPT, "0x%x => 0x%x\n", omask, ints);
  737. /* TODO: global int Ref count */
  738. mask = ints & ATH9K_INT_COMMON;
  739. mask2 = 0;
  740. if (ints & ATH9K_INT_TX) {
  741. if (ah->config.tx_intr_mitigation)
  742. mask |= AR_IMR_TXMINTR | AR_IMR_TXINTM;
  743. else {
  744. if (ah->txok_interrupt_mask)
  745. mask |= AR_IMR_TXOK;
  746. if (ah->txdesc_interrupt_mask)
  747. mask |= AR_IMR_TXDESC;
  748. }
  749. if (ah->txerr_interrupt_mask)
  750. mask |= AR_IMR_TXERR;
  751. if (ah->txeol_interrupt_mask)
  752. mask |= AR_IMR_TXEOL;
  753. }
  754. if (ints & ATH9K_INT_RX) {
  755. if (AR_SREV_9300_20_OR_LATER(ah)) {
  756. mask |= AR_IMR_RXERR | AR_IMR_RXOK_HP;
  757. if (ah->config.rx_intr_mitigation) {
  758. mask &= ~AR_IMR_RXOK_LP;
  759. mask |= AR_IMR_RXMINTR | AR_IMR_RXINTM;
  760. } else {
  761. mask |= AR_IMR_RXOK_LP;
  762. }
  763. } else {
  764. if (ah->config.rx_intr_mitigation)
  765. mask |= AR_IMR_RXMINTR | AR_IMR_RXINTM;
  766. else
  767. mask |= AR_IMR_RXOK | AR_IMR_RXDESC;
  768. }
  769. if (!(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP))
  770. mask |= AR_IMR_GENTMR;
  771. }
  772. if (ints & (ATH9K_INT_BMISC)) {
  773. mask |= AR_IMR_BCNMISC;
  774. if (ints & ATH9K_INT_TIM)
  775. mask2 |= AR_IMR_S2_TIM;
  776. if (ints & ATH9K_INT_DTIM)
  777. mask2 |= AR_IMR_S2_DTIM;
  778. if (ints & ATH9K_INT_DTIMSYNC)
  779. mask2 |= AR_IMR_S2_DTIMSYNC;
  780. if (ints & ATH9K_INT_CABEND)
  781. mask2 |= AR_IMR_S2_CABEND;
  782. if (ints & ATH9K_INT_TSFOOR)
  783. mask2 |= AR_IMR_S2_TSFOOR;
  784. }
  785. if (ints & (ATH9K_INT_GTT | ATH9K_INT_CST)) {
  786. mask |= AR_IMR_BCNMISC;
  787. if (ints & ATH9K_INT_GTT)
  788. mask2 |= AR_IMR_S2_GTT;
  789. if (ints & ATH9K_INT_CST)
  790. mask2 |= AR_IMR_S2_CST;
  791. }
  792. ath_dbg(common, ATH_DBG_INTERRUPT, "new IMR 0x%x\n", mask);
  793. REG_WRITE(ah, AR_IMR, mask);
  794. ah->imrs2_reg &= ~(AR_IMR_S2_TIM | AR_IMR_S2_DTIM | AR_IMR_S2_DTIMSYNC |
  795. AR_IMR_S2_CABEND | AR_IMR_S2_CABTO |
  796. AR_IMR_S2_TSFOOR | AR_IMR_S2_GTT | AR_IMR_S2_CST);
  797. ah->imrs2_reg |= mask2;
  798. REG_WRITE(ah, AR_IMR_S2, ah->imrs2_reg);
  799. if (!(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) {
  800. if (ints & ATH9K_INT_TIM_TIMER)
  801. REG_SET_BIT(ah, AR_IMR_S5, AR_IMR_S5_TIM_TIMER);
  802. else
  803. REG_CLR_BIT(ah, AR_IMR_S5, AR_IMR_S5_TIM_TIMER);
  804. }
  805. if (ints & ATH9K_INT_GLOBAL)
  806. ath9k_hw_enable_interrupts(ah);
  807. return;
  808. }
  809. EXPORT_SYMBOL(ath9k_hw_set_interrupts);