Lines Matching full:ab

137 static int ath12k_pci_bus_wake_up(struct ath12k_base *ab)  in ath12k_pci_bus_wake_up()  argument
139 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_bus_wake_up()
144 static void ath12k_pci_bus_release(struct ath12k_base *ab) in ath12k_pci_bus_release() argument
146 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_bus_release()
163 struct ath12k_base *ab = ab_pci->ab; in ath12k_pci_select_window() local
176 ab->mem + WINDOW_REG_ADDRESS); in ath12k_pci_select_window()
177 ioread32(ab->mem + WINDOW_REG_ADDRESS); in ath12k_pci_select_window()
194 iowrite32(WINDOW_ENABLE_BIT | window, ab_pci->ab->mem + WINDOW_REG_ADDRESS); in ath12k_pci_select_static_window()
197 static u32 ath12k_pci_get_window_start(struct ath12k_base *ab, in ath12k_pci_get_window_start() argument
219 static void ath12k_pci_soc_global_reset(struct ath12k_base *ab) in ath12k_pci_soc_global_reset() argument
223 val = ath12k_pci_read32(ab, PCIE_SOC_GLOBAL_RESET); in ath12k_pci_soc_global_reset()
227 ath12k_pci_write32(ab, PCIE_SOC_GLOBAL_RESET, val); in ath12k_pci_soc_global_reset()
236 ath12k_pci_write32(ab, PCIE_SOC_GLOBAL_RESET, val); in ath12k_pci_soc_global_reset()
240 val = ath12k_pci_read32(ab, PCIE_SOC_GLOBAL_RESET); in ath12k_pci_soc_global_reset()
242 ath12k_warn(ab, "link down error during global reset\n"); in ath12k_pci_soc_global_reset()
245 static void ath12k_pci_clear_dbg_registers(struct ath12k_base *ab) in ath12k_pci_clear_dbg_registers() argument
250 val = ath12k_pci_read32(ab, PCIE_Q6_COOKIE_ADDR); in ath12k_pci_clear_dbg_registers()
251 ath12k_dbg(ab, ATH12K_DBG_PCI, "cookie:0x%x\n", val); in ath12k_pci_clear_dbg_registers()
253 val = ath12k_pci_read32(ab, WLAON_WARM_SW_ENTRY); in ath12k_pci_clear_dbg_registers()
254 ath12k_dbg(ab, ATH12K_DBG_PCI, "WLAON_WARM_SW_ENTRY 0x%x\n", val); in ath12k_pci_clear_dbg_registers()
262 ath12k_pci_write32(ab, WLAON_WARM_SW_ENTRY, 0); in ath12k_pci_clear_dbg_registers()
265 val = ath12k_pci_read32(ab, WLAON_WARM_SW_ENTRY); in ath12k_pci_clear_dbg_registers()
266 ath12k_dbg(ab, ATH12K_DBG_PCI, "WLAON_WARM_SW_ENTRY 0x%x\n", val); in ath12k_pci_clear_dbg_registers()
271 val = ath12k_pci_read32(ab, WLAON_SOC_RESET_CAUSE_REG); in ath12k_pci_clear_dbg_registers()
272 ath12k_dbg(ab, ATH12K_DBG_PCI, "soc reset cause:%d\n", val); in ath12k_pci_clear_dbg_registers()
275 static void ath12k_pci_enable_ltssm(struct ath12k_base *ab) in ath12k_pci_enable_ltssm() argument
280 val = ath12k_pci_read32(ab, PCIE_PCIE_PARF_LTSSM); in ath12k_pci_enable_ltssm()
287 ath12k_pci_write32(ab, PCIE_PCIE_PARF_LTSSM, PARM_LTSSM_VALUE); in ath12k_pci_enable_ltssm()
288 val = ath12k_pci_read32(ab, PCIE_PCIE_PARF_LTSSM); in ath12k_pci_enable_ltssm()
291 ath12k_dbg(ab, ATH12K_DBG_PCI, "pci ltssm 0x%x\n", val); in ath12k_pci_enable_ltssm()
293 val = ath12k_pci_read32(ab, GCC_GCC_PCIE_HOT_RST); in ath12k_pci_enable_ltssm()
295 ath12k_pci_write32(ab, GCC_GCC_PCIE_HOT_RST, val); in ath12k_pci_enable_ltssm()
296 val = ath12k_pci_read32(ab, GCC_GCC_PCIE_HOT_RST); in ath12k_pci_enable_ltssm()
298 ath12k_dbg(ab, ATH12K_DBG_PCI, "pci pcie_hot_rst 0x%x\n", val); in ath12k_pci_enable_ltssm()
303 static void ath12k_pci_clear_all_intrs(struct ath12k_base *ab) in ath12k_pci_clear_all_intrs() argument
310 ath12k_pci_write32(ab, PCIE_PCIE_INT_ALL_CLEAR, PCIE_INT_CLEAR_ALL); in ath12k_pci_clear_all_intrs()
313 static void ath12k_pci_set_wlaon_pwr_ctrl(struct ath12k_base *ab) in ath12k_pci_set_wlaon_pwr_ctrl() argument
317 val = ath12k_pci_read32(ab, WLAON_QFPROM_PWR_CTRL_REG); in ath12k_pci_set_wlaon_pwr_ctrl()
319 ath12k_pci_write32(ab, WLAON_QFPROM_PWR_CTRL_REG, val); in ath12k_pci_set_wlaon_pwr_ctrl()
322 static void ath12k_pci_force_wake(struct ath12k_base *ab) in ath12k_pci_force_wake() argument
324 ath12k_pci_write32(ab, PCIE_SOC_WAKE_PCIE_LOCAL_REG, 1); in ath12k_pci_force_wake()
328 static void ath12k_pci_sw_reset(struct ath12k_base *ab, bool power_on) in ath12k_pci_sw_reset() argument
331 ath12k_pci_enable_ltssm(ab); in ath12k_pci_sw_reset()
332 ath12k_pci_clear_all_intrs(ab); in ath12k_pci_sw_reset()
333 ath12k_pci_set_wlaon_pwr_ctrl(ab); in ath12k_pci_sw_reset()
336 ath12k_mhi_clear_vector(ab); in ath12k_pci_sw_reset()
337 ath12k_pci_clear_dbg_registers(ab); in ath12k_pci_sw_reset()
338 ath12k_pci_soc_global_reset(ab); in ath12k_pci_sw_reset()
339 ath12k_mhi_set_mhictrl_reset(ab); in ath12k_pci_sw_reset()
342 static void ath12k_pci_free_ext_irq(struct ath12k_base *ab) in ath12k_pci_free_ext_irq() argument
347 struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath12k_pci_free_ext_irq()
350 free_irq(ab->irq_num[irq_grp->irqs[j]], irq_grp); in ath12k_pci_free_ext_irq()
357 static void ath12k_pci_free_irq(struct ath12k_base *ab) in ath12k_pci_free_irq() argument
361 for (i = 0; i < ab->hw_params->ce_count; i++) { in ath12k_pci_free_irq()
362 if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath12k_pci_free_irq()
365 free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); in ath12k_pci_free_irq()
368 ath12k_pci_free_ext_irq(ab); in ath12k_pci_free_irq()
371 static void ath12k_pci_ce_irq_enable(struct ath12k_base *ab, u16 ce_id) in ath12k_pci_ce_irq_enable() argument
373 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_ce_irq_enable()
383 enable_irq(ab->irq_num[irq_idx]); in ath12k_pci_ce_irq_enable()
386 static void ath12k_pci_ce_irq_disable(struct ath12k_base *ab, u16 ce_id) in ath12k_pci_ce_irq_disable() argument
388 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_ce_irq_disable()
398 disable_irq_nosync(ab->irq_num[irq_idx]); in ath12k_pci_ce_irq_disable()
401 static void ath12k_pci_ce_irqs_disable(struct ath12k_base *ab) in ath12k_pci_ce_irqs_disable() argument
405 clear_bit(ATH12K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags); in ath12k_pci_ce_irqs_disable()
407 for (i = 0; i < ab->hw_params->ce_count; i++) { in ath12k_pci_ce_irqs_disable()
408 if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath12k_pci_ce_irqs_disable()
410 ath12k_pci_ce_irq_disable(ab, i); in ath12k_pci_ce_irqs_disable()
414 static void ath12k_pci_sync_ce_irqs(struct ath12k_base *ab) in ath12k_pci_sync_ce_irqs() argument
419 for (i = 0; i < ab->hw_params->ce_count; i++) { in ath12k_pci_sync_ce_irqs()
420 if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath12k_pci_sync_ce_irqs()
424 synchronize_irq(ab->irq_num[irq_idx]); in ath12k_pci_sync_ce_irqs()
433 ath12k_ce_per_engine_service(ce_pipe->ab, ce_pipe->pipe_num); in ath12k_pci_ce_tasklet()
435 enable_irq(ce_pipe->ab->irq_num[irq_idx]); in ath12k_pci_ce_tasklet()
441 struct ath12k_base *ab = ce_pipe->ab; in ath12k_pci_ce_interrupt_handler() local
444 if (!test_bit(ATH12K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags)) in ath12k_pci_ce_interrupt_handler()
450 disable_irq_nosync(ab->irq_num[irq_idx]); in ath12k_pci_ce_interrupt_handler()
459 struct ath12k_pci *ab_pci = ath12k_pci_priv(irq_grp->ab); in ath12k_pci_ext_grp_disable()
469 disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath12k_pci_ext_grp_disable()
472 static void __ath12k_pci_ext_irq_disable(struct ath12k_base *ab) in __ath12k_pci_ext_irq_disable() argument
476 if (!test_and_clear_bit(ATH12K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags)) in __ath12k_pci_ext_irq_disable()
480 struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in __ath12k_pci_ext_irq_disable()
491 struct ath12k_pci *ab_pci = ath12k_pci_priv(irq_grp->ab); in ath12k_pci_ext_grp_enable()
501 enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath12k_pci_ext_grp_enable()
504 static void ath12k_pci_sync_ext_irqs(struct ath12k_base *ab) in ath12k_pci_sync_ext_irqs() argument
509 struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath12k_pci_sync_ext_irqs()
513 synchronize_irq(ab->irq_num[irq_idx]); in ath12k_pci_sync_ext_irqs()
523 struct ath12k_base *ab = irq_grp->ab; in ath12k_pci_ext_grp_napi_poll() local
527 work_done = ath12k_dp_service_srng(ab, irq_grp, budget); in ath12k_pci_ext_grp_napi_poll()
531 enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath12k_pci_ext_grp_napi_poll()
543 struct ath12k_base *ab = irq_grp->ab; in ath12k_pci_ext_interrupt_handler() local
546 if (!test_bit(ATH12K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags)) in ath12k_pci_ext_interrupt_handler()
549 ath12k_dbg(irq_grp->ab, ATH12K_DBG_PCI, "ext irq:%d\n", irq); in ath12k_pci_ext_interrupt_handler()
555 disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath12k_pci_ext_interrupt_handler()
562 static int ath12k_pci_ext_irq_config(struct ath12k_base *ab) in ath12k_pci_ext_irq_config() argument
564 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_ext_irq_config()
570 ret = ath12k_pci_get_user_msi_assignment(ab, "DP", in ath12k_pci_ext_irq_config()
578 irq_grp = &ab->ext_irq_grp[i]; in ath12k_pci_ext_irq_config()
581 irq_grp->ab = ab; in ath12k_pci_ext_irq_config()
592 if (ab->hw_params->ring_mask->tx[i] || in ath12k_pci_ext_irq_config()
593 ab->hw_params->ring_mask->rx[i] || in ath12k_pci_ext_irq_config()
594 ab->hw_params->ring_mask->rx_err[i] || in ath12k_pci_ext_irq_config()
595 ab->hw_params->ring_mask->rx_wbm_rel[i] || in ath12k_pci_ext_irq_config()
596 ab->hw_params->ring_mask->reo_status[i] || in ath12k_pci_ext_irq_config()
597 ab->hw_params->ring_mask->host2rxdma[i] || in ath12k_pci_ext_irq_config()
598 ab->hw_params->ring_mask->rx_mon_dest[i]) { in ath12k_pci_ext_irq_config()
608 int irq = ath12k_pci_get_msi_irq(ab->dev, vector); in ath12k_pci_ext_irq_config()
610 ab->irq_num[irq_idx] = irq; in ath12k_pci_ext_irq_config()
612 ath12k_dbg(ab, ATH12K_DBG_PCI, in ath12k_pci_ext_irq_config()
620 ath12k_err(ab, "failed request irq %d: %d\n", in ath12k_pci_ext_irq_config()
635 irq_grp = &ab->ext_irq_grp[n]; in ath12k_pci_ext_irq_config()
650 static int ath12k_pci_config_irq(struct ath12k_base *ab) in ath12k_pci_config_irq() argument
652 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_config_irq()
660 ret = ath12k_pci_get_user_msi_assignment(ab, in ath12k_pci_config_irq()
668 for (i = 0, msi_data_idx = 0; i < ab->hw_params->ce_count; i++) { in ath12k_pci_config_irq()
669 if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath12k_pci_config_irq()
673 irq = ath12k_pci_get_msi_irq(ab->dev, msi_data); in ath12k_pci_config_irq()
674 ce_pipe = &ab->ce.ce_pipe[i]; in ath12k_pci_config_irq()
684 ath12k_err(ab, "failed to request irq %d: %d\n", in ath12k_pci_config_irq()
689 ab->irq_num[irq_idx] = irq; in ath12k_pci_config_irq()
692 ath12k_pci_ce_irq_disable(ab, i); in ath12k_pci_config_irq()
695 ret = ath12k_pci_ext_irq_config(ab); in ath12k_pci_config_irq()
702 static void ath12k_pci_init_qmi_ce_config(struct ath12k_base *ab) in ath12k_pci_init_qmi_ce_config() argument
704 struct ath12k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; in ath12k_pci_init_qmi_ce_config()
706 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_init_qmi_ce_config()
709 cfg->tgt_ce = ab->hw_params->target_ce_config; in ath12k_pci_init_qmi_ce_config()
710 cfg->tgt_ce_len = ab->hw_params->target_ce_count; in ath12k_pci_init_qmi_ce_config()
712 cfg->svc_to_ce_map = ab->hw_params->svc_to_ce_map; in ath12k_pci_init_qmi_ce_config()
713 cfg->svc_to_ce_map_len = ab->hw_params->svc_to_ce_map_len; in ath12k_pci_init_qmi_ce_config()
714 ab->qmi.service_ins_id = ab->hw_params->qmi_service_ins_id; in ath12k_pci_init_qmi_ce_config()
716 if (test_bit(ATH12K_FW_FEATURE_MULTI_QRTR_ID, ab->fw.fw_features)) { in ath12k_pci_init_qmi_ce_config()
720 ab->qmi.service_ins_id += ab_pci->qmi_instance; in ath12k_pci_init_qmi_ce_config()
724 static void ath12k_pci_ce_irqs_enable(struct ath12k_base *ab) in ath12k_pci_ce_irqs_enable() argument
728 set_bit(ATH12K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags); in ath12k_pci_ce_irqs_enable()
730 for (i = 0; i < ab->hw_params->ce_count; i++) { in ath12k_pci_ce_irqs_enable()
731 if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath12k_pci_ce_irqs_enable()
733 ath12k_pci_ce_irq_enable(ab, i); in ath12k_pci_ce_irqs_enable()
764 struct ath12k_base *ab = ab_pci->ab; in ath12k_pci_msi_alloc() local
790 ath12k_dbg(ab, ATH12K_DBG_PCI, "request MSI one vector\n"); in ath12k_pci_msi_alloc()
793 ath12k_info(ab, "MSI vectors: %d\n", num_vectors); in ath12k_pci_msi_alloc()
799 ath12k_err(ab, "msi_desc is NULL!\n"); in ath12k_pci_msi_alloc()
808 ath12k_dbg(ab, ATH12K_DBG_PCI, "msi base data is %d\n", ab_pci->msi_ep_base_data); in ath12k_pci_msi_alloc()
830 ath12k_err(ab_pci->ab, "msi_desc is NULL!\n"); in ath12k_pci_config_msi_data()
837 ath12k_dbg(ab_pci->ab, ATH12K_DBG_PCI, "pci after request_irq msi_ep_base_data %d\n", in ath12k_pci_config_msi_data()
845 struct ath12k_base *ab = ab_pci->ab; in ath12k_pci_claim() local
851 ath12k_err(ab, "pci device id mismatch: 0x%x 0x%x\n", in ath12k_pci_claim()
859 ath12k_err(ab, "failed to assign pci resource: %d\n", ret); in ath12k_pci_claim()
865 ath12k_err(ab, "failed to enable pci device: %d\n", ret); in ath12k_pci_claim()
871 ath12k_err(ab, "failed to request pci region: %d\n", ret); in ath12k_pci_claim()
878 ath12k_err(ab, "failed to set pci dma mask to %d: %d\n", in ath12k_pci_claim()
885 ab->mem_len = pci_resource_len(pdev, ATH12K_PCI_BAR_NUM); in ath12k_pci_claim()
886 ab->mem = pci_iomap(pdev, ATH12K_PCI_BAR_NUM, 0); in ath12k_pci_claim()
887 if (!ab->mem) { in ath12k_pci_claim()
888 ath12k_err(ab, "failed to map pci bar %d\n", ATH12K_PCI_BAR_NUM); in ath12k_pci_claim()
893 ath12k_dbg(ab, ATH12K_DBG_BOOT, "boot pci_mem 0x%p\n", ab->mem); in ath12k_pci_claim()
906 struct ath12k_base *ab = ab_pci->ab; in ath12k_pci_free_region() local
909 pci_iounmap(pci_dev, ab->mem); in ath12k_pci_free_region()
910 ab->mem = NULL; in ath12k_pci_free_region()
918 struct ath12k_base *ab = ab_pci->ab; in ath12k_pci_aspm_disable() local
923 ath12k_dbg(ab, ATH12K_DBG_PCI, "pci link_ctl 0x%04x L0s %d L1 %d\n", in ath12k_pci_aspm_disable()
935 static void ath12k_pci_update_qrtr_node_id(struct ath12k_base *ab) in ath12k_pci_update_qrtr_node_id() argument
937 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_update_qrtr_node_id()
949 ath12k_pci_write32(ab, reg, ab_pci->qmi_instance); in ath12k_pci_update_qrtr_node_id()
951 ath12k_dbg(ab, ATH12K_DBG_PCI, "pci reg 0x%x instance 0x%x read val 0x%x\n", in ath12k_pci_update_qrtr_node_id()
952 reg, ab_pci->qmi_instance, ath12k_pci_read32(ab, reg)); in ath12k_pci_update_qrtr_node_id()
957 if (ab_pci->ab->hw_params->supports_aspm && in ath12k_pci_aspm_restore()
965 static void ath12k_pci_kill_tasklets(struct ath12k_base *ab) in ath12k_pci_kill_tasklets() argument
969 for (i = 0; i < ab->hw_params->ce_count; i++) { in ath12k_pci_kill_tasklets()
970 struct ath12k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i]; in ath12k_pci_kill_tasklets()
972 if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath12k_pci_kill_tasklets()
979 static void ath12k_pci_ce_irq_disable_sync(struct ath12k_base *ab) in ath12k_pci_ce_irq_disable_sync() argument
981 ath12k_pci_ce_irqs_disable(ab); in ath12k_pci_ce_irq_disable_sync()
982 ath12k_pci_sync_ce_irqs(ab); in ath12k_pci_ce_irq_disable_sync()
983 ath12k_pci_kill_tasklets(ab); in ath12k_pci_ce_irq_disable_sync()
986 int ath12k_pci_map_service_to_pipe(struct ath12k_base *ab, u16 service_id, in ath12k_pci_map_service_to_pipe() argument
993 for (i = 0; i < ab->hw_params->svc_to_ce_map_len; i++) { in ath12k_pci_map_service_to_pipe()
994 entry = &ab->hw_params->svc_to_ce_map[i]; in ath12k_pci_map_service_to_pipe()
1036 int ath12k_pci_get_user_msi_assignment(struct ath12k_base *ab, char *user_name, in ath12k_pci_get_user_msi_assignment() argument
1040 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_get_user_msi_assignment()
1050 ath12k_dbg(ab, ATH12K_DBG_PCI, in ath12k_pci_get_user_msi_assignment()
1059 ath12k_err(ab, "Failed to find MSI assignment for %s!\n", user_name); in ath12k_pci_get_user_msi_assignment()
1064 void ath12k_pci_get_msi_address(struct ath12k_base *ab, u32 *msi_addr_lo, in ath12k_pci_get_msi_address() argument
1067 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_get_msi_address()
1068 struct pci_dev *pci_dev = to_pci_dev(ab->dev); in ath12k_pci_get_msi_address()
1081 void ath12k_pci_get_ce_msi_idx(struct ath12k_base *ab, u32 ce_id, in ath12k_pci_get_ce_msi_idx() argument
1086 for (i = 0, msi_data_idx = 0; i < ab->hw_params->ce_count; i++) { in ath12k_pci_get_ce_msi_idx()
1087 if (ath12k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath12k_pci_get_ce_msi_idx()
1098 void ath12k_pci_hif_ce_irq_enable(struct ath12k_base *ab) in ath12k_pci_hif_ce_irq_enable() argument
1100 ath12k_pci_ce_irqs_enable(ab); in ath12k_pci_hif_ce_irq_enable()
1103 void ath12k_pci_hif_ce_irq_disable(struct ath12k_base *ab) in ath12k_pci_hif_ce_irq_disable() argument
1105 ath12k_pci_ce_irq_disable_sync(ab); in ath12k_pci_hif_ce_irq_disable()
1108 void ath12k_pci_ext_irq_enable(struct ath12k_base *ab) in ath12k_pci_ext_irq_enable() argument
1113 struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath12k_pci_ext_irq_enable()
1119 set_bit(ATH12K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags); in ath12k_pci_ext_irq_enable()
1122 void ath12k_pci_ext_irq_disable(struct ath12k_base *ab) in ath12k_pci_ext_irq_disable() argument
1124 __ath12k_pci_ext_irq_disable(ab); in ath12k_pci_ext_irq_disable()
1125 ath12k_pci_sync_ext_irqs(ab); in ath12k_pci_ext_irq_disable()
1128 int ath12k_pci_hif_suspend(struct ath12k_base *ab) in ath12k_pci_hif_suspend() argument
1130 struct ath12k_pci *ar_pci = ath12k_pci_priv(ab); in ath12k_pci_hif_suspend()
1137 int ath12k_pci_hif_resume(struct ath12k_base *ab) in ath12k_pci_hif_resume() argument
1139 struct ath12k_pci *ar_pci = ath12k_pci_priv(ab); in ath12k_pci_hif_resume()
1146 void ath12k_pci_stop(struct ath12k_base *ab) in ath12k_pci_stop() argument
1148 ath12k_pci_ce_irq_disable_sync(ab); in ath12k_pci_stop()
1149 ath12k_ce_cleanup_pipes(ab); in ath12k_pci_stop()
1152 int ath12k_pci_start(struct ath12k_base *ab) in ath12k_pci_start() argument
1154 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_start()
1161 ath12k_info(ab, "leaving PCI ASPM disabled to avoid MHI M2 problems\n"); in ath12k_pci_start()
1163 ath12k_pci_ce_irqs_enable(ab); in ath12k_pci_start()
1164 ath12k_ce_rx_post_buf(ab); in ath12k_pci_start()
1169 u32 ath12k_pci_read32(struct ath12k_base *ab, u32 offset) in ath12k_pci_read32() argument
1171 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_read32()
1180 ret = ab_pci->pci_ops->wakeup(ab); in ath12k_pci_read32()
1183 val = ioread32(ab->mem + offset); in ath12k_pci_read32()
1185 if (ab->static_window_map) in ath12k_pci_read32()
1186 window_start = ath12k_pci_get_window_start(ab, offset); in ath12k_pci_read32()
1196 val = ioread32(ab->mem + in ath12k_pci_read32()
1199 val = ioread32(ab->mem + window_start + in ath12k_pci_read32()
1204 val = ioread32(ab->mem + window_start + in ath12k_pci_read32()
1212 ab_pci->pci_ops->release(ab); in ath12k_pci_read32()
1216 void ath12k_pci_write32(struct ath12k_base *ab, u32 offset, u32 value) in ath12k_pci_write32() argument
1218 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_write32()
1227 ret = ab_pci->pci_ops->wakeup(ab); in ath12k_pci_write32()
1230 iowrite32(value, ab->mem + offset); in ath12k_pci_write32()
1232 if (ab->static_window_map) in ath12k_pci_write32()
1233 window_start = ath12k_pci_get_window_start(ab, offset); in ath12k_pci_write32()
1243 iowrite32(value, ab->mem + in ath12k_pci_write32()
1246 iowrite32(value, ab->mem + window_start + in ath12k_pci_write32()
1251 iowrite32(value, ab->mem + window_start + in ath12k_pci_write32()
1259 ab_pci->pci_ops->release(ab); in ath12k_pci_write32()
1262 int ath12k_pci_power_up(struct ath12k_base *ab) in ath12k_pci_power_up() argument
1264 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_power_up()
1269 ath12k_pci_sw_reset(ab_pci->ab, true); in ath12k_pci_power_up()
1278 if (test_bit(ATH12K_FW_FEATURE_MULTI_QRTR_ID, ab->fw.fw_features)) in ath12k_pci_power_up()
1279 ath12k_pci_update_qrtr_node_id(ab); in ath12k_pci_power_up()
1283 ath12k_err(ab, "failed to start mhi: %d\n", ret); in ath12k_pci_power_up()
1287 if (ab->static_window_map) in ath12k_pci_power_up()
1293 void ath12k_pci_power_down(struct ath12k_base *ab, bool is_suspend) in ath12k_pci_power_down() argument
1295 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_power_down()
1300 ath12k_pci_force_wake(ab_pci->ab); in ath12k_pci_power_down()
1304 ath12k_pci_sw_reset(ab_pci->ab, false); in ath12k_pci_power_down()
1307 static int ath12k_pci_panic_handler(struct ath12k_base *ab) in ath12k_pci_panic_handler() argument
1309 ath12k_pci_sw_reset(ab, false); in ath12k_pci_panic_handler()
1335 void ath12k_pci_read_hw_version(struct ath12k_base *ab, u32 *major, u32 *minor) in ath12k_pci_read_hw_version() argument
1339 soc_hw_version = ath12k_pci_read32(ab, TCSR_SOC_HW_VERSION); in ath12k_pci_read_hw_version()
1345 ath12k_dbg(ab, ATH12K_DBG_PCI, in ath12k_pci_read_hw_version()
1353 struct ath12k_base *ab; in ath12k_pci_probe() local
1358 ab = ath12k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH12K_BUS_PCI); in ath12k_pci_probe()
1359 if (!ab) { in ath12k_pci_probe()
1364 ab->dev = &pdev->dev; in ath12k_pci_probe()
1365 pci_set_drvdata(pdev, ab); in ath12k_pci_probe()
1366 ab_pci = ath12k_pci_priv(ab); in ath12k_pci_probe()
1368 ab_pci->ab = ab; in ath12k_pci_probe()
1370 ab->hif.ops = &ath12k_pci_hif_ops; in ath12k_pci_probe()
1371 pci_set_drvdata(pdev, ab); in ath12k_pci_probe()
1376 ath12k_err(ab, "failed to claim device: %d\n", ret); in ath12k_pci_probe()
1380 ath12k_dbg(ab, ATH12K_DBG_BOOT, "pci probe %04x:%04x %04x:%04x\n", in ath12k_pci_probe()
1384 ab->id.vendor = pdev->vendor; in ath12k_pci_probe()
1385 ab->id.device = pdev->device; in ath12k_pci_probe()
1386 ab->id.subsystem_vendor = pdev->subsystem_vendor; in ath12k_pci_probe()
1387 ab->id.subsystem_device = pdev->subsystem_device; in ath12k_pci_probe()
1392 ab->static_window_map = true; in ath12k_pci_probe()
1394 ab->hal_rx_ops = &hal_rx_qcn9274_ops; in ath12k_pci_probe()
1395 ath12k_pci_read_hw_version(ab, &soc_hw_version_major, in ath12k_pci_probe()
1399 ab->hw_rev = ATH12K_HW_QCN9274_HW20; in ath12k_pci_probe()
1402 ab->hw_rev = ATH12K_HW_QCN9274_HW10; in ath12k_pci_probe()
1413 ab->id.bdf_search = ATH12K_BDF_SEARCH_BUS_AND_BOARD; in ath12k_pci_probe()
1415 ab->static_window_map = false; in ath12k_pci_probe()
1417 ab->hal_rx_ops = &hal_rx_wcn7850_ops; in ath12k_pci_probe()
1418 ath12k_pci_read_hw_version(ab, &soc_hw_version_major, in ath12k_pci_probe()
1422 ab->hw_rev = ATH12K_HW_WCN7850_HW20; in ath12k_pci_probe()
1442 ath12k_err(ab, "failed to alloc msi: %d\n", ret); in ath12k_pci_probe()
1446 ret = ath12k_core_pre_init(ab); in ath12k_pci_probe()
1452 ath12k_err(ab, "failed to set irq affinity %d\n", ret); in ath12k_pci_probe()
1458 ath12k_err(ab, "failed to register mhi: %d\n", ret); in ath12k_pci_probe()
1462 ret = ath12k_hal_srng_init(ab); in ath12k_pci_probe()
1466 ret = ath12k_ce_alloc_pipes(ab); in ath12k_pci_probe()
1468 ath12k_err(ab, "failed to allocate ce pipes: %d\n", ret); in ath12k_pci_probe()
1472 ath12k_pci_init_qmi_ce_config(ab); in ath12k_pci_probe()
1474 ret = ath12k_pci_config_irq(ab); in ath12k_pci_probe()
1476 ath12k_err(ab, "failed to config irq: %d\n", ret); in ath12k_pci_probe()
1487 ath12k_err(ab, "failed to config msi_data: %d\n", ret); in ath12k_pci_probe()
1491 ret = ath12k_core_init(ab); in ath12k_pci_probe()
1493 ath12k_err(ab, "failed to init core: %d\n", ret); in ath12k_pci_probe()
1499 ath12k_pci_free_irq(ab); in ath12k_pci_probe()
1502 ath12k_ce_free_pipes(ab); in ath12k_pci_probe()
1505 ath12k_hal_srng_deinit(ab); in ath12k_pci_probe()
1520 ath12k_core_free(ab); in ath12k_pci_probe()
1527 struct ath12k_base *ab = pci_get_drvdata(pdev); in ath12k_pci_remove() local
1528 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_remove()
1532 if (test_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags)) { in ath12k_pci_remove()
1533 ath12k_pci_power_down(ab, false); in ath12k_pci_remove()
1534 ath12k_qmi_deinit_service(ab); in ath12k_pci_remove()
1538 set_bit(ATH12K_FLAG_UNREGISTERING, &ab->dev_flags); in ath12k_pci_remove()
1540 cancel_work_sync(&ab->reset_work); in ath12k_pci_remove()
1541 ath12k_core_deinit(ab); in ath12k_pci_remove()
1546 ath12k_pci_free_irq(ab); in ath12k_pci_remove()
1550 ath12k_hal_srng_deinit(ab); in ath12k_pci_remove()
1551 ath12k_ce_free_pipes(ab); in ath12k_pci_remove()
1552 ath12k_core_free(ab); in ath12k_pci_remove()
1557 struct ath12k_base *ab = pci_get_drvdata(pdev); in ath12k_pci_shutdown() local
1558 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_shutdown()
1561 ath12k_pci_power_down(ab, false); in ath12k_pci_shutdown()
1566 struct ath12k_base *ab = dev_get_drvdata(dev); in ath12k_pci_pm_suspend() local
1569 ret = ath12k_core_suspend(ab); in ath12k_pci_pm_suspend()
1571 ath12k_warn(ab, "failed to suspend core: %d\n", ret); in ath12k_pci_pm_suspend()
1578 struct ath12k_base *ab = dev_get_drvdata(dev); in ath12k_pci_pm_resume() local
1581 ret = ath12k_core_resume(ab); in ath12k_pci_pm_resume()
1583 ath12k_warn(ab, "failed to resume core: %d\n", ret); in ath12k_pci_pm_resume()
1590 struct ath12k_base *ab = dev_get_drvdata(dev); in ath12k_pci_pm_suspend_late() local
1593 ret = ath12k_core_suspend_late(ab); in ath12k_pci_pm_suspend_late()
1595 ath12k_warn(ab, "failed to late suspend core: %d\n", ret); in ath12k_pci_pm_suspend_late()
1602 struct ath12k_base *ab = dev_get_drvdata(dev); in ath12k_pci_pm_resume_early() local
1605 ret = ath12k_core_resume_early(ab); in ath12k_pci_pm_resume_early()
1607 ath12k_warn(ab, "failed to early resume core: %d\n", ret); in ath12k_pci_pm_resume_early()