Lines Matching refs:ab

140 ath11k_ahb_get_msi_irq_wcn6750(struct ath11k_base *ab, unsigned int vector)  in ath11k_ahb_get_msi_irq_wcn6750()  argument
142 return ab->pci.msi.irqs[vector]; in ath11k_ahb_get_msi_irq_wcn6750()
146 ath11k_ahb_get_window_start_wcn6750(struct ath11k_base *ab, u32 offset) in ath11k_ahb_get_window_start_wcn6750() argument
154 else if ((offset ^ HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab)) < in ath11k_ahb_get_window_start_wcn6750()
162 ath11k_ahb_window_write32_wcn6750(struct ath11k_base *ab, u32 offset, u32 value) in ath11k_ahb_window_write32_wcn6750() argument
167 window_start = ath11k_ahb_get_window_start_wcn6750(ab, offset); in ath11k_ahb_window_write32_wcn6750()
169 iowrite32(value, ab->mem + window_start + in ath11k_ahb_window_write32_wcn6750()
173 static u32 ath11k_ahb_window_read32_wcn6750(struct ath11k_base *ab, u32 offset) in ath11k_ahb_window_read32_wcn6750() argument
179 window_start = ath11k_ahb_get_window_start_wcn6750(ab, offset); in ath11k_ahb_window_read32_wcn6750()
181 val = ioread32(ab->mem + window_start + in ath11k_ahb_window_read32_wcn6750()
194 static inline u32 ath11k_ahb_read32(struct ath11k_base *ab, u32 offset) in ath11k_ahb_read32() argument
196 return ioread32(ab->mem + offset); in ath11k_ahb_read32()
199 static inline void ath11k_ahb_write32(struct ath11k_base *ab, u32 offset, u32 value) in ath11k_ahb_write32() argument
201 iowrite32(value, ab->mem + offset); in ath11k_ahb_write32()
204 static void ath11k_ahb_kill_tasklets(struct ath11k_base *ab) in ath11k_ahb_kill_tasklets() argument
208 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_kill_tasklets()
209 struct ath11k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i]; in ath11k_ahb_kill_tasklets()
211 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_ahb_kill_tasklets()
223 disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_ahb_ext_grp_disable()
226 static void __ath11k_ahb_ext_irq_disable(struct ath11k_base *ab) in __ath11k_ahb_ext_irq_disable() argument
231 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in __ath11k_ahb_ext_irq_disable()
248 enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_ahb_ext_grp_enable()
251 static void ath11k_ahb_setbit32(struct ath11k_base *ab, u8 bit, u32 offset) in ath11k_ahb_setbit32() argument
255 val = ath11k_ahb_read32(ab, offset); in ath11k_ahb_setbit32()
256 ath11k_ahb_write32(ab, offset, val | BIT(bit)); in ath11k_ahb_setbit32()
259 static void ath11k_ahb_clearbit32(struct ath11k_base *ab, u8 bit, u32 offset) in ath11k_ahb_clearbit32() argument
263 val = ath11k_ahb_read32(ab, offset); in ath11k_ahb_clearbit32()
264 ath11k_ahb_write32(ab, offset, val & ~BIT(bit)); in ath11k_ahb_clearbit32()
267 static void ath11k_ahb_ce_irq_enable(struct ath11k_base *ab, u16 ce_id) in ath11k_ahb_ce_irq_enable() argument
271 ce_attr = &ab->hw_params.host_ce_config[ce_id]; in ath11k_ahb_ce_irq_enable()
273 ath11k_ahb_setbit32(ab, ce_id, CE_HOST_IE_ADDRESS); in ath11k_ahb_ce_irq_enable()
276 ath11k_ahb_setbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS); in ath11k_ahb_ce_irq_enable()
277 ath11k_ahb_setbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, in ath11k_ahb_ce_irq_enable()
282 static void ath11k_ahb_ce_irq_disable(struct ath11k_base *ab, u16 ce_id) in ath11k_ahb_ce_irq_disable() argument
286 ce_attr = &ab->hw_params.host_ce_config[ce_id]; in ath11k_ahb_ce_irq_disable()
288 ath11k_ahb_clearbit32(ab, ce_id, CE_HOST_IE_ADDRESS); in ath11k_ahb_ce_irq_disable()
291 ath11k_ahb_clearbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS); in ath11k_ahb_ce_irq_disable()
292 ath11k_ahb_clearbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, in ath11k_ahb_ce_irq_disable()
297 static void ath11k_ahb_sync_ce_irqs(struct ath11k_base *ab) in ath11k_ahb_sync_ce_irqs() argument
302 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_sync_ce_irqs()
303 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_ahb_sync_ce_irqs()
307 synchronize_irq(ab->irq_num[irq_idx]); in ath11k_ahb_sync_ce_irqs()
311 static void ath11k_ahb_sync_ext_irqs(struct ath11k_base *ab) in ath11k_ahb_sync_ext_irqs() argument
317 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_ahb_sync_ext_irqs()
321 synchronize_irq(ab->irq_num[irq_idx]); in ath11k_ahb_sync_ext_irqs()
326 static void ath11k_ahb_ce_irqs_enable(struct ath11k_base *ab) in ath11k_ahb_ce_irqs_enable() argument
330 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_ce_irqs_enable()
331 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_ahb_ce_irqs_enable()
333 ath11k_ahb_ce_irq_enable(ab, i); in ath11k_ahb_ce_irqs_enable()
337 static void ath11k_ahb_ce_irqs_disable(struct ath11k_base *ab) in ath11k_ahb_ce_irqs_disable() argument
341 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_ce_irqs_disable()
342 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_ahb_ce_irqs_disable()
344 ath11k_ahb_ce_irq_disable(ab, i); in ath11k_ahb_ce_irqs_disable()
348 static int ath11k_ahb_start(struct ath11k_base *ab) in ath11k_ahb_start() argument
350 ath11k_ahb_ce_irqs_enable(ab); in ath11k_ahb_start()
351 ath11k_ce_rx_post_buf(ab); in ath11k_ahb_start()
356 static void ath11k_ahb_ext_irq_enable(struct ath11k_base *ab) in ath11k_ahb_ext_irq_enable() argument
361 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_ahb_ext_irq_enable()
372 static void ath11k_ahb_ext_irq_disable(struct ath11k_base *ab) in ath11k_ahb_ext_irq_disable() argument
374 __ath11k_ahb_ext_irq_disable(ab); in ath11k_ahb_ext_irq_disable()
375 ath11k_ahb_sync_ext_irqs(ab); in ath11k_ahb_ext_irq_disable()
378 static void ath11k_ahb_stop(struct ath11k_base *ab) in ath11k_ahb_stop() argument
380 if (!test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags)) in ath11k_ahb_stop()
381 ath11k_ahb_ce_irqs_disable(ab); in ath11k_ahb_stop()
382 ath11k_ahb_sync_ce_irqs(ab); in ath11k_ahb_stop()
383 ath11k_ahb_kill_tasklets(ab); in ath11k_ahb_stop()
384 del_timer_sync(&ab->rx_replenish_retry); in ath11k_ahb_stop()
385 ath11k_ce_cleanup_pipes(ab); in ath11k_ahb_stop()
388 static int ath11k_ahb_power_up(struct ath11k_base *ab) in ath11k_ahb_power_up() argument
390 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_power_up()
395 ath11k_err(ab, "failed to boot the remote processor Q6\n"); in ath11k_ahb_power_up()
400 static void ath11k_ahb_power_down(struct ath11k_base *ab) in ath11k_ahb_power_down() argument
402 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_power_down()
407 static int ath11k_ahb_fwreset_from_cold_boot(struct ath11k_base *ab) in ath11k_ahb_fwreset_from_cold_boot() argument
411 if (ath11k_cold_boot_cal == 0 || ab->qmi.cal_done || in ath11k_ahb_fwreset_from_cold_boot()
412 ab->hw_params.cold_boot_calib == 0 || in ath11k_ahb_fwreset_from_cold_boot()
413 ab->hw_params.cbcal_restart_fw == 0) in ath11k_ahb_fwreset_from_cold_boot()
416 ath11k_dbg(ab, ATH11K_DBG_AHB, "wait for cold boot done\n"); in ath11k_ahb_fwreset_from_cold_boot()
417 timeout = wait_event_timeout(ab->qmi.cold_boot_waitq, in ath11k_ahb_fwreset_from_cold_boot()
418 (ab->qmi.cal_done == 1), in ath11k_ahb_fwreset_from_cold_boot()
422 ath11k_warn(ab, "Coldboot Calibration failed timed out\n"); in ath11k_ahb_fwreset_from_cold_boot()
426 ath11k_ahb_power_down(ab); in ath11k_ahb_fwreset_from_cold_boot()
427 ath11k_ahb_power_up(ab); in ath11k_ahb_fwreset_from_cold_boot()
429 ath11k_dbg(ab, ATH11K_DBG_AHB, "exited from cold boot mode\n"); in ath11k_ahb_fwreset_from_cold_boot()
433 static void ath11k_ahb_init_qmi_ce_config(struct ath11k_base *ab) in ath11k_ahb_init_qmi_ce_config() argument
435 struct ath11k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; in ath11k_ahb_init_qmi_ce_config()
437 cfg->tgt_ce_len = ab->hw_params.target_ce_count; in ath11k_ahb_init_qmi_ce_config()
438 cfg->tgt_ce = ab->hw_params.target_ce_config; in ath11k_ahb_init_qmi_ce_config()
439 cfg->svc_to_ce_map_len = ab->hw_params.svc_to_ce_map_len; in ath11k_ahb_init_qmi_ce_config()
440 cfg->svc_to_ce_map = ab->hw_params.svc_to_ce_map; in ath11k_ahb_init_qmi_ce_config()
441 ab->qmi.service_ins_id = ab->hw_params.qmi_service_ins_id; in ath11k_ahb_init_qmi_ce_config()
444 static void ath11k_ahb_free_ext_irq(struct ath11k_base *ab) in ath11k_ahb_free_ext_irq() argument
449 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_ahb_free_ext_irq()
452 free_irq(ab->irq_num[irq_grp->irqs[j]], irq_grp); in ath11k_ahb_free_ext_irq()
458 static void ath11k_ahb_free_irq(struct ath11k_base *ab) in ath11k_ahb_free_irq() argument
463 if (ab->hw_params.hybrid_bus_type) in ath11k_ahb_free_irq()
464 return ath11k_pcic_free_irq(ab); in ath11k_ahb_free_irq()
466 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_free_irq()
467 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_ahb_free_irq()
470 free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); in ath11k_ahb_free_irq()
473 ath11k_ahb_free_ext_irq(ab); in ath11k_ahb_free_irq()
480 ath11k_ce_per_engine_service(ce_pipe->ab, ce_pipe->pipe_num); in ath11k_ahb_ce_tasklet()
482 ath11k_ahb_ce_irq_enable(ce_pipe->ab, ce_pipe->pipe_num); in ath11k_ahb_ce_tasklet()
492 ath11k_ahb_ce_irq_disable(ce_pipe->ab, ce_pipe->pipe_num); in ath11k_ahb_ce_interrupt_handler()
504 struct ath11k_base *ab = irq_grp->ab; in ath11k_ahb_ext_grp_napi_poll() local
507 work_done = ath11k_dp_service_srng(ab, irq_grp, budget); in ath11k_ahb_ext_grp_napi_poll()
533 static int ath11k_ahb_config_ext_irq(struct ath11k_base *ab) in ath11k_ahb_config_ext_irq() argument
535 struct ath11k_hw_params *hw = &ab->hw_params; in ath11k_ahb_config_ext_irq()
541 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_ahb_config_ext_irq()
544 irq_grp->ab = ab; in ath11k_ahb_config_ext_irq()
551 if (ab->hw_params.ring_mask->tx[i] & BIT(j)) { in ath11k_ahb_config_ext_irq()
556 if (ab->hw_params.ring_mask->rx[i] & BIT(j)) { in ath11k_ahb_config_ext_irq()
561 if (ab->hw_params.ring_mask->rx_err[i] & BIT(j)) in ath11k_ahb_config_ext_irq()
564 if (ab->hw_params.ring_mask->rx_wbm_rel[i] & BIT(j)) in ath11k_ahb_config_ext_irq()
567 if (ab->hw_params.ring_mask->reo_status[i] & BIT(j)) in ath11k_ahb_config_ext_irq()
570 if (j < ab->hw_params.max_radios) { in ath11k_ahb_config_ext_irq()
571 if (ab->hw_params.ring_mask->rxdma2host[i] & BIT(j)) { in ath11k_ahb_config_ext_irq()
577 if (ab->hw_params.ring_mask->host2rxdma[i] & BIT(j)) { in ath11k_ahb_config_ext_irq()
583 if (ab->hw_params.ring_mask->rx_mon_status[i] & BIT(j)) { in ath11k_ahb_config_ext_irq()
598 irq = platform_get_irq_byname(ab->pdev, in ath11k_ahb_config_ext_irq()
600 ab->irq_num[irq_idx] = irq; in ath11k_ahb_config_ext_irq()
606 ath11k_err(ab, "failed request_irq for %d\n", in ath11k_ahb_config_ext_irq()
615 static int ath11k_ahb_config_irq(struct ath11k_base *ab) in ath11k_ahb_config_irq() argument
620 if (ab->hw_params.hybrid_bus_type) in ath11k_ahb_config_irq()
621 return ath11k_pcic_config_irq(ab); in ath11k_ahb_config_irq()
624 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_config_irq()
625 struct ath11k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i]; in ath11k_ahb_config_irq()
627 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_ahb_config_irq()
633 irq = platform_get_irq_byname(ab->pdev, irq_name[irq_idx]); in ath11k_ahb_config_irq()
640 ab->irq_num[irq_idx] = irq; in ath11k_ahb_config_irq()
644 ret = ath11k_ahb_config_ext_irq(ab); in ath11k_ahb_config_irq()
649 static int ath11k_ahb_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, in ath11k_ahb_map_service_to_pipe() argument
656 for (i = 0; i < ab->hw_params.svc_to_ce_map_len; i++) { in ath11k_ahb_map_service_to_pipe()
657 entry = &ab->hw_params.svc_to_ce_map[i]; in ath11k_ahb_map_service_to_pipe()
692 static int ath11k_ahb_hif_suspend(struct ath11k_base *ab) in ath11k_ahb_hif_suspend() argument
694 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_hif_suspend()
699 if (!device_may_wakeup(ab->dev)) in ath11k_ahb_hif_suspend()
702 wake_irq = ab->irq_num[ATH11K_PCI_IRQ_CE0_OFFSET + ATH11K_PCI_CE_WAKE_IRQ]; in ath11k_ahb_hif_suspend()
706 ath11k_err(ab, "failed to enable wakeup irq :%d\n", ret); in ath11k_ahb_hif_suspend()
718 ath11k_err(ab, "failed to send smp2p power save enter cmd :%d\n", ret); in ath11k_ahb_hif_suspend()
722 ath11k_dbg(ab, ATH11K_DBG_AHB, "ahb device suspended\n"); in ath11k_ahb_hif_suspend()
727 static int ath11k_ahb_hif_resume(struct ath11k_base *ab) in ath11k_ahb_hif_resume() argument
729 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_hif_resume()
734 if (!device_may_wakeup(ab->dev)) in ath11k_ahb_hif_resume()
737 wake_irq = ab->irq_num[ATH11K_PCI_IRQ_CE0_OFFSET + ATH11K_PCI_CE_WAKE_IRQ]; in ath11k_ahb_hif_resume()
741 ath11k_err(ab, "failed to disable wakeup irq: %d\n", ret); in ath11k_ahb_hif_resume()
745 reinit_completion(&ab->wow.wakeup_completed); in ath11k_ahb_hif_resume()
755 ath11k_err(ab, "failed to send smp2p power save enter cmd :%d\n", ret); in ath11k_ahb_hif_resume()
759 ret = wait_for_completion_timeout(&ab->wow.wakeup_completed, 3 * HZ); in ath11k_ahb_hif_resume()
761 ath11k_warn(ab, "timed out while waiting for wow wakeup completion\n"); in ath11k_ahb_hif_resume()
765 ath11k_dbg(ab, ATH11K_DBG_AHB, "ahb device resumed\n"); in ath11k_ahb_hif_resume()
802 static int ath11k_core_get_rproc(struct ath11k_base *ab) in ath11k_core_get_rproc() argument
804 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_core_get_rproc()
805 struct device *dev = ab->dev; in ath11k_core_get_rproc()
810 ath11k_err(ab, "failed to get q6_rproc handle\n"); in ath11k_core_get_rproc()
816 ath11k_err(ab, "failed to get rproc\n"); in ath11k_core_get_rproc()
824 static int ath11k_ahb_setup_msi_resources(struct ath11k_base *ab) in ath11k_ahb_setup_msi_resources() argument
826 struct platform_device *pdev = ab->pdev; in ath11k_ahb_setup_msi_resources()
834 ret = ath11k_pcic_init_msi_config(ab); in ath11k_ahb_setup_msi_resources()
836 ath11k_err(ab, "failed to init msi config: %d\n", ret); in ath11k_ahb_setup_msi_resources()
842 ath11k_err(ab, "failed to fetch msi_addr\n"); in ath11k_ahb_setup_msi_resources()
847 msi_addr_iova = dma_map_resource(ab->dev, msi_addr_pa, PAGE_SIZE, in ath11k_ahb_setup_msi_resources()
849 if (dma_mapping_error(ab->dev, msi_addr_iova)) in ath11k_ahb_setup_msi_resources()
852 ab->pci.msi.addr_lo = lower_32_bits(msi_addr_iova); in ath11k_ahb_setup_msi_resources()
853 ab->pci.msi.addr_hi = upper_32_bits(msi_addr_iova); in ath11k_ahb_setup_msi_resources()
855 ret = of_property_read_u32_index(ab->dev->of_node, "interrupts", 1, &int_prop); in ath11k_ahb_setup_msi_resources()
859 ab->pci.msi.ep_base_data = int_prop + 32; in ath11k_ahb_setup_msi_resources()
861 for (i = 0; i < ab->pci.msi.config->total_vectors; i++) { in ath11k_ahb_setup_msi_resources()
866 ab->pci.msi.irqs[i] = res->start; in ath11k_ahb_setup_msi_resources()
869 set_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags); in ath11k_ahb_setup_msi_resources()
874 static int ath11k_ahb_setup_smp2p_handle(struct ath11k_base *ab) in ath11k_ahb_setup_smp2p_handle() argument
876 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_setup_smp2p_handle()
878 if (!ab->hw_params.smp2p_wow_exit) in ath11k_ahb_setup_smp2p_handle()
881 ab_ahb->smp2p_info.smem_state = qcom_smem_state_get(ab->dev, "wlan-smp2p-out", in ath11k_ahb_setup_smp2p_handle()
884 ath11k_err(ab, "failed to fetch smem state: %ld\n", in ath11k_ahb_setup_smp2p_handle()
892 static void ath11k_ahb_release_smp2p_handle(struct ath11k_base *ab) in ath11k_ahb_release_smp2p_handle() argument
894 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_release_smp2p_handle()
896 if (!ab->hw_params.smp2p_wow_exit) in ath11k_ahb_release_smp2p_handle()
902 static int ath11k_ahb_setup_resources(struct ath11k_base *ab) in ath11k_ahb_setup_resources() argument
904 struct platform_device *pdev = ab->pdev; in ath11k_ahb_setup_resources()
908 if (ab->hw_params.hybrid_bus_type) in ath11k_ahb_setup_resources()
909 return ath11k_ahb_setup_msi_resources(ab); in ath11k_ahb_setup_resources()
917 ab->mem = mem; in ath11k_ahb_setup_resources()
918 ab->mem_len = resource_size(mem_res); in ath11k_ahb_setup_resources()
923 static int ath11k_ahb_setup_msa_resources(struct ath11k_base *ab) in ath11k_ahb_setup_msa_resources() argument
925 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_setup_msa_resources()
926 struct device *dev = ab->dev; in ath11k_ahb_setup_msa_resources()
962 static int ath11k_ahb_fw_resources_init(struct ath11k_base *ab) in ath11k_ahb_fw_resources_init() argument
964 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_fw_resources_init()
965 struct device *host_dev = ab->dev; in ath11k_ahb_fw_resources_init()
975 if (!ab->hw_params.fixed_fw_mem) in ath11k_ahb_fw_resources_init()
978 ret = ath11k_ahb_setup_msa_resources(ab); in ath11k_ahb_fw_resources_init()
980 ath11k_err(ab, "failed to setup msa resources\n"); in ath11k_ahb_fw_resources_init()
1003 ath11k_err(ab, "dma configure fail: %d\n", ret); in ath11k_ahb_fw_resources_init()
1011 ath11k_err(ab, "failed to allocate iommu domain\n"); in ath11k_ahb_fw_resources_init()
1018 ath11k_err(ab, "could not attach device: %d\n", ret); in ath11k_ahb_fw_resources_init()
1026 ath11k_err(ab, "failed to map firmware region: %d\n", ret); in ath11k_ahb_fw_resources_init()
1034 ath11k_err(ab, "failed to map firmware CE region: %d\n", ret); in ath11k_ahb_fw_resources_init()
1060 static int ath11k_ahb_fw_resource_deinit(struct ath11k_base *ab) in ath11k_ahb_fw_resource_deinit() argument
1062 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_fw_resource_deinit()
1073 ath11k_err(ab, "failed to unmap firmware: %zu\n", in ath11k_ahb_fw_resource_deinit()
1078 ath11k_err(ab, "failed to unmap firmware CE memory: %zu\n", in ath11k_ahb_fw_resource_deinit()
1091 struct ath11k_base *ab; in ath11k_ahb_probe() local
1127 ab = ath11k_core_alloc(&pdev->dev, sizeof(struct ath11k_ahb), in ath11k_ahb_probe()
1129 if (!ab) { in ath11k_ahb_probe()
1134 ab->hif.ops = hif_ops; in ath11k_ahb_probe()
1135 ab->pdev = pdev; in ath11k_ahb_probe()
1136 ab->hw_rev = hw_rev; in ath11k_ahb_probe()
1137 platform_set_drvdata(pdev, ab); in ath11k_ahb_probe()
1139 ret = ath11k_pcic_register_pci_ops(ab, pci_ops); in ath11k_ahb_probe()
1141 ath11k_err(ab, "failed to register PCI ops: %d\n", ret); in ath11k_ahb_probe()
1145 ret = ath11k_core_pre_init(ab); in ath11k_ahb_probe()
1149 ret = ath11k_ahb_setup_resources(ab); in ath11k_ahb_probe()
1153 ret = ath11k_ahb_fw_resources_init(ab); in ath11k_ahb_probe()
1157 ret = ath11k_ahb_setup_smp2p_handle(ab); in ath11k_ahb_probe()
1161 ret = ath11k_hal_srng_init(ab); in ath11k_ahb_probe()
1165 ret = ath11k_ce_alloc_pipes(ab); in ath11k_ahb_probe()
1167 ath11k_err(ab, "failed to allocate ce pipes: %d\n", ret); in ath11k_ahb_probe()
1171 ath11k_ahb_init_qmi_ce_config(ab); in ath11k_ahb_probe()
1173 ret = ath11k_core_get_rproc(ab); in ath11k_ahb_probe()
1175 ath11k_err(ab, "failed to get rproc: %d\n", ret); in ath11k_ahb_probe()
1179 ret = ath11k_core_init(ab); in ath11k_ahb_probe()
1181 ath11k_err(ab, "failed to init core: %d\n", ret); in ath11k_ahb_probe()
1185 ret = ath11k_ahb_config_irq(ab); in ath11k_ahb_probe()
1187 ath11k_err(ab, "failed to configure irq: %d\n", ret); in ath11k_ahb_probe()
1191 ath11k_ahb_fwreset_from_cold_boot(ab); in ath11k_ahb_probe()
1196 ath11k_ce_free_pipes(ab); in ath11k_ahb_probe()
1199 ath11k_hal_srng_deinit(ab); in ath11k_ahb_probe()
1202 ath11k_ahb_release_smp2p_handle(ab); in ath11k_ahb_probe()
1205 ath11k_ahb_fw_resource_deinit(ab); in ath11k_ahb_probe()
1208 ath11k_core_free(ab); in ath11k_ahb_probe()
1214 static void ath11k_ahb_remove_prepare(struct ath11k_base *ab) in ath11k_ahb_remove_prepare() argument
1218 if (test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags)) { in ath11k_ahb_remove_prepare()
1219 left = wait_for_completion_timeout(&ab->driver_recovery, in ath11k_ahb_remove_prepare()
1222 ath11k_warn(ab, "failed to receive recovery response completion\n"); in ath11k_ahb_remove_prepare()
1225 set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags); in ath11k_ahb_remove_prepare()
1226 cancel_work_sync(&ab->restart_work); in ath11k_ahb_remove_prepare()
1227 cancel_work_sync(&ab->qmi.event_work); in ath11k_ahb_remove_prepare()
1230 static void ath11k_ahb_free_resources(struct ath11k_base *ab) in ath11k_ahb_free_resources() argument
1232 struct platform_device *pdev = ab->pdev; in ath11k_ahb_free_resources()
1234 ath11k_ahb_free_irq(ab); in ath11k_ahb_free_resources()
1235 ath11k_hal_srng_deinit(ab); in ath11k_ahb_free_resources()
1236 ath11k_ahb_release_smp2p_handle(ab); in ath11k_ahb_free_resources()
1237 ath11k_ahb_fw_resource_deinit(ab); in ath11k_ahb_free_resources()
1238 ath11k_ce_free_pipes(ab); in ath11k_ahb_free_resources()
1239 ath11k_core_free(ab); in ath11k_ahb_free_resources()
1245 struct ath11k_base *ab = platform_get_drvdata(pdev); in ath11k_ahb_remove() local
1247 if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { in ath11k_ahb_remove()
1248 ath11k_ahb_power_down(ab); in ath11k_ahb_remove()
1249 ath11k_debugfs_soc_destroy(ab); in ath11k_ahb_remove()
1250 ath11k_qmi_deinit_service(ab); in ath11k_ahb_remove()
1254 ath11k_ahb_remove_prepare(ab); in ath11k_ahb_remove()
1255 ath11k_core_deinit(ab); in ath11k_ahb_remove()
1258 ath11k_ahb_free_resources(ab); in ath11k_ahb_remove()
1265 struct ath11k_base *ab = platform_get_drvdata(pdev); in ath11k_ahb_shutdown() local
1271 ath11k_ahb_remove_prepare(ab); in ath11k_ahb_shutdown()
1273 if (!(test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags))) in ath11k_ahb_shutdown()
1276 ath11k_core_deinit(ab); in ath11k_ahb_shutdown()
1279 ath11k_ahb_free_resources(ab); in ath11k_ahb_shutdown()