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-2022, Qualcomm Innovation Center, Inc. All rights reserved.
43 return mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); in ath11k_pci_bus_wake_up()
50 mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); in ath11k_pci_bus_release()
55 if (!ab->hw_params.static_window_map) in ath11k_pci_get_window_start()
71 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_select_window()
75 lockdep_assert_held(&ab_pci->window_lock); in ath11k_pci_select_window()
77 if (window != ab_pci->register_window) { in ath11k_pci_select_window()
79 ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); in ath11k_pci_select_window()
80 ioread32(ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); in ath11k_pci_select_window()
81 ab_pci->register_window = window; in ath11k_pci_select_window()
94 spin_lock_bh(&ab_pci->window_lock); in ath11k_pci_window_write32()
96 iowrite32(value, ab->mem + window_start + in ath11k_pci_window_write32()
98 spin_unlock_bh(&ab_pci->window_lock); in ath11k_pci_window_write32()
100 iowrite32(value, ab->mem + window_start + in ath11k_pci_window_write32()
113 spin_lock_bh(&ab_pci->window_lock); in ath11k_pci_window_read32()
115 val = ioread32(ab->mem + window_start + in ath11k_pci_window_read32()
117 spin_unlock_bh(&ab_pci->window_lock); in ath11k_pci_window_read32()
119 val = ioread32(ab->mem + window_start + in ath11k_pci_window_read32()
128 struct pci_dev *pci_dev = to_pci_dev(ab->dev); in ath11k_pci_get_msi_irq()
171 ab_pci->ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); in ath11k_pci_select_static_window()
253 return -ETIMEDOUT; in ath11k_pci_set_link_reg()
360 if (ab->hw_params.fix_l1ss) in ath11k_pci_sw_reset()
372 struct ath11k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; in ath11k_pci_init_qmi_ce_config()
374 cfg->tgt_ce = ab->hw_params.target_ce_config; in ath11k_pci_init_qmi_ce_config()
375 cfg->tgt_ce_len = ab->hw_params.target_ce_count; in ath11k_pci_init_qmi_ce_config()
377 cfg->svc_to_ce_map = ab->hw_params.svc_to_ce_map; in ath11k_pci_init_qmi_ce_config()
378 cfg->svc_to_ce_map_len = ab->hw_params.svc_to_ce_map_len; in ath11k_pci_init_qmi_ce_config()
379 ab->qmi.service_ins_id = ab->hw_params.qmi_service_ins_id; in ath11k_pci_init_qmi_ce_config()
381 ath11k_ce_get_shadow_config(ab, &cfg->shadow_reg_v2, in ath11k_pci_init_qmi_ce_config()
382 &cfg->shadow_reg_v2_len); in ath11k_pci_init_qmi_ce_config()
387 struct pci_dev *dev = ab_pci->pdev; in ath11k_pci_msi_config()
390 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control); in ath11k_pci_msi_config()
397 pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control); in ath11k_pci_msi_config()
412 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_alloc_msi()
413 const struct ath11k_msi_config *msi_config = ab->pci.msi.config; in ath11k_pci_alloc_msi()
414 struct pci_dev *pci_dev = ab_pci->pdev; in ath11k_pci_alloc_msi()
420 msi_config->total_vectors, in ath11k_pci_alloc_msi()
421 msi_config->total_vectors, in ath11k_pci_alloc_msi()
423 if (num_vectors == msi_config->total_vectors) { in ath11k_pci_alloc_msi()
424 set_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags); in ath11k_pci_alloc_msi()
426 num_vectors = pci_alloc_irq_vectors(ab_pci->pdev, in ath11k_pci_alloc_msi()
431 ret = -EINVAL; in ath11k_pci_alloc_msi()
434 clear_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags); in ath11k_pci_alloc_msi()
435 ab->pci.msi.config = &msi_config_one_msi; in ath11k_pci_alloc_msi()
442 msi_desc = irq_get_msi_desc(ab_pci->pdev->irq); in ath11k_pci_alloc_msi()
445 ret = -EINVAL; in ath11k_pci_alloc_msi()
449 ab->pci.msi.ep_base_data = msi_desc->msg.data; in ath11k_pci_alloc_msi()
451 pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_LO, in ath11k_pci_alloc_msi()
452 &ab->pci.msi.addr_lo); in ath11k_pci_alloc_msi()
454 if (msi_desc->pci.msi_attrib.is_64) { in ath11k_pci_alloc_msi()
455 pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_HI, in ath11k_pci_alloc_msi()
456 &ab->pci.msi.addr_hi); in ath11k_pci_alloc_msi()
458 ab->pci.msi.addr_hi = 0; in ath11k_pci_alloc_msi()
461 ath11k_dbg(ab, ATH11K_DBG_PCI, "msi base data is %d\n", ab->pci.msi.ep_base_data); in ath11k_pci_alloc_msi()
466 pci_free_irq_vectors(ab_pci->pdev); in ath11k_pci_alloc_msi()
474 pci_free_irq_vectors(ab_pci->pdev); in ath11k_pci_free_msi()
481 msi_desc = irq_get_msi_desc(ab_pci->pdev->irq); in ath11k_pci_config_msi_data()
483 ath11k_err(ab_pci->ab, "msi_desc is NULL!\n"); in ath11k_pci_config_msi_data()
484 pci_free_irq_vectors(ab_pci->pdev); in ath11k_pci_config_msi_data()
485 return -EINVAL; in ath11k_pci_config_msi_data()
488 ab_pci->ab->pci.msi.ep_base_data = msi_desc->msg.data; in ath11k_pci_config_msi_data()
490 ath11k_dbg(ab_pci->ab, ATH11K_DBG_PCI, "pci after request_irq msi_ep_base_data %d\n", in ath11k_pci_config_msi_data()
491 ab_pci->ab->pci.msi.ep_base_data); in ath11k_pci_config_msi_data()
498 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_claim()
503 if (device_id != ab_pci->dev_id) { in ath11k_pci_claim()
505 device_id, ab_pci->dev_id); in ath11k_pci_claim()
506 ret = -EIO; in ath11k_pci_claim()
528 ret = dma_set_mask_and_coherent(&pdev->dev, in ath11k_pci_claim()
538 ab->mem_len = pci_resource_len(pdev, ATH11K_PCI_BAR_NUM); in ath11k_pci_claim()
539 ab->mem = pci_iomap(pdev, ATH11K_PCI_BAR_NUM, 0); in ath11k_pci_claim()
540 if (!ab->mem) { in ath11k_pci_claim()
542 ret = -EIO; in ath11k_pci_claim()
546 ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot pci_mem 0x%pK\n", ab->mem); in ath11k_pci_claim()
561 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_free_region()
562 struct pci_dev *pci_dev = ab_pci->pdev; in ath11k_pci_free_region()
564 pci_iounmap(pci_dev, ab->mem); in ath11k_pci_free_region()
565 ab->mem = NULL; in ath11k_pci_free_region()
574 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_aspm_disable()
576 pcie_capability_read_word(ab_pci->pdev, PCI_EXP_LNKCTL, in ath11k_pci_aspm_disable()
577 &ab_pci->link_ctl); in ath11k_pci_aspm_disable()
580 ab_pci->link_ctl, in ath11k_pci_aspm_disable()
581 u16_get_bits(ab_pci->link_ctl, PCI_EXP_LNKCTL_ASPM_L0S), in ath11k_pci_aspm_disable()
582 u16_get_bits(ab_pci->link_ctl, PCI_EXP_LNKCTL_ASPM_L1)); in ath11k_pci_aspm_disable()
585 pcie_capability_write_word(ab_pci->pdev, PCI_EXP_LNKCTL, in ath11k_pci_aspm_disable()
586 ab_pci->link_ctl & ~PCI_EXP_LNKCTL_ASPMC); in ath11k_pci_aspm_disable()
588 set_bit(ATH11K_PCI_ASPM_RESTORE, &ab_pci->flags); in ath11k_pci_aspm_disable()
593 if (test_and_clear_bit(ATH11K_PCI_ASPM_RESTORE, &ab_pci->flags)) in ath11k_pci_aspm_restore()
594 pcie_capability_write_word(ab_pci->pdev, PCI_EXP_LNKCTL, in ath11k_pci_aspm_restore()
595 ab_pci->link_ctl); in ath11k_pci_aspm_restore()
603 ab_pci->register_window = 0; in ath11k_pci_power_up()
604 clear_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags); in ath11k_pci_power_up()
605 ath11k_pci_sw_reset(ab_pci->ab, true); in ath11k_pci_power_up()
607 /* Disable ASPM during firmware download due to problems switching in ath11k_pci_power_up()
620 if (ab->hw_params.static_window_map) in ath11k_pci_power_up()
630 /* restore aspm in case firmware bootup fails */ in ath11k_pci_power_down()
633 ath11k_pci_force_wake(ab_pci->ab); in ath11k_pci_power_down()
638 clear_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags); in ath11k_pci_power_down()
639 ath11k_pci_sw_reset(ab_pci->ab, false); in ath11k_pci_power_down()
673 if (test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) in ath11k_pci_start()
720 if (test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab_pci->ab->dev_flags)) in ath11k_pci_set_irq_affinity_hint()
723 return irq_set_affinity_hint(ab_pci->pdev->irq, m); in ath11k_pci_set_irq_affinity_hint()
735 ab = ath11k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH11K_BUS_PCI); in ath11k_pci_probe()
738 dev_err(&pdev->dev, "failed to allocate ath11k base\n"); in ath11k_pci_probe()
739 return -ENOMEM; in ath11k_pci_probe()
742 ab->dev = &pdev->dev; in ath11k_pci_probe()
745 ab_pci->dev_id = pci_dev->device; in ath11k_pci_probe()
746 ab_pci->ab = ab; in ath11k_pci_probe()
747 ab_pci->pdev = pdev; in ath11k_pci_probe()
748 ab->hif.ops = &ath11k_pci_hif_ops; in ath11k_pci_probe()
750 spin_lock_init(&ab_pci->window_lock); in ath11k_pci_probe()
756 ret = of_property_read_u32(ab->dev->of_node, "memory-region", &addr); in ath11k_pci_probe()
758 set_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags); in ath11k_pci_probe()
767 pdev->vendor, pdev->device, in ath11k_pci_probe()
768 pdev->subsystem_vendor, pdev->subsystem_device); in ath11k_pci_probe()
770 ab->id.vendor = pdev->vendor; in ath11k_pci_probe()
771 ab->id.device = pdev->device; in ath11k_pci_probe()
772 ab->id.subsystem_vendor = pdev->subsystem_vendor; in ath11k_pci_probe()
773 ab->id.subsystem_device = pdev->subsystem_device; in ath11k_pci_probe()
775 switch (pci_dev->device) { in ath11k_pci_probe()
781 ab->hw_rev = ATH11K_HW_QCA6390_HW20; in ath11k_pci_probe()
784 dev_err(&pdev->dev, "Unsupported QCA6390 SOC hardware version: %d %d\n", in ath11k_pci_probe()
786 ret = -EOPNOTSUPP; in ath11k_pci_probe()
794 ab->hw_rev = ATH11K_HW_QCN9074_HW10; in ath11k_pci_probe()
797 ab->id.bdf_search = ATH11K_BDF_SEARCH_BUS_AND_BOARD; in ath11k_pci_probe()
805 ab->hw_rev = ATH11K_HW_WCN6855_HW20; in ath11k_pci_probe()
809 ab->hw_rev = ATH11K_HW_WCN6855_HW21; in ath11k_pci_probe()
817 dev_err(&pdev->dev, "Unsupported WCN6855 SOC hardware version: %d %d\n", in ath11k_pci_probe()
819 ret = -EOPNOTSUPP; in ath11k_pci_probe()
826 dev_err(&pdev->dev, "Unknown PCI device found: 0x%x\n", in ath11k_pci_probe()
827 pci_dev->device); in ath11k_pci_probe()
828 ret = -EOPNOTSUPP; in ath11k_pci_probe()
936 if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { in ath11k_pci_remove()
943 set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags); in ath11k_pci_remove()
973 if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { in ath11k_pci_pm_suspend()
974 ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot skipping pci suspend as qmi is not initialised\n"); in ath11k_pci_pm_suspend()
990 if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { in ath11k_pci_pm_resume()
991 ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot skipping pci resume as qmi is not initialised\n"); in ath11k_pci_pm_resume()
1040 /* QCA639x 2.0 firmware files */