htc_hif.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  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. if (!read) {
  161. scat_req->status = status;
  162. scat_req->complete(dev->ar->htc_target, scat_req);
  163. return 0;
  164. }
  165. return status;
  166. }
  167. status = ath6kl_hif_scat_req_rw(dev->ar, scat_req);
  168. if (read) {
  169. /* in sync mode, we can touch the scatter request */
  170. scat_req->status = status;
  171. if (!status && scat_req->virt_scat)
  172. scat_req->status =
  173. ath6kldev_cp_scat_dma_buf(scat_req, true);
  174. }
  175. return status;
  176. }
  177. static int ath6kldev_proc_counter_intr(struct ath6kl_device *dev)
  178. {
  179. u8 counter_int_status;
  180. ath6kl_dbg(ATH6KL_DBG_IRQ, "counter interrupt\n");
  181. counter_int_status = dev->irq_proc_reg.counter_int_status &
  182. dev->irq_en_reg.cntr_int_status_en;
  183. ath6kl_dbg(ATH6KL_DBG_IRQ,
  184. "valid interrupt source(s) in COUNTER_INT_STATUS: 0x%x\n",
  185. counter_int_status);
  186. /*
  187. * NOTE: other modules like GMBOX may use the counter interrupt for
  188. * credit flow control on other counters, we only need to check for
  189. * the debug assertion counter interrupt.
  190. */
  191. if (counter_int_status & ATH6KL_TARGET_DEBUG_INTR_MASK)
  192. return ath6kldev_proc_dbg_intr(dev);
  193. return 0;
  194. }
  195. static int ath6kldev_proc_err_intr(struct ath6kl_device *dev)
  196. {
  197. int status;
  198. u8 error_int_status;
  199. u8 reg_buf[4];
  200. ath6kl_dbg(ATH6KL_DBG_IRQ, "error interrupt\n");
  201. error_int_status = dev->irq_proc_reg.error_int_status & 0x0F;
  202. if (!error_int_status) {
  203. WARN_ON(1);
  204. return -EIO;
  205. }
  206. ath6kl_dbg(ATH6KL_DBG_IRQ,
  207. "valid interrupt source(s) in ERROR_INT_STATUS: 0x%x\n",
  208. error_int_status);
  209. if (MS(ERROR_INT_STATUS_WAKEUP, error_int_status))
  210. ath6kl_dbg(ATH6KL_DBG_IRQ, "error : wakeup\n");
  211. if (MS(ERROR_INT_STATUS_RX_UNDERFLOW, error_int_status))
  212. ath6kl_err("rx underflow\n");
  213. if (MS(ERROR_INT_STATUS_TX_OVERFLOW, error_int_status))
  214. ath6kl_err("tx overflow\n");
  215. /* Clear the interrupt */
  216. dev->irq_proc_reg.error_int_status &= ~error_int_status;
  217. /* set W1C value to clear the interrupt, this hits the register first */
  218. reg_buf[0] = error_int_status;
  219. reg_buf[1] = 0;
  220. reg_buf[2] = 0;
  221. reg_buf[3] = 0;
  222. status = hif_read_write_sync(dev->ar, ERROR_INT_STATUS_ADDRESS,
  223. reg_buf, 4, HIF_WR_SYNC_BYTE_FIX);
  224. if (status)
  225. WARN_ON(1);
  226. return status;
  227. }
  228. static int ath6kldev_proc_cpu_intr(struct ath6kl_device *dev)
  229. {
  230. int status;
  231. u8 cpu_int_status;
  232. u8 reg_buf[4];
  233. ath6kl_dbg(ATH6KL_DBG_IRQ, "cpu interrupt\n");
  234. cpu_int_status = dev->irq_proc_reg.cpu_int_status &
  235. dev->irq_en_reg.cpu_int_status_en;
  236. if (!cpu_int_status) {
  237. WARN_ON(1);
  238. return -EIO;
  239. }
  240. ath6kl_dbg(ATH6KL_DBG_IRQ,
  241. "valid interrupt source(s) in CPU_INT_STATUS: 0x%x\n",
  242. cpu_int_status);
  243. /* Clear the interrupt */
  244. dev->irq_proc_reg.cpu_int_status &= ~cpu_int_status;
  245. /*
  246. * Set up the register transfer buffer to hit the register 4 times ,
  247. * this is done to make the access 4-byte aligned to mitigate issues
  248. * with host bus interconnects that restrict bus transfer lengths to
  249. * be a multiple of 4-bytes.
  250. */
  251. /* set W1C value to clear the interrupt, this hits the register first */
  252. reg_buf[0] = cpu_int_status;
  253. /* the remaining are set to zero which have no-effect */
  254. reg_buf[1] = 0;
  255. reg_buf[2] = 0;
  256. reg_buf[3] = 0;
  257. status = hif_read_write_sync(dev->ar, CPU_INT_STATUS_ADDRESS,
  258. reg_buf, 4, HIF_WR_SYNC_BYTE_FIX);
  259. if (status)
  260. WARN_ON(1);
  261. return status;
  262. }
  263. /* process pending interrupts synchronously */
  264. static int proc_pending_irqs(struct ath6kl_device *dev, bool *done)
  265. {
  266. struct ath6kl_irq_proc_registers *rg;
  267. int status = 0;
  268. u8 host_int_status = 0;
  269. u32 lk_ahd = 0;
  270. u8 htc_mbox = 1 << HTC_MAILBOX;
  271. ath6kl_dbg(ATH6KL_DBG_IRQ, "proc_pending_irqs: (dev: 0x%p)\n", dev);
  272. /*
  273. * NOTE: HIF implementation guarantees that the context of this
  274. * call allows us to perform SYNCHRONOUS I/O, that is we can block,
  275. * sleep or call any API that can block or switch thread/task
  276. * contexts. This is a fully schedulable context.
  277. */
  278. /*
  279. * Process pending intr only when int_status_en is clear, it may
  280. * result in unnecessary bus transaction otherwise. Target may be
  281. * unresponsive at the time.
  282. */
  283. if (dev->irq_en_reg.int_status_en) {
  284. /*
  285. * Read the first 28 bytes of the HTC register table. This
  286. * will yield us the value of different int status
  287. * registers and the lookahead registers.
  288. *
  289. * length = sizeof(int_status) + sizeof(cpu_int_status)
  290. * + sizeof(error_int_status) +
  291. * sizeof(counter_int_status) +
  292. * sizeof(mbox_frame) + sizeof(rx_lkahd_valid)
  293. * + sizeof(hole) + sizeof(rx_lkahd) +
  294. * sizeof(int_status_en) +
  295. * sizeof(cpu_int_status_en) +
  296. * sizeof(err_int_status_en) +
  297. * sizeof(cntr_int_status_en);
  298. */
  299. status = hif_read_write_sync(dev->ar, HOST_INT_STATUS_ADDRESS,
  300. (u8 *) &dev->irq_proc_reg,
  301. sizeof(dev->irq_proc_reg),
  302. HIF_RD_SYNC_BYTE_INC);
  303. if (status)
  304. goto out;
  305. if (AR_DBG_LVL_CHECK(ATH6KL_DBG_IRQ))
  306. ath6kl_dump_registers(dev, &dev->irq_proc_reg,
  307. &dev->irq_en_reg);
  308. /* Update only those registers that are enabled */
  309. host_int_status = dev->irq_proc_reg.host_int_status &
  310. dev->irq_en_reg.int_status_en;
  311. /* Look at mbox status */
  312. if (host_int_status & htc_mbox) {
  313. /*
  314. * Mask out pending mbox value, we use "lookAhead as
  315. * the real flag for mbox processing.
  316. */
  317. host_int_status &= ~htc_mbox;
  318. if (dev->irq_proc_reg.rx_lkahd_valid &
  319. htc_mbox) {
  320. rg = &dev->irq_proc_reg;
  321. lk_ahd = le32_to_cpu(rg->rx_lkahd[HTC_MAILBOX]);
  322. if (!lk_ahd)
  323. ath6kl_err("lookAhead is zero!\n");
  324. }
  325. }
  326. }
  327. if (!host_int_status && !lk_ahd) {
  328. *done = true;
  329. goto out;
  330. }
  331. if (lk_ahd) {
  332. int fetched = 0;
  333. ath6kl_dbg(ATH6KL_DBG_IRQ,
  334. "pending mailbox msg, lk_ahd: 0x%X\n", lk_ahd);
  335. /*
  336. * Mailbox Interrupt, the HTC layer may issue async
  337. * requests to empty the mailbox. When emptying the recv
  338. * mailbox we use the async handler above called from the
  339. * completion routine of the callers read request. This can
  340. * improve performance by reducing context switching when
  341. * we rapidly pull packets.
  342. */
  343. status = dev->msg_pending(dev->htc_cnxt, &lk_ahd, &fetched);
  344. if (status)
  345. goto out;
  346. if (!fetched)
  347. /*
  348. * HTC could not pull any messages out due to lack
  349. * of resources.
  350. */
  351. dev->chk_irq_status_cnt = 0;
  352. }
  353. /* now handle the rest of them */
  354. ath6kl_dbg(ATH6KL_DBG_IRQ,
  355. "valid interrupt source(s) for other interrupts: 0x%x\n",
  356. host_int_status);
  357. if (MS(HOST_INT_STATUS_CPU, host_int_status)) {
  358. /* CPU Interrupt */
  359. status = ath6kldev_proc_cpu_intr(dev);
  360. if (status)
  361. goto out;
  362. }
  363. if (MS(HOST_INT_STATUS_ERROR, host_int_status)) {
  364. /* Error Interrupt */
  365. status = ath6kldev_proc_err_intr(dev);
  366. if (status)
  367. goto out;
  368. }
  369. if (MS(HOST_INT_STATUS_COUNTER, host_int_status))
  370. /* Counter Interrupt */
  371. status = ath6kldev_proc_counter_intr(dev);
  372. out:
  373. /*
  374. * An optimization to bypass reading the IRQ status registers
  375. * unecessarily which can re-wake the target, if upper layers
  376. * determine that we are in a low-throughput mode, we can rely on
  377. * taking another interrupt rather than re-checking the status
  378. * registers which can re-wake the target.
  379. *
  380. * NOTE : for host interfaces that makes use of detecting pending
  381. * mbox messages at hif can not use this optimization due to
  382. * possible side effects, SPI requires the host to drain all
  383. * messages from the mailbox before exiting the ISR routine.
  384. */
  385. ath6kl_dbg(ATH6KL_DBG_IRQ,
  386. "bypassing irq status re-check, forcing done\n");
  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->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->block_sz = dev->ar->mbox_info.block_size;
  505. /* must be a power of 2 */
  506. if ((dev->block_sz & (dev->block_sz - 1)) != 0) {
  507. WARN_ON(1);
  508. goto fail_setup;
  509. }
  510. /* assemble mask, used for padding to a block */
  511. dev->block_mask = dev->block_sz - 1;
  512. ath6kl_dbg(ATH6KL_DBG_TRC, "block size: %d, mbox addr:0x%X\n",
  513. dev->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. }