Lines Matching refs:ar
474 static void ath10k_snoc_write32(struct ath10k *ar, u32 offset, u32 value) in ath10k_snoc_write32() argument
476 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_write32()
481 static u32 ath10k_snoc_read32(struct ath10k *ar, u32 offset) in ath10k_snoc_read32() argument
483 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_read32()
494 struct ath10k *ar = pipe->hif_ce_state; in __ath10k_snoc_rx_post_buf() local
495 struct ath10k_ce *ce = ath10k_ce_priv(ar); in __ath10k_snoc_rx_post_buf()
506 paddr = dma_map_single(ar->dev, skb->data, in __ath10k_snoc_rx_post_buf()
509 if (unlikely(dma_mapping_error(ar->dev, paddr))) { in __ath10k_snoc_rx_post_buf()
510 ath10k_warn(ar, "failed to dma map snoc rx buf\n"); in __ath10k_snoc_rx_post_buf()
521 dma_unmap_single(ar->dev, paddr, skb->len + skb_tailroom(skb), in __ath10k_snoc_rx_post_buf()
532 struct ath10k *ar = pipe->hif_ce_state; in ath10k_snoc_rx_post_pipe() local
533 struct ath10k_ce *ce = ath10k_ce_priv(ar); in ath10k_snoc_rx_post_pipe()
534 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_rx_post_pipe()
552 ath10k_warn(ar, "failed to post rx buf: %d\n", ret); in ath10k_snoc_rx_post_pipe()
560 static void ath10k_snoc_rx_post(struct ath10k *ar) in ath10k_snoc_rx_post() argument
562 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_rx_post()
570 void (*callback)(struct ath10k *ar, in ath10k_snoc_process_rx_cb() argument
573 struct ath10k *ar = ce_state->ar; in ath10k_snoc_process_rx_cb() local
574 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_process_rx_cb()
586 dma_unmap_single(ar->dev, ATH10K_SKB_RXCB(skb)->paddr, in ath10k_snoc_process_rx_cb()
590 ath10k_warn(ar, "rxed more than expected (nbytes %d, max %d)\n", in ath10k_snoc_process_rx_cb()
601 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc rx ce pipe %d len %d\n", in ath10k_snoc_process_rx_cb()
604 callback(ar, skb); in ath10k_snoc_process_rx_cb()
620 ath10k_ce_per_engine_service(ce_state->ar, CE_POLL_PIPE); in ath10k_snoc_htt_htc_rx_cb()
633 static void ath10k_snoc_htt_rx_deliver(struct ath10k *ar, struct sk_buff *skb) in ath10k_snoc_htt_rx_deliver() argument
636 ath10k_htt_t2h_msg_handler(ar, skb); in ath10k_snoc_htt_rx_deliver()
641 ath10k_ce_per_engine_service(ce_state->ar, CE_POLL_PIPE); in ath10k_snoc_htt_rx_cb()
648 struct ath10k *ar = ar_snoc->ar; in ath10k_snoc_rx_replenish_retry() local
650 ath10k_snoc_rx_post(ar); in ath10k_snoc_rx_replenish_retry()
655 struct ath10k *ar = ce_state->ar; in ath10k_snoc_htc_tx_cb() local
668 ath10k_htc_tx_completion_handler(ar, skb); in ath10k_snoc_htc_tx_cb()
673 struct ath10k *ar = ce_state->ar; in ath10k_snoc_htt_tx_cb() local
680 dma_unmap_single(ar->dev, ATH10K_SKB_CB(skb)->paddr, in ath10k_snoc_htt_tx_cb()
682 ath10k_htt_hif_tx_complete(ar, skb); in ath10k_snoc_htt_tx_cb()
686 static int ath10k_snoc_hif_tx_sg(struct ath10k *ar, u8 pipe_id, in ath10k_snoc_hif_tx_sg() argument
689 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_hif_tx_sg()
690 struct ath10k_ce *ce = ath10k_ce_priv(ar); in ath10k_snoc_hif_tx_sg()
700 ath10k_dbg(ar, ATH10K_DBG_SNOC, in ath10k_snoc_hif_tx_sg()
714 ath10k_dbg(ar, ATH10K_DBG_SNOC, in ath10k_snoc_hif_tx_sg()
739 static int ath10k_snoc_hif_get_target_info(struct ath10k *ar, in ath10k_snoc_hif_get_target_info() argument
748 static u16 ath10k_snoc_hif_get_free_queue_number(struct ath10k *ar, u8 pipe) in ath10k_snoc_hif_get_free_queue_number() argument
750 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_hif_get_free_queue_number()
752 ath10k_dbg(ar, ATH10K_DBG_SNOC, "hif get free queue number\n"); in ath10k_snoc_hif_get_free_queue_number()
757 static void ath10k_snoc_hif_send_complete_check(struct ath10k *ar, u8 pipe, in ath10k_snoc_hif_send_complete_check() argument
762 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc hif send complete check\n"); in ath10k_snoc_hif_send_complete_check()
765 resources = ath10k_snoc_hif_get_free_queue_number(ar, pipe); in ath10k_snoc_hif_send_complete_check()
770 ath10k_ce_per_engine_service(ar, pipe); in ath10k_snoc_hif_send_complete_check()
773 static int ath10k_snoc_hif_map_service_to_pipe(struct ath10k *ar, in ath10k_snoc_hif_map_service_to_pipe() argument
781 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc hif map service\n"); in ath10k_snoc_hif_map_service_to_pipe()
819 static void ath10k_snoc_hif_get_default_pipe(struct ath10k *ar, in ath10k_snoc_hif_get_default_pipe() argument
822 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc hif get default pipe\n"); in ath10k_snoc_hif_get_default_pipe()
824 (void)ath10k_snoc_hif_map_service_to_pipe(ar, in ath10k_snoc_hif_get_default_pipe()
829 static inline void ath10k_snoc_irq_disable(struct ath10k *ar) in ath10k_snoc_irq_disable() argument
831 ath10k_ce_disable_interrupts(ar); in ath10k_snoc_irq_disable()
834 static inline void ath10k_snoc_irq_enable(struct ath10k *ar) in ath10k_snoc_irq_enable() argument
836 ath10k_ce_enable_interrupts(ar); in ath10k_snoc_irq_enable()
844 struct ath10k *ar; in ath10k_snoc_rx_pipe_cleanup() local
847 ar = snoc_pipe->hif_ce_state; in ath10k_snoc_rx_pipe_cleanup()
864 dma_unmap_single(ar->dev, ATH10K_SKB_RXCB(skb)->paddr, in ath10k_snoc_rx_pipe_cleanup()
876 struct ath10k *ar; in ath10k_snoc_tx_pipe_cleanup() local
879 ar = snoc_pipe->hif_ce_state; in ath10k_snoc_tx_pipe_cleanup()
896 ath10k_htc_tx_completion_handler(ar, skb); in ath10k_snoc_tx_pipe_cleanup()
900 static void ath10k_snoc_buffer_cleanup(struct ath10k *ar) in ath10k_snoc_buffer_cleanup() argument
902 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_buffer_cleanup()
914 static void ath10k_snoc_hif_stop(struct ath10k *ar) in ath10k_snoc_hif_stop() argument
916 if (!test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags)) in ath10k_snoc_hif_stop()
917 ath10k_snoc_irq_disable(ar); in ath10k_snoc_hif_stop()
919 ath10k_core_napi_sync_disable(ar); in ath10k_snoc_hif_stop()
920 ath10k_snoc_buffer_cleanup(ar); in ath10k_snoc_hif_stop()
921 ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif stop\n"); in ath10k_snoc_hif_stop()
924 static int ath10k_snoc_hif_start(struct ath10k *ar) in ath10k_snoc_hif_start() argument
926 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_hif_start()
930 ath10k_core_napi_enable(ar); in ath10k_snoc_hif_start()
931 ath10k_snoc_irq_enable(ar); in ath10k_snoc_hif_start()
932 ath10k_snoc_rx_post(ar); in ath10k_snoc_hif_start()
936 ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif start\n"); in ath10k_snoc_hif_start()
941 static int ath10k_snoc_init_pipes(struct ath10k *ar) in ath10k_snoc_init_pipes() argument
946 ret = ath10k_ce_init_pipe(ar, i, &host_ce_config_wlan[i]); in ath10k_snoc_init_pipes()
948 ath10k_err(ar, "failed to initialize copy engine pipe %d: %d\n", in ath10k_snoc_init_pipes()
957 static int ath10k_snoc_wlan_enable(struct ath10k *ar, in ath10k_snoc_wlan_enable() argument
999 ath10k_err(ar, "invalid firmware mode %d\n", fw_mode); in ath10k_snoc_wlan_enable()
1003 return ath10k_qmi_wlan_enable(ar, &cfg, mode, in ath10k_snoc_wlan_enable()
1007 static int ath10k_hw_power_on(struct ath10k *ar) in ath10k_hw_power_on() argument
1009 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_hw_power_on()
1012 ath10k_dbg(ar, ATH10K_DBG_SNOC, "soc power on\n"); in ath10k_hw_power_on()
1029 static int ath10k_hw_power_off(struct ath10k *ar) in ath10k_hw_power_off() argument
1031 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_hw_power_off()
1033 ath10k_dbg(ar, ATH10K_DBG_SNOC, "soc power off\n"); in ath10k_hw_power_off()
1040 static void ath10k_snoc_wlan_disable(struct ath10k *ar) in ath10k_snoc_wlan_disable() argument
1042 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_wlan_disable()
1050 if (!test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags) || in ath10k_snoc_wlan_disable()
1052 ath10k_qmi_wlan_disable(ar); in ath10k_snoc_wlan_disable()
1055 static void ath10k_snoc_hif_power_down(struct ath10k *ar) in ath10k_snoc_hif_power_down() argument
1057 ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif power down\n"); in ath10k_snoc_hif_power_down()
1059 ath10k_snoc_wlan_disable(ar); in ath10k_snoc_hif_power_down()
1060 ath10k_ce_free_rri(ar); in ath10k_snoc_hif_power_down()
1061 ath10k_hw_power_off(ar); in ath10k_snoc_hif_power_down()
1064 static int ath10k_snoc_hif_power_up(struct ath10k *ar, in ath10k_snoc_hif_power_up() argument
1069 ath10k_dbg(ar, ATH10K_DBG_SNOC, "%s:WCN3990 driver state = %d\n", in ath10k_snoc_hif_power_up()
1070 __func__, ar->state); in ath10k_snoc_hif_power_up()
1072 ret = ath10k_hw_power_on(ar); in ath10k_snoc_hif_power_up()
1074 ath10k_err(ar, "failed to power on device: %d\n", ret); in ath10k_snoc_hif_power_up()
1078 ret = ath10k_snoc_wlan_enable(ar, fw_mode); in ath10k_snoc_hif_power_up()
1080 ath10k_err(ar, "failed to enable wcn3990: %d\n", ret); in ath10k_snoc_hif_power_up()
1084 ath10k_ce_alloc_rri(ar); in ath10k_snoc_hif_power_up()
1086 ret = ath10k_snoc_init_pipes(ar); in ath10k_snoc_hif_power_up()
1088 ath10k_err(ar, "failed to initialize CE: %d\n", ret); in ath10k_snoc_hif_power_up()
1095 ath10k_ce_free_rri(ar); in ath10k_snoc_hif_power_up()
1096 ath10k_snoc_wlan_disable(ar); in ath10k_snoc_hif_power_up()
1099 ath10k_hw_power_off(ar); in ath10k_snoc_hif_power_up()
1104 static int ath10k_snoc_hif_set_target_log_mode(struct ath10k *ar, in ath10k_snoc_hif_set_target_log_mode() argument
1114 return ath10k_qmi_set_fw_log_mode(ar, fw_dbg_mode); in ath10k_snoc_hif_set_target_log_mode()
1118 static int ath10k_snoc_hif_suspend(struct ath10k *ar) in ath10k_snoc_hif_suspend() argument
1120 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_hif_suspend()
1123 if (!device_may_wakeup(ar->dev)) in ath10k_snoc_hif_suspend()
1128 ath10k_err(ar, "failed to enable wakeup irq :%d\n", ret); in ath10k_snoc_hif_suspend()
1132 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device suspended\n"); in ath10k_snoc_hif_suspend()
1137 static int ath10k_snoc_hif_resume(struct ath10k *ar) in ath10k_snoc_hif_resume() argument
1139 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_hif_resume()
1142 if (!device_may_wakeup(ar->dev)) in ath10k_snoc_hif_resume()
1147 ath10k_err(ar, "failed to disable wakeup irq: %d\n", ret); in ath10k_snoc_hif_resume()
1151 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device resumed\n"); in ath10k_snoc_hif_resume()
1183 static int ath10k_snoc_get_ce_id_from_irq(struct ath10k *ar, int irq) in ath10k_snoc_get_ce_id_from_irq() argument
1185 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_get_ce_id_from_irq()
1192 ath10k_err(ar, "No matching CE id for irq %d\n", irq); in ath10k_snoc_get_ce_id_from_irq()
1199 struct ath10k *ar = arg; in ath10k_snoc_per_engine_handler() local
1200 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_per_engine_handler()
1201 int ce_id = ath10k_snoc_get_ce_id_from_irq(ar, irq); in ath10k_snoc_per_engine_handler()
1204 ath10k_warn(ar, "unexpected/invalid irq %d ce_id %d\n", irq, in ath10k_snoc_per_engine_handler()
1209 ath10k_ce_disable_interrupt(ar, ce_id); in ath10k_snoc_per_engine_handler()
1212 napi_schedule(&ar->napi); in ath10k_snoc_per_engine_handler()
1219 struct ath10k *ar = container_of(ctx, struct ath10k, napi); in ath10k_snoc_napi_poll() local
1220 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_napi_poll()
1224 if (test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags)) { in ath10k_snoc_napi_poll()
1231 ath10k_ce_per_engine_service(ar, ce_id); in ath10k_snoc_napi_poll()
1232 ath10k_ce_enable_interrupt(ar, ce_id); in ath10k_snoc_napi_poll()
1235 done = ath10k_htt_txrx_compl_task(ar, budget); in ath10k_snoc_napi_poll()
1243 static void ath10k_snoc_init_napi(struct ath10k *ar) in ath10k_snoc_init_napi() argument
1245 netif_napi_add(&ar->napi_dev, &ar->napi, ath10k_snoc_napi_poll, in ath10k_snoc_init_napi()
1249 static int ath10k_snoc_request_irq(struct ath10k *ar) in ath10k_snoc_request_irq() argument
1251 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_request_irq()
1258 irqflags, ce_name[id], ar); in ath10k_snoc_request_irq()
1260 ath10k_err(ar, in ath10k_snoc_request_irq()
1271 free_irq(ar_snoc->ce_irqs[id].irq_line, ar); in ath10k_snoc_request_irq()
1276 static void ath10k_snoc_free_irq(struct ath10k *ar) in ath10k_snoc_free_irq() argument
1278 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_free_irq()
1282 free_irq(ar_snoc->ce_irqs[id].irq_line, ar); in ath10k_snoc_free_irq()
1285 static int ath10k_snoc_resource_init(struct ath10k *ar) in ath10k_snoc_resource_init() argument
1287 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_resource_init()
1295 ath10k_err(ar, "Memory base not found in DT\n"); in ath10k_snoc_resource_init()
1303 ath10k_err(ar, "Memory base ioremap failed with physical address %pa\n", in ath10k_snoc_resource_init()
1311 ath10k_err(ar, "failed to get IRQ%d\n", i); in ath10k_snoc_resource_init()
1320 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc xo-cal-data return %d\n", ret); in ath10k_snoc_resource_init()
1323 ath10k_dbg(ar, ATH10K_DBG_SNOC, "xo cal data %x\n", in ath10k_snoc_resource_init()
1332 static void ath10k_snoc_quirks_init(struct ath10k *ar) in ath10k_snoc_quirks_init() argument
1334 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_quirks_init()
1341 int ath10k_snoc_fw_indication(struct ath10k *ar, u64 type) in ath10k_snoc_fw_indication() argument
1343 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_fw_indication()
1353 ath10k_core_start_recovery(ar); in ath10k_snoc_fw_indication()
1359 ret = ath10k_core_register(ar, &bus_params); in ath10k_snoc_fw_indication()
1361 ath10k_err(ar, "Failed to register driver core: %d\n", in ath10k_snoc_fw_indication()
1369 set_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags); in ath10k_snoc_fw_indication()
1372 ath10k_err(ar, "invalid fw indication: %llx\n", type); in ath10k_snoc_fw_indication()
1379 static int ath10k_snoc_setup_resource(struct ath10k *ar) in ath10k_snoc_setup_resource() argument
1381 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_setup_resource()
1382 struct ath10k_ce *ce = ath10k_ce_priv(ar); in ath10k_snoc_setup_resource()
1392 pipe->hif_ce_state = ar; in ath10k_snoc_setup_resource()
1394 ret = ath10k_ce_alloc_pipe(ar, i, &host_ce_config_wlan[i]); in ath10k_snoc_setup_resource()
1396 ath10k_err(ar, "failed to allocate copy engine pipe %d: %d\n", in ath10k_snoc_setup_resource()
1403 ath10k_snoc_init_napi(ar); in ath10k_snoc_setup_resource()
1408 static void ath10k_snoc_release_resource(struct ath10k *ar) in ath10k_snoc_release_resource() argument
1412 netif_napi_del(&ar->napi); in ath10k_snoc_release_resource()
1414 ath10k_ce_free_pipe(ar, i); in ath10k_snoc_release_resource()
1417 static void ath10k_msa_dump_memory(struct ath10k *ar, in ath10k_msa_dump_memory() argument
1429 mem_layout = ath10k_coredump_get_mem_layout(ar); in ath10k_msa_dump_memory()
1445 hdr->start = cpu_to_le32((unsigned long)ar->msa.vaddr); in ath10k_msa_dump_memory()
1446 hdr->length = cpu_to_le32(ar->msa.mem_size); in ath10k_msa_dump_memory()
1448 if (current_region->len < ar->msa.mem_size) { in ath10k_msa_dump_memory()
1449 memcpy(buf, ar->msa.vaddr, current_region->len); in ath10k_msa_dump_memory()
1450 ath10k_warn(ar, "msa dump length is less than msa size %x, %x\n", in ath10k_msa_dump_memory()
1451 current_region->len, ar->msa.mem_size); in ath10k_msa_dump_memory()
1453 memcpy(buf, ar->msa.vaddr, ar->msa.mem_size); in ath10k_msa_dump_memory()
1457 void ath10k_snoc_fw_crashed_dump(struct ath10k *ar) in ath10k_snoc_fw_crashed_dump() argument
1462 mutex_lock(&ar->dump_mutex); in ath10k_snoc_fw_crashed_dump()
1464 spin_lock_bh(&ar->data_lock); in ath10k_snoc_fw_crashed_dump()
1465 ar->stats.fw_crash_counter++; in ath10k_snoc_fw_crashed_dump()
1466 spin_unlock_bh(&ar->data_lock); in ath10k_snoc_fw_crashed_dump()
1468 crash_data = ath10k_coredump_new(ar); in ath10k_snoc_fw_crashed_dump()
1475 ath10k_err(ar, "firmware crashed! (guid %s)\n", guid); in ath10k_snoc_fw_crashed_dump()
1476 ath10k_print_driver_info(ar); in ath10k_snoc_fw_crashed_dump()
1477 ath10k_msa_dump_memory(ar, crash_data); in ath10k_snoc_fw_crashed_dump()
1478 mutex_unlock(&ar->dump_mutex); in ath10k_snoc_fw_crashed_dump()
1485 struct ath10k *ar = ar_snoc->ar; in ath10k_snoc_modem_notify() local
1490 ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem starting event\n"); in ath10k_snoc_modem_notify()
1495 ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem running event\n"); in ath10k_snoc_modem_notify()
1499 ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem %s event\n", in ath10k_snoc_modem_notify()
1508 ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem offline event\n"); in ath10k_snoc_modem_notify()
1512 ath10k_err(ar, "received unrecognized event %lu\n", action); in ath10k_snoc_modem_notify()
1519 static int ath10k_modem_init(struct ath10k *ar) in ath10k_modem_init() argument
1521 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_modem_init()
1530 ath10k_err(ar, "failed to initialize modem notifier: %d\n", ret); in ath10k_modem_init()
1539 static void ath10k_modem_deinit(struct ath10k *ar) in ath10k_modem_deinit() argument
1542 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_modem_deinit()
1546 ath10k_err(ar, "error %d unregistering notifier\n", ret); in ath10k_modem_deinit()
1549 static int ath10k_setup_msa_resources(struct ath10k *ar, u32 msa_size) in ath10k_setup_msa_resources() argument
1551 struct device *dev = ar->dev; in ath10k_setup_msa_resources()
1565 ar->msa.paddr = r.start; in ath10k_setup_msa_resources()
1566 ar->msa.mem_size = resource_size(&r); in ath10k_setup_msa_resources()
1567 ar->msa.vaddr = devm_memremap(dev, ar->msa.paddr, in ath10k_setup_msa_resources()
1568 ar->msa.mem_size, in ath10k_setup_msa_resources()
1570 if (IS_ERR(ar->msa.vaddr)) { in ath10k_setup_msa_resources()
1573 return PTR_ERR(ar->msa.vaddr); in ath10k_setup_msa_resources()
1576 ar->msa.vaddr = dmam_alloc_coherent(dev, msa_size, in ath10k_setup_msa_resources()
1577 &ar->msa.paddr, in ath10k_setup_msa_resources()
1579 if (!ar->msa.vaddr) { in ath10k_setup_msa_resources()
1580 ath10k_err(ar, "failed to allocate dma memory for msa region\n"); in ath10k_setup_msa_resources()
1583 ar->msa.mem_size = msa_size; in ath10k_setup_msa_resources()
1586 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi msa.paddr: %pad , msa.vaddr: 0x%p\n", in ath10k_setup_msa_resources()
1587 &ar->msa.paddr, in ath10k_setup_msa_resources()
1588 ar->msa.vaddr); in ath10k_setup_msa_resources()
1593 static int ath10k_fw_init(struct ath10k *ar) in ath10k_fw_init() argument
1595 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_fw_init()
1625 ath10k_err(ar, "dma configure fail: %d\n", ret); in ath10k_fw_init()
1633 ath10k_err(ar, "failed to allocate iommu domain\n"); in ath10k_fw_init()
1640 ath10k_err(ar, "could not attach device: %d\n", ret); in ath10k_fw_init()
1645 ar_snoc->fw.fw_start_addr = ar->msa.paddr; in ath10k_fw_init()
1648 ar->msa.paddr, ar->msa.mem_size, in ath10k_fw_init()
1651 ath10k_err(ar, "failed to map firmware region: %d\n", ret); in ath10k_fw_init()
1672 static int ath10k_fw_deinit(struct ath10k *ar) in ath10k_fw_deinit() argument
1674 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_fw_deinit()
1687 ath10k_err(ar, "failed to unmap firmware: %zu\n", in ath10k_fw_deinit()
1711 struct ath10k *ar; in ath10k_snoc_probe() local
1729 ar = ath10k_core_create(sizeof(*ar_snoc), dev, ATH10K_BUS_SNOC, in ath10k_snoc_probe()
1731 if (!ar) { in ath10k_snoc_probe()
1736 ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_probe()
1738 platform_set_drvdata(pdev, ar); in ath10k_snoc_probe()
1739 ar_snoc->ar = ar; in ath10k_snoc_probe()
1741 ar->ce_priv = &ar_snoc->ce; in ath10k_snoc_probe()
1744 ath10k_snoc_quirks_init(ar); in ath10k_snoc_probe()
1746 ret = ath10k_snoc_resource_init(ar); in ath10k_snoc_probe()
1748 ath10k_warn(ar, "failed to initialize resource: %d\n", ret); in ath10k_snoc_probe()
1752 ret = ath10k_snoc_setup_resource(ar); in ath10k_snoc_probe()
1754 ath10k_warn(ar, "failed to setup resource: %d\n", ret); in ath10k_snoc_probe()
1757 ret = ath10k_snoc_request_irq(ar); in ath10k_snoc_probe()
1759 ath10k_warn(ar, "failed to request irqs: %d\n", ret); in ath10k_snoc_probe()
1794 ret = ath10k_setup_msa_resources(ar, msa_size); in ath10k_snoc_probe()
1796 ath10k_warn(ar, "failed to setup msa resources: %d\n", ret); in ath10k_snoc_probe()
1800 ret = ath10k_fw_init(ar); in ath10k_snoc_probe()
1802 ath10k_err(ar, "failed to initialize firmware: %d\n", ret); in ath10k_snoc_probe()
1806 ret = ath10k_qmi_init(ar, msa_size); in ath10k_snoc_probe()
1808 ath10k_warn(ar, "failed to register wlfw qmi client: %d\n", ret); in ath10k_snoc_probe()
1812 ret = ath10k_modem_init(ar); in ath10k_snoc_probe()
1816 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc probe\n"); in ath10k_snoc_probe()
1821 ath10k_qmi_deinit(ar); in ath10k_snoc_probe()
1824 ath10k_fw_deinit(ar); in ath10k_snoc_probe()
1827 ath10k_snoc_free_irq(ar); in ath10k_snoc_probe()
1830 ath10k_snoc_release_resource(ar); in ath10k_snoc_probe()
1833 ath10k_core_destroy(ar); in ath10k_snoc_probe()
1838 static int ath10k_snoc_free_resources(struct ath10k *ar) in ath10k_snoc_free_resources() argument
1840 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_free_resources()
1842 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc free resources\n"); in ath10k_snoc_free_resources()
1846 ath10k_core_unregister(ar); in ath10k_snoc_free_resources()
1847 ath10k_fw_deinit(ar); in ath10k_snoc_free_resources()
1848 ath10k_snoc_free_irq(ar); in ath10k_snoc_free_resources()
1849 ath10k_snoc_release_resource(ar); in ath10k_snoc_free_resources()
1850 ath10k_modem_deinit(ar); in ath10k_snoc_free_resources()
1851 ath10k_qmi_deinit(ar); in ath10k_snoc_free_resources()
1852 ath10k_core_destroy(ar); in ath10k_snoc_free_resources()
1859 struct ath10k *ar = platform_get_drvdata(pdev); in ath10k_snoc_remove() local
1860 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_remove()
1862 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc remove\n"); in ath10k_snoc_remove()
1864 reinit_completion(&ar->driver_recovery); in ath10k_snoc_remove()
1867 wait_for_completion_timeout(&ar->driver_recovery, 3 * HZ); in ath10k_snoc_remove()
1869 ath10k_snoc_free_resources(ar); in ath10k_snoc_remove()
1876 struct ath10k *ar = platform_get_drvdata(pdev); in ath10k_snoc_shutdown() local
1878 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc shutdown\n"); in ath10k_snoc_shutdown()
1879 ath10k_snoc_free_resources(ar); in ath10k_snoc_shutdown()