Lines Matching +full:aspm +full:- +full:no +full:- +full:l0s
1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
33 /* BAR0 + 4k is always accessible, and no
35 * 4K - 32 = 0xFE0
80 "mhi-er0",
81 "mhi-er1",
98 "host2wbm-desc-feed",
99 "host2reo-re-injection",
100 "host2reo-command",
101 "host2rxdma-monitor-ring3",
102 "host2rxdma-monitor-ring2",
103 "host2rxdma-monitor-ring1",
104 "reo2ost-exception",
105 "wbm2host-rx-release",
106 "reo2host-status",
107 "reo2host-destination-ring4",
108 "reo2host-destination-ring3",
109 "reo2host-destination-ring2",
110 "reo2host-destination-ring1",
111 "rxdma2host-monitor-destination-mac3",
112 "rxdma2host-monitor-destination-mac2",
113 "rxdma2host-monitor-destination-mac1",
114 "ppdu-end-interrupts-mac3",
115 "ppdu-end-interrupts-mac2",
116 "ppdu-end-interrupts-mac1",
117 "rxdma2host-monitor-status-ring-mac3",
118 "rxdma2host-monitor-status-ring-mac2",
119 "rxdma2host-monitor-status-ring-mac1",
120 "host2rxdma-host-buf-ring-mac3",
121 "host2rxdma-host-buf-ring-mac2",
122 "host2rxdma-host-buf-ring-mac1",
123 "rxdma2host-destination-ring-mac3",
124 "rxdma2host-destination-ring-mac2",
125 "rxdma2host-destination-ring-mac1",
126 "host2tcl-input-ring4",
127 "host2tcl-input-ring3",
128 "host2tcl-input-ring2",
129 "host2tcl-input-ring1",
130 "wbm2host-tx-completions-ring4",
131 "wbm2host-tx-completions-ring3",
132 "wbm2host-tx-completions-ring2",
133 "wbm2host-tx-completions-ring1",
134 "tcl2host-status-ring",
141 return mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); in ath12k_pci_bus_wake_up()
148 mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); in ath12k_pci_bus_release()
163 struct ath12k_base *ab = ab_pci->ab; in ath12k_pci_select_window()
168 lockdep_assert_held(&ab_pci->window_lock); in ath12k_pci_select_window()
171 static_window = ab_pci->register_window & WINDOW_STATIC_MASK; in ath12k_pci_select_window()
174 if (window != ab_pci->register_window) { in ath12k_pci_select_window()
176 ab->mem + WINDOW_REG_ADDRESS); in ath12k_pci_select_window()
177 ioread32(ab->mem + WINDOW_REG_ADDRESS); in ath12k_pci_select_window()
178 ab_pci->register_window = window; in ath12k_pci_select_window()
190 spin_lock_bh(&ab_pci->window_lock); in ath12k_pci_select_static_window()
191 ab_pci->register_window = window; in ath12k_pci_select_static_window()
192 spin_unlock_bh(&ab_pci->window_lock); in ath12k_pci_select_static_window()
194 iowrite32(WINDOW_ENABLE_BIT | window, ab_pci->ab->mem + WINDOW_REG_ADDRESS); in ath12k_pci_select_static_window()
347 struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath12k_pci_free_ext_irq()
349 for (j = 0; j < irq_grp->num_irq; j++) in ath12k_pci_free_ext_irq()
350 free_irq(ab->irq_num[irq_grp->irqs[j]], irq_grp); in ath12k_pci_free_ext_irq()
352 netif_napi_del(&irq_grp->napi); in ath12k_pci_free_ext_irq()
353 free_netdev(irq_grp->napi_ndev); in ath12k_pci_free_ext_irq()
361 for (i = 0; i < ab->hw_params->ce_count; i++) { in ath12k_pci_free_irq()
365 free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); in ath12k_pci_free_irq()
379 if (!test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) in ath12k_pci_ce_irq_enable()
383 enable_irq(ab->irq_num[irq_idx]); in ath12k_pci_ce_irq_enable()
394 if (!test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) in ath12k_pci_ce_irq_disable()
398 disable_irq_nosync(ab->irq_num[irq_idx]); in ath12k_pci_ce_irq_disable()
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()
419 for (i = 0; i < ab->hw_params->ce_count; i++) { in ath12k_pci_sync_ce_irqs()
424 synchronize_irq(ab->irq_num[irq_idx]); in ath12k_pci_sync_ce_irqs()
431 int irq_idx = ATH12K_PCI_IRQ_CE0_OFFSET + ce_pipe->pipe_num; in ath12k_pci_ce_tasklet()
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()
442 int irq_idx = ATH12K_PCI_IRQ_CE0_OFFSET + ce_pipe->pipe_num; in ath12k_pci_ce_interrupt_handler()
444 if (!test_bit(ATH12K_FLAG_CE_IRQ_ENABLED, &ab->dev_flags)) in ath12k_pci_ce_interrupt_handler()
448 ce_pipe->timestamp = jiffies; in ath12k_pci_ce_interrupt_handler()
450 disable_irq_nosync(ab->irq_num[irq_idx]); in ath12k_pci_ce_interrupt_handler()
452 tasklet_schedule(&ce_pipe->intr_tq); in ath12k_pci_ce_interrupt_handler()
459 struct ath12k_pci *ab_pci = ath12k_pci_priv(irq_grp->ab); in ath12k_pci_ext_grp_disable()
465 if (!test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) in ath12k_pci_ext_grp_disable()
468 for (i = 0; i < irq_grp->num_irq; i++) 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()
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()
484 napi_synchronize(&irq_grp->napi); in __ath12k_pci_ext_irq_disable()
485 napi_disable(&irq_grp->napi); in __ath12k_pci_ext_irq_disable()
491 struct ath12k_pci *ab_pci = ath12k_pci_priv(irq_grp->ab); in ath12k_pci_ext_grp_enable()
497 if (!test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) in ath12k_pci_ext_grp_enable()
500 for (i = 0; i < irq_grp->num_irq; i++) in ath12k_pci_ext_grp_enable()
501 enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath12k_pci_ext_grp_enable()
509 struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath12k_pci_sync_ext_irqs()
511 for (j = 0; j < irq_grp->num_irq; j++) { in ath12k_pci_sync_ext_irqs()
512 irq_idx = irq_grp->irqs[j]; 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()
530 for (i = 0; i < irq_grp->num_irq; i++) 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()
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()
552 irq_grp->timestamp = jiffies; in ath12k_pci_ext_interrupt_handler()
554 for (i = 0; i < irq_grp->num_irq; i++) 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()
557 napi_schedule(&irq_grp->napi); in ath12k_pci_ext_interrupt_handler()
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()
582 irq_grp->grp_id = i; in ath12k_pci_ext_irq_config()
583 irq_grp->napi_ndev = alloc_netdev_dummy(0); in ath12k_pci_ext_irq_config()
584 if (!irq_grp->napi_ndev) { in ath12k_pci_ext_irq_config()
585 ret = -ENOMEM; in ath12k_pci_ext_irq_config()
589 netif_napi_add(irq_grp->napi_ndev, &irq_grp->napi, 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()
602 irq_grp->num_irq = num_irq; in ath12k_pci_ext_irq_config()
603 irq_grp->irqs[0] = base_idx + i; in ath12k_pci_ext_irq_config()
605 for (j = 0; j < irq_grp->num_irq; j++) { in ath12k_pci_ext_irq_config()
606 int irq_idx = irq_grp->irqs[j]; 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()
617 ab_pci->irq_flags, in ath12k_pci_ext_irq_config()
631 /* i ->napi_ndev was properly allocated. Free it also */ in ath12k_pci_ext_irq_config()
635 irq_grp = &ab->ext_irq_grp[n]; in ath12k_pci_ext_irq_config()
636 free_netdev(irq_grp->napi_ndev); in ath12k_pci_ext_irq_config()
644 if (test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) in ath12k_pci_set_irq_affinity_hint()
647 return irq_set_affinity_hint(ab_pci->pdev->irq, m); in ath12k_pci_set_irq_affinity_hint()
668 for (i = 0, msi_data_idx = 0; i < ab->hw_params->ce_count; i++) { 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()
678 tasklet_setup(&ce_pipe->intr_tq, ath12k_pci_ce_tasklet); in ath12k_pci_config_irq()
681 ab_pci->irq_flags, irq_name[irq_idx], in ath12k_pci_config_irq()
689 ab->irq_num[irq_idx] = irq; in ath12k_pci_config_irq()
704 struct ath12k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; in ath12k_pci_init_qmi_ce_config()
707 struct pci_bus *bus = ab_pci->pdev->bus; 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()
717 ab_pci->qmi_instance = in ath12k_pci_init_qmi_ce_config()
719 u32_encode_bits(bus->number, BUS_NUMBER_MASK); in ath12k_pci_init_qmi_ce_config()
720 ab->qmi.service_ins_id += ab_pci->qmi_instance; in ath12k_pci_init_qmi_ce_config()
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()
739 struct pci_dev *dev = ab_pci->pdev; in ath12k_pci_msi_config()
742 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control); in ath12k_pci_msi_config()
749 pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control); in ath12k_pci_msi_config()
764 struct ath12k_base *ab = ab_pci->ab; in ath12k_pci_msi_alloc()
765 const struct ath12k_msi_config *msi_config = ab_pci->msi_config; in ath12k_pci_msi_alloc()
770 num_vectors = pci_alloc_irq_vectors(ab_pci->pdev, in ath12k_pci_msi_alloc()
771 msi_config->total_vectors, in ath12k_pci_msi_alloc()
772 msi_config->total_vectors, in ath12k_pci_msi_alloc()
775 if (num_vectors == msi_config->total_vectors) { in ath12k_pci_msi_alloc()
776 set_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags); in ath12k_pci_msi_alloc()
777 ab_pci->irq_flags = IRQF_SHARED; in ath12k_pci_msi_alloc()
779 num_vectors = pci_alloc_irq_vectors(ab_pci->pdev, in ath12k_pci_msi_alloc()
784 ret = -EINVAL; in ath12k_pci_msi_alloc()
787 clear_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags); in ath12k_pci_msi_alloc()
788 ab_pci->msi_config = &msi_config_one_msi; in ath12k_pci_msi_alloc()
789 ab_pci->irq_flags = IRQF_SHARED | IRQF_NOBALANCING; in ath12k_pci_msi_alloc()
797 msi_desc = irq_get_msi_desc(ab_pci->pdev->irq); in ath12k_pci_msi_alloc()
800 ret = -EINVAL; in ath12k_pci_msi_alloc()
804 ab_pci->msi_ep_base_data = msi_desc->msg.data; in ath12k_pci_msi_alloc()
805 if (msi_desc->pci.msi_attrib.is_64) in ath12k_pci_msi_alloc()
806 set_bit(ATH12K_PCI_FLAG_IS_MSI_64, &ab_pci->flags); 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()
813 pci_free_irq_vectors(ab_pci->pdev); in ath12k_pci_msi_alloc()
821 pci_free_irq_vectors(ab_pci->pdev); in ath12k_pci_msi_free()
828 msi_desc = irq_get_msi_desc(ab_pci->pdev->irq); in ath12k_pci_config_msi_data()
830 ath12k_err(ab_pci->ab, "msi_desc is NULL!\n"); in ath12k_pci_config_msi_data()
831 pci_free_irq_vectors(ab_pci->pdev); in ath12k_pci_config_msi_data()
832 return -EINVAL; in ath12k_pci_config_msi_data()
835 ab_pci->msi_ep_base_data = msi_desc->msg.data; 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()
838 ab_pci->msi_ep_base_data); in ath12k_pci_config_msi_data()
845 struct ath12k_base *ab = ab_pci->ab; in ath12k_pci_claim()
850 if (device_id != ab_pci->dev_id) { in ath12k_pci_claim()
852 device_id, ab_pci->dev_id); in ath12k_pci_claim()
853 ret = -EIO; in ath12k_pci_claim()
875 ret = dma_set_mask_and_coherent(&pdev->dev, 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()
889 ret = -EIO; 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()
907 struct pci_dev *pci_dev = ab_pci->pdev; in ath12k_pci_free_region()
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()
920 pcie_capability_read_word(ab_pci->pdev, PCI_EXP_LNKCTL, in ath12k_pci_aspm_disable()
921 &ab_pci->link_ctl); in ath12k_pci_aspm_disable()
923 ath12k_dbg(ab, ATH12K_DBG_PCI, "pci link_ctl 0x%04x L0s %d L1 %d\n", in ath12k_pci_aspm_disable()
924 ab_pci->link_ctl, in ath12k_pci_aspm_disable()
925 u16_get_bits(ab_pci->link_ctl, PCI_EXP_LNKCTL_ASPM_L0S), in ath12k_pci_aspm_disable()
926 u16_get_bits(ab_pci->link_ctl, PCI_EXP_LNKCTL_ASPM_L1)); in ath12k_pci_aspm_disable()
928 /* disable L0s and L1 */ in ath12k_pci_aspm_disable()
929 pcie_capability_clear_word(ab_pci->pdev, PCI_EXP_LNKCTL, in ath12k_pci_aspm_disable()
932 set_bit(ATH12K_PCI_ASPM_RESTORE, &ab_pci->flags); in ath12k_pci_aspm_disable()
941 * with identical qrtr-node-id. Because of this identical ID qrtr-lookup in ath12k_pci_update_qrtr_node_id()
949 ath12k_pci_write32(ab, reg, ab_pci->qmi_instance); 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()
958 test_and_clear_bit(ATH12K_PCI_ASPM_RESTORE, &ab_pci->flags)) in ath12k_pci_aspm_restore()
959 pcie_capability_clear_and_set_word(ab_pci->pdev, PCI_EXP_LNKCTL, in ath12k_pci_aspm_restore()
961 ab_pci->link_ctl & in ath12k_pci_aspm_restore()
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()
975 tasklet_kill(&ce_pipe->intr_tq); in ath12k_pci_kill_tasklets()
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()
996 if (__le32_to_cpu(entry->service_id) != service_id) in ath12k_pci_map_service_to_pipe()
999 switch (__le32_to_cpu(entry->pipedir)) { in ath12k_pci_map_service_to_pipe()
1004 *dl_pipe = __le32_to_cpu(entry->pipenum); in ath12k_pci_map_service_to_pipe()
1009 *ul_pipe = __le32_to_cpu(entry->pipenum); in ath12k_pci_map_service_to_pipe()
1015 *dl_pipe = __le32_to_cpu(entry->pipenum); in ath12k_pci_map_service_to_pipe()
1016 *ul_pipe = __le32_to_cpu(entry->pipenum); in ath12k_pci_map_service_to_pipe()
1024 return -ENOENT; in ath12k_pci_map_service_to_pipe()
1041 const struct ath12k_msi_config *msi_config = ab_pci->msi_config; in ath12k_pci_get_user_msi_assignment()
1044 for (idx = 0; idx < msi_config->total_users; idx++) { in ath12k_pci_get_user_msi_assignment()
1045 if (strcmp(user_name, msi_config->users[idx].name) == 0) { in ath12k_pci_get_user_msi_assignment()
1046 *num_vectors = msi_config->users[idx].num_vectors; in ath12k_pci_get_user_msi_assignment()
1047 *base_vector = msi_config->users[idx].base_vector; in ath12k_pci_get_user_msi_assignment()
1048 *user_base_data = *base_vector + ab_pci->msi_ep_base_data; in ath12k_pci_get_user_msi_assignment()
1061 return -EINVAL; in ath12k_pci_get_user_msi_assignment()
1068 struct pci_dev *pci_dev = to_pci_dev(ab->dev); in ath12k_pci_get_msi_address()
1070 pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_LO, in ath12k_pci_get_msi_address()
1073 if (test_bit(ATH12K_PCI_FLAG_IS_MSI_64, &ab_pci->flags)) { in ath12k_pci_get_msi_address()
1074 pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_HI, in ath12k_pci_get_msi_address()
1086 for (i = 0, msi_data_idx = 0; i < ab->hw_params->ce_count; i++) { in ath12k_pci_get_ce_msi_idx()
1113 struct ath12k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath12k_pci_ext_irq_enable()
1115 napi_enable(&irq_grp->napi); in ath12k_pci_ext_irq_enable()
1119 set_bit(ATH12K_FLAG_EXT_IRQ_ENABLED, &ab->dev_flags); in ath12k_pci_ext_irq_enable()
1156 set_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags); in ath12k_pci_start()
1158 if (test_bit(ATH12K_PCI_FLAG_MULTI_MSI_VECTORS, &ab_pci->flags)) in ath12k_pci_start()
1161 ath12k_info(ab, "leaving PCI ASPM disabled to avoid MHI M2 problems\n"); in ath12k_pci_start()
1175 /* for offset beyond BAR + 4K - 32, may in ath12k_pci_read32()
1178 if (test_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && in ath12k_pci_read32()
1179 offset >= ACCESS_ALWAYS_OFF && ab_pci->pci_ops->wakeup) 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()
1191 spin_lock_bh(&ab_pci->window_lock); in ath12k_pci_read32()
1195 offset = offset - PCI_MHIREGLEN_REG; in ath12k_pci_read32()
1196 val = ioread32(ab->mem + in ath12k_pci_read32()
1199 val = ioread32(ab->mem + window_start + in ath12k_pci_read32()
1202 spin_unlock_bh(&ab_pci->window_lock); in ath12k_pci_read32()
1204 val = ioread32(ab->mem + window_start + in ath12k_pci_read32()
1209 if (test_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && in ath12k_pci_read32()
1210 offset >= ACCESS_ALWAYS_OFF && ab_pci->pci_ops->release && in ath12k_pci_read32()
1212 ab_pci->pci_ops->release(ab); in ath12k_pci_read32()
1222 /* for offset beyond BAR + 4K - 32, may in ath12k_pci_write32()
1225 if (test_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && in ath12k_pci_write32()
1226 offset >= ACCESS_ALWAYS_OFF && ab_pci->pci_ops->wakeup) 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()
1238 spin_lock_bh(&ab_pci->window_lock); in ath12k_pci_write32()
1242 offset = offset - PCI_MHIREGLEN_REG; in ath12k_pci_write32()
1243 iowrite32(value, ab->mem + in ath12k_pci_write32()
1246 iowrite32(value, ab->mem + window_start + in ath12k_pci_write32()
1249 spin_unlock_bh(&ab_pci->window_lock); in ath12k_pci_write32()
1251 iowrite32(value, ab->mem + window_start + in ath12k_pci_write32()
1256 if (test_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && in ath12k_pci_write32()
1257 offset >= ACCESS_ALWAYS_OFF && ab_pci->pci_ops->release && in ath12k_pci_write32()
1259 ab_pci->pci_ops->release(ab); in ath12k_pci_write32()
1267 ab_pci->register_window = 0; in ath12k_pci_power_up()
1268 clear_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags); in ath12k_pci_power_up()
1269 ath12k_pci_sw_reset(ab_pci->ab, true); in ath12k_pci_power_up()
1271 /* Disable ASPM during firmware download due to problems switching in ath12k_pci_power_up()
1278 if (test_bit(ATH12K_FW_FEATURE_MULTI_QRTR_ID, ab->fw.fw_features)) in ath12k_pci_power_up()
1287 if (ab->static_window_map) in ath12k_pci_power_up()
1297 /* restore aspm in case firmware bootup fails */ in ath12k_pci_power_down()
1300 ath12k_pci_force_wake(ab_pci->ab); in ath12k_pci_power_down()
1303 clear_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags); in ath12k_pci_power_down()
1304 ath12k_pci_sw_reset(ab_pci->ab, false); in ath12k_pci_power_down()
1358 ab = ath12k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH12K_BUS_PCI); in ath12k_pci_probe()
1360 dev_err(&pdev->dev, "failed to allocate ath12k base\n"); in ath12k_pci_probe()
1361 return -ENOMEM; in ath12k_pci_probe()
1364 ab->dev = &pdev->dev; in ath12k_pci_probe()
1367 ab_pci->dev_id = pci_dev->device; in ath12k_pci_probe()
1368 ab_pci->ab = ab; in ath12k_pci_probe()
1369 ab_pci->pdev = pdev; in ath12k_pci_probe()
1370 ab->hif.ops = &ath12k_pci_hif_ops; in ath12k_pci_probe()
1372 spin_lock_init(&ab_pci->window_lock); in ath12k_pci_probe()
1381 pdev->vendor, pdev->device, in ath12k_pci_probe()
1382 pdev->subsystem_vendor, pdev->subsystem_device); 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()
1389 switch (pci_dev->device) { in ath12k_pci_probe()
1391 ab_pci->msi_config = &ath12k_msi_config[0]; in ath12k_pci_probe()
1392 ab->static_window_map = true; in ath12k_pci_probe()
1393 ab_pci->pci_ops = &ath12k_pci_ops_qcn9274; in ath12k_pci_probe()
1394 ab->hal_rx_ops = &hal_rx_qcn9274_ops; 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()
1405 dev_err(&pdev->dev, in ath12k_pci_probe()
1408 ret = -EOPNOTSUPP; in ath12k_pci_probe()
1413 ab->id.bdf_search = ATH12K_BDF_SEARCH_BUS_AND_BOARD; in ath12k_pci_probe()
1414 ab_pci->msi_config = &ath12k_msi_config[0]; in ath12k_pci_probe()
1415 ab->static_window_map = false; in ath12k_pci_probe()
1416 ab_pci->pci_ops = &ath12k_pci_ops_wcn7850; in ath12k_pci_probe()
1417 ab->hal_rx_ops = &hal_rx_wcn7850_ops; in ath12k_pci_probe()
1422 ab->hw_rev = ATH12K_HW_WCN7850_HW20; in ath12k_pci_probe()
1425 dev_err(&pdev->dev, in ath12k_pci_probe()
1428 ret = -EOPNOTSUPP; in ath12k_pci_probe()
1434 dev_err(&pdev->dev, "Unknown PCI device found: 0x%x\n", in ath12k_pci_probe()
1435 pci_dev->device); in ath12k_pci_probe()
1436 ret = -EOPNOTSUPP; in ath12k_pci_probe()
1532 if (test_bit(ATH12K_FLAG_QMI_FAIL, &ab->dev_flags)) { 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()