19 #include <linux/export.h>
26 #define MAILBOX_FOR_BLOCK_SIZE 1
28 #define ATH6KL_TIME_QUANTUM 10
57 ath6kl_dbg(
ATH6KL_DBG_HIF,
"hif rw completion pkt 0x%p status %d\n",
67 #define REG_DUMP_COUNT_AR6003 60
68 #define REGISTER_DUMP_LEN_MAX 60
70 static void ath6kl_hif_dump_fw_crash(
struct ath6kl *
ar)
80 address = ath6kl_get_hi_item_addr(ar,
HI_ITEM(hi_failure_state));
86 if (ret || !regdump_addr) {
87 ath6kl_warn(
"failed to get ptr to register dump area: %d\n",
100 ath6kl_warn(
"failed to get register dump: %d\n", ret);
106 ar->
wiphy->fw_version);
111 ath6kl_info(
"%d: 0x%8.8x 0x%8.8x 0x%8.8x 0x%8.8x\n",
135 ath6kl_warn(
"Failed to clear debug interrupt: %d\n", ret);
137 ath6kl_hif_dump_fw_crash(dev->
ar);
184 ath6kl_err(
"timeout waiting for recv message\n");
193 ath6kl_hif_proc_dbg_intr(dev);
209 enable_rx ?
"enable" :
"disable");
212 spin_lock_bh(&dev->
lock);
223 spin_unlock_bh(&dev->
lock);
240 scat_req->
addr = dev->
ar->mbox_info.htc_addr;
246 dev->
ar->mbox_info.htc_ext_addr :
247 dev->
ar->mbox_info.htc_addr;
251 "hif submit scatter request entries %d len %d mbox 0x%x %s %s\n",
253 scat_req->
addr, !read ?
"async" :
"sync",
254 (read) ?
"rd" :
"wr");
257 status = ath6kl_hif_cp_scat_dma_buf(scat_req,
false);
260 scat_req->
complete(dev->
ar->htc_target, scat_req);
265 status = ath6kl_hif_scat_req_rw(dev->
ar, scat_req);
272 ath6kl_hif_cp_scat_dma_buf(scat_req,
true);
278 static int ath6kl_hif_proc_counter_intr(
struct ath6kl_device *dev)
280 u8 counter_int_status;
284 counter_int_status = dev->
irq_proc_reg.counter_int_status &
288 "valid interrupt source(s) in COUNTER_INT_STATUS: 0x%x\n",
297 return ath6kl_hif_proc_dbg_intr(dev);
302 static int ath6kl_hif_proc_err_intr(
struct ath6kl_device *dev)
310 error_int_status = dev->
irq_proc_reg.error_int_status & 0x0F;
311 if (!error_int_status) {
317 "valid interrupt source(s) in ERROR_INT_STATUS: 0x%x\n",
330 dev->
irq_proc_reg.error_int_status &= ~error_int_status;
333 reg_buf[0] = error_int_status;
347 static int ath6kl_hif_proc_cpu_intr(
struct ath6kl_device *dev)
357 if (!cpu_int_status) {
363 "valid interrupt source(s) in CPU_INT_STATUS: 0x%x\n",
377 reg_buf[0] = cpu_int_status;
401 ath6kl_dbg(
ATH6KL_DBG_IRQ,
"proc_pending_irqs: (dev: 0x%p)\n", dev);
446 if (host_int_status & htc_mbox) {
451 host_int_status &= ~htc_mbox;
462 if (!host_int_status && !lk_ahd) {
471 "pending mailbox msg, lk_ahd: 0x%X\n", lk_ahd);
490 dev->
htc_cnxt->chk_irq_status_cnt = 0;
495 "valid interrupt source(s) for other interrupts: 0x%x\n",
500 status = ath6kl_hif_proc_cpu_intr(dev);
507 status = ath6kl_hif_proc_err_intr(dev);
514 status = ath6kl_hif_proc_counter_intr(dev);
531 "bypassing irq status re-check, forcing done\n");
533 if (!dev->
htc_cnxt->chk_irq_status_cnt)
537 "proc_pending_irqs: (done:%d, status=%d\n", *done, status);
554 dev->
htc_cnxt->chk_irq_status_cnt = 0;
562 status = proc_pending_irqs(dev, &done);
571 static int ath6kl_hif_enable_intrs(
struct ath6kl_device *dev)
576 spin_lock_bh(&dev->
lock);
606 spin_unlock_bh(&dev->
lock);
613 ath6kl_err(
"failed to update interrupt ctl reg err: %d\n",
623 spin_lock_bh(&dev->
lock);
630 spin_unlock_bh(&dev->
lock);
653 ath6kl_hif_irq_enable(dev->
ar);
654 status = ath6kl_hif_enable_intrs(dev);
667 ath6kl_hif_irq_disable(dev->
ar);
683 dev->
htc_cnxt->block_sz = dev->
ar->mbox_info.block_size;
696 dev->
htc_cnxt->block_sz, dev->
ar->mbox_info.htc_addr);