Lines Matching full:ab
120 int ath11k_pcic_init_msi_config(struct ath11k_base *ab) in ath11k_pcic_init_msi_config() argument
128 if (msi_config->hw_rev == ab->hw_rev) in ath11k_pcic_init_msi_config()
133 ath11k_err(ab, "failed to fetch msi config, unsupported hw version: 0x%x\n", in ath11k_pcic_init_msi_config()
134 ab->hw_rev); in ath11k_pcic_init_msi_config()
138 ab->pci.msi.config = msi_config; in ath11k_pcic_init_msi_config()
143 static void __ath11k_pcic_write32(struct ath11k_base *ab, u32 offset, u32 value) in __ath11k_pcic_write32() argument
146 iowrite32(value, ab->mem + offset); in __ath11k_pcic_write32()
148 ab->pci.ops->window_write32(ab, offset, value); in __ath11k_pcic_write32()
151 void ath11k_pcic_write32(struct ath11k_base *ab, u32 offset, u32 value) in ath11k_pcic_write32() argument
159 wakeup_required = test_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags) && in ath11k_pcic_write32()
161 if (wakeup_required && ab->pci.ops->wakeup) in ath11k_pcic_write32()
162 ret = ab->pci.ops->wakeup(ab); in ath11k_pcic_write32()
164 __ath11k_pcic_write32(ab, offset, value); in ath11k_pcic_write32()
166 if (wakeup_required && !ret && ab->pci.ops->release) in ath11k_pcic_write32()
167 ab->pci.ops->release(ab); in ath11k_pcic_write32()
171 static u32 __ath11k_pcic_read32(struct ath11k_base *ab, u32 offset) in __ath11k_pcic_read32() argument
176 val = ioread32(ab->mem + offset); in __ath11k_pcic_read32()
178 val = ab->pci.ops->window_read32(ab, offset); in __ath11k_pcic_read32()
183 u32 ath11k_pcic_read32(struct ath11k_base *ab, u32 offset) in ath11k_pcic_read32() argument
192 wakeup_required = test_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags) && in ath11k_pcic_read32()
194 if (wakeup_required && ab->pci.ops->wakeup) in ath11k_pcic_read32()
195 ret = ab->pci.ops->wakeup(ab); in ath11k_pcic_read32()
197 val = __ath11k_pcic_read32(ab, offset); in ath11k_pcic_read32()
199 if (wakeup_required && !ret && ab->pci.ops->release) in ath11k_pcic_read32()
200 ab->pci.ops->release(ab); in ath11k_pcic_read32()
206 int ath11k_pcic_read(struct ath11k_base *ab, void *buf, u32 start, u32 end) in ath11k_pcic_read() argument
216 wakeup_required = test_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags) && in ath11k_pcic_read()
218 if (wakeup_required && ab->pci.ops->wakeup) { in ath11k_pcic_read()
219 ret = ab->pci.ops->wakeup(ab); in ath11k_pcic_read()
221 ath11k_warn(ab, "failed to wakeup for read from 0x%x: %d\n", in ath11k_pcic_read()
228 *data++ = __ath11k_pcic_read32(ab, i); in ath11k_pcic_read()
230 if (wakeup_required && ab->pci.ops->release) in ath11k_pcic_read()
231 ab->pci.ops->release(ab); in ath11k_pcic_read()
237 void ath11k_pcic_get_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo, in ath11k_pcic_get_msi_address() argument
240 *msi_addr_lo = ab->pci.msi.addr_lo; in ath11k_pcic_get_msi_address()
241 *msi_addr_hi = ab->pci.msi.addr_hi; in ath11k_pcic_get_msi_address()
245 int ath11k_pcic_get_user_msi_assignment(struct ath11k_base *ab, char *user_name, in ath11k_pcic_get_user_msi_assignment() argument
249 const struct ath11k_msi_config *msi_config = ab->pci.msi.config; in ath11k_pcic_get_user_msi_assignment()
256 *user_base_data = *base_vector + ab->pci.msi.ep_base_data; in ath11k_pcic_get_user_msi_assignment()
258 ath11k_dbg(ab, ATH11K_DBG_PCI, in ath11k_pcic_get_user_msi_assignment()
267 ath11k_err(ab, "Failed to find MSI assignment for %s!\n", user_name); in ath11k_pcic_get_user_msi_assignment()
273 void ath11k_pcic_get_ce_msi_idx(struct ath11k_base *ab, u32 ce_id, u32 *msi_idx) in ath11k_pcic_get_ce_msi_idx() argument
277 for (i = 0, msi_data_idx = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pcic_get_ce_msi_idx()
278 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pcic_get_ce_msi_idx()
290 static void ath11k_pcic_free_ext_irq(struct ath11k_base *ab) in ath11k_pcic_free_ext_irq() argument
295 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_pcic_free_ext_irq()
298 free_irq(ab->irq_num[irq_grp->irqs[j]], irq_grp); in ath11k_pcic_free_ext_irq()
304 void ath11k_pcic_free_irq(struct ath11k_base *ab) in ath11k_pcic_free_irq() argument
308 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pcic_free_irq()
309 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pcic_free_irq()
312 free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); in ath11k_pcic_free_irq()
315 ath11k_pcic_free_ext_irq(ab); in ath11k_pcic_free_irq()
319 static void ath11k_pcic_ce_irq_enable(struct ath11k_base *ab, u16 ce_id) in ath11k_pcic_ce_irq_enable() argument
326 if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) in ath11k_pcic_ce_irq_enable()
330 enable_irq(ab->irq_num[irq_idx]); in ath11k_pcic_ce_irq_enable()
333 static void ath11k_pcic_ce_irq_disable(struct ath11k_base *ab, u16 ce_id) in ath11k_pcic_ce_irq_disable() argument
340 if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) in ath11k_pcic_ce_irq_disable()
344 disable_irq_nosync(ab->irq_num[irq_idx]); in ath11k_pcic_ce_irq_disable()
347 static void ath11k_pcic_ce_irqs_disable(struct ath11k_base *ab) in ath11k_pcic_ce_irqs_disable() argument
351 clear_bit(ATH11K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags); in ath11k_pcic_ce_irqs_disable()
353 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pcic_ce_irqs_disable()
354 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pcic_ce_irqs_disable()
356 ath11k_pcic_ce_irq_disable(ab, i); in ath11k_pcic_ce_irqs_disable()
360 static void ath11k_pcic_sync_ce_irqs(struct ath11k_base *ab) in ath11k_pcic_sync_ce_irqs() argument
365 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pcic_sync_ce_irqs()
366 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pcic_sync_ce_irqs()
370 synchronize_irq(ab->irq_num[irq_idx]); in ath11k_pcic_sync_ce_irqs()
379 ath11k_ce_per_engine_service(ce_pipe->ab, ce_pipe->pipe_num); in ath11k_pcic_ce_tasklet()
381 enable_irq(ce_pipe->ab->irq_num[irq_idx]); in ath11k_pcic_ce_tasklet()
387 struct ath11k_base *ab = ce_pipe->ab; in ath11k_pcic_ce_interrupt_handler() local
390 if (!test_bit(ATH11K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags)) in ath11k_pcic_ce_interrupt_handler()
396 disable_irq_nosync(ab->irq_num[irq_idx]); in ath11k_pcic_ce_interrupt_handler()
405 struct ath11k_base *ab = irq_grp->ab; in ath11k_pcic_ext_grp_disable() local
411 if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) in ath11k_pcic_ext_grp_disable()
415 disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_pcic_ext_grp_disable()
439 struct ath11k_base *ab = irq_grp->ab; in ath11k_pcic_ext_grp_enable() local
445 if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) in ath11k_pcic_ext_grp_enable()
449 enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_pcic_ext_grp_enable()
452 void ath11k_pcic_ext_irq_enable(struct ath11k_base *ab) in ath11k_pcic_ext_irq_enable() argument
456 set_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags); in ath11k_pcic_ext_irq_enable()
459 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_pcic_ext_irq_enable()
471 static void ath11k_pcic_sync_ext_irqs(struct ath11k_base *ab) in ath11k_pcic_sync_ext_irqs() argument
476 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_pcic_sync_ext_irqs()
480 synchronize_irq(ab->irq_num[irq_idx]); in ath11k_pcic_sync_ext_irqs()
485 void ath11k_pcic_ext_irq_disable(struct ath11k_base *ab) in ath11k_pcic_ext_irq_disable() argument
487 __ath11k_pcic_ext_irq_disable(ab); in ath11k_pcic_ext_irq_disable()
488 ath11k_pcic_sync_ext_irqs(ab); in ath11k_pcic_ext_irq_disable()
497 struct ath11k_base *ab = irq_grp->ab; in ath11k_pcic_ext_grp_napi_poll() local
501 work_done = ath11k_dp_service_srng(ab, irq_grp, budget); in ath11k_pcic_ext_grp_napi_poll()
505 enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_pcic_ext_grp_napi_poll()
517 struct ath11k_base *ab = irq_grp->ab; in ath11k_pcic_ext_interrupt_handler() local
520 if (!test_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags)) in ath11k_pcic_ext_interrupt_handler()
523 ath11k_dbg(irq_grp->ab, ATH11K_DBG_PCI, "ext irq:%d\n", irq); in ath11k_pcic_ext_interrupt_handler()
529 disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_pcic_ext_interrupt_handler()
537 ath11k_pcic_get_msi_irq(struct ath11k_base *ab, unsigned int vector) in ath11k_pcic_get_msi_irq() argument
539 return ab->pci.ops->get_msi_irq(ab, vector); in ath11k_pcic_get_msi_irq()
542 static int ath11k_pcic_ext_irq_config(struct ath11k_base *ab) in ath11k_pcic_ext_irq_config() argument
548 ret = ath11k_pcic_get_user_msi_assignment(ab, "DP", &num_vectors, in ath11k_pcic_ext_irq_config()
555 if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) in ath11k_pcic_ext_irq_config()
559 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_pcic_ext_irq_config()
562 irq_grp->ab = ab; in ath11k_pcic_ext_irq_config()
568 if (ab->hw_params.ring_mask->tx[i] || in ath11k_pcic_ext_irq_config()
569 ab->hw_params.ring_mask->rx[i] || in ath11k_pcic_ext_irq_config()
570 ab->hw_params.ring_mask->rx_err[i] || in ath11k_pcic_ext_irq_config()
571 ab->hw_params.ring_mask->rx_wbm_rel[i] || in ath11k_pcic_ext_irq_config()
572 ab->hw_params.ring_mask->reo_status[i] || in ath11k_pcic_ext_irq_config()
573 ab->hw_params.ring_mask->rxdma2host[i] || in ath11k_pcic_ext_irq_config()
574 ab->hw_params.ring_mask->host2rxdma[i] || in ath11k_pcic_ext_irq_config()
575 ab->hw_params.ring_mask->rx_mon_status[i]) { in ath11k_pcic_ext_irq_config()
585 int irq = ath11k_pcic_get_msi_irq(ab, vector); in ath11k_pcic_ext_irq_config()
590 ab->irq_num[irq_idx] = irq; in ath11k_pcic_ext_irq_config()
592 ath11k_dbg(ab, ATH11K_DBG_PCI, in ath11k_pcic_ext_irq_config()
599 ath11k_err(ab, "failed request irq %d: %d\n", in ath11k_pcic_ext_irq_config()
610 int ath11k_pcic_config_irq(struct ath11k_base *ab) in ath11k_pcic_config_irq() argument
620 ret = ath11k_pcic_get_user_msi_assignment(ab, "CE", &msi_data_count, in ath11k_pcic_config_irq()
626 if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) in ath11k_pcic_config_irq()
630 for (i = 0, msi_data_idx = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pcic_config_irq()
631 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pcic_config_irq()
635 irq = ath11k_pcic_get_msi_irq(ab, msi_data); in ath11k_pcic_config_irq()
639 ce_pipe = &ab->ce.ce_pipe[i]; in ath11k_pcic_config_irq()
648 ath11k_err(ab, "failed to request irq %d: %d\n", in ath11k_pcic_config_irq()
653 ab->irq_num[irq_idx] = irq; in ath11k_pcic_config_irq()
656 ath11k_pcic_ce_irq_disable(ab, i); in ath11k_pcic_config_irq()
659 ret = ath11k_pcic_ext_irq_config(ab); in ath11k_pcic_config_irq()
667 void ath11k_pcic_ce_irqs_enable(struct ath11k_base *ab) in ath11k_pcic_ce_irqs_enable() argument
671 set_bit(ATH11K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags); in ath11k_pcic_ce_irqs_enable()
673 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pcic_ce_irqs_enable()
674 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pcic_ce_irqs_enable()
676 ath11k_pcic_ce_irq_enable(ab, i); in ath11k_pcic_ce_irqs_enable()
681 static void ath11k_pcic_kill_tasklets(struct ath11k_base *ab) in ath11k_pcic_kill_tasklets() argument
685 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pcic_kill_tasklets()
686 struct ath11k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i]; in ath11k_pcic_kill_tasklets()
688 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pcic_kill_tasklets()
695 void ath11k_pcic_ce_irq_disable_sync(struct ath11k_base *ab) in ath11k_pcic_ce_irq_disable_sync() argument
697 ath11k_pcic_ce_irqs_disable(ab); in ath11k_pcic_ce_irq_disable_sync()
698 ath11k_pcic_sync_ce_irqs(ab); in ath11k_pcic_ce_irq_disable_sync()
699 ath11k_pcic_kill_tasklets(ab); in ath11k_pcic_ce_irq_disable_sync()
703 void ath11k_pcic_stop(struct ath11k_base *ab) in ath11k_pcic_stop() argument
705 ath11k_pcic_ce_irq_disable_sync(ab); in ath11k_pcic_stop()
706 ath11k_ce_cleanup_pipes(ab); in ath11k_pcic_stop()
710 int ath11k_pcic_start(struct ath11k_base *ab) in ath11k_pcic_start() argument
712 set_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags); in ath11k_pcic_start()
714 ath11k_pcic_ce_irqs_enable(ab); in ath11k_pcic_start()
715 ath11k_ce_rx_post_buf(ab); in ath11k_pcic_start()
721 int ath11k_pcic_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, in ath11k_pcic_map_service_to_pipe() argument
728 for (i = 0; i < ab->hw_params.svc_to_ce_map_len; i++) { in ath11k_pcic_map_service_to_pipe()
729 entry = &ab->hw_params.svc_to_ce_map[i]; in ath11k_pcic_map_service_to_pipe()
765 int ath11k_pcic_register_pci_ops(struct ath11k_base *ab, in ath11k_pcic_register_pci_ops() argument
776 ab->pci.ops = pci_ops; in ath11k_pcic_register_pci_ops()
781 void ath11k_pci_enable_ce_irqs_except_wake_irq(struct ath11k_base *ab) in ath11k_pci_enable_ce_irqs_except_wake_irq() argument
785 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pci_enable_ce_irqs_except_wake_irq()
786 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR || in ath11k_pci_enable_ce_irqs_except_wake_irq()
789 ath11k_pcic_ce_irq_enable(ab, i); in ath11k_pci_enable_ce_irqs_except_wake_irq()
794 void ath11k_pci_disable_ce_irqs_except_wake_irq(struct ath11k_base *ab) in ath11k_pci_disable_ce_irqs_except_wake_irq() argument
800 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pci_disable_ce_irqs_except_wake_irq()
801 ce_pipe = &ab->ce.ce_pipe[i]; in ath11k_pci_disable_ce_irqs_except_wake_irq()
804 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR || in ath11k_pci_disable_ce_irqs_except_wake_irq()
808 disable_irq_nosync(ab->irq_num[irq_idx]); in ath11k_pci_disable_ce_irqs_except_wake_irq()
809 synchronize_irq(ab->irq_num[irq_idx]); in ath11k_pci_disable_ce_irqs_except_wake_irq()