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-2023 Qualcomm Innovation Center, Inc. All rights reserved.
44 return mhi_device_get_sync(ab_pci->mhi_ctrl->mhi_dev); in ath11k_pci_bus_wake_up()
51 mhi_device_put(ab_pci->mhi_ctrl->mhi_dev); in ath11k_pci_bus_release()
56 if (!ab->hw_params.static_window_map) in ath11k_pci_get_window_start()
72 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_select_window()
76 lockdep_assert_held(&ab_pci->window_lock); in ath11k_pci_select_window()
78 if (window != ab_pci->register_window) { in ath11k_pci_select_window()
80 ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); in ath11k_pci_select_window()
81 ioread32(ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); in ath11k_pci_select_window()
82 ab_pci->register_window = window; in ath11k_pci_select_window()
95 spin_lock_bh(&ab_pci->window_lock); in ath11k_pci_window_write32()
97 iowrite32(value, ab->mem + window_start + in ath11k_pci_window_write32()
99 spin_unlock_bh(&ab_pci->window_lock); in ath11k_pci_window_write32()
101 iowrite32(value, ab->mem + window_start + in ath11k_pci_window_write32()
114 spin_lock_bh(&ab_pci->window_lock); in ath11k_pci_window_read32()
116 val = ioread32(ab->mem + window_start + in ath11k_pci_window_read32()
118 spin_unlock_bh(&ab_pci->window_lock); in ath11k_pci_window_read32()
120 val = ioread32(ab->mem + window_start + in ath11k_pci_window_read32()
129 struct pci_dev *pci_dev = to_pci_dev(ab->dev); in ath11k_pci_get_msi_irq()
172 ab_pci->ab->mem + ATH11K_PCI_WINDOW_REG_ADDRESS); in ath11k_pci_select_static_window()
254 return -ETIMEDOUT; in ath11k_pci_set_link_reg()
361 if (ab->hw_params.fix_l1ss) in ath11k_pci_sw_reset()
373 struct ath11k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; in ath11k_pci_init_qmi_ce_config()
375 cfg->tgt_ce = ab->hw_params.target_ce_config; in ath11k_pci_init_qmi_ce_config()
376 cfg->tgt_ce_len = ab->hw_params.target_ce_count; in ath11k_pci_init_qmi_ce_config()
378 cfg->svc_to_ce_map = ab->hw_params.svc_to_ce_map; in ath11k_pci_init_qmi_ce_config()
379 cfg->svc_to_ce_map_len = ab->hw_params.svc_to_ce_map_len; in ath11k_pci_init_qmi_ce_config()
380 ab->qmi.service_ins_id = ab->hw_params.qmi_service_ins_id; in ath11k_pci_init_qmi_ce_config()
382 ath11k_ce_get_shadow_config(ab, &cfg->shadow_reg_v2, in ath11k_pci_init_qmi_ce_config()
383 &cfg->shadow_reg_v2_len); in ath11k_pci_init_qmi_ce_config()
388 struct pci_dev *dev = ab_pci->pdev; in ath11k_pci_msi_config()
391 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control); in ath11k_pci_msi_config()
398 pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control); in ath11k_pci_msi_config()
413 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_alloc_msi()
414 const struct ath11k_msi_config *msi_config = ab->pci.msi.config; in ath11k_pci_alloc_msi()
415 struct pci_dev *pci_dev = ab_pci->pdev; in ath11k_pci_alloc_msi()
421 msi_config->total_vectors, in ath11k_pci_alloc_msi()
422 msi_config->total_vectors, in ath11k_pci_alloc_msi()
424 if (num_vectors == msi_config->total_vectors) { in ath11k_pci_alloc_msi()
425 set_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags); in ath11k_pci_alloc_msi()
427 num_vectors = pci_alloc_irq_vectors(ab_pci->pdev, in ath11k_pci_alloc_msi()
432 ret = -EINVAL; in ath11k_pci_alloc_msi()
435 clear_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags); in ath11k_pci_alloc_msi()
436 ab->pci.msi.config = &msi_config_one_msi; in ath11k_pci_alloc_msi()
443 msi_desc = irq_get_msi_desc(ab_pci->pdev->irq); in ath11k_pci_alloc_msi()
446 ret = -EINVAL; in ath11k_pci_alloc_msi()
450 ab->pci.msi.ep_base_data = msi_desc->msg.data; in ath11k_pci_alloc_msi()
452 pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_LO, in ath11k_pci_alloc_msi()
453 &ab->pci.msi.addr_lo); in ath11k_pci_alloc_msi()
455 if (msi_desc->pci.msi_attrib.is_64) { in ath11k_pci_alloc_msi()
456 pci_read_config_dword(pci_dev, pci_dev->msi_cap + PCI_MSI_ADDRESS_HI, in ath11k_pci_alloc_msi()
457 &ab->pci.msi.addr_hi); in ath11k_pci_alloc_msi()
459 ab->pci.msi.addr_hi = 0; in ath11k_pci_alloc_msi()
462 ath11k_dbg(ab, ATH11K_DBG_PCI, "msi base data is %d\n", ab->pci.msi.ep_base_data); in ath11k_pci_alloc_msi()
467 pci_free_irq_vectors(ab_pci->pdev); in ath11k_pci_alloc_msi()
475 pci_free_irq_vectors(ab_pci->pdev); in ath11k_pci_free_msi()
482 msi_desc = irq_get_msi_desc(ab_pci->pdev->irq); in ath11k_pci_config_msi_data()
484 ath11k_err(ab_pci->ab, "msi_desc is NULL!\n"); in ath11k_pci_config_msi_data()
485 pci_free_irq_vectors(ab_pci->pdev); in ath11k_pci_config_msi_data()
486 return -EINVAL; in ath11k_pci_config_msi_data()
489 ab_pci->ab->pci.msi.ep_base_data = msi_desc->msg.data; in ath11k_pci_config_msi_data()
491 ath11k_dbg(ab_pci->ab, ATH11K_DBG_PCI, "after request_irq msi_ep_base_data %d\n", in ath11k_pci_config_msi_data()
492 ab_pci->ab->pci.msi.ep_base_data); in ath11k_pci_config_msi_data()
499 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_claim()
504 if (device_id != ab_pci->dev_id) { in ath11k_pci_claim()
506 device_id, ab_pci->dev_id); in ath11k_pci_claim()
507 ret = -EIO; in ath11k_pci_claim()
529 ret = dma_set_mask_and_coherent(&pdev->dev, in ath11k_pci_claim()
539 ab->mem_len = pci_resource_len(pdev, ATH11K_PCI_BAR_NUM); in ath11k_pci_claim()
540 ab->mem = pci_iomap(pdev, ATH11K_PCI_BAR_NUM, 0); in ath11k_pci_claim()
541 if (!ab->mem) { in ath11k_pci_claim()
543 ret = -EIO; in ath11k_pci_claim()
547 ab->mem_ce = ab->mem; in ath11k_pci_claim()
549 ath11k_dbg(ab, ATH11K_DBG_BOOT, "pci_mem 0x%p\n", ab->mem); in ath11k_pci_claim()
562 struct ath11k_base *ab = ab_pci->ab; in ath11k_pci_free_region()
563 struct pci_dev *pci_dev = ab_pci->pdev; in ath11k_pci_free_region()
565 pci_iounmap(pci_dev, ab->mem); in ath11k_pci_free_region()
566 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_clear_word(ab_pci->pdev, PCI_EXP_LNKCTL, 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_clear_and_set_word(ab_pci->pdev, PCI_EXP_LNKCTL, in ath11k_pci_aspm_restore()
596 ab_pci->link_ctl & in ath11k_pci_aspm_restore()
605 ab_pci->register_window = 0; in ath11k_pci_power_up()
606 clear_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags); in ath11k_pci_power_up()
607 ath11k_pci_sw_reset(ab_pci->ab, true); in ath11k_pci_power_up()
609 /* Disable ASPM during firmware download due to problems switching in ath11k_pci_power_up()
622 if (ab->hw_params.static_window_map) in ath11k_pci_power_up()
632 /* restore aspm in case firmware bootup fails */ in ath11k_pci_power_down()
635 ath11k_pci_force_wake(ab_pci->ab); in ath11k_pci_power_down()
640 clear_bit(ATH11K_FLAG_DEVICE_INIT_DONE, &ab->dev_flags); in ath11k_pci_power_down()
641 ath11k_pci_sw_reset(ab_pci->ab, false); in ath11k_pci_power_down()
675 if (test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags)) in ath11k_pci_start()
722 if (test_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab_pci->ab->dev_flags)) in ath11k_pci_set_irq_affinity_hint()
725 return irq_set_affinity_hint(ab_pci->pdev->irq, m); in ath11k_pci_set_irq_affinity_hint()
737 ab = ath11k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH11K_BUS_PCI); in ath11k_pci_probe()
740 dev_err(&pdev->dev, "failed to allocate ath11k base\n"); in ath11k_pci_probe()
741 return -ENOMEM; in ath11k_pci_probe()
744 ab->dev = &pdev->dev; in ath11k_pci_probe()
747 ab_pci->dev_id = pci_dev->device; in ath11k_pci_probe()
748 ab_pci->ab = ab; in ath11k_pci_probe()
749 ab_pci->pdev = pdev; in ath11k_pci_probe()
750 ab->hif.ops = &ath11k_pci_hif_ops; in ath11k_pci_probe()
751 ab->fw_mode = ATH11K_FIRMWARE_MODE_NORMAL; in ath11k_pci_probe()
753 spin_lock_init(&ab_pci->window_lock); in ath11k_pci_probe()
759 ret = of_property_read_u32(ab->dev->of_node, "memory-region", &addr); in ath11k_pci_probe()
761 set_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags); in ath11k_pci_probe()
770 pdev->vendor, pdev->device, in ath11k_pci_probe()
771 pdev->subsystem_vendor, pdev->subsystem_device); in ath11k_pci_probe()
773 ab->id.vendor = pdev->vendor; in ath11k_pci_probe()
774 ab->id.device = pdev->device; in ath11k_pci_probe()
775 ab->id.subsystem_vendor = pdev->subsystem_vendor; in ath11k_pci_probe()
776 ab->id.subsystem_device = pdev->subsystem_device; in ath11k_pci_probe()
778 switch (pci_dev->device) { in ath11k_pci_probe()
784 ab->hw_rev = ATH11K_HW_QCA6390_HW20; in ath11k_pci_probe()
787 dev_err(&pdev->dev, "Unsupported QCA6390 SOC hardware version: %d %d\n", in ath11k_pci_probe()
789 ret = -EOPNOTSUPP; in ath11k_pci_probe()
797 ab->hw_rev = ATH11K_HW_QCN9074_HW10; in ath11k_pci_probe()
800 ab->id.bdf_search = ATH11K_BDF_SEARCH_BUS_AND_BOARD; in ath11k_pci_probe()
808 ab->hw_rev = ATH11K_HW_WCN6855_HW20; in ath11k_pci_probe()
812 ab->hw_rev = ATH11K_HW_WCN6855_HW21; in ath11k_pci_probe()
820 dev_err(&pdev->dev, "Unsupported WCN6855 SOC hardware version: %d %d\n", in ath11k_pci_probe()
822 ret = -EOPNOTSUPP; in ath11k_pci_probe()
829 dev_err(&pdev->dev, "Unknown PCI device found: 0x%x\n", in ath11k_pci_probe()
830 pci_dev->device); in ath11k_pci_probe()
831 ret = -EOPNOTSUPP; in ath11k_pci_probe()
940 if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { in ath11k_pci_remove()
947 set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags); in ath11k_pci_remove()
977 if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { in ath11k_pci_pm_suspend()
978 ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot skipping pci suspend as qmi is not initialised\n"); in ath11k_pci_pm_suspend()
994 if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { in ath11k_pci_pm_resume()
995 ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot skipping pci resume as qmi is not initialised\n"); in ath11k_pci_pm_resume()
1044 /* firmware files */