Lines Matching full:ab

131 int ath11k_pcic_init_msi_config(struct ath11k_base *ab)  in ath11k_pcic_init_msi_config()  argument
139 if (msi_config->hw_rev == ab->hw_rev) in ath11k_pcic_init_msi_config()
144 ath11k_err(ab, "failed to fetch msi config, unsupported hw version: 0x%x\n", in ath11k_pcic_init_msi_config()
145 ab->hw_rev); in ath11k_pcic_init_msi_config()
149 ab->pci.msi.config = msi_config; in ath11k_pcic_init_msi_config()
154 static void __ath11k_pcic_write32(struct ath11k_base *ab, u32 offset, u32 value) in __ath11k_pcic_write32() argument
157 iowrite32(value, ab->mem + offset); in __ath11k_pcic_write32()
159 ab->pci.ops->window_write32(ab, offset, value); in __ath11k_pcic_write32()
162 void ath11k_pcic_write32(struct ath11k_base *ab, u32 offset, u32 value) in ath11k_pcic_write32() argument
170 wakeup_required = test_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags) && in ath11k_pcic_write32()
172 if (wakeup_required && ab->pci.ops->wakeup) in ath11k_pcic_write32()
173 ret = ab->pci.ops->wakeup(ab); in ath11k_pcic_write32()
175 __ath11k_pcic_write32(ab, offset, value); in ath11k_pcic_write32()
177 if (wakeup_required && !ret && ab->pci.ops->release) in ath11k_pcic_write32()
178 ab->pci.ops->release(ab); in ath11k_pcic_write32()
182 static u32 __ath11k_pcic_read32(struct ath11k_base *ab, u32 offset) in __ath11k_pcic_read32() argument
187 val = ioread32(ab->mem + offset); in __ath11k_pcic_read32()
189 val = ab->pci.ops->window_read32(ab, offset); in __ath11k_pcic_read32()
194 u32 ath11k_pcic_read32(struct ath11k_base *ab, u32 offset) in ath11k_pcic_read32() argument
203 wakeup_required = test_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags) && in ath11k_pcic_read32()
205 if (wakeup_required && ab->pci.ops->wakeup) in ath11k_pcic_read32()
206 ret = ab->pci.ops->wakeup(ab); in ath11k_pcic_read32()
208 val = __ath11k_pcic_read32(ab, offset); in ath11k_pcic_read32()
210 if (wakeup_required && !ret && ab->pci.ops->release) in ath11k_pcic_read32()
211 ab->pci.ops->release(ab); in ath11k_pcic_read32()
217 int ath11k_pcic_read(struct ath11k_base *ab, void *buf, u32 start, u32 end) in ath11k_pcic_read() argument
227 wakeup_required = test_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags) && in ath11k_pcic_read()
229 if (wakeup_required && ab->pci.ops->wakeup) { in ath11k_pcic_read()
230 ret = ab->pci.ops->wakeup(ab); in ath11k_pcic_read()
232 ath11k_warn(ab, in ath11k_pcic_read()
246 *data++ = __ath11k_pcic_read32(ab, i); in ath11k_pcic_read()
248 if (wakeup_required && ab->pci.ops->release) in ath11k_pcic_read()
249 ab->pci.ops->release(ab); in ath11k_pcic_read()
255 void ath11k_pcic_get_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo, in ath11k_pcic_get_msi_address() argument
258 *msi_addr_lo = ab->pci.msi.addr_lo; in ath11k_pcic_get_msi_address()
259 *msi_addr_hi = ab->pci.msi.addr_hi; in ath11k_pcic_get_msi_address()
263 int ath11k_pcic_get_user_msi_assignment(struct ath11k_base *ab, char *user_name, in ath11k_pcic_get_user_msi_assignment() argument
267 const struct ath11k_msi_config *msi_config = ab->pci.msi.config; in ath11k_pcic_get_user_msi_assignment()
274 *user_base_data = *base_vector + ab->pci.msi.ep_base_data; in ath11k_pcic_get_user_msi_assignment()
276 ath11k_dbg(ab, ATH11K_DBG_PCI, in ath11k_pcic_get_user_msi_assignment()
285 ath11k_err(ab, "Failed to find MSI assignment for %s!\n", user_name); in ath11k_pcic_get_user_msi_assignment()
291 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
295 for (i = 0, msi_data_idx = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pcic_get_ce_msi_idx()
296 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pcic_get_ce_msi_idx()
308 static void ath11k_pcic_free_ext_irq(struct ath11k_base *ab) in ath11k_pcic_free_ext_irq() argument
313 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_pcic_free_ext_irq()
316 free_irq(ab->irq_num[irq_grp->irqs[j]], irq_grp); in ath11k_pcic_free_ext_irq()
323 void ath11k_pcic_free_irq(struct ath11k_base *ab) in ath11k_pcic_free_irq() argument
327 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pcic_free_irq()
328 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pcic_free_irq()
331 free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); in ath11k_pcic_free_irq()
334 ath11k_pcic_free_ext_irq(ab); in ath11k_pcic_free_irq()
338 static void ath11k_pcic_ce_irq_enable(struct ath11k_base *ab, u16 ce_id) in ath11k_pcic_ce_irq_enable() argument
345 if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) in ath11k_pcic_ce_irq_enable()
349 enable_irq(ab->irq_num[irq_idx]); in ath11k_pcic_ce_irq_enable()
352 static void ath11k_pcic_ce_irq_disable(struct ath11k_base *ab, u16 ce_id) in ath11k_pcic_ce_irq_disable() argument
359 if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) in ath11k_pcic_ce_irq_disable()
363 disable_irq_nosync(ab->irq_num[irq_idx]); in ath11k_pcic_ce_irq_disable()
366 static void ath11k_pcic_ce_irqs_disable(struct ath11k_base *ab) in ath11k_pcic_ce_irqs_disable() argument
370 clear_bit(ATH11K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags); in ath11k_pcic_ce_irqs_disable()
372 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pcic_ce_irqs_disable()
373 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pcic_ce_irqs_disable()
375 ath11k_pcic_ce_irq_disable(ab, i); in ath11k_pcic_ce_irqs_disable()
379 static void ath11k_pcic_sync_ce_irqs(struct ath11k_base *ab) in ath11k_pcic_sync_ce_irqs() argument
384 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pcic_sync_ce_irqs()
385 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pcic_sync_ce_irqs()
389 synchronize_irq(ab->irq_num[irq_idx]); in ath11k_pcic_sync_ce_irqs()
398 ath11k_ce_per_engine_service(ce_pipe->ab, ce_pipe->pipe_num); in ath11k_pcic_ce_tasklet()
400 enable_irq(ce_pipe->ab->irq_num[irq_idx]); in ath11k_pcic_ce_tasklet()
406 struct ath11k_base *ab = ce_pipe->ab; in ath11k_pcic_ce_interrupt_handler() local
409 if (!test_bit(ATH11K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags)) in ath11k_pcic_ce_interrupt_handler()
415 disable_irq_nosync(ab->irq_num[irq_idx]); in ath11k_pcic_ce_interrupt_handler()
424 struct ath11k_base *ab = irq_grp->ab; in ath11k_pcic_ext_grp_disable() local
430 if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) in ath11k_pcic_ext_grp_disable()
434 disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_pcic_ext_grp_disable()
437 static void __ath11k_pcic_ext_irq_disable(struct ath11k_base *ab) in __ath11k_pcic_ext_irq_disable() argument
441 clear_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags); in __ath11k_pcic_ext_irq_disable()
444 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in __ath11k_pcic_ext_irq_disable()
458 struct ath11k_base *ab = irq_grp->ab; in ath11k_pcic_ext_grp_enable() local
464 if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) in ath11k_pcic_ext_grp_enable()
468 enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_pcic_ext_grp_enable()
471 void ath11k_pcic_ext_irq_enable(struct ath11k_base *ab) in ath11k_pcic_ext_irq_enable() argument
476 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_pcic_ext_irq_enable()
485 set_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags); in ath11k_pcic_ext_irq_enable()
489 static void ath11k_pcic_sync_ext_irqs(struct ath11k_base *ab) in ath11k_pcic_sync_ext_irqs() argument
494 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_pcic_sync_ext_irqs()
498 synchronize_irq(ab->irq_num[irq_idx]); in ath11k_pcic_sync_ext_irqs()
503 void ath11k_pcic_ext_irq_disable(struct ath11k_base *ab) in ath11k_pcic_ext_irq_disable() argument
505 __ath11k_pcic_ext_irq_disable(ab); in ath11k_pcic_ext_irq_disable()
506 ath11k_pcic_sync_ext_irqs(ab); in ath11k_pcic_ext_irq_disable()
515 struct ath11k_base *ab = irq_grp->ab; in ath11k_pcic_ext_grp_napi_poll() local
519 work_done = ath11k_dp_service_srng(ab, irq_grp, budget); in ath11k_pcic_ext_grp_napi_poll()
523 enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_pcic_ext_grp_napi_poll()
535 struct ath11k_base *ab = irq_grp->ab; in ath11k_pcic_ext_interrupt_handler() local
538 if (!test_bit(ATH11K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags)) in ath11k_pcic_ext_interrupt_handler()
541 ath11k_dbg(irq_grp->ab, ATH11K_DBG_PCI, "ext irq %d\n", irq); in ath11k_pcic_ext_interrupt_handler()
547 disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_pcic_ext_interrupt_handler()
555 ath11k_pcic_get_msi_irq(struct ath11k_base *ab, unsigned int vector) in ath11k_pcic_get_msi_irq() argument
557 return ab->pci.ops->get_msi_irq(ab, vector); in ath11k_pcic_get_msi_irq()
560 static int ath11k_pcic_ext_irq_config(struct ath11k_base *ab) in ath11k_pcic_ext_irq_config() argument
567 ret = ath11k_pcic_get_user_msi_assignment(ab, "DP", &num_vectors, in ath11k_pcic_ext_irq_config()
574 if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) in ath11k_pcic_ext_irq_config()
578 irq_grp = &ab->ext_irq_grp[i]; in ath11k_pcic_ext_irq_config()
581 irq_grp->ab = ab; in ath11k_pcic_ext_irq_config()
592 if (ab->hw_params.ring_mask->tx[i] || in ath11k_pcic_ext_irq_config()
593 ab->hw_params.ring_mask->rx[i] || in ath11k_pcic_ext_irq_config()
594 ab->hw_params.ring_mask->rx_err[i] || in ath11k_pcic_ext_irq_config()
595 ab->hw_params.ring_mask->rx_wbm_rel[i] || in ath11k_pcic_ext_irq_config()
596 ab->hw_params.ring_mask->reo_status[i] || in ath11k_pcic_ext_irq_config()
597 ab->hw_params.ring_mask->rxdma2host[i] || in ath11k_pcic_ext_irq_config()
598 ab->hw_params.ring_mask->host2rxdma[i] || in ath11k_pcic_ext_irq_config()
599 ab->hw_params.ring_mask->rx_mon_status[i]) { in ath11k_pcic_ext_irq_config()
609 int irq = ath11k_pcic_get_msi_irq(ab, vector); in ath11k_pcic_ext_irq_config()
616 ab->irq_num[irq_idx] = irq; in ath11k_pcic_ext_irq_config()
618 ath11k_dbg(ab, ATH11K_DBG_PCI, in ath11k_pcic_ext_irq_config()
625 ath11k_err(ab, "failed request irq %d: %d\n", in ath11k_pcic_ext_irq_config()
628 irq_grp = &ab->ext_irq_grp[n]; in ath11k_pcic_ext_irq_config()
643 irq_grp = &ab->ext_irq_grp[n]; in ath11k_pcic_ext_irq_config()
649 int ath11k_pcic_config_irq(struct ath11k_base *ab) in ath11k_pcic_config_irq() argument
659 ret = ath11k_pcic_get_user_msi_assignment(ab, "CE", &msi_data_count, in ath11k_pcic_config_irq()
665 if (!test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) in ath11k_pcic_config_irq()
669 for (i = 0, msi_data_idx = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pcic_config_irq()
670 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pcic_config_irq()
674 irq = ath11k_pcic_get_msi_irq(ab, msi_data); in ath11k_pcic_config_irq()
678 ce_pipe = &ab->ce.ce_pipe[i]; in ath11k_pcic_config_irq()
687 ath11k_err(ab, "failed to request irq %d: %d\n", in ath11k_pcic_config_irq()
692 ab->irq_num[irq_idx] = irq; in ath11k_pcic_config_irq()
695 ath11k_pcic_ce_irq_disable(ab, i); in ath11k_pcic_config_irq()
698 ret = ath11k_pcic_ext_irq_config(ab); in ath11k_pcic_config_irq()
706 void ath11k_pcic_ce_irqs_enable(struct ath11k_base *ab) in ath11k_pcic_ce_irqs_enable() argument
710 set_bit(ATH11K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags); in ath11k_pcic_ce_irqs_enable()
712 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pcic_ce_irqs_enable()
713 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pcic_ce_irqs_enable()
715 ath11k_pcic_ce_irq_enable(ab, i); in ath11k_pcic_ce_irqs_enable()
720 static void ath11k_pcic_kill_tasklets(struct ath11k_base *ab) in ath11k_pcic_kill_tasklets() argument
724 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pcic_kill_tasklets()
725 struct ath11k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i]; in ath11k_pcic_kill_tasklets()
727 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pcic_kill_tasklets()
734 void ath11k_pcic_ce_irq_disable_sync(struct ath11k_base *ab) in ath11k_pcic_ce_irq_disable_sync() argument
736 ath11k_pcic_ce_irqs_disable(ab); in ath11k_pcic_ce_irq_disable_sync()
737 ath11k_pcic_sync_ce_irqs(ab); in ath11k_pcic_ce_irq_disable_sync()
738 ath11k_pcic_kill_tasklets(ab); in ath11k_pcic_ce_irq_disable_sync()
742 void ath11k_pcic_stop(struct ath11k_base *ab) in ath11k_pcic_stop() argument
744 ath11k_pcic_ce_irq_disable_sync(ab); in ath11k_pcic_stop()
745 ath11k_ce_cleanup_pipes(ab); in ath11k_pcic_stop()
749 int ath11k_pcic_start(struct ath11k_base *ab) in ath11k_pcic_start() argument
751 set_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags); in ath11k_pcic_start()
753 ath11k_pcic_ce_irqs_enable(ab); in ath11k_pcic_start()
754 ath11k_ce_rx_post_buf(ab); in ath11k_pcic_start()
760 int ath11k_pcic_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, in ath11k_pcic_map_service_to_pipe() argument
767 for (i = 0; i < ab->hw_params.svc_to_ce_map_len; i++) { in ath11k_pcic_map_service_to_pipe()
768 entry = &ab->hw_params.svc_to_ce_map[i]; in ath11k_pcic_map_service_to_pipe()
804 int ath11k_pcic_register_pci_ops(struct ath11k_base *ab, in ath11k_pcic_register_pci_ops() argument
815 ab->pci.ops = pci_ops; in ath11k_pcic_register_pci_ops()
820 void ath11k_pci_enable_ce_irqs_except_wake_irq(struct ath11k_base *ab) in ath11k_pci_enable_ce_irqs_except_wake_irq() argument
824 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pci_enable_ce_irqs_except_wake_irq()
825 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR || in ath11k_pci_enable_ce_irqs_except_wake_irq()
828 ath11k_pcic_ce_irq_enable(ab, i); in ath11k_pci_enable_ce_irqs_except_wake_irq()
833 void ath11k_pci_disable_ce_irqs_except_wake_irq(struct ath11k_base *ab) in ath11k_pci_disable_ce_irqs_except_wake_irq() argument
839 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pci_disable_ce_irqs_except_wake_irq()
840 ce_pipe = &ab->ce.ce_pipe[i]; in ath11k_pci_disable_ce_irqs_except_wake_irq()
843 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR || in ath11k_pci_disable_ce_irqs_except_wake_irq()
847 disable_irq_nosync(ab->irq_num[irq_idx]); in ath11k_pci_disable_ce_irqs_except_wake_irq()
848 synchronize_irq(ab->irq_num[irq_idx]); in ath11k_pci_disable_ce_irqs_except_wake_irq()