Lines Matching refs:ab_pci
127 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_bus_wake_up() local
129 return mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); in ath12k_pci_bus_wake_up()
134 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_bus_release() local
136 mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); in ath12k_pci_bus_release()
149 static void ath12k_pci_select_window(struct ath12k_pci *ab_pci, u32 offset) in ath12k_pci_select_window() argument
151 struct ath12k_base *ab = ab_pci->ab; in ath12k_pci_select_window()
156 lockdep_assert_held(&ab_pci->window_lock); in ath12k_pci_select_window()
159 static_window = ab_pci->register_window & WINDOW_STATIC_MASK; in ath12k_pci_select_window()
162 if (window != ab_pci->register_window) { in ath12k_pci_select_window()
171 ab_pci->register_window = window; in ath12k_pci_select_window()
175 static void ath12k_pci_select_static_window(struct ath12k_pci *ab_pci) in ath12k_pci_select_static_window() argument
183 spin_lock_bh(&ab_pci->window_lock); in ath12k_pci_select_static_window()
184 ab_pci->register_window = window; in ath12k_pci_select_static_window()
185 spin_unlock_bh(&ab_pci->window_lock); in ath12k_pci_select_static_window()
188 iowrite32(WINDOW_ENABLE_BIT | window, ab_pci->ab->mem + WINDOW_REG_ADDRESS); in ath12k_pci_select_static_window()
190 iowrite32(WINDOW_ENABLE_BIT | window, (char *)ab_pci->ab->mem + WINDOW_REG_ADDRESS); in ath12k_pci_select_static_window()
648 static void ath12k_pci_msi_config(struct ath12k_pci *ab_pci, bool enable) in ath12k_pci_msi_config() argument
650 struct pci_dev *dev = ab_pci->pdev; in ath12k_pci_msi_config()
663 static void ath12k_pci_msi_enable(struct ath12k_pci *ab_pci) in ath12k_pci_msi_enable() argument
665 ath12k_pci_msi_config(ab_pci, true); in ath12k_pci_msi_enable()
668 static void ath12k_pci_msi_disable(struct ath12k_pci *ab_pci) in ath12k_pci_msi_disable() argument
670 ath12k_pci_msi_config(ab_pci, false); in ath12k_pci_msi_disable()
673 static int ath12k_pci_msi_alloc(struct ath12k_pci *ab_pci) in ath12k_pci_msi_alloc() argument
675 struct ath12k_base *ab = ab_pci->ab; in ath12k_pci_msi_alloc()
676 const struct ath12k_msi_config *msi_config = ab_pci->msi_config; in ath12k_pci_msi_alloc()
681 num_vectors = pci_alloc_irq_vectors(ab_pci->pdev, in ath12k_pci_msi_alloc()
695 ath12k_pci_msi_disable(ab_pci); in ath12k_pci_msi_alloc()
697 msi_desc = irq_get_msi_desc(ab_pci->pdev->irq); in ath12k_pci_msi_alloc()
704 ab_pci->msi_ep_base_data = msi_desc->msg.data; in ath12k_pci_msi_alloc()
706 set_bit(ATH12K_PCI_FLAG_IS_MSI_64, &ab_pci->flags); in ath12k_pci_msi_alloc()
708 ath12k_dbg(ab, ATH12K_DBG_PCI, "msi base data is %d\n", ab_pci->msi_ep_base_data); in ath12k_pci_msi_alloc()
713 pci_free_irq_vectors(ab_pci->pdev); in ath12k_pci_msi_alloc()
718 static void ath12k_pci_msi_free(struct ath12k_pci *ab_pci) in ath12k_pci_msi_free() argument
720 pci_free_irq_vectors(ab_pci->pdev); in ath12k_pci_msi_free()
723 static int ath12k_pci_claim(struct ath12k_pci *ab_pci, struct pci_dev *pdev) in ath12k_pci_claim() argument
725 struct ath12k_base *ab = ab_pci->ab; in ath12k_pci_claim()
730 if (device_id != ab_pci->dev_id) { in ath12k_pci_claim()
732 device_id, ab_pci->dev_id); in ath12k_pci_claim()
784 static void ath12k_pci_free_region(struct ath12k_pci *ab_pci) in ath12k_pci_free_region() argument
786 struct ath12k_base *ab = ab_pci->ab; in ath12k_pci_free_region()
787 struct pci_dev *pci_dev = ab_pci->pdev; in ath12k_pci_free_region()
796 static void ath12k_pci_aspm_disable(struct ath12k_pci *ab_pci) in ath12k_pci_aspm_disable() argument
798 struct ath12k_base *ab = ab_pci->ab; in ath12k_pci_aspm_disable()
800 pcie_capability_read_word(ab_pci->pdev, PCI_EXP_LNKCTL, in ath12k_pci_aspm_disable()
801 &ab_pci->link_ctl); in ath12k_pci_aspm_disable()
804 ab_pci->link_ctl, in ath12k_pci_aspm_disable()
805 u16_get_bits(ab_pci->link_ctl, PCI_EXP_LNKCTL_ASPM_L0S), in ath12k_pci_aspm_disable()
806 u16_get_bits(ab_pci->link_ctl, PCI_EXP_LNKCTL_ASPM_L1)); in ath12k_pci_aspm_disable()
809 pcie_capability_write_word(ab_pci->pdev, PCI_EXP_LNKCTL, in ath12k_pci_aspm_disable()
810 ab_pci->link_ctl & ~PCI_EXP_LNKCTL_ASPMC); in ath12k_pci_aspm_disable()
812 set_bit(ATH12K_PCI_ASPM_RESTORE, &ab_pci->flags); in ath12k_pci_aspm_disable()
815 static void ath12k_pci_aspm_restore(struct ath12k_pci *ab_pci) in ath12k_pci_aspm_restore() argument
817 if (test_and_clear_bit(ATH12K_PCI_ASPM_RESTORE, &ab_pci->flags)) in ath12k_pci_aspm_restore()
818 pcie_capability_write_word(ab_pci->pdev, PCI_EXP_LNKCTL, in ath12k_pci_aspm_restore()
819 ab_pci->link_ctl); in ath12k_pci_aspm_restore()
897 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_get_user_msi_assignment() local
898 const struct ath12k_msi_config *msi_config = ab_pci->msi_config; in ath12k_pci_get_user_msi_assignment()
905 + ab_pci->msi_ep_base_data; in ath12k_pci_get_user_msi_assignment()
924 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_get_msi_address() local
930 if (test_bit(ATH12K_PCI_FLAG_IS_MSI_64, &ab_pci->flags)) { in ath12k_pci_get_msi_address()
1009 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_start() local
1011 set_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags); in ath12k_pci_start()
1013 ath12k_pci_aspm_restore(ab_pci); in ath12k_pci_start()
1023 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_read32() local
1030 if (test_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && in ath12k_pci_read32()
1031 offset >= ACCESS_ALWAYS_OFF && ab_pci->pci_ops->wakeup) in ath12k_pci_read32()
1032 ret = ab_pci->pci_ops->wakeup(ab); in ath12k_pci_read32()
1047 spin_lock_bh(&ab_pci->window_lock); in ath12k_pci_read32()
1048 ath12k_pci_select_window(ab_pci, offset); in ath12k_pci_read32()
1055 spin_unlock_bh(&ab_pci->window_lock); in ath12k_pci_read32()
1071 if (test_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && in ath12k_pci_read32()
1072 offset >= ACCESS_ALWAYS_OFF && ab_pci->pci_ops->release && in ath12k_pci_read32()
1074 ab_pci->pci_ops->release(ab); in ath12k_pci_read32()
1080 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_write32() local
1087 if (test_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && in ath12k_pci_write32()
1088 offset >= ACCESS_ALWAYS_OFF && ab_pci->pci_ops->wakeup) in ath12k_pci_write32()
1089 ret = ab_pci->pci_ops->wakeup(ab); in ath12k_pci_write32()
1104 spin_lock_bh(&ab_pci->window_lock); in ath12k_pci_write32()
1105 ath12k_pci_select_window(ab_pci, offset); in ath12k_pci_write32()
1112 spin_unlock_bh(&ab_pci->window_lock); in ath12k_pci_write32()
1128 if (test_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags) && in ath12k_pci_write32()
1129 offset >= ACCESS_ALWAYS_OFF && ab_pci->pci_ops->release && in ath12k_pci_write32()
1131 ab_pci->pci_ops->release(ab); in ath12k_pci_write32()
1136 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_power_up() local
1139 ab_pci->register_window = 0; in ath12k_pci_power_up()
1140 clear_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags); in ath12k_pci_power_up()
1141 ath12k_pci_sw_reset(ab_pci->ab, true); in ath12k_pci_power_up()
1146 ath12k_pci_aspm_disable(ab_pci); in ath12k_pci_power_up()
1148 ath12k_pci_msi_enable(ab_pci); in ath12k_pci_power_up()
1150 ret = ath12k_mhi_start(ab_pci); in ath12k_pci_power_up()
1157 ath12k_pci_select_static_window(ab_pci); in ath12k_pci_power_up()
1164 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_power_down() local
1167 ath12k_pci_aspm_restore(ab_pci); in ath12k_pci_power_down()
1169 ath12k_pci_force_wake(ab_pci->ab); in ath12k_pci_power_down()
1170 ath12k_pci_msi_disable(ab_pci); in ath12k_pci_power_down()
1171 ath12k_mhi_stop(ab_pci); in ath12k_pci_power_down()
1172 clear_bit(ATH12K_PCI_FLAG_INIT_DONE, &ab_pci->flags); in ath12k_pci_power_down()
1173 ath12k_pci_sw_reset(ab_pci->ab, false); in ath12k_pci_power_down()
1215 struct ath12k_pci *ab_pci; in ath12k_pci_probe() local
1219 ab = ath12k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH12K_BUS_PCI); in ath12k_pci_probe()
1227 ab_pci = ath12k_pci_priv(ab); in ath12k_pci_probe()
1228 ab_pci->dev_id = pci_dev->device; in ath12k_pci_probe()
1229 ab_pci->ab = ab; in ath12k_pci_probe()
1230 ab_pci->pdev = pdev; in ath12k_pci_probe()
1233 spin_lock_init(&ab_pci->window_lock); in ath12k_pci_probe()
1235 ret = ath12k_pci_claim(ab_pci, pdev); in ath12k_pci_probe()
1243 ab_pci->msi_config = &ath12k_msi_config[0]; in ath12k_pci_probe()
1245 ab_pci->pci_ops = &ath12k_pci_ops_qcn9274; in ath12k_pci_probe()
1264 ab_pci->msi_config = &ath12k_msi_config[0]; in ath12k_pci_probe()
1266 ab_pci->pci_ops = &ath12k_pci_ops_wcn7850; in ath12k_pci_probe()
1289 ret = ath12k_pci_msi_alloc(ab_pci); in ath12k_pci_probe()
1299 ret = ath12k_mhi_register(ab_pci); in ath12k_pci_probe()
1340 ath12k_mhi_unregister(ab_pci); in ath12k_pci_probe()
1343 ath12k_pci_msi_free(ab_pci); in ath12k_pci_probe()
1346 ath12k_pci_free_region(ab_pci); in ath12k_pci_probe()
1357 struct ath12k_pci *ab_pci = ath12k_pci_priv(ab); in ath12k_pci_remove() local
1371 ath12k_mhi_unregister(ab_pci); in ath12k_pci_remove()
1374 ath12k_pci_msi_free(ab_pci); in ath12k_pci_remove()
1375 ath12k_pci_free_region(ab_pci); in ath12k_pci_remove()