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 dev_set_threaded(&ar->napi_dev, true); in ath10k_snoc_hif_start()
931 ath10k_core_napi_enable(ar); in ath10k_snoc_hif_start()
932 ath10k_snoc_irq_enable(ar); in ath10k_snoc_hif_start()
933 ath10k_snoc_rx_post(ar); in ath10k_snoc_hif_start()
937 ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif start\n"); in ath10k_snoc_hif_start()
942 static int ath10k_snoc_init_pipes(struct ath10k *ar) in ath10k_snoc_init_pipes() argument
947 ret = ath10k_ce_init_pipe(ar, i, &host_ce_config_wlan[i]); in ath10k_snoc_init_pipes()
949 ath10k_err(ar, "failed to initialize copy engine pipe %d: %d\n", in ath10k_snoc_init_pipes()
958 static int ath10k_snoc_wlan_enable(struct ath10k *ar, in ath10k_snoc_wlan_enable() argument
1000 ath10k_err(ar, "invalid firmware mode %d\n", fw_mode); in ath10k_snoc_wlan_enable()
1004 return ath10k_qmi_wlan_enable(ar, &cfg, mode, in ath10k_snoc_wlan_enable()
1008 static int ath10k_hw_power_on(struct ath10k *ar) in ath10k_hw_power_on() argument
1010 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_hw_power_on()
1013 ath10k_dbg(ar, ATH10K_DBG_SNOC, "soc power on\n"); in ath10k_hw_power_on()
1030 static int ath10k_hw_power_off(struct ath10k *ar) in ath10k_hw_power_off() argument
1032 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_hw_power_off()
1034 ath10k_dbg(ar, ATH10K_DBG_SNOC, "soc power off\n"); in ath10k_hw_power_off()
1041 static void ath10k_snoc_wlan_disable(struct ath10k *ar) in ath10k_snoc_wlan_disable() argument
1043 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_wlan_disable()
1051 if (!test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags) || in ath10k_snoc_wlan_disable()
1053 ath10k_qmi_wlan_disable(ar); in ath10k_snoc_wlan_disable()
1056 static void ath10k_snoc_hif_power_down(struct ath10k *ar) in ath10k_snoc_hif_power_down() argument
1058 ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif power down\n"); in ath10k_snoc_hif_power_down()
1060 ath10k_snoc_wlan_disable(ar); in ath10k_snoc_hif_power_down()
1061 ath10k_ce_free_rri(ar); in ath10k_snoc_hif_power_down()
1062 ath10k_hw_power_off(ar); in ath10k_snoc_hif_power_down()
1065 static int ath10k_snoc_hif_power_up(struct ath10k *ar, in ath10k_snoc_hif_power_up() argument
1070 ath10k_dbg(ar, ATH10K_DBG_SNOC, "%s:WCN3990 driver state = %d\n", in ath10k_snoc_hif_power_up()
1071 __func__, ar->state); in ath10k_snoc_hif_power_up()
1073 ret = ath10k_hw_power_on(ar); in ath10k_snoc_hif_power_up()
1075 ath10k_err(ar, "failed to power on device: %d\n", ret); in ath10k_snoc_hif_power_up()
1079 ret = ath10k_snoc_wlan_enable(ar, fw_mode); in ath10k_snoc_hif_power_up()
1081 ath10k_err(ar, "failed to enable wcn3990: %d\n", ret); in ath10k_snoc_hif_power_up()
1085 ath10k_ce_alloc_rri(ar); in ath10k_snoc_hif_power_up()
1087 ret = ath10k_snoc_init_pipes(ar); in ath10k_snoc_hif_power_up()
1089 ath10k_err(ar, "failed to initialize CE: %d\n", ret); in ath10k_snoc_hif_power_up()
1096 ath10k_ce_free_rri(ar); in ath10k_snoc_hif_power_up()
1097 ath10k_snoc_wlan_disable(ar); in ath10k_snoc_hif_power_up()
1100 ath10k_hw_power_off(ar); in ath10k_snoc_hif_power_up()
1105 static int ath10k_snoc_hif_set_target_log_mode(struct ath10k *ar, in ath10k_snoc_hif_set_target_log_mode() argument
1115 return ath10k_qmi_set_fw_log_mode(ar, fw_dbg_mode); in ath10k_snoc_hif_set_target_log_mode()
1119 static int ath10k_snoc_hif_suspend(struct ath10k *ar) in ath10k_snoc_hif_suspend() argument
1121 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_hif_suspend()
1124 if (!device_may_wakeup(ar->dev)) in ath10k_snoc_hif_suspend()
1129 ath10k_err(ar, "failed to enable wakeup irq :%d\n", ret); in ath10k_snoc_hif_suspend()
1133 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device suspended\n"); in ath10k_snoc_hif_suspend()
1138 static int ath10k_snoc_hif_resume(struct ath10k *ar) in ath10k_snoc_hif_resume() argument
1140 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_hif_resume()
1143 if (!device_may_wakeup(ar->dev)) in ath10k_snoc_hif_resume()
1148 ath10k_err(ar, "failed to disable wakeup irq: %d\n", ret); in ath10k_snoc_hif_resume()
1152 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device resumed\n"); in ath10k_snoc_hif_resume()
1184 static int ath10k_snoc_get_ce_id_from_irq(struct ath10k *ar, int irq) in ath10k_snoc_get_ce_id_from_irq() argument
1186 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_get_ce_id_from_irq()
1193 ath10k_err(ar, "No matching CE id for irq %d\n", irq); in ath10k_snoc_get_ce_id_from_irq()
1200 struct ath10k *ar = arg; in ath10k_snoc_per_engine_handler() local
1201 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_per_engine_handler()
1202 int ce_id = ath10k_snoc_get_ce_id_from_irq(ar, irq); in ath10k_snoc_per_engine_handler()
1205 ath10k_warn(ar, "unexpected/invalid irq %d ce_id %d\n", irq, in ath10k_snoc_per_engine_handler()
1210 ath10k_ce_disable_interrupt(ar, ce_id); in ath10k_snoc_per_engine_handler()
1213 napi_schedule(&ar->napi); in ath10k_snoc_per_engine_handler()
1220 struct ath10k *ar = container_of(ctx, struct ath10k, napi); in ath10k_snoc_napi_poll() local
1221 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_napi_poll()
1225 if (test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags)) { in ath10k_snoc_napi_poll()
1232 ath10k_ce_per_engine_service(ar, ce_id); in ath10k_snoc_napi_poll()
1233 ath10k_ce_enable_interrupt(ar, ce_id); in ath10k_snoc_napi_poll()
1236 done = ath10k_htt_txrx_compl_task(ar, budget); in ath10k_snoc_napi_poll()
1244 static void ath10k_snoc_init_napi(struct ath10k *ar) in ath10k_snoc_init_napi() argument
1246 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()
1257 ce_name[id], ar); in ath10k_snoc_request_irq()
1259 ath10k_err(ar, in ath10k_snoc_request_irq()
1270 free_irq(ar_snoc->ce_irqs[id].irq_line, ar); in ath10k_snoc_request_irq()
1275 static void ath10k_snoc_free_irq(struct ath10k *ar) in ath10k_snoc_free_irq() argument
1277 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_free_irq()
1281 free_irq(ar_snoc->ce_irqs[id].irq_line, ar); in ath10k_snoc_free_irq()
1284 static int ath10k_snoc_resource_init(struct ath10k *ar) in ath10k_snoc_resource_init() argument
1286 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_resource_init()
1294 ath10k_err(ar, "Memory base not found in DT\n"); in ath10k_snoc_resource_init()
1302 ath10k_err(ar, "Memory base ioremap failed with physical address %pa\n", in ath10k_snoc_resource_init()
1316 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc xo-cal-data return %d\n", ret); in ath10k_snoc_resource_init()
1319 ath10k_dbg(ar, ATH10K_DBG_SNOC, "xo cal data %x\n", in ath10k_snoc_resource_init()
1326 static void ath10k_snoc_quirks_init(struct ath10k *ar) in ath10k_snoc_quirks_init() argument
1328 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_quirks_init()
1335 int ath10k_snoc_fw_indication(struct ath10k *ar, u64 type) in ath10k_snoc_fw_indication() argument
1337 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_fw_indication()
1347 ath10k_core_start_recovery(ar); in ath10k_snoc_fw_indication()
1353 ret = ath10k_core_register(ar, &bus_params); in ath10k_snoc_fw_indication()
1355 ath10k_err(ar, "Failed to register driver core: %d\n", in ath10k_snoc_fw_indication()
1363 set_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags); in ath10k_snoc_fw_indication()
1366 ath10k_err(ar, "invalid fw indication: %llx\n", type); in ath10k_snoc_fw_indication()
1373 static int ath10k_snoc_setup_resource(struct ath10k *ar) in ath10k_snoc_setup_resource() argument
1375 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_setup_resource()
1376 struct ath10k_ce *ce = ath10k_ce_priv(ar); in ath10k_snoc_setup_resource()
1386 pipe->hif_ce_state = ar; in ath10k_snoc_setup_resource()
1388 ret = ath10k_ce_alloc_pipe(ar, i, &host_ce_config_wlan[i]); in ath10k_snoc_setup_resource()
1390 ath10k_err(ar, "failed to allocate copy engine pipe %d: %d\n", in ath10k_snoc_setup_resource()
1397 ath10k_snoc_init_napi(ar); in ath10k_snoc_setup_resource()
1402 static void ath10k_snoc_release_resource(struct ath10k *ar) in ath10k_snoc_release_resource() argument
1406 netif_napi_del(&ar->napi); in ath10k_snoc_release_resource()
1408 ath10k_ce_free_pipe(ar, i); in ath10k_snoc_release_resource()
1411 static void ath10k_msa_dump_memory(struct ath10k *ar, in ath10k_msa_dump_memory() argument
1423 mem_layout = ath10k_coredump_get_mem_layout(ar); in ath10k_msa_dump_memory()
1439 hdr->start = cpu_to_le32((unsigned long)ar->msa.vaddr); in ath10k_msa_dump_memory()
1440 hdr->length = cpu_to_le32(ar->msa.mem_size); in ath10k_msa_dump_memory()
1442 if (current_region->len < ar->msa.mem_size) { in ath10k_msa_dump_memory()
1443 memcpy(buf, ar->msa.vaddr, current_region->len); in ath10k_msa_dump_memory()
1444 ath10k_warn(ar, "msa dump length is less than msa size %x, %x\n", in ath10k_msa_dump_memory()
1445 current_region->len, ar->msa.mem_size); in ath10k_msa_dump_memory()
1447 memcpy(buf, ar->msa.vaddr, ar->msa.mem_size); in ath10k_msa_dump_memory()
1451 void ath10k_snoc_fw_crashed_dump(struct ath10k *ar) in ath10k_snoc_fw_crashed_dump() argument
1456 mutex_lock(&ar->dump_mutex); in ath10k_snoc_fw_crashed_dump()
1458 spin_lock_bh(&ar->data_lock); in ath10k_snoc_fw_crashed_dump()
1459 ar->stats.fw_crash_counter++; in ath10k_snoc_fw_crashed_dump()
1460 spin_unlock_bh(&ar->data_lock); in ath10k_snoc_fw_crashed_dump()
1462 crash_data = ath10k_coredump_new(ar); in ath10k_snoc_fw_crashed_dump()
1469 ath10k_err(ar, "firmware crashed! (guid %s)\n", guid); in ath10k_snoc_fw_crashed_dump()
1470 ath10k_print_driver_info(ar); in ath10k_snoc_fw_crashed_dump()
1471 ath10k_msa_dump_memory(ar, crash_data); in ath10k_snoc_fw_crashed_dump()
1472 mutex_unlock(&ar->dump_mutex); in ath10k_snoc_fw_crashed_dump()
1479 struct ath10k *ar = ar_snoc->ar; in ath10k_snoc_modem_notify() local
1484 ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem starting event\n"); in ath10k_snoc_modem_notify()
1489 ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem running event\n"); in ath10k_snoc_modem_notify()
1493 ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem %s event\n", in ath10k_snoc_modem_notify()
1502 ath10k_dbg(ar, ATH10K_DBG_SNOC, "received modem offline event\n"); in ath10k_snoc_modem_notify()
1506 ath10k_err(ar, "received unrecognized event %lu\n", action); in ath10k_snoc_modem_notify()
1513 static int ath10k_modem_init(struct ath10k *ar) in ath10k_modem_init() argument
1515 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_modem_init()
1524 ath10k_err(ar, "failed to initialize modem notifier: %d\n", ret); in ath10k_modem_init()
1533 static void ath10k_modem_deinit(struct ath10k *ar) in ath10k_modem_deinit() argument
1536 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_modem_deinit()
1540 ath10k_err(ar, "error %d unregistering notifier\n", ret); in ath10k_modem_deinit()
1543 static int ath10k_setup_msa_resources(struct ath10k *ar, u32 msa_size) in ath10k_setup_msa_resources() argument
1545 struct device *dev = ar->dev; in ath10k_setup_msa_resources()
1559 ar->msa.paddr = r.start; in ath10k_setup_msa_resources()
1560 ar->msa.mem_size = resource_size(&r); in ath10k_setup_msa_resources()
1561 ar->msa.vaddr = devm_memremap(dev, ar->msa.paddr, in ath10k_setup_msa_resources()
1562 ar->msa.mem_size, in ath10k_setup_msa_resources()
1564 if (IS_ERR(ar->msa.vaddr)) { in ath10k_setup_msa_resources()
1567 return PTR_ERR(ar->msa.vaddr); in ath10k_setup_msa_resources()
1570 ar->msa.vaddr = dmam_alloc_coherent(dev, msa_size, in ath10k_setup_msa_resources()
1571 &ar->msa.paddr, in ath10k_setup_msa_resources()
1573 if (!ar->msa.vaddr) { in ath10k_setup_msa_resources()
1574 ath10k_err(ar, "failed to allocate dma memory for msa region\n"); in ath10k_setup_msa_resources()
1577 ar->msa.mem_size = msa_size; in ath10k_setup_msa_resources()
1580 ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi msa.paddr: %pad , msa.vaddr: 0x%p\n", in ath10k_setup_msa_resources()
1581 &ar->msa.paddr, in ath10k_setup_msa_resources()
1582 ar->msa.vaddr); in ath10k_setup_msa_resources()
1587 static int ath10k_fw_init(struct ath10k *ar) in ath10k_fw_init() argument
1589 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_fw_init()
1619 ath10k_err(ar, "dma configure fail: %d\n", ret); in ath10k_fw_init()
1627 ath10k_err(ar, "failed to allocate iommu domain\n"); in ath10k_fw_init()
1634 ath10k_err(ar, "could not attach device: %d\n", ret); in ath10k_fw_init()
1639 ar_snoc->fw.fw_start_addr = ar->msa.paddr; in ath10k_fw_init()
1642 ar->msa.paddr, ar->msa.mem_size, in ath10k_fw_init()
1645 ath10k_err(ar, "failed to map firmware region: %d\n", ret); in ath10k_fw_init()
1666 static int ath10k_fw_deinit(struct ath10k *ar) in ath10k_fw_deinit() argument
1668 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_fw_deinit()
1681 ath10k_err(ar, "failed to unmap firmware: %zu\n", in ath10k_fw_deinit()
1705 struct ath10k *ar; in ath10k_snoc_probe() local
1723 ar = ath10k_core_create(sizeof(*ar_snoc), dev, ATH10K_BUS_SNOC, in ath10k_snoc_probe()
1725 if (!ar) { in ath10k_snoc_probe()
1730 ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_probe()
1732 platform_set_drvdata(pdev, ar); in ath10k_snoc_probe()
1733 ar_snoc->ar = ar; in ath10k_snoc_probe()
1735 ar->ce_priv = &ar_snoc->ce; in ath10k_snoc_probe()
1738 ath10k_snoc_quirks_init(ar); in ath10k_snoc_probe()
1740 ret = ath10k_snoc_resource_init(ar); in ath10k_snoc_probe()
1742 ath10k_warn(ar, "failed to initialize resource: %d\n", ret); in ath10k_snoc_probe()
1746 ret = ath10k_snoc_setup_resource(ar); in ath10k_snoc_probe()
1748 ath10k_warn(ar, "failed to setup resource: %d\n", ret); in ath10k_snoc_probe()
1751 ret = ath10k_snoc_request_irq(ar); in ath10k_snoc_probe()
1753 ath10k_warn(ar, "failed to request irqs: %d\n", ret); in ath10k_snoc_probe()
1788 ret = ath10k_setup_msa_resources(ar, msa_size); in ath10k_snoc_probe()
1790 ath10k_warn(ar, "failed to setup msa resources: %d\n", ret); in ath10k_snoc_probe()
1794 ret = ath10k_fw_init(ar); in ath10k_snoc_probe()
1796 ath10k_err(ar, "failed to initialize firmware: %d\n", ret); in ath10k_snoc_probe()
1800 ret = ath10k_qmi_init(ar, msa_size); in ath10k_snoc_probe()
1802 ath10k_warn(ar, "failed to register wlfw qmi client: %d\n", ret); in ath10k_snoc_probe()
1806 ret = ath10k_modem_init(ar); in ath10k_snoc_probe()
1810 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc probe\n"); in ath10k_snoc_probe()
1815 ath10k_qmi_deinit(ar); in ath10k_snoc_probe()
1818 ath10k_fw_deinit(ar); in ath10k_snoc_probe()
1821 ath10k_snoc_free_irq(ar); in ath10k_snoc_probe()
1824 ath10k_snoc_release_resource(ar); in ath10k_snoc_probe()
1827 ath10k_core_destroy(ar); in ath10k_snoc_probe()
1832 static int ath10k_snoc_free_resources(struct ath10k *ar) in ath10k_snoc_free_resources() argument
1834 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_free_resources()
1836 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc free resources\n"); in ath10k_snoc_free_resources()
1840 ath10k_core_unregister(ar); in ath10k_snoc_free_resources()
1841 ath10k_fw_deinit(ar); in ath10k_snoc_free_resources()
1842 ath10k_snoc_free_irq(ar); in ath10k_snoc_free_resources()
1843 ath10k_snoc_release_resource(ar); in ath10k_snoc_free_resources()
1844 ath10k_modem_deinit(ar); in ath10k_snoc_free_resources()
1845 ath10k_qmi_deinit(ar); in ath10k_snoc_free_resources()
1846 ath10k_core_destroy(ar); in ath10k_snoc_free_resources()
1853 struct ath10k *ar = platform_get_drvdata(pdev); in ath10k_snoc_remove() local
1854 struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar); in ath10k_snoc_remove()
1856 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc remove\n"); in ath10k_snoc_remove()
1858 reinit_completion(&ar->driver_recovery); in ath10k_snoc_remove()
1861 wait_for_completion_timeout(&ar->driver_recovery, 3 * HZ); in ath10k_snoc_remove()
1863 ath10k_snoc_free_resources(ar); in ath10k_snoc_remove()
1868 struct ath10k *ar = platform_get_drvdata(pdev); in ath10k_snoc_shutdown() local
1870 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc shutdown\n"); in ath10k_snoc_shutdown()
1871 ath10k_snoc_free_resources(ar); in ath10k_snoc_shutdown()