• Home
  • Raw
  • Download

Lines Matching refs:ab

120 	struct ath11k_base *ab = ab_pci->ab;  in ath11k_pci_select_window()  local
128 ab->mem + WINDOW_REG_ADDRESS); in ath11k_pci_select_window()
133 void ath11k_pci_write32(struct ath11k_base *ab, u32 offset, u32 value) in ath11k_pci_write32() argument
135 struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); in ath11k_pci_write32()
145 iowrite32(value, ab->mem + offset); in ath11k_pci_write32()
149 iowrite32(value, ab->mem + WINDOW_START + (offset & WINDOW_RANGE_MASK)); in ath11k_pci_write32()
158 u32 ath11k_pci_read32(struct ath11k_base *ab, u32 offset) in ath11k_pci_read32() argument
160 struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); in ath11k_pci_read32()
171 val = ioread32(ab->mem + offset); in ath11k_pci_read32()
175 val = ioread32(ab->mem + WINDOW_START + (offset & WINDOW_RANGE_MASK)); in ath11k_pci_read32()
186 static void ath11k_pci_soc_global_reset(struct ath11k_base *ab) in ath11k_pci_soc_global_reset() argument
190 val = ath11k_pci_read32(ab, PCIE_SOC_GLOBAL_RESET); in ath11k_pci_soc_global_reset()
194 ath11k_pci_write32(ab, PCIE_SOC_GLOBAL_RESET, val); in ath11k_pci_soc_global_reset()
203 ath11k_pci_write32(ab, PCIE_SOC_GLOBAL_RESET, val); in ath11k_pci_soc_global_reset()
207 val = ath11k_pci_read32(ab, PCIE_SOC_GLOBAL_RESET); in ath11k_pci_soc_global_reset()
209 ath11k_warn(ab, "link down error during global reset\n"); in ath11k_pci_soc_global_reset()
212 static void ath11k_pci_clear_dbg_registers(struct ath11k_base *ab) in ath11k_pci_clear_dbg_registers() argument
217 val = ath11k_pci_read32(ab, PCIE_Q6_COOKIE_ADDR); in ath11k_pci_clear_dbg_registers()
218 ath11k_dbg(ab, ATH11K_DBG_PCI, "cookie:0x%x\n", val); in ath11k_pci_clear_dbg_registers()
220 val = ath11k_pci_read32(ab, WLAON_WARM_SW_ENTRY); in ath11k_pci_clear_dbg_registers()
221 ath11k_dbg(ab, ATH11K_DBG_PCI, "WLAON_WARM_SW_ENTRY 0x%x\n", val); in ath11k_pci_clear_dbg_registers()
229 ath11k_pci_write32(ab, WLAON_WARM_SW_ENTRY, 0); in ath11k_pci_clear_dbg_registers()
232 val = ath11k_pci_read32(ab, WLAON_WARM_SW_ENTRY); in ath11k_pci_clear_dbg_registers()
233 ath11k_dbg(ab, ATH11K_DBG_PCI, "WLAON_WARM_SW_ENTRY 0x%x\n", val); in ath11k_pci_clear_dbg_registers()
238 val = ath11k_pci_read32(ab, WLAON_SOC_RESET_CAUSE_REG); in ath11k_pci_clear_dbg_registers()
239 ath11k_dbg(ab, ATH11K_DBG_PCI, "soc reset cause:%d\n", val); in ath11k_pci_clear_dbg_registers()
242 static void ath11k_pci_force_wake(struct ath11k_base *ab) in ath11k_pci_force_wake() argument
244 ath11k_pci_write32(ab, PCIE_SOC_WAKE_PCIE_LOCAL_REG, 1); in ath11k_pci_force_wake()
248 static void ath11k_pci_sw_reset(struct ath11k_base *ab) in ath11k_pci_sw_reset() argument
250 ath11k_pci_soc_global_reset(ab); in ath11k_pci_sw_reset()
251 ath11k_mhi_clear_vector(ab); in ath11k_pci_sw_reset()
252 ath11k_pci_soc_global_reset(ab); in ath11k_pci_sw_reset()
253 ath11k_mhi_set_mhictrl_reset(ab); in ath11k_pci_sw_reset()
254 ath11k_pci_clear_dbg_registers(ab); in ath11k_pci_sw_reset()
264 static void ath11k_pci_get_msi_address(struct ath11k_base *ab, u32 *msi_addr_lo, in ath11k_pci_get_msi_address() argument
267 struct pci_dev *pci_dev = to_pci_dev(ab->dev); in ath11k_pci_get_msi_address()
280 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_get_user_msi_assignment() local
290 …ath11k_dbg(ab, ATH11K_DBG_PCI, "Assign MSI to user: %s, num_vectors: %d, user_base_data: %u, base_… in ath11k_pci_get_user_msi_assignment()
298 ath11k_err(ab, "Failed to find MSI assignment for %s!\n", user_name); in ath11k_pci_get_user_msi_assignment()
303 static int ath11k_get_user_msi_assignment(struct ath11k_base *ab, char *user_name, in ath11k_get_user_msi_assignment() argument
307 struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); in ath11k_get_user_msi_assignment()
314 static void ath11k_pci_free_ext_irq(struct ath11k_base *ab) in ath11k_pci_free_ext_irq() argument
319 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_pci_free_ext_irq()
322 free_irq(ab->irq_num[irq_grp->irqs[j]], irq_grp); in ath11k_pci_free_ext_irq()
328 static void ath11k_pci_free_irq(struct ath11k_base *ab) in ath11k_pci_free_irq() argument
332 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pci_free_irq()
333 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pci_free_irq()
336 free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); in ath11k_pci_free_irq()
339 ath11k_pci_free_ext_irq(ab); in ath11k_pci_free_irq()
342 static void ath11k_pci_ce_irq_enable(struct ath11k_base *ab, u16 ce_id) in ath11k_pci_ce_irq_enable() argument
347 enable_irq(ab->irq_num[irq_idx]); in ath11k_pci_ce_irq_enable()
350 static void ath11k_pci_ce_irq_disable(struct ath11k_base *ab, u16 ce_id) in ath11k_pci_ce_irq_disable() argument
355 disable_irq_nosync(ab->irq_num[irq_idx]); in ath11k_pci_ce_irq_disable()
358 static void ath11k_pci_ce_irqs_disable(struct ath11k_base *ab) in ath11k_pci_ce_irqs_disable() argument
362 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pci_ce_irqs_disable()
363 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pci_ce_irqs_disable()
365 ath11k_pci_ce_irq_disable(ab, i); in ath11k_pci_ce_irqs_disable()
369 static void ath11k_pci_sync_ce_irqs(struct ath11k_base *ab) in ath11k_pci_sync_ce_irqs() argument
374 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pci_sync_ce_irqs()
375 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pci_sync_ce_irqs()
379 synchronize_irq(ab->irq_num[irq_idx]); in ath11k_pci_sync_ce_irqs()
387 ath11k_ce_per_engine_service(ce_pipe->ab, ce_pipe->pipe_num); in ath11k_pci_ce_tasklet()
389 ath11k_pci_ce_irq_enable(ce_pipe->ab, ce_pipe->pipe_num); in ath11k_pci_ce_tasklet()
396 ath11k_pci_ce_irq_disable(ce_pipe->ab, ce_pipe->pipe_num); in ath11k_pci_ce_interrupt_handler()
407 disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_pci_ext_grp_disable()
432 enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_pci_ext_grp_enable()
435 static void ath11k_pci_ext_irq_enable(struct ath11k_base *ab) in ath11k_pci_ext_irq_enable() argument
440 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_pci_ext_irq_enable()
450 static void ath11k_pci_sync_ext_irqs(struct ath11k_base *ab) in ath11k_pci_sync_ext_irqs() argument
455 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_pci_sync_ext_irqs()
459 synchronize_irq(ab->irq_num[irq_idx]); in ath11k_pci_sync_ext_irqs()
464 static void ath11k_pci_ext_irq_disable(struct ath11k_base *ab) in ath11k_pci_ext_irq_disable() argument
466 __ath11k_pci_ext_irq_disable(ab); in ath11k_pci_ext_irq_disable()
467 ath11k_pci_sync_ext_irqs(ab); in ath11k_pci_ext_irq_disable()
475 struct ath11k_base *ab = irq_grp->ab; in ath11k_pci_ext_grp_napi_poll() local
478 work_done = ath11k_dp_service_srng(ab, irq_grp, budget); in ath11k_pci_ext_grp_napi_poll()
494 ath11k_dbg(irq_grp->ab, ATH11K_DBG_PCI, "ext irq:%d\n", irq); in ath11k_pci_ext_interrupt_handler()
503 static int ath11k_pci_ext_irq_config(struct ath11k_base *ab) in ath11k_pci_ext_irq_config() argument
508 ret = ath11k_pci_get_user_msi_assignment(ath11k_pci_priv(ab), "DP", in ath11k_pci_ext_irq_config()
516 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_pci_ext_irq_config()
519 irq_grp->ab = ab; in ath11k_pci_ext_irq_config()
525 if (ab->hw_params.ring_mask->tx[i] || in ath11k_pci_ext_irq_config()
526 ab->hw_params.ring_mask->rx[i] || in ath11k_pci_ext_irq_config()
527 ab->hw_params.ring_mask->rx_err[i] || in ath11k_pci_ext_irq_config()
528 ab->hw_params.ring_mask->rx_wbm_rel[i] || in ath11k_pci_ext_irq_config()
529 ab->hw_params.ring_mask->reo_status[i] || in ath11k_pci_ext_irq_config()
530 ab->hw_params.ring_mask->rxdma2host[i] || in ath11k_pci_ext_irq_config()
531 ab->hw_params.ring_mask->host2rxdma[i] || in ath11k_pci_ext_irq_config()
532 ab->hw_params.ring_mask->rx_mon_status[i]) { in ath11k_pci_ext_irq_config()
542 int irq = ath11k_pci_get_msi_irq(ab->dev, vector); in ath11k_pci_ext_irq_config()
544 ab->irq_num[irq_idx] = irq; in ath11k_pci_ext_irq_config()
546 ath11k_dbg(ab, ATH11K_DBG_PCI, in ath11k_pci_ext_irq_config()
552 ath11k_err(ab, "failed request irq %d: %d\n", in ath11k_pci_ext_irq_config()
557 disable_irq_nosync(ab->irq_num[irq_idx]); in ath11k_pci_ext_irq_config()
564 static int ath11k_pci_config_irq(struct ath11k_base *ab) in ath11k_pci_config_irq() argument
573 ret = ath11k_pci_get_user_msi_assignment(ath11k_pci_priv(ab), in ath11k_pci_config_irq()
580 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pci_config_irq()
582 irq = ath11k_pci_get_msi_irq(ab->dev, msi_data); in ath11k_pci_config_irq()
583 ce_pipe = &ab->ce.ce_pipe[i]; in ath11k_pci_config_irq()
585 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pci_config_irq()
597 ath11k_err(ab, "failed to request irq %d: %d\n", in ath11k_pci_config_irq()
602 ab->irq_num[irq_idx] = irq; in ath11k_pci_config_irq()
603 ath11k_pci_ce_irq_disable(ab, i); in ath11k_pci_config_irq()
606 ret = ath11k_pci_ext_irq_config(ab); in ath11k_pci_config_irq()
613 static void ath11k_pci_init_qmi_ce_config(struct ath11k_base *ab) in ath11k_pci_init_qmi_ce_config() argument
615 struct ath11k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; in ath11k_pci_init_qmi_ce_config()
617 cfg->tgt_ce = ab->hw_params.target_ce_config; in ath11k_pci_init_qmi_ce_config()
618 cfg->tgt_ce_len = ab->hw_params.target_ce_count; in ath11k_pci_init_qmi_ce_config()
620 cfg->svc_to_ce_map = ab->hw_params.svc_to_ce_map; in ath11k_pci_init_qmi_ce_config()
621 cfg->svc_to_ce_map_len = ab->hw_params.svc_to_ce_map_len; in ath11k_pci_init_qmi_ce_config()
622 ab->qmi.service_ins_id = ATH11K_QMI_WLFW_SERVICE_INS_ID_V01_QCA6390; in ath11k_pci_init_qmi_ce_config()
624 ath11k_ce_get_shadow_config(ab, &cfg->shadow_reg_v2, in ath11k_pci_init_qmi_ce_config()
628 static void ath11k_pci_ce_irqs_enable(struct ath11k_base *ab) in ath11k_pci_ce_irqs_enable() argument
632 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pci_ce_irqs_enable()
633 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pci_ce_irqs_enable()
635 ath11k_pci_ce_irq_enable(ab, i); in ath11k_pci_ce_irqs_enable()
641 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_enable_msi() local
651 ath11k_err(ab, "failed to get %d MSI vectors, only %d available", in ath11k_pci_enable_msi()
662 ath11k_err(ab, "msi_desc is NULL!\n"); in ath11k_pci_enable_msi()
669 ath11k_dbg(ab, ATH11K_DBG_PCI, "msi base data is %d\n", ab_pci->msi_ep_base_data); in ath11k_pci_enable_msi()
686 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_claim() local
692 ath11k_err(ab, "pci device id mismatch: 0x%x 0x%x\n", in ath11k_pci_claim()
700 ath11k_err(ab, "failed to assign pci resource: %d\n", ret); in ath11k_pci_claim()
706 ath11k_err(ab, "failed to enable pci device: %d\n", ret); in ath11k_pci_claim()
712 ath11k_err(ab, "failed to request pci region: %d\n", ret); in ath11k_pci_claim()
718 ath11k_err(ab, "failed to set pci dma mask to %d: %d\n", in ath11k_pci_claim()
725 ath11k_err(ab, "failed to set pci consistent dma mask to %d: %d\n", in ath11k_pci_claim()
732 ab->mem_len = pci_resource_len(pdev, ATH11K_PCI_BAR_NUM); in ath11k_pci_claim()
733 ab->mem = pci_iomap(pdev, ATH11K_PCI_BAR_NUM, 0); in ath11k_pci_claim()
734 if (!ab->mem) { in ath11k_pci_claim()
735 ath11k_err(ab, "failed to map pci bar %d\n", ATH11K_PCI_BAR_NUM); in ath11k_pci_claim()
740 ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot pci_mem 0x%pK\n", ab->mem); in ath11k_pci_claim()
755 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_free_region() local
758 pci_iounmap(pci_dev, ab->mem); in ath11k_pci_free_region()
759 ab->mem = NULL; in ath11k_pci_free_region()
766 static int ath11k_pci_power_up(struct ath11k_base *ab) in ath11k_pci_power_up() argument
768 struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); in ath11k_pci_power_up()
773 ath11k_pci_sw_reset(ab_pci->ab); in ath11k_pci_power_up()
777 ath11k_err(ab, "failed to start mhi: %d\n", ret); in ath11k_pci_power_up()
784 static void ath11k_pci_power_down(struct ath11k_base *ab) in ath11k_pci_power_down() argument
786 struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); in ath11k_pci_power_down()
790 ath11k_pci_force_wake(ab_pci->ab); in ath11k_pci_power_down()
791 ath11k_pci_sw_reset(ab_pci->ab); in ath11k_pci_power_down()
794 static void ath11k_pci_kill_tasklets(struct ath11k_base *ab) in ath11k_pci_kill_tasklets() argument
798 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_pci_kill_tasklets()
799 struct ath11k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i]; in ath11k_pci_kill_tasklets()
801 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_pci_kill_tasklets()
808 static void ath11k_pci_stop(struct ath11k_base *ab) in ath11k_pci_stop() argument
810 ath11k_pci_ce_irqs_disable(ab); in ath11k_pci_stop()
811 ath11k_pci_sync_ce_irqs(ab); in ath11k_pci_stop()
812 ath11k_pci_kill_tasklets(ab); in ath11k_pci_stop()
813 ath11k_ce_cleanup_pipes(ab); in ath11k_pci_stop()
816 static int ath11k_pci_start(struct ath11k_base *ab) in ath11k_pci_start() argument
818 struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); in ath11k_pci_start()
822 ath11k_pci_ce_irqs_enable(ab); in ath11k_pci_start()
823 ath11k_ce_rx_post_buf(ab); in ath11k_pci_start()
828 static int ath11k_pci_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, in ath11k_pci_map_service_to_pipe() argument
835 for (i = 0; i < ab->hw_params.svc_to_ce_map_len; i++) { in ath11k_pci_map_service_to_pipe()
836 entry = &ab->hw_params.svc_to_ce_map[i]; in ath11k_pci_map_service_to_pipe()
888 struct ath11k_base *ab; in ath11k_pci_probe() local
895 ab = ath11k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH11K_BUS_PCI, in ath11k_pci_probe()
897 if (!ab) { in ath11k_pci_probe()
902 ab->dev = &pdev->dev; in ath11k_pci_probe()
903 pci_set_drvdata(pdev, ab); in ath11k_pci_probe()
904 ab_pci = ath11k_pci_priv(ab); in ath11k_pci_probe()
906 ab_pci->ab = ab; in ath11k_pci_probe()
908 ab->hif.ops = &ath11k_pci_hif_ops; in ath11k_pci_probe()
909 pci_set_drvdata(pdev, ab); in ath11k_pci_probe()
914 ath11k_err(ab, "failed to claim device: %d\n", ret); in ath11k_pci_probe()
920 soc_hw_version = ath11k_pci_read32(ab, TCSR_SOC_HW_VERSION); in ath11k_pci_probe()
926 ath11k_dbg(ab, ATH11K_DBG_PCI, "pci tcsr_soc_hw_version major %d minor %d\n", in ath11k_pci_probe()
931 ab->hw_rev = ATH11K_HW_QCA6390_HW20; in ath11k_pci_probe()
949 ath11k_err(ab, "failed to enable msi: %d\n", ret); in ath11k_pci_probe()
953 ret = ath11k_core_pre_init(ab); in ath11k_pci_probe()
959 ath11k_err(ab, "failed to register mhi: %d\n", ret); in ath11k_pci_probe()
963 ret = ath11k_hal_srng_init(ab); in ath11k_pci_probe()
967 ret = ath11k_ce_alloc_pipes(ab); in ath11k_pci_probe()
969 ath11k_err(ab, "failed to allocate ce pipes: %d\n", ret); in ath11k_pci_probe()
973 ath11k_pci_init_qmi_ce_config(ab); in ath11k_pci_probe()
975 ret = ath11k_pci_config_irq(ab); in ath11k_pci_probe()
977 ath11k_err(ab, "failed to config irq: %d\n", ret); in ath11k_pci_probe()
981 ret = ath11k_core_init(ab); in ath11k_pci_probe()
983 ath11k_err(ab, "failed to init core: %d\n", ret); in ath11k_pci_probe()
989 ath11k_pci_free_irq(ab); in ath11k_pci_probe()
992 ath11k_ce_free_pipes(ab); in ath11k_pci_probe()
995 ath11k_hal_srng_deinit(ab); in ath11k_pci_probe()
1007 ath11k_core_free(ab); in ath11k_pci_probe()
1014 struct ath11k_base *ab = pci_get_drvdata(pdev); in ath11k_pci_remove() local
1015 struct ath11k_pci *ab_pci = ath11k_pci_priv(ab); in ath11k_pci_remove()
1017 set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags); in ath11k_pci_remove()
1019 ath11k_core_deinit(ab); in ath11k_pci_remove()
1023 ath11k_pci_free_irq(ab); in ath11k_pci_remove()
1027 ath11k_hal_srng_deinit(ab); in ath11k_pci_remove()
1028 ath11k_ce_free_pipes(ab); in ath11k_pci_remove()
1029 ath11k_core_free(ab); in ath11k_pci_remove()
1034 struct ath11k_base *ab = pci_get_drvdata(pdev); in ath11k_pci_shutdown() local
1036 ath11k_pci_power_down(ab); in ath11k_pci_shutdown()