Lines Matching full:ab
145 ath11k_ahb_get_msi_irq_wcn6750(struct ath11k_base *ab, unsigned int vector) in ath11k_ahb_get_msi_irq_wcn6750() argument
147 return ab->pci.msi.irqs[vector]; in ath11k_ahb_get_msi_irq_wcn6750()
151 ath11k_ahb_get_window_start_wcn6750(struct ath11k_base *ab, u32 offset) in ath11k_ahb_get_window_start_wcn6750() argument
159 else if ((offset ^ HAL_SEQ_WCSS_UMAC_CE0_SRC_REG(ab)) < in ath11k_ahb_get_window_start_wcn6750()
167 ath11k_ahb_window_write32_wcn6750(struct ath11k_base *ab, u32 offset, u32 value) in ath11k_ahb_window_write32_wcn6750() argument
172 window_start = ath11k_ahb_get_window_start_wcn6750(ab, offset); in ath11k_ahb_window_write32_wcn6750()
174 iowrite32(value, ab->mem + window_start + in ath11k_ahb_window_write32_wcn6750()
178 static u32 ath11k_ahb_window_read32_wcn6750(struct ath11k_base *ab, u32 offset) in ath11k_ahb_window_read32_wcn6750() argument
184 window_start = ath11k_ahb_get_window_start_wcn6750(ab, offset); in ath11k_ahb_window_read32_wcn6750()
186 val = ioread32(ab->mem + window_start + in ath11k_ahb_window_read32_wcn6750()
199 static inline u32 ath11k_ahb_read32(struct ath11k_base *ab, u32 offset) in ath11k_ahb_read32() argument
201 return ioread32(ab->mem + offset); in ath11k_ahb_read32()
204 static inline void ath11k_ahb_write32(struct ath11k_base *ab, u32 offset, u32 value) in ath11k_ahb_write32() argument
206 iowrite32(value, ab->mem + offset); in ath11k_ahb_write32()
209 static void ath11k_ahb_kill_tasklets(struct ath11k_base *ab) in ath11k_ahb_kill_tasklets() argument
213 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_kill_tasklets()
214 struct ath11k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i]; in ath11k_ahb_kill_tasklets()
216 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_ahb_kill_tasklets()
228 disable_irq_nosync(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_ahb_ext_grp_disable()
231 static void __ath11k_ahb_ext_irq_disable(struct ath11k_base *ab) in __ath11k_ahb_ext_irq_disable() argument
236 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in __ath11k_ahb_ext_irq_disable()
253 enable_irq(irq_grp->ab->irq_num[irq_grp->irqs[i]]); in ath11k_ahb_ext_grp_enable()
256 static void ath11k_ahb_setbit32(struct ath11k_base *ab, u8 bit, u32 offset) in ath11k_ahb_setbit32() argument
260 val = ath11k_ahb_read32(ab, offset); in ath11k_ahb_setbit32()
261 ath11k_ahb_write32(ab, offset, val | BIT(bit)); in ath11k_ahb_setbit32()
264 static void ath11k_ahb_clearbit32(struct ath11k_base *ab, u8 bit, u32 offset) in ath11k_ahb_clearbit32() argument
268 val = ath11k_ahb_read32(ab, offset); in ath11k_ahb_clearbit32()
269 ath11k_ahb_write32(ab, offset, val & ~BIT(bit)); in ath11k_ahb_clearbit32()
272 static void ath11k_ahb_ce_irq_enable(struct ath11k_base *ab, u16 ce_id) in ath11k_ahb_ce_irq_enable() argument
275 const struct ce_ie_addr *ce_ie_addr = ab->hw_params.ce_ie_addr; in ath11k_ahb_ce_irq_enable()
278 ie1_reg_addr = ce_ie_addr->ie1_reg_addr + ATH11K_CE_OFFSET(ab); in ath11k_ahb_ce_irq_enable()
279 ie2_reg_addr = ce_ie_addr->ie2_reg_addr + ATH11K_CE_OFFSET(ab); in ath11k_ahb_ce_irq_enable()
280 ie3_reg_addr = ce_ie_addr->ie3_reg_addr + ATH11K_CE_OFFSET(ab); in ath11k_ahb_ce_irq_enable()
282 ce_attr = &ab->hw_params.host_ce_config[ce_id]; in ath11k_ahb_ce_irq_enable()
284 ath11k_ahb_setbit32(ab, ce_id, ie1_reg_addr); in ath11k_ahb_ce_irq_enable()
287 ath11k_ahb_setbit32(ab, ce_id, ie2_reg_addr); in ath11k_ahb_ce_irq_enable()
288 ath11k_ahb_setbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, in ath11k_ahb_ce_irq_enable()
293 static void ath11k_ahb_ce_irq_disable(struct ath11k_base *ab, u16 ce_id) in ath11k_ahb_ce_irq_disable() argument
296 const struct ce_ie_addr *ce_ie_addr = ab->hw_params.ce_ie_addr; in ath11k_ahb_ce_irq_disable()
299 ie1_reg_addr = ce_ie_addr->ie1_reg_addr + ATH11K_CE_OFFSET(ab); in ath11k_ahb_ce_irq_disable()
300 ie2_reg_addr = ce_ie_addr->ie2_reg_addr + ATH11K_CE_OFFSET(ab); in ath11k_ahb_ce_irq_disable()
301 ie3_reg_addr = ce_ie_addr->ie3_reg_addr + ATH11K_CE_OFFSET(ab); in ath11k_ahb_ce_irq_disable()
303 ce_attr = &ab->hw_params.host_ce_config[ce_id]; in ath11k_ahb_ce_irq_disable()
305 ath11k_ahb_clearbit32(ab, ce_id, ie1_reg_addr); in ath11k_ahb_ce_irq_disable()
308 ath11k_ahb_clearbit32(ab, ce_id, ie2_reg_addr); in ath11k_ahb_ce_irq_disable()
309 ath11k_ahb_clearbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, in ath11k_ahb_ce_irq_disable()
314 static void ath11k_ahb_sync_ce_irqs(struct ath11k_base *ab) in ath11k_ahb_sync_ce_irqs() argument
319 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_sync_ce_irqs()
320 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_ahb_sync_ce_irqs()
324 synchronize_irq(ab->irq_num[irq_idx]); in ath11k_ahb_sync_ce_irqs()
328 static void ath11k_ahb_sync_ext_irqs(struct ath11k_base *ab) in ath11k_ahb_sync_ext_irqs() argument
334 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_ahb_sync_ext_irqs()
338 synchronize_irq(ab->irq_num[irq_idx]); in ath11k_ahb_sync_ext_irqs()
343 static void ath11k_ahb_ce_irqs_enable(struct ath11k_base *ab) in ath11k_ahb_ce_irqs_enable() argument
347 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_ce_irqs_enable()
348 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_ahb_ce_irqs_enable()
350 ath11k_ahb_ce_irq_enable(ab, i); in ath11k_ahb_ce_irqs_enable()
354 static void ath11k_ahb_ce_irqs_disable(struct ath11k_base *ab) in ath11k_ahb_ce_irqs_disable() argument
358 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_ce_irqs_disable()
359 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_ahb_ce_irqs_disable()
361 ath11k_ahb_ce_irq_disable(ab, i); in ath11k_ahb_ce_irqs_disable()
365 static int ath11k_ahb_start(struct ath11k_base *ab) in ath11k_ahb_start() argument
367 ath11k_ahb_ce_irqs_enable(ab); in ath11k_ahb_start()
368 ath11k_ce_rx_post_buf(ab); in ath11k_ahb_start()
373 static void ath11k_ahb_ext_irq_enable(struct ath11k_base *ab) in ath11k_ahb_ext_irq_enable() argument
378 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_ahb_ext_irq_enable()
388 static void ath11k_ahb_ext_irq_disable(struct ath11k_base *ab) in ath11k_ahb_ext_irq_disable() argument
390 __ath11k_ahb_ext_irq_disable(ab); in ath11k_ahb_ext_irq_disable()
391 ath11k_ahb_sync_ext_irqs(ab); in ath11k_ahb_ext_irq_disable()
394 static void ath11k_ahb_stop(struct ath11k_base *ab) in ath11k_ahb_stop() argument
396 if (!test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags)) in ath11k_ahb_stop()
397 ath11k_ahb_ce_irqs_disable(ab); in ath11k_ahb_stop()
398 ath11k_ahb_sync_ce_irqs(ab); in ath11k_ahb_stop()
399 ath11k_ahb_kill_tasklets(ab); in ath11k_ahb_stop()
400 del_timer_sync(&ab->rx_replenish_retry); in ath11k_ahb_stop()
401 ath11k_ce_cleanup_pipes(ab); in ath11k_ahb_stop()
404 static int ath11k_ahb_power_up(struct ath11k_base *ab) in ath11k_ahb_power_up() argument
406 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_power_up()
411 ath11k_err(ab, "failed to boot the remote processor Q6\n"); in ath11k_ahb_power_up()
416 static void ath11k_ahb_power_down(struct ath11k_base *ab) in ath11k_ahb_power_down() argument
418 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_power_down()
423 static void ath11k_ahb_init_qmi_ce_config(struct ath11k_base *ab) in ath11k_ahb_init_qmi_ce_config() argument
425 struct ath11k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; in ath11k_ahb_init_qmi_ce_config()
427 cfg->tgt_ce_len = ab->hw_params.target_ce_count; in ath11k_ahb_init_qmi_ce_config()
428 cfg->tgt_ce = ab->hw_params.target_ce_config; in ath11k_ahb_init_qmi_ce_config()
429 cfg->svc_to_ce_map_len = ab->hw_params.svc_to_ce_map_len; in ath11k_ahb_init_qmi_ce_config()
430 cfg->svc_to_ce_map = ab->hw_params.svc_to_ce_map; in ath11k_ahb_init_qmi_ce_config()
431 ab->qmi.service_ins_id = ab->hw_params.qmi_service_ins_id; in ath11k_ahb_init_qmi_ce_config()
434 static void ath11k_ahb_free_ext_irq(struct ath11k_base *ab) in ath11k_ahb_free_ext_irq() argument
439 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_ahb_free_ext_irq()
442 free_irq(ab->irq_num[irq_grp->irqs[j]], irq_grp); in ath11k_ahb_free_ext_irq()
449 static void ath11k_ahb_free_irq(struct ath11k_base *ab) in ath11k_ahb_free_irq() argument
454 if (ab->hw_params.hybrid_bus_type) in ath11k_ahb_free_irq()
455 return ath11k_pcic_free_irq(ab); in ath11k_ahb_free_irq()
457 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_free_irq()
458 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_ahb_free_irq()
461 free_irq(ab->irq_num[irq_idx], &ab->ce.ce_pipe[i]); in ath11k_ahb_free_irq()
464 ath11k_ahb_free_ext_irq(ab); in ath11k_ahb_free_irq()
471 ath11k_ce_per_engine_service(ce_pipe->ab, ce_pipe->pipe_num); in ath11k_ahb_ce_tasklet()
473 ath11k_ahb_ce_irq_enable(ce_pipe->ab, ce_pipe->pipe_num); in ath11k_ahb_ce_tasklet()
483 ath11k_ahb_ce_irq_disable(ce_pipe->ab, ce_pipe->pipe_num); in ath11k_ahb_ce_interrupt_handler()
495 struct ath11k_base *ab = irq_grp->ab; in ath11k_ahb_ext_grp_napi_poll() local
498 work_done = ath11k_dp_service_srng(ab, irq_grp, budget); in ath11k_ahb_ext_grp_napi_poll()
524 static int ath11k_ahb_config_ext_irq(struct ath11k_base *ab) in ath11k_ahb_config_ext_irq() argument
526 struct ath11k_hw_params *hw = &ab->hw_params; in ath11k_ahb_config_ext_irq()
532 struct ath11k_ext_irq_grp *irq_grp = &ab->ext_irq_grp[i]; in ath11k_ahb_config_ext_irq()
535 irq_grp->ab = ab; in ath11k_ahb_config_ext_irq()
546 if (ab->hw_params.ring_mask->tx[i] & BIT(j)) { in ath11k_ahb_config_ext_irq()
551 if (ab->hw_params.ring_mask->rx[i] & BIT(j)) { in ath11k_ahb_config_ext_irq()
556 if (ab->hw_params.ring_mask->rx_err[i] & BIT(j)) in ath11k_ahb_config_ext_irq()
559 if (ab->hw_params.ring_mask->rx_wbm_rel[i] & BIT(j)) in ath11k_ahb_config_ext_irq()
562 if (ab->hw_params.ring_mask->reo_status[i] & BIT(j)) in ath11k_ahb_config_ext_irq()
565 if (j < ab->hw_params.max_radios) { in ath11k_ahb_config_ext_irq()
566 if (ab->hw_params.ring_mask->rxdma2host[i] & BIT(j)) { in ath11k_ahb_config_ext_irq()
572 if (ab->hw_params.ring_mask->host2rxdma[i] & BIT(j)) { in ath11k_ahb_config_ext_irq()
578 if (ab->hw_params.ring_mask->rx_mon_status[i] & BIT(j)) { in ath11k_ahb_config_ext_irq()
593 irq = platform_get_irq_byname(ab->pdev, in ath11k_ahb_config_ext_irq()
595 ab->irq_num[irq_idx] = irq; in ath11k_ahb_config_ext_irq()
601 ath11k_err(ab, "failed request_irq for %d\n", in ath11k_ahb_config_ext_irq()
610 static int ath11k_ahb_config_irq(struct ath11k_base *ab) in ath11k_ahb_config_irq() argument
615 if (ab->hw_params.hybrid_bus_type) in ath11k_ahb_config_irq()
616 return ath11k_pcic_config_irq(ab); in ath11k_ahb_config_irq()
619 for (i = 0; i < ab->hw_params.ce_count; i++) { in ath11k_ahb_config_irq()
620 struct ath11k_ce_pipe *ce_pipe = &ab->ce.ce_pipe[i]; in ath11k_ahb_config_irq()
622 if (ath11k_ce_get_attr_flags(ab, i) & CE_ATTR_DIS_INTR) in ath11k_ahb_config_irq()
628 irq = platform_get_irq_byname(ab->pdev, irq_name[irq_idx]); in ath11k_ahb_config_irq()
635 ab->irq_num[irq_idx] = irq; in ath11k_ahb_config_irq()
639 ret = ath11k_ahb_config_ext_irq(ab); in ath11k_ahb_config_irq()
644 static int ath11k_ahb_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, in ath11k_ahb_map_service_to_pipe() argument
651 for (i = 0; i < ab->hw_params.svc_to_ce_map_len; i++) { in ath11k_ahb_map_service_to_pipe()
652 entry = &ab->hw_params.svc_to_ce_map[i]; in ath11k_ahb_map_service_to_pipe()
687 static int ath11k_ahb_hif_suspend(struct ath11k_base *ab) in ath11k_ahb_hif_suspend() argument
689 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_hif_suspend()
694 if (!device_may_wakeup(ab->dev)) in ath11k_ahb_hif_suspend()
697 wake_irq = ab->irq_num[ATH11K_PCI_IRQ_CE0_OFFSET + ATH11K_PCI_CE_WAKE_IRQ]; in ath11k_ahb_hif_suspend()
701 ath11k_err(ab, "failed to enable wakeup irq :%d\n", ret); in ath11k_ahb_hif_suspend()
713 ath11k_err(ab, "failed to send smp2p power save enter cmd :%d\n", ret); in ath11k_ahb_hif_suspend()
717 ath11k_dbg(ab, ATH11K_DBG_AHB, "device suspended\n"); in ath11k_ahb_hif_suspend()
722 static int ath11k_ahb_hif_resume(struct ath11k_base *ab) in ath11k_ahb_hif_resume() argument
724 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_hif_resume()
729 if (!device_may_wakeup(ab->dev)) in ath11k_ahb_hif_resume()
732 wake_irq = ab->irq_num[ATH11K_PCI_IRQ_CE0_OFFSET + ATH11K_PCI_CE_WAKE_IRQ]; in ath11k_ahb_hif_resume()
736 ath11k_err(ab, "failed to disable wakeup irq: %d\n", ret); in ath11k_ahb_hif_resume()
740 reinit_completion(&ab->wow.wakeup_completed); in ath11k_ahb_hif_resume()
750 ath11k_err(ab, "failed to send smp2p power save enter cmd :%d\n", ret); in ath11k_ahb_hif_resume()
754 ret = wait_for_completion_timeout(&ab->wow.wakeup_completed, 3 * HZ); in ath11k_ahb_hif_resume()
756 ath11k_warn(ab, "timed out while waiting for wow wakeup completion\n"); in ath11k_ahb_hif_resume()
760 ath11k_dbg(ab, ATH11K_DBG_AHB, "device resumed\n"); in ath11k_ahb_hif_resume()
797 static int ath11k_core_get_rproc(struct ath11k_base *ab) in ath11k_core_get_rproc() argument
799 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_core_get_rproc()
800 struct device *dev = ab->dev; in ath11k_core_get_rproc()
805 ath11k_err(ab, "failed to get q6_rproc handle\n"); in ath11k_core_get_rproc()
811 ath11k_dbg(ab, ATH11K_DBG_AHB, "failed to get rproc, deferring\n"); in ath11k_core_get_rproc()
819 static int ath11k_ahb_setup_msi_resources(struct ath11k_base *ab) in ath11k_ahb_setup_msi_resources() argument
821 struct platform_device *pdev = ab->pdev; in ath11k_ahb_setup_msi_resources()
829 ret = ath11k_pcic_init_msi_config(ab); in ath11k_ahb_setup_msi_resources()
831 ath11k_err(ab, "failed to init msi config: %d\n", ret); in ath11k_ahb_setup_msi_resources()
837 ath11k_err(ab, "failed to fetch msi_addr\n"); in ath11k_ahb_setup_msi_resources()
842 msi_addr_iova = dma_map_resource(ab->dev, msi_addr_pa, PAGE_SIZE, in ath11k_ahb_setup_msi_resources()
844 if (dma_mapping_error(ab->dev, msi_addr_iova)) in ath11k_ahb_setup_msi_resources()
847 ab->pci.msi.addr_lo = lower_32_bits(msi_addr_iova); in ath11k_ahb_setup_msi_resources()
848 ab->pci.msi.addr_hi = upper_32_bits(msi_addr_iova); in ath11k_ahb_setup_msi_resources()
850 ret = of_property_read_u32_index(ab->dev->of_node, "interrupts", 1, &int_prop); in ath11k_ahb_setup_msi_resources()
854 ab->pci.msi.ep_base_data = int_prop + 32; in ath11k_ahb_setup_msi_resources()
856 for (i = 0; i < ab->pci.msi.config->total_vectors; i++) { in ath11k_ahb_setup_msi_resources()
861 ab->pci.msi.irqs[i] = ret; in ath11k_ahb_setup_msi_resources()
864 set_bit(ATH11K_FLAG_MULTI_MSI_VECTORS, &ab->dev_flags); in ath11k_ahb_setup_msi_resources()
869 static int ath11k_ahb_setup_smp2p_handle(struct ath11k_base *ab) in ath11k_ahb_setup_smp2p_handle() argument
871 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_setup_smp2p_handle()
873 if (!ab->hw_params.smp2p_wow_exit) in ath11k_ahb_setup_smp2p_handle()
876 ab_ahb->smp2p_info.smem_state = qcom_smem_state_get(ab->dev, "wlan-smp2p-out", in ath11k_ahb_setup_smp2p_handle()
879 ath11k_err(ab, "failed to fetch smem state: %ld\n", in ath11k_ahb_setup_smp2p_handle()
887 static void ath11k_ahb_release_smp2p_handle(struct ath11k_base *ab) in ath11k_ahb_release_smp2p_handle() argument
889 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_release_smp2p_handle()
891 if (!ab->hw_params.smp2p_wow_exit) in ath11k_ahb_release_smp2p_handle()
897 static int ath11k_ahb_setup_resources(struct ath11k_base *ab) in ath11k_ahb_setup_resources() argument
899 struct platform_device *pdev = ab->pdev; in ath11k_ahb_setup_resources()
903 if (ab->hw_params.hybrid_bus_type) in ath11k_ahb_setup_resources()
904 return ath11k_ahb_setup_msi_resources(ab); in ath11k_ahb_setup_resources()
912 ab->mem = mem; in ath11k_ahb_setup_resources()
913 ab->mem_len = resource_size(mem_res); in ath11k_ahb_setup_resources()
918 static int ath11k_ahb_setup_msa_resources(struct ath11k_base *ab) in ath11k_ahb_setup_msa_resources() argument
920 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_setup_msa_resources()
921 struct device *dev = ab->dev; in ath11k_ahb_setup_msa_resources()
957 static int ath11k_ahb_ce_remap(struct ath11k_base *ab) in ath11k_ahb_ce_remap() argument
959 const struct ce_remap *ce_remap = ab->hw_params.ce_remap; in ath11k_ahb_ce_remap()
960 struct platform_device *pdev = ab->pdev; in ath11k_ahb_ce_remap()
964 ab->mem_ce = ab->mem; in ath11k_ahb_ce_remap()
972 ab->mem_ce = ioremap(ce_remap->base, ce_remap->size); in ath11k_ahb_ce_remap()
973 if (!ab->mem_ce) { in ath11k_ahb_ce_remap()
981 static void ath11k_ahb_ce_unmap(struct ath11k_base *ab) in ath11k_ahb_ce_unmap() argument
983 if (ab->hw_params.ce_remap) in ath11k_ahb_ce_unmap()
984 iounmap(ab->mem_ce); in ath11k_ahb_ce_unmap()
987 static int ath11k_ahb_fw_resources_init(struct ath11k_base *ab) in ath11k_ahb_fw_resources_init() argument
989 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_fw_resources_init()
990 struct device *host_dev = ab->dev; in ath11k_ahb_fw_resources_init()
1000 if (!ab->hw_params.fixed_fw_mem) in ath11k_ahb_fw_resources_init()
1003 ret = ath11k_ahb_setup_msa_resources(ab); in ath11k_ahb_fw_resources_init()
1005 ath11k_err(ab, "failed to setup msa resources\n"); in ath11k_ahb_fw_resources_init()
1028 ath11k_err(ab, "dma configure fail: %d\n", ret); in ath11k_ahb_fw_resources_init()
1036 ath11k_err(ab, "failed to allocate iommu domain\n"); in ath11k_ahb_fw_resources_init()
1043 ath11k_err(ab, "could not attach device: %d\n", ret); in ath11k_ahb_fw_resources_init()
1051 ath11k_err(ab, "failed to map firmware region: %d\n", ret); in ath11k_ahb_fw_resources_init()
1059 ath11k_err(ab, "failed to map firmware CE region: %d\n", ret); in ath11k_ahb_fw_resources_init()
1085 static int ath11k_ahb_fw_resource_deinit(struct ath11k_base *ab) in ath11k_ahb_fw_resource_deinit() argument
1087 struct ath11k_ahb *ab_ahb = ath11k_ahb_priv(ab); in ath11k_ahb_fw_resource_deinit()
1094 if (!ab->hw_params.fixed_fw_mem) in ath11k_ahb_fw_resource_deinit()
1104 ath11k_err(ab, "failed to unmap firmware: %zu\n", in ath11k_ahb_fw_resource_deinit()
1109 ath11k_err(ab, "failed to unmap firmware CE memory: %zu\n", in ath11k_ahb_fw_resource_deinit()
1122 struct ath11k_base *ab; in ath11k_ahb_probe() local
1152 ab = ath11k_core_alloc(&pdev->dev, sizeof(struct ath11k_ahb), in ath11k_ahb_probe()
1154 if (!ab) { in ath11k_ahb_probe()
1159 ab->hif.ops = hif_ops; in ath11k_ahb_probe()
1160 ab->pdev = pdev; in ath11k_ahb_probe()
1161 ab->hw_rev = hw_rev; in ath11k_ahb_probe()
1162 ab->fw_mode = ATH11K_FIRMWARE_MODE_NORMAL; in ath11k_ahb_probe()
1163 platform_set_drvdata(pdev, ab); in ath11k_ahb_probe()
1165 ret = ath11k_pcic_register_pci_ops(ab, pci_ops); in ath11k_ahb_probe()
1167 ath11k_err(ab, "failed to register PCI ops: %d\n", ret); in ath11k_ahb_probe()
1171 ret = ath11k_core_pre_init(ab); in ath11k_ahb_probe()
1175 ret = ath11k_ahb_setup_resources(ab); in ath11k_ahb_probe()
1179 ret = ath11k_ahb_ce_remap(ab); in ath11k_ahb_probe()
1183 ret = ath11k_ahb_fw_resources_init(ab); in ath11k_ahb_probe()
1187 ret = ath11k_ahb_setup_smp2p_handle(ab); in ath11k_ahb_probe()
1191 ret = ath11k_hal_srng_init(ab); in ath11k_ahb_probe()
1195 ret = ath11k_ce_alloc_pipes(ab); in ath11k_ahb_probe()
1197 ath11k_err(ab, "failed to allocate ce pipes: %d\n", ret); in ath11k_ahb_probe()
1201 ath11k_ahb_init_qmi_ce_config(ab); in ath11k_ahb_probe()
1203 ret = ath11k_core_get_rproc(ab); in ath11k_ahb_probe()
1205 ath11k_err(ab, "failed to get rproc: %d\n", ret); in ath11k_ahb_probe()
1209 ret = ath11k_core_init(ab); in ath11k_ahb_probe()
1211 ath11k_err(ab, "failed to init core: %d\n", ret); in ath11k_ahb_probe()
1215 ret = ath11k_ahb_config_irq(ab); in ath11k_ahb_probe()
1217 ath11k_err(ab, "failed to configure irq: %d\n", ret); in ath11k_ahb_probe()
1221 ath11k_qmi_fwreset_from_cold_boot(ab); in ath11k_ahb_probe()
1226 ath11k_ce_free_pipes(ab); in ath11k_ahb_probe()
1229 ath11k_hal_srng_deinit(ab); in ath11k_ahb_probe()
1232 ath11k_ahb_release_smp2p_handle(ab); in ath11k_ahb_probe()
1235 ath11k_ahb_fw_resource_deinit(ab); in ath11k_ahb_probe()
1238 ath11k_ahb_ce_unmap(ab); in ath11k_ahb_probe()
1241 ath11k_core_free(ab); in ath11k_ahb_probe()
1247 static void ath11k_ahb_remove_prepare(struct ath11k_base *ab) in ath11k_ahb_remove_prepare() argument
1251 if (test_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags)) { in ath11k_ahb_remove_prepare()
1252 left = wait_for_completion_timeout(&ab->driver_recovery, in ath11k_ahb_remove_prepare()
1255 ath11k_warn(ab, "failed to receive recovery response completion\n"); in ath11k_ahb_remove_prepare()
1258 set_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags); in ath11k_ahb_remove_prepare()
1259 cancel_work_sync(&ab->restart_work); in ath11k_ahb_remove_prepare()
1260 cancel_work_sync(&ab->qmi.event_work); in ath11k_ahb_remove_prepare()
1263 static void ath11k_ahb_free_resources(struct ath11k_base *ab) in ath11k_ahb_free_resources() argument
1265 struct platform_device *pdev = ab->pdev; in ath11k_ahb_free_resources()
1267 ath11k_ahb_free_irq(ab); in ath11k_ahb_free_resources()
1268 ath11k_hal_srng_deinit(ab); in ath11k_ahb_free_resources()
1269 ath11k_ahb_release_smp2p_handle(ab); in ath11k_ahb_free_resources()
1270 ath11k_ahb_fw_resource_deinit(ab); in ath11k_ahb_free_resources()
1271 ath11k_ce_free_pipes(ab); in ath11k_ahb_free_resources()
1272 ath11k_ahb_ce_unmap(ab); in ath11k_ahb_free_resources()
1274 ath11k_core_free(ab); in ath11k_ahb_free_resources()
1280 struct ath11k_base *ab = platform_get_drvdata(pdev); in ath11k_ahb_remove() local
1282 if (test_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags)) { in ath11k_ahb_remove()
1283 ath11k_ahb_power_down(ab); in ath11k_ahb_remove()
1284 ath11k_debugfs_soc_destroy(ab); in ath11k_ahb_remove()
1285 ath11k_qmi_deinit_service(ab); in ath11k_ahb_remove()
1289 ath11k_ahb_remove_prepare(ab); in ath11k_ahb_remove()
1290 ath11k_core_deinit(ab); in ath11k_ahb_remove()
1293 ath11k_ahb_free_resources(ab); in ath11k_ahb_remove()
1298 struct ath11k_base *ab = platform_get_drvdata(pdev); in ath11k_ahb_shutdown() local
1304 ath11k_ahb_remove_prepare(ab); in ath11k_ahb_shutdown()
1306 if (!(test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags))) in ath11k_ahb_shutdown()
1309 ath11k_core_deinit(ab); in ath11k_ahb_shutdown()
1312 ath11k_ahb_free_resources(ab); in ath11k_ahb_shutdown()