htc_hif.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. /*
  2. * Copyright (c) 2007-2011 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 "core.h"
  17. #include "target.h"
  18. #include "hif-ops.h"
  19. #include "htc_hif.h"
  20. #include "debug.h"
  21. #define MAILBOX_FOR_BLOCK_SIZE 1
  22. #define ATH6KL_TIME_QUANTUM 10 /* in ms */
  23. static int ath6kldev_cp_scat_dma_buf(struct hif_scatter_req *req, bool from_dma)
  24. {
  25. u8 *buf;
  26. int i;
  27. buf = req->virt_dma_buf;
  28. for (i = 0; i < req->scat_entries; i++) {
  29. if (from_dma)
  30. memcpy(req->scat_list[i].buf, buf,
  31. req->scat_list[i].len);
  32. else
  33. memcpy(buf, req->scat_list[i].buf,
  34. req->scat_list[i].len);
  35. buf += req->scat_list[i].len;
  36. }
  37. return 0;
  38. }
  39. int ath6kldev_rw_comp_handler(void *context, int status)
  40. {
  41. struct htc_packet *packet = context;
  42. ath6kl_dbg(ATH6KL_DBG_HTC_RECV,
  43. "ath6kldev_rw_comp_handler (pkt:0x%p , status: %d\n",
  44. packet, status);
  45. packet->status = status;
  46. packet->completion(packet->context, packet);
  47. return 0;
  48. }
  49. static int ath6kldev_proc_dbg_intr(struct ath6kl_device *dev)
  50. {
  51. u32 dummy;
  52. int status;
  53. ath6kl_err("target debug interrupt\n");
  54. ath6kl_target_failure(dev->ar);
  55. /*
  56. * read counter to clear the interrupt, the debug error interrupt is
  57. * counter 0.
  58. */
  59. status = hif_read_write_sync(dev->ar, COUNT_DEC_ADDRESS,
  60. (u8 *)&dummy, 4, HIF_RD_SYNC_BYTE_INC);
  61. if (status)
  62. WARN_ON(1);
  63. return status;
  64. }
  65. /* mailbox recv message polling */
  66. int ath6kldev_poll_mboxmsg_rx(struct ath6kl_device *dev, u32 *lk_ahd,
  67. int timeout)
  68. {
  69. struct ath6kl_irq_proc_registers *rg;
  70. int status = 0, i;
  71. u8 htc_mbox = 1 << HTC_MAILBOX;
  72. for (i = timeout / ATH6KL_TIME_QUANTUM; i > 0; i--) {
  73. /* this is the standard HIF way, load the reg table */
  74. status = hif_read_write_sync(dev->ar, HOST_INT_STATUS_ADDRESS,
  75. (u8 *) &dev->irq_proc_reg,
  76. sizeof(dev->irq_proc_reg),
  77. HIF_RD_SYNC_BYTE_INC);
  78. if (status) {
  79. ath6kl_err("failed to read reg table\n");
  80. return status;
  81. }
  82. /* check for MBOX data and valid lookahead */
  83. if (dev->irq_proc_reg.host_int_status & htc_mbox) {
  84. if (dev->irq_proc_reg.rx_lkahd_valid &
  85. htc_mbox) {
  86. /*
  87. * Mailbox has a message and the look ahead
  88. * is valid.
  89. */
  90. rg = &dev->irq_proc_reg;
  91. *lk_ahd =
  92. le32_to_cpu(rg->rx_lkahd[HTC_MAILBOX]);
  93. break;
  94. }
  95. }
  96. /* delay a little */
  97. mdelay(ATH6KL_TIME_QUANTUM);
  98. ath6kl_dbg(ATH6KL_DBG_HTC_RECV, "retry mbox poll : %d\n", i);
  99. }
  100. if (i == 0) {
  101. ath6kl_err("timeout waiting for recv message\n");
  102. status = -ETIME;
  103. /* check if the target asserted */
  104. if (dev->irq_proc_reg.counter_int_status &
  105. ATH6KL_TARGET_DEBUG_INTR_MASK)
  106. /*
  107. * Target failure handler will be called in case of
  108. * an assert.
  109. */
  110. ath6kldev_proc_dbg_intr(dev);
  111. }
  112. return status;
  113. }
  114. /*
  115. * Disable packet reception (used in case the host runs out of buffers)
  116. * using the interrupt enable registers through the host I/F
  117. */
  118. int ath6kldev_rx_control(struct ath6kl_device *dev, bool enable_rx)
  119. {
  120. struct ath6kl_irq_enable_reg regs;
  121. int status = 0;
  122. /* take the lock to protect interrupt enable shadows */
  123. spin_lock_bh(&dev->lock);
  124. if (enable_rx)
  125. dev->irq_en_reg.int_status_en |=
  126. SM(INT_STATUS_ENABLE_MBOX_DATA, 0x01);
  127. else
  128. dev->irq_en_reg.int_status_en &=
  129. ~SM(INT_STATUS_ENABLE_MBOX_DATA, 0x01);
  130. memcpy(&regs, &dev->irq_en_reg, sizeof(regs));
  131. spin_unlock_bh(&dev->lock);
  132. status = hif_read_write_sync(dev->ar, INT_STATUS_ENABLE_ADDRESS,
  133. &regs.int_status_en,
  134. sizeof(struct ath6kl_irq_enable_reg),
  135. HIF_WR_SYNC_BYTE_INC);
  136. return status;
  137. }
  138. int ath6kldev_submit_scat_req(struct ath6kl_device *dev,
  139. struct hif_scatter_req *scat_req, bool read)
  140. {
  141. int status = 0;
  142. if (read) {
  143. scat_req->req = HIF_RD_SYNC_BLOCK_FIX;
  144. scat_req->addr = dev->ar->mbox_info.htc_addr;
  145. } else {
  146. scat_req->req = HIF_WR_ASYNC_BLOCK_INC;
  147. scat_req->addr =
  148. (scat_req->len > HIF_MBOX_WIDTH) ?
  149. dev->ar->mbox_info.htc_ext_addr :
  150. dev->ar->mbox_info.htc_addr;
  151. }
  152. ath6kl_dbg((ATH6KL_DBG_HTC_RECV | ATH6KL_DBG_HTC_SEND),
  153. "ath6kldev_submit_scat_req, entries: %d, total len: %d mbox:0x%X (mode: %s : %s)\n",
  154. scat_req->scat_entries, scat_req->len,
  155. scat_req->addr, !read ? "async" : "sync",
  156. (read) ? "rd" : "wr");
  157. if (!read && scat_req->virt_scat) {
  158. status = ath6kldev_cp_scat_dma_buf(scat_req, false);
  159. if (status) {
  160. scat_req->status = status;
  161. scat_req->complete(dev->ar->htc_target, scat_req);
  162. return 0;
  163. }
  164. }
  165. status = ath6kl_hif_scat_req_rw(dev->ar, scat_req);
  166. if (read) {
  167. /* in sync mode, we can touch the scatter request */
  168. scat_req->status = status;
  169. if (!status && scat_req->virt_scat)
  170. scat_req->status =
  171. ath6kldev_cp_scat_dma_buf(scat_req, true);
  172. }
  173. return status;
  174. }
  175. static int ath6kldev_proc_counter_intr(struct ath6kl_device *dev)
  176. {
  177. u8 counter_int_status;
  178. ath6kl_dbg(ATH6KL_DBG_IRQ, "counter interrupt\n");
  179. counter_int_status = dev->irq_proc_reg.counter_int_status &
  180. dev->irq_en_reg.cntr_int_status_en;
  181. ath6kl_dbg(ATH6KL_DBG_IRQ,
  182. "valid interrupt source(s) in COUNTER_INT_STATUS: 0x%x\n",
  183. counter_int_status);
  184. /*
  185. * NOTE: other modules like GMBOX may use the counter interrupt for
  186. * credit flow control on other counters, we only need to check for
  187. * the debug assertion counter interrupt.
  188. */
  189. if (counter_int_status & ATH6KL_TARGET_DEBUG_INTR_MASK)
  190. return ath6kldev_proc_dbg_intr(dev);
  191. return 0;
  192. }
  193. static int ath6kldev_proc_err_intr(struct ath6kl_device *dev)
  194. {
  195. int status;
  196. u8 error_int_status;
  197. u8 reg_buf[4];
  198. ath6kl_dbg(ATH6KL_DBG_IRQ, "error interrupt\n");
  199. error_int_status = dev->irq_proc_reg.error_int_status & 0x0F;
  200. if (!error_int_status) {
  201. WARN_ON(1);
  202. return -EIO;
  203. }
  204. ath6kl_dbg(ATH6KL_DBG_IRQ,
  205. "valid interrupt source(s) in ERROR_INT_STATUS: 0x%x\n",
  206. error_int_status);
  207. if (MS(ERROR_INT_STATUS_WAKEUP, error_int_status))
  208. ath6kl_dbg(ATH6KL_DBG_IRQ, "error : wakeup\n");
  209. if (MS(ERROR_INT_STATUS_RX_UNDERFLOW, error_int_status))
  210. ath6kl_err("rx underflow\n");
  211. if (MS(ERROR_INT_STATUS_TX_OVERFLOW, error_int_status))
  212. ath6kl_err("tx overflow\n");
  213. /* Clear the interrupt */
  214. dev->irq_proc_reg.error_int_status &= ~error_int_status;
  215. /* set W1C value to clear the interrupt, this hits the register first */
  216. reg_buf[0] = error_int_status;
  217. reg_buf[1] = 0;
  218. reg_buf[2] = 0;
  219. reg_buf[3] = 0;
  220. status = hif_read_write_sync(dev->ar, ERROR_INT_STATUS_ADDRESS,
  221. reg_buf, 4, HIF_WR_SYNC_BYTE_FIX);
  222. if (status)
  223. WARN_ON(1);
  224. return status;
  225. }
  226. static int ath6kldev_proc_cpu_intr(struct ath6kl_device *dev)
  227. {
  228. int status;
  229. u8 cpu_int_status;
  230. u8 reg_buf[4];
  231. ath6kl_dbg(ATH6KL_DBG_IRQ, "cpu interrupt\n");
  232. cpu_int_status = dev->irq_proc_reg.cpu_int_status &
  233. dev->irq_en_reg.cpu_int_status_en;
  234. if (!cpu_int_status) {
  235. WARN_ON(1);
  236. return -EIO;
  237. }
  238. ath6kl_dbg(ATH6KL_DBG_IRQ,
  239. "valid interrupt source(s) in CPU_INT_STATUS: 0x%x\n",
  240. cpu_int_status);
  241. /* Clear the interrupt */
  242. dev->irq_proc_reg.cpu_int_status &= ~cpu_int_status;
  243. /*
  244. * Set up the register transfer buffer to hit the register 4 times ,
  245. * this is done to make the access 4-byte aligned to mitigate issues
  246. * with host bus interconnects that restrict bus transfer lengths to
  247. * be a multiple of 4-bytes.
  248. */
  249. /* set W1C value to clear the interrupt, this hits the register first */
  250. reg_buf[0] = cpu_int_status;
  251. /* the remaining are set to zero which have no-effect */
  252. reg_buf[1] = 0;
  253. reg_buf[2] = 0;
  254. reg_buf[3] = 0;
  255. status = hif_read_write_sync(dev->ar, CPU_INT_STATUS_ADDRESS,
  256. reg_buf, 4, HIF_WR_SYNC_BYTE_FIX);
  257. if (status)
  258. WARN_ON(1);
  259. return status;
  260. }
  261. /* process pending interrupts synchronously */
  262. static int proc_pending_irqs(struct ath6kl_device *dev, bool *done)
  263. {
  264. struct ath6kl_irq_proc_registers *rg;
  265. int status = 0;
  266. u8 host_int_status = 0;
  267. u32 lk_ahd = 0;
  268. u8 htc_mbox = 1 << HTC_MAILBOX;
  269. ath6kl_dbg(ATH6KL_DBG_IRQ, "proc_pending_irqs: (dev: 0x%p)\n", dev);
  270. /*
  271. * NOTE: HIF implementation guarantees that the context of this
  272. * call allows us to perform SYNCHRONOUS I/O, that is we can block,
  273. * sleep or call any API that can block or switch thread/task
  274. * contexts. This is a fully schedulable context.
  275. */
  276. /*
  277. * Process pending intr only when int_status_en is clear, it may
  278. * result in unnecessary bus transaction otherwise. Target may be
  279. * unresponsive at the time.
  280. */
  281. if (dev->irq_en_reg.int_status_en) {
  282. /*
  283. * Read the first 28 bytes of the HTC register table. This
  284. * will yield us the value of different int status
  285. * registers and the lookahead registers.
  286. *
  287. * length = sizeof(int_status) + sizeof(cpu_int_status)
  288. * + sizeof(error_int_status) +
  289. * sizeof(counter_int_status) +
  290. * sizeof(mbox_frame) + sizeof(rx_lkahd_valid)
  291. * + sizeof(hole) + sizeof(rx_lkahd) +
  292. * sizeof(int_status_en) +
  293. * sizeof(cpu_int_status_en) +
  294. * sizeof(err_int_status_en) +
  295. * sizeof(cntr_int_status_en);
  296. */
  297. status = hif_read_write_sync(dev->ar, HOST_INT_STATUS_ADDRESS,
  298. (u8 *) &dev->irq_proc_reg,
  299. sizeof(dev->irq_proc_reg),
  300. HIF_RD_SYNC_BYTE_INC);
  301. if (status)
  302. goto out;
  303. if (AR_DBG_LVL_CHECK(ATH6KL_DBG_IRQ))
  304. ath6kl_dump_registers(dev, &dev->irq_proc_reg,
  305. &dev->irq_en_reg);
  306. /* Update only those registers that are enabled */
  307. host_int_status = dev->irq_proc_reg.host_int_status &
  308. dev->irq_en_reg.int_status_en;
  309. /* Look at mbox status */
  310. if (host_int_status & htc_mbox) {
  311. /*
  312. * Mask out pending mbox value, we use "lookAhead as
  313. * the real flag for mbox processing.
  314. */
  315. host_int_status &= ~htc_mbox;
  316. if (dev->irq_proc_reg.rx_lkahd_valid &
  317. htc_mbox) {
  318. rg = &dev->irq_proc_reg;
  319. lk_ahd = le32_to_cpu(rg->rx_lkahd[HTC_MAILBOX]);
  320. if (!lk_ahd)
  321. ath6kl_err("lookAhead is zero!\n");
  322. }
  323. }
  324. }
  325. if (!host_int_status && !lk_ahd) {
  326. *done = true;
  327. goto out;
  328. }
  329. if (lk_ahd) {
  330. int fetched = 0;
  331. ath6kl_dbg(ATH6KL_DBG_IRQ,
  332. "pending mailbox msg, lk_ahd: 0x%X\n", lk_ahd);
  333. /*
  334. * Mailbox Interrupt, the HTC layer may issue async
  335. * requests to empty the mailbox. When emptying the recv
  336. * mailbox we use the async handler above called from the
  337. * completion routine of the callers read request. This can
  338. * improve performance by reducing context switching when
  339. * we rapidly pull packets.
  340. */
  341. status = ath6kl_htc_rxmsg_pending_handler(dev->htc_cnxt,
  342. &lk_ahd, &fetched);
  343. if (status)
  344. goto out;
  345. if (!fetched)
  346. /*
  347. * HTC could not pull any messages out due to lack
  348. * of resources.
  349. */
  350. dev->htc_cnxt->chk_irq_status_cnt = 0;
  351. }
  352. /* now handle the rest of them */
  353. ath6kl_dbg(ATH6KL_DBG_IRQ,
  354. "valid interrupt source(s) for other interrupts: 0x%x\n",
  355. host_int_status);
  356. if (MS(HOST_INT_STATUS_CPU, host_int_status)) {
  357. /* CPU Interrupt */
  358. status = ath6kldev_proc_cpu_intr(dev);
  359. if (status)
  360. goto out;
  361. }
  362. if (MS(HOST_INT_STATUS_ERROR, host_int_status)) {
  363. /* Error Interrupt */
  364. status = ath6kldev_proc_err_intr(dev);
  365. if (status)
  366. goto out;
  367. }
  368. if (MS(HOST_INT_STATUS_COUNTER, host_int_status))
  369. /* Counter Interrupt */
  370. status = ath6kldev_proc_counter_intr(dev);
  371. out:
  372. /*
  373. * An optimization to bypass reading the IRQ status registers
  374. * unecessarily which can re-wake the target, if upper layers
  375. * determine that we are in a low-throughput mode, we can rely on
  376. * taking another interrupt rather than re-checking the status
  377. * registers which can re-wake the target.
  378. *
  379. * NOTE : for host interfaces that makes use of detecting pending
  380. * mbox messages at hif can not use this optimization due to
  381. * possible side effects, SPI requires the host to drain all
  382. * messages from the mailbox before exiting the ISR routine.
  383. */
  384. ath6kl_dbg(ATH6KL_DBG_IRQ,
  385. "bypassing irq status re-check, forcing done\n");
  386. if (!dev->htc_cnxt->chk_irq_status_cnt)
  387. *done = true;
  388. ath6kl_dbg(ATH6KL_DBG_IRQ,
  389. "proc_pending_irqs: (done:%d, status=%d\n", *done, status);
  390. return status;
  391. }
  392. /* interrupt handler, kicks off all interrupt processing */
  393. int ath6kldev_intr_bh_handler(struct ath6kl *ar)
  394. {
  395. struct ath6kl_device *dev = ar->htc_target->dev;
  396. int status = 0;
  397. bool done = false;
  398. /*
  399. * Reset counter used to flag a re-scan of IRQ status registers on
  400. * the target.
  401. */
  402. dev->htc_cnxt->chk_irq_status_cnt = 0;
  403. /*
  404. * IRQ processing is synchronous, interrupt status registers can be
  405. * re-read.
  406. */
  407. while (!done) {
  408. status = proc_pending_irqs(dev, &done);
  409. if (status)
  410. break;
  411. }
  412. return status;
  413. }
  414. static int ath6kldev_enable_intrs(struct ath6kl_device *dev)
  415. {
  416. struct ath6kl_irq_enable_reg regs;
  417. int status;
  418. spin_lock_bh(&dev->lock);
  419. /* Enable all but ATH6KL CPU interrupts */
  420. dev->irq_en_reg.int_status_en =
  421. SM(INT_STATUS_ENABLE_ERROR, 0x01) |
  422. SM(INT_STATUS_ENABLE_CPU, 0x01) |
  423. SM(INT_STATUS_ENABLE_COUNTER, 0x01);
  424. /*
  425. * NOTE: There are some cases where HIF can do detection of
  426. * pending mbox messages which is disabled now.
  427. */
  428. dev->irq_en_reg.int_status_en |= SM(INT_STATUS_ENABLE_MBOX_DATA, 0x01);
  429. /* Set up the CPU Interrupt status Register */
  430. dev->irq_en_reg.cpu_int_status_en = 0;
  431. /* Set up the Error Interrupt status Register */
  432. dev->irq_en_reg.err_int_status_en =
  433. SM(ERROR_STATUS_ENABLE_RX_UNDERFLOW, 0x01) |
  434. SM(ERROR_STATUS_ENABLE_TX_OVERFLOW, 0x1);
  435. /*
  436. * Enable Counter interrupt status register to get fatal errors for
  437. * debugging.
  438. */
  439. dev->irq_en_reg.cntr_int_status_en = SM(COUNTER_INT_STATUS_ENABLE_BIT,
  440. ATH6KL_TARGET_DEBUG_INTR_MASK);
  441. memcpy(&regs, &dev->irq_en_reg, sizeof(regs));
  442. spin_unlock_bh(&dev->lock);
  443. status = hif_read_write_sync(dev->ar, INT_STATUS_ENABLE_ADDRESS,
  444. &regs.int_status_en, sizeof(regs),
  445. HIF_WR_SYNC_BYTE_INC);
  446. if (status)
  447. ath6kl_err("failed to update interrupt ctl reg err: %d\n",
  448. status);
  449. return status;
  450. }
  451. int ath6kldev_disable_intrs(struct ath6kl_device *dev)
  452. {
  453. struct ath6kl_irq_enable_reg regs;
  454. spin_lock_bh(&dev->lock);
  455. /* Disable all interrupts */
  456. dev->irq_en_reg.int_status_en = 0;
  457. dev->irq_en_reg.cpu_int_status_en = 0;
  458. dev->irq_en_reg.err_int_status_en = 0;
  459. dev->irq_en_reg.cntr_int_status_en = 0;
  460. memcpy(&regs, &dev->irq_en_reg, sizeof(regs));
  461. spin_unlock_bh(&dev->lock);
  462. return hif_read_write_sync(dev->ar, INT_STATUS_ENABLE_ADDRESS,
  463. &regs.int_status_en, sizeof(regs),
  464. HIF_WR_SYNC_BYTE_INC);
  465. }
  466. /* enable device interrupts */
  467. int ath6kldev_unmask_intrs(struct ath6kl_device *dev)
  468. {
  469. int status = 0;
  470. /*
  471. * Make sure interrupt are disabled before unmasking at the HIF
  472. * layer. The rationale here is that between device insertion
  473. * (where we clear the interrupts the first time) and when HTC
  474. * is finally ready to handle interrupts, other software can perform
  475. * target "soft" resets. The ATH6KL interrupt enables reset back to an
  476. * "enabled" state when this happens.
  477. */
  478. ath6kldev_disable_intrs(dev);
  479. /* unmask the host controller interrupts */
  480. ath6kl_hif_irq_enable(dev->ar);
  481. status = ath6kldev_enable_intrs(dev);
  482. return status;
  483. }
  484. /* disable all device interrupts */
  485. int ath6kldev_mask_intrs(struct ath6kl_device *dev)
  486. {
  487. /*
  488. * Mask the interrupt at the HIF layer to avoid any stray interrupt
  489. * taken while we zero out our shadow registers in
  490. * ath6kldev_disable_intrs().
  491. */
  492. ath6kl_hif_irq_disable(dev->ar);
  493. return ath6kldev_disable_intrs(dev);
  494. }
  495. int ath6kldev_setup(struct ath6kl_device *dev)
  496. {
  497. int status = 0;
  498. spin_lock_init(&dev->lock);
  499. /*
  500. * NOTE: we actually get the block size of a mailbox other than 0,
  501. * for SDIO the block size on mailbox 0 is artificially set to 1.
  502. * So we use the block size that is set for the other 3 mailboxes.
  503. */
  504. dev->htc_cnxt->block_sz = dev->ar->mbox_info.block_size;
  505. /* must be a power of 2 */
  506. if ((dev->htc_cnxt->block_sz & (dev->htc_cnxt->block_sz - 1)) != 0) {
  507. WARN_ON(1);
  508. goto fail_setup;
  509. }
  510. /* assemble mask, used for padding to a block */
  511. dev->htc_cnxt->block_mask = dev->htc_cnxt->block_sz - 1;
  512. ath6kl_dbg(ATH6KL_DBG_TRC, "block size: %d, mbox addr:0x%X\n",
  513. dev->htc_cnxt->block_sz, dev->ar->mbox_info.htc_addr);
  514. ath6kl_dbg(ATH6KL_DBG_TRC,
  515. "hif interrupt processing is sync only\n");
  516. status = ath6kldev_disable_intrs(dev);
  517. fail_setup:
  518. return status;
  519. }