Lines Matching +full:firmware +full:- +full:initialised
1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
47 return mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); in ath11k_pci_bus_wake_up()
54 mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); in ath11k_pci_bus_release()
59 if (!ab->hw_params.static_window_map) in ath11k_pci_get_window_start()
75 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_select_window()
79 lockdep_assert_held(&ab_pci->window_lock); in ath11k_pci_select_window()
81 if (window != ab_pci->register_window) { in ath11k_pci_select_window()
83 ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); in ath11k_pci_select_window()
84 ioread32(ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); in ath11k_pci_select_window()
85 ab_pci->register_window = window; in ath11k_pci_select_window()
98 spin_lock_bh(&ab_pci->window_lock); in ath11k_pci_window_write32()
100 iowrite32(value, ab->mem + window_start + in ath11k_pci_window_write32()
102 spin_unlock_bh(&ab_pci->window_lock); in ath11k_pci_window_write32()
104 iowrite32(value, ab->mem + window_start + in ath11k_pci_window_write32()
117 spin_lock_bh(&ab_pci->window_lock); in ath11k_pci_window_read32()
119 val = ioread32(ab->mem + window_start + in ath11k_pci_window_read32()
121 spin_unlock_bh(&ab_pci->window_lock); in ath11k_pci_window_read32()
123 val = ioread32(ab->mem + window_start + in ath11k_pci_window_read32()
132 struct pci_dev *pci_dev = to_pci_dev(ab->dev); in ath11k_pci_get_msi_irq()
175 ab_pci->ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); in ath11k_pci_select_static_window()
257 return -ETIMEDOUT; in ath11k_pci_set_link_reg()
364 if (ab->hw_params.fix_l1ss) in ath11k_pci_sw_reset()
376 struct ath11k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; in ath11k_pci_init_qmi_ce_config()
378 cfg->tgt_ce = ab->hw_params.target_ce_config; in ath11k_pci_init_qmi_ce_config()
379 cfg->tgt_ce_len = ab->hw_params.target_ce_count; in ath11k_pci_init_qmi_ce_config()
381 cfg->svc_to_ce_map = ab->hw_params.svc_to_ce_map; in ath11k_pci_init_qmi_ce_config()
382 cfg->svc_to_ce_map_len = ab->hw_params.svc_to_ce_map_len; in ath11k_pci_init_qmi_ce_config()
383 ab->qmi.service_ins_id = ab->hw_params.qmi_service_ins_id; in ath11k_pci_init_qmi_ce_config()
385 ath11k_ce_get_shadow_config(ab, &cfg->shadow_reg_v2, in ath11k_pci_init_qmi_ce_config()
386 &cfg->shadow_reg_v2_len); in ath11k_pci_init_qmi_ce_config()
391 struct pci_dev *dev = ab_pci->pdev; in ath11k_pci_msi_config()
394 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control); in ath11k_pci_msi_config()
401 pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control); in ath11k_pci_msi_config()
416 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_alloc_msi()
417 const struct ath11k_msi_config *msi_config = ab->pci.msi.config; in ath11k_pci_alloc_msi()
418 struct pci_dev *pci_dev = ab_pci->pdev; in ath11k_pci_alloc_msi()
424 msi_config->total_vectors, in ath11k_pci_alloc_msi()
425 msi_config->total_vectors, in ath11k_pci_alloc_msi()
427 if (num_vectors == msi_config->total_vectors) { in ath11k_pci_alloc_msi()
428 set_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags); in ath11k_pci_alloc_msi()
430 num_vectors = pci_alloc_irq_vectors(ab_pci->pdev, in ath11k_pci_alloc_msi()
435 ret = -EINVAL; in ath11k_pci_alloc_msi()
438 clear_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags); in ath11k_pci_alloc_msi()
439 ab->pci.msi.config = &msi_config_one_msi; in ath11k_pci_alloc_msi()
446 msi_desc = irq_get_msi_desc(ab_pci->pdev->irq); in ath11k_pci_alloc_msi()
449 ret = -EINVAL; in ath11k_pci_alloc_msi()
453 ab->pci.msi.ep_base_data = msi_desc->msg.data; in ath11k_pci_alloc_msi()
455 pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_LO, in ath11k_pci_alloc_msi()
456 &ab->pci.msi.addr_lo); in ath11k_pci_alloc_msi()
458 if (msi_desc->pci.msi_attrib.is_64) { in ath11k_pci_alloc_msi()
459 pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_HI, in ath11k_pci_alloc_msi()
460 &ab->pci.msi.addr_hi); in ath11k_pci_alloc_msi()
462 ab->pci.msi.addr_hi = 0; in ath11k_pci_alloc_msi()
465 ath11k_dbg(ab, ATH11K_DBG_PCI, "msi base data is %d\n", ab->pci.msi.ep_base_data); in ath11k_pci_alloc_msi()
470 pci_free_irq_vectors(ab_pci->pdev); in ath11k_pci_alloc_msi()
478 pci_free_irq_vectors(ab_pci->pdev); in ath11k_pci_free_msi()
485 msi_desc = irq_get_msi_desc(ab_pci->pdev->irq); in ath11k_pci_config_msi_data()
487 ath11k_err(ab_pci->ab, "msi_desc is NULL!\n"); in ath11k_pci_config_msi_data()
488 pci_free_irq_vectors(ab_pci->pdev); in ath11k_pci_config_msi_data()
489 return -EINVAL; in ath11k_pci_config_msi_data()
492 ab_pci->ab->pci.msi.ep_base_data = msi_desc->msg.data; in ath11k_pci_config_msi_data()
494 ath11k_dbg(ab_pci->ab, ATH11K_DBG_PCI, "after request_irq msi_ep_base_data %d\n", in ath11k_pci_config_msi_data()
495 ab_pci->ab->pci.msi.ep_base_data); in ath11k_pci_config_msi_data()
502 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_claim()
507 if (device_id != ab_pci->dev_id) { in ath11k_pci_claim()
509 device_id, ab_pci->dev_id); in ath11k_pci_claim()
510 ret = -EIO; in ath11k_pci_claim()
532 ret = dma_set_mask(&pdev->dev, in ath11k_pci_claim()
540 ab_pci->dma_mask = DMA_BIT_MASK(ATH11K_PCI_DMA_MASK); in ath11k_pci_claim()
542 ret = dma_set_coherent_mask(&pdev->dev, in ath11k_pci_claim()
552 ab->mem_len = pci_resource_len(pdev, ATH11K_PCI_BAR_NUM); in ath11k_pci_claim()
553 ab->mem = pci_iomap(pdev, ATH11K_PCI_BAR_NUM, 0); in ath11k_pci_claim()
554 if (!ab->mem) { in ath11k_pci_claim()
556 ret = -EIO; in ath11k_pci_claim()
560 ab->mem_ce = ab->mem; in ath11k_pci_claim()
562 ath11k_dbg(ab, ATH11K_DBG_BOOT, "pci_mem 0x%p\n", ab->mem); in ath11k_pci_claim()
575 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_free_region()
576 struct pci_dev *pci_dev = ab_pci->pdev; in ath11k_pci_free_region()
578 pci_iounmap(pci_dev, ab->mem); in ath11k_pci_free_region()
579 ab->mem = NULL; in ath11k_pci_free_region()
587 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_aspm_disable()
589 pcie_capability_read_word(ab_pci->pdev, PCI_EXP_LNKCTL, in ath11k_pci_aspm_disable()
590 &ab_pci->link_ctl); in ath11k_pci_aspm_disable()
593 ab_pci->link_ctl, in ath11k_pci_aspm_disable()
594 u16_get_bits(ab_pci->link_ctl, PCI_EXP_LNKCTL_ASPM_L0S), in ath11k_pci_aspm_disable()
595 u16_get_bits(ab_pci->link_ctl, PCI_EXP_LNKCTL_ASPM_L1)); in ath11k_pci_aspm_disable()
598 pcie_capability_clear_word(ab_pci->pdev, PCI_EXP_LNKCTL, in ath11k_pci_aspm_disable()
601 set_bit(ATH11K_PCI_ASPM_RESTORE, &ab_pci->flags); in ath11k_pci_aspm_disable()
606 if (test_and_clear_bit(ATH11K_PCI_ASPM_RESTORE, &ab_pci->flags)) in ath11k_pci_aspm_restore()
607 pcie_capability_clear_and_set_word(ab_pci->pdev, PCI_EXP_LNKCTL, in ath11k_pci_aspm_restore()
609 ab_pci->link_ctl & in ath11k_pci_aspm_restore()
618 ab_pci->register_window = 0; in ath11k_pci_power_up()
619 clear_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags); in ath11k_pci_power_up()
620 ath11k_pci_sw_reset(ab_pci->ab, true); in ath11k_pci_power_up()
622 /* Disable ASPM during firmware download due to problems switching in ath11k_pci_power_up()
635 if (ab->hw_params.static_window_map) in ath11k_pci_power_up()
645 /* restore aspm in case firmware bootup fails */ in ath11k_pci_power_down()
648 ath11k_pci_force_wake(ab_pci->ab); in ath11k_pci_power_down()
653 clear_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags); in ath11k_pci_power_down()
654 ath11k_pci_sw_reset(ab_pci->ab, false); in ath11k_pci_power_down()
688 if (test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) in ath11k_pci_start()
735 if (test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab_pci->ab->dev_flags)) in ath11k_pci_set_irq_affinity_hint()
738 return irq_set_affinity_hint(ab_pci->pdev->irq, m); in ath11k_pci_set_irq_affinity_hint()
750 ab = ath11k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH11K_BUS_PCI); in ath11k_pci_probe()
753 dev_err(&pdev->dev, "failed to allocate ath11k base\n"); in ath11k_pci_probe()
754 return -ENOMEM; in ath11k_pci_probe()
757 ab->dev = &pdev->dev; in ath11k_pci_probe()
760 ab_pci->dev_id = pci_dev->device; in ath11k_pci_probe()
761 ab_pci->ab = ab; in ath11k_pci_probe()
762 ab_pci->pdev = pdev; in ath11k_pci_probe()
763 ab->hif.ops = &ath11k_pci_hif_ops; in ath11k_pci_probe()
764 ab->fw_mode = ATH11K_FIRMWARE_MODE_NORMAL; in ath11k_pci_probe()
766 spin_lock_init(&ab_pci->window_lock); in ath11k_pci_probe()
772 ret = of_property_read_u32(ab->dev->of_node, "memory-region", &addr); in ath11k_pci_probe()
774 set_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags); in ath11k_pci_probe()
783 pdev->vendor, pdev->device, in ath11k_pci_probe()
784 pdev->subsystem_vendor, pdev->subsystem_device); in ath11k_pci_probe()
786 ab->id.vendor = pdev->vendor; in ath11k_pci_probe()
787 ab->id.device = pdev->device; in ath11k_pci_probe()
788 ab->id.subsystem_vendor = pdev->subsystem_vendor; in ath11k_pci_probe()
789 ab->id.subsystem_device = pdev->subsystem_device; in ath11k_pci_probe()
791 switch (pci_dev->device) { in ath11k_pci_probe()
803 ab->hw_rev = ATH11K_HW_QCA6390_HW20; in ath11k_pci_probe()
806 dev_err(&pdev->dev, "Unsupported QCA6390 SOC hardware version: %d %d\n", in ath11k_pci_probe()
808 ret = -EOPNOTSUPP; in ath11k_pci_probe()
819 ab->hw_rev = ATH11K_HW_QCN9074_HW10; in ath11k_pci_probe()
827 ab->id.bdf_search = ATH11K_BDF_SEARCH_BUS_AND_BOARD; in ath11k_pci_probe()
835 ab->hw_rev = ATH11K_HW_WCN6855_HW20; in ath11k_pci_probe()
847 ab->hw_rev = ATH11K_HW_QCA2066_HW21; in ath11k_pci_probe()
850 ab->hw_rev = ATH11K_HW_QCA6698AQ_HW21; in ath11k_pci_probe()
853 ab->hw_rev = ATH11K_HW_WCN6855_HW21; in ath11k_pci_probe()
862 dev_err(&pdev->dev, "Unsupported WCN6855 SOC hardware version: %d %d\n", in ath11k_pci_probe()
864 ret = -EOPNOTSUPP; in ath11k_pci_probe()
870 dev_err(&pdev->dev, "Unknown PCI device found: 0x%x\n", in ath11k_pci_probe()
871 pci_dev->device); in ath11k_pci_probe()
872 ret = -EOPNOTSUPP; in ath11k_pci_probe()
977 if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { in ath11k_pci_remove()
984 set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags); in ath11k_pci_remove()
1015 if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { in ath11k_pci_pm_suspend()
1016 ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot skipping pci suspend as qmi is not initialised\n"); in ath11k_pci_pm_suspend()
1032 if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { in ath11k_pci_pm_resume()
1033 ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot skipping pci resume as qmi is not initialised\n"); in ath11k_pci_pm_resume()
1082 /* firmware files */