• Home
  • Raw
  • Download

Lines Matching refs:wil

28 int wil_set_capabilities(struct wil6210_priv *wil)  in wil_set_capabilities()  argument
31 u32 jtag_id = wil_r(wil, RGF_USER_JTAG_DEV_ID); in wil_set_capabilities()
32 u8 chip_revision = (wil_r(wil, RGF_USER_REVISION_ID) & in wil_set_capabilities()
37 bitmap_zero(wil->hw_capa, hw_capa_last); in wil_set_capabilities()
38 bitmap_zero(wil->fw_capabilities, WMI_FW_CAPABILITY_MAX); in wil_set_capabilities()
39 bitmap_zero(wil->platform_capa, WIL_PLATFORM_CAPA_MAX); in wil_set_capabilities()
40 wil->wil_fw_name = ftm_mode ? WIL_FW_NAME_FTM_DEFAULT : in wil_set_capabilities()
42 wil->chip_revision = chip_revision; in wil_set_capabilities()
50 wil->hw_name = "Sparrow D0"; in wil_set_capabilities()
51 wil->hw_version = HW_VER_SPARROW_D0; in wil_set_capabilities()
55 if (wil_fw_verify_file_exists(wil, wil_fw_name)) in wil_set_capabilities()
56 wil->wil_fw_name = wil_fw_name; in wil_set_capabilities()
59 wil_err(wil, "mac_rgf_ext section not found in fw_mapping\n"); in wil_set_capabilities()
65 wil->hw_name = "Sparrow B0"; in wil_set_capabilities()
66 wil->hw_version = HW_VER_SPARROW_B0; in wil_set_capabilities()
69 wil->hw_name = "Unknown"; in wil_set_capabilities()
70 wil->hw_version = HW_VER_UNKNOWN; in wil_set_capabilities()
73 wil->rgf_fw_assert_code_addr = SPARROW_RGF_FW_ASSERT_CODE; in wil_set_capabilities()
74 wil->rgf_ucode_assert_code_addr = SPARROW_RGF_UCODE_ASSERT_CODE; in wil_set_capabilities()
77 wil->hw_name = "Talyn-MA"; in wil_set_capabilities()
78 wil->hw_version = HW_VER_TALYN; in wil_set_capabilities()
80 wil->rgf_fw_assert_code_addr = TALYN_RGF_FW_ASSERT_CODE; in wil_set_capabilities()
81 wil->rgf_ucode_assert_code_addr = TALYN_RGF_UCODE_ASSERT_CODE; in wil_set_capabilities()
82 if (wil_r(wil, RGF_USER_OTP_HW_RD_MACHINE_1) & in wil_set_capabilities()
84 set_bit(hw_capa_no_flash, wil->hw_capa); in wil_set_capabilities()
87 if (wil_fw_verify_file_exists(wil, wil_fw_name)) in wil_set_capabilities()
88 wil->wil_fw_name = wil_fw_name; in wil_set_capabilities()
91 wil->hw_name = "Talyn-MB"; in wil_set_capabilities()
92 wil->hw_version = HW_VER_TALYN_MB; in wil_set_capabilities()
95 wil->rgf_fw_assert_code_addr = TALYN_RGF_FW_ASSERT_CODE; in wil_set_capabilities()
96 wil->rgf_ucode_assert_code_addr = TALYN_RGF_UCODE_ASSERT_CODE; in wil_set_capabilities()
97 set_bit(hw_capa_no_flash, wil->hw_capa); in wil_set_capabilities()
98 wil->use_enhanced_dma_hw = true; in wil_set_capabilities()
99 wil->use_rx_hw_reordering = true; in wil_set_capabilities()
100 wil->use_compressed_rx_status = true; in wil_set_capabilities()
103 if (wil_fw_verify_file_exists(wil, wil_fw_name)) in wil_set_capabilities()
104 wil->wil_fw_name = wil_fw_name; in wil_set_capabilities()
107 wil_err(wil, "Unknown board hardware, chip_id 0x%08x, chip_revision 0x%08x\n", in wil_set_capabilities()
109 wil->hw_name = "Unknown"; in wil_set_capabilities()
110 wil->hw_version = HW_VER_UNKNOWN; in wil_set_capabilities()
114 wil_init_txrx_ops(wil); in wil_set_capabilities()
118 wil_err(wil, "fw_code section not found in fw_mapping\n"); in wil_set_capabilities()
121 wil->iccm_base = iccm_section->host; in wil_set_capabilities()
123 wil_info(wil, "Board hardware is %s, flash %sexist\n", wil->hw_name, in wil_set_capabilities()
124 test_bit(hw_capa_no_flash, wil->hw_capa) ? "doesn't " : ""); in wil_set_capabilities()
127 if (wil->platform_ops.get_capa) { in wil_set_capabilities()
129 wil->platform_ops.get_capa(wil->platform_handle); in wil_set_capabilities()
130 memcpy(wil->platform_capa, &platform_capa, in wil_set_capabilities()
131 min(sizeof(wil->platform_capa), sizeof(platform_capa))); in wil_set_capabilities()
134 wil_info(wil, "platform_capa 0x%lx\n", *wil->platform_capa); in wil_set_capabilities()
137 wil_request_firmware(wil, wil->wil_fw_name, false); in wil_set_capabilities()
138 wil_refresh_fw_capabilities(wil); in wil_set_capabilities()
143 void wil_disable_irq(struct wil6210_priv *wil) in wil_disable_irq() argument
145 int irq = wil->pdev->irq; in wil_disable_irq()
148 if (wil->n_msi == 3) { in wil_disable_irq()
154 void wil_enable_irq(struct wil6210_priv *wil) in wil_enable_irq() argument
156 int irq = wil->pdev->irq; in wil_enable_irq()
159 if (wil->n_msi == 3) { in wil_enable_irq()
165 static void wil_remove_all_additional_vifs(struct wil6210_priv *wil) in wil_remove_all_additional_vifs() argument
170 for (i = 1; i < GET_MAX_VIFS(wil); i++) { in wil_remove_all_additional_vifs()
171 vif = wil->vifs[i]; in wil_remove_all_additional_vifs()
174 wil_vif_remove(wil, vif->mid); in wil_remove_all_additional_vifs()
180 static int wil_if_pcie_enable(struct wil6210_priv *wil) in wil_if_pcie_enable() argument
182 struct pci_dev *pdev = wil->pdev; in wil_if_pcie_enable()
190 wil_dbg_misc(wil, "if_pcie_enable\n"); in wil_if_pcie_enable()
198 wil_dbg_misc(wil, "Setup %d MSI interrupts\n", n_msi); in wil_if_pcie_enable()
201 wil_dbg_misc(wil, "MSI interrupts disabled, use INTx\n"); in wil_if_pcie_enable()
204 wil_err(wil, "Invalid n_msi=%d, default to 1\n", n_msi); in wil_if_pcie_enable()
210 wil_err(wil, "3 MSI mode failed, try 1 MSI\n"); in wil_if_pcie_enable()
215 wil_err(wil, "pci_enable_msi failed, use INTx\n"); in wil_if_pcie_enable()
219 wil->n_msi = n_msi; in wil_if_pcie_enable()
221 if (wil->n_msi == 0 && msi_only) { in wil_if_pcie_enable()
222 wil_err(wil, "Interrupt pin not routed, unable to use INTx\n"); in wil_if_pcie_enable()
227 rc = wil6210_init_irq(wil, pdev->irq); in wil_if_pcie_enable()
232 mutex_lock(&wil->mutex); in wil_if_pcie_enable()
233 rc = wil_reset(wil, false); in wil_if_pcie_enable()
234 mutex_unlock(&wil->mutex); in wil_if_pcie_enable()
241 wil6210_fini_irq(wil, pdev->irq); in wil_if_pcie_enable()
250 static int wil_if_pcie_disable(struct wil6210_priv *wil) in wil_if_pcie_disable() argument
252 struct pci_dev *pdev = wil->pdev; in wil_if_pcie_disable()
254 wil_dbg_misc(wil, "if_pcie_disable\n"); in wil_if_pcie_disable()
258 wil6210_fini_irq(wil, pdev->irq); in wil_if_pcie_disable()
268 struct wil6210_priv *wil = wil_handle; in wil_platform_rop_ramdump() local
270 if (!wil) in wil_platform_rop_ramdump()
273 return wil_fw_copy_crash_dump(wil, buf, size); in wil_platform_rop_ramdump()
278 struct wil6210_priv *wil = wil_handle; in wil_platform_rop_fw_recovery() local
280 if (!wil) in wil_platform_rop_fw_recovery()
283 wil_fw_error_recovery(wil); in wil_platform_rop_fw_recovery()
288 static void wil_platform_ops_uninit(struct wil6210_priv *wil) in wil_platform_ops_uninit() argument
290 if (wil->platform_ops.uninit) in wil_platform_ops_uninit()
291 wil->platform_ops.uninit(wil->platform_handle); in wil_platform_ops_uninit()
292 memset(&wil->platform_ops, 0, sizeof(wil->platform_ops)); in wil_platform_ops_uninit()
297 struct wil6210_priv *wil; in wil_pcie_probe() local
321 wil = wil_if_alloc(dev); in wil_pcie_probe()
322 if (IS_ERR(wil)) { in wil_pcie_probe()
323 rc = (int)PTR_ERR(wil); in wil_pcie_probe()
328 wil->pdev = pdev; in wil_pcie_probe()
329 pci_set_drvdata(pdev, wil); in wil_pcie_probe()
330 wil->bar_size = bar_size; in wil_pcie_probe()
333 wil->platform_handle = in wil_pcie_probe()
334 wil_platform_init(&pdev->dev, &wil->platform_ops, &rops, wil); in wil_pcie_probe()
335 if (!wil->platform_handle) { in wil_pcie_probe()
337 wil_err(wil, "wil_platform_init failed\n"); in wil_pcie_probe()
343 wil_err(wil, in wil_pcie_probe()
352 wil_err(wil, in wil_pcie_probe()
361 wil_err(wil, "pci_request_region failed\n"); in wil_pcie_probe()
366 wil->csr = pci_ioremap_bar(pdev, 0); in wil_pcie_probe()
367 if (!wil->csr) { in wil_pcie_probe()
368 wil_err(wil, "pci_ioremap_bar failed\n"); in wil_pcie_probe()
373 wil_info(wil, "CSR at %pR -> 0x%p\n", &pdev->resource[0], wil->csr); in wil_pcie_probe()
375 rc = wil_set_capabilities(wil); in wil_pcie_probe()
377 wil_err(wil, "wil_set_capabilities failed, rc %d\n", rc); in wil_pcie_probe()
384 start_idx = wil->use_enhanced_dma_hw ? 0 : 1; in wil_pcie_probe()
395 wil->dma_addr_size = dma_addr_size[i]; in wil_pcie_probe()
399 if (wil->dma_addr_size == 0) in wil_pcie_probe()
402 wil6210_clear_irq(wil); in wil_pcie_probe()
405 rc = wil_if_pcie_enable(wil); in wil_pcie_probe()
407 wil_err(wil, "Enable device failed\n"); in wil_pcie_probe()
412 wil_clear_fw_log_addr(wil); in wil_pcie_probe()
413 rc = wil_if_add(wil); in wil_pcie_probe()
415 wil_err(wil, "wil_if_add failed: %d\n", rc); in wil_pcie_probe()
420 if (test_bit(WMI_FW_CAPABILITY_WMI_ONLY, wil->fw_capabilities)) { in wil_pcie_probe()
421 wil_dbg_misc(wil, "Loading WMI only FW\n"); in wil_pcie_probe()
422 mutex_lock(&wil->mutex); in wil_pcie_probe()
423 rc = wil_reset(wil, true); in wil_pcie_probe()
424 mutex_unlock(&wil->mutex); in wil_pcie_probe()
426 wil_err(wil, "failed to load WMI only FW\n"); in wil_pcie_probe()
432 wil->pm_notify.notifier_call = wil6210_pm_notify; in wil_pcie_probe()
434 rc = register_pm_notifier(&wil->pm_notify); in wil_pcie_probe()
439 wil_err(wil, "register_pm_notifier failed: %d\n", rc); in wil_pcie_probe()
441 wil6210_debugfs_init(wil); in wil_pcie_probe()
443 wil_pm_runtime_allow(wil); in wil_pcie_probe()
448 wil_if_pcie_disable(wil); in wil_pcie_probe()
450 pci_iounmap(pdev, wil->csr); in wil_pcie_probe()
456 wil_platform_ops_uninit(wil); in wil_pcie_probe()
458 wil_if_free(wil); in wil_pcie_probe()
465 struct wil6210_priv *wil = pci_get_drvdata(pdev); in wil_pcie_remove() local
466 void __iomem *csr = wil->csr; in wil_pcie_remove()
468 wil_dbg_misc(wil, "pcie_remove\n"); in wil_pcie_remove()
470 unregister_pm_notifier(&wil->pm_notify); in wil_pcie_remove()
472 wil_pm_runtime_forbid(wil); in wil_pcie_remove()
474 wil6210_debugfs_remove(wil); in wil_pcie_remove()
476 wiphy_lock(wil->wiphy); in wil_pcie_remove()
477 wil_p2p_wdev_free(wil); in wil_pcie_remove()
478 wil_remove_all_additional_vifs(wil); in wil_pcie_remove()
479 wiphy_unlock(wil->wiphy); in wil_pcie_remove()
481 wil_if_remove(wil); in wil_pcie_remove()
482 wil_if_pcie_disable(wil); in wil_pcie_remove()
486 wil_platform_ops_uninit(wil); in wil_pcie_remove()
487 wil_if_free(wil); in wil_pcie_remove()
502 struct wil6210_priv *wil = pci_get_drvdata(pdev); in wil6210_suspend() local
505 wil_dbg_pm(wil, "suspend: %s\n", is_runtime ? "runtime" : "system"); in wil6210_suspend()
507 mutex_lock(&wil->vif_mutex); in wil6210_suspend()
508 active_ifaces = wil_has_active_ifaces(wil, true, false); in wil6210_suspend()
509 mutex_unlock(&wil->vif_mutex); in wil6210_suspend()
510 keep_radio_on = active_ifaces && wil->keep_radio_on_during_sleep; in wil6210_suspend()
512 rc = wil_can_suspend(wil, is_runtime); in wil6210_suspend()
516 rc = wil_suspend(wil, is_runtime, keep_radio_on); in wil6210_suspend()
524 wil->suspend_stats.r_off.successful_suspends++; in wil6210_suspend()
526 wil->suspend_stats.r_on.successful_suspends++; in wil6210_suspend()
537 struct wil6210_priv *wil = pci_get_drvdata(pdev); in wil6210_resume() local
540 wil_dbg_pm(wil, "resume: %s\n", is_runtime ? "runtime" : "system"); in wil6210_resume()
542 mutex_lock(&wil->vif_mutex); in wil6210_resume()
543 active_ifaces = wil_has_active_ifaces(wil, true, false); in wil6210_resume()
544 mutex_unlock(&wil->vif_mutex); in wil6210_resume()
545 keep_radio_on = active_ifaces && wil->keep_radio_on_during_sleep; in wil6210_resume()
553 rc = wil_resume(wil, is_runtime, keep_radio_on); in wil6210_resume()
555 wil_err(wil, "device failed to resume (%d)\n", rc); in wil6210_resume()
558 wil->suspend_stats.r_off.failed_resumes++; in wil6210_resume()
560 wil->suspend_stats.r_on.failed_resumes++; in wil6210_resume()
564 wil->suspend_stats.r_on.successful_resumes++; in wil6210_resume()
566 wil->suspend_stats.r_off.successful_resumes++; in wil6210_resume()
575 struct wil6210_priv *wil = container_of( in wil6210_pm_notify() local
580 wil_dbg_pm(wil, "pm_notify: mode (%ld)\n", mode); in wil6210_pm_notify()
586 rc = wil_can_suspend(wil, false); in wil6210_pm_notify()
590 if (wil->platform_ops.notify) in wil6210_pm_notify()
591 rc = wil->platform_ops.notify(wil->platform_handle, in wil6210_pm_notify()
598 if (wil->platform_ops.notify) in wil6210_pm_notify()
599 rc = wil->platform_ops.notify(wil->platform_handle, in wil6210_pm_notify()
603 wil_dbg_pm(wil, "unhandled notify mode %ld\n", mode); in wil6210_pm_notify()
607 wil_dbg_pm(wil, "notification mode %ld: rc (%d)\n", mode, rc); in wil6210_pm_notify()
623 struct wil6210_priv *wil = dev_get_drvdata(dev); in wil6210_pm_runtime_idle() local
625 wil_dbg_pm(wil, "Runtime idle\n"); in wil6210_pm_runtime_idle()
627 return wil_can_suspend(wil, true); in wil6210_pm_runtime_idle()
637 struct wil6210_priv *wil = dev_get_drvdata(dev); in wil6210_pm_runtime_suspend() local
639 if (test_bit(wil_status_suspended, wil->status)) { in wil6210_pm_runtime_suspend()
640 wil_dbg_pm(wil, "trying to suspend while suspended\n"); in wil6210_pm_runtime_suspend()