Lines Matching refs:wil
179 int wil_mem_access_lock(struct wil6210_priv *wil) in wil_mem_access_lock() argument
181 if (!down_read_trylock(&wil->mem_lock)) in wil_mem_access_lock()
184 if (test_bit(wil_status_suspending, wil->status) || in wil_mem_access_lock()
185 test_bit(wil_status_suspended, wil->status)) { in wil_mem_access_lock()
186 up_read(&wil->mem_lock); in wil_mem_access_lock()
193 void wil_mem_access_unlock(struct wil6210_priv *wil) in wil_mem_access_unlock() argument
195 up_read(&wil->mem_lock); in wil_mem_access_unlock()
198 static void wil_ring_fini_tx(struct wil6210_priv *wil, int id) in wil_ring_fini_tx() argument
200 struct wil_ring *ring = &wil->ring_tx[id]; in wil_ring_fini_tx()
201 struct wil_ring_tx_data *txdata = &wil->ring_tx_data[id]; in wil_ring_fini_tx()
203 lockdep_assert_held(&wil->mutex); in wil_ring_fini_tx()
208 wil_dbg_misc(wil, "vring_fini_tx: id=%d\n", id); in wil_ring_fini_tx()
223 if (test_bit(wil_status_napi_en, wil->status)) in wil_ring_fini_tx()
224 napi_synchronize(&wil->napi_tx); in wil_ring_fini_tx()
226 wil->txrx_ops.ring_fini_tx(wil, ring); in wil_ring_fini_tx()
229 static bool wil_vif_is_connected(struct wil6210_priv *wil, u8 mid) in wil_vif_is_connected() argument
233 for (i = 0; i < wil->max_assoc_sta; i++) { in wil_vif_is_connected()
234 if (wil->sta[i].mid == mid && in wil_vif_is_connected()
235 wil->sta[i].status == wil_sta_connected) in wil_vif_is_connected()
247 struct wil6210_priv *wil = vif_to_wil(vif); in wil_disconnect_cid_complete() local
250 struct wil_sta_info *sta = &wil->sta[cid]; in wil_disconnect_cid_complete()
251 int min_ring_id = wil_get_min_tx_ring_id(wil); in wil_disconnect_cid_complete()
254 wil_dbg_misc(wil, in wil_disconnect_cid_complete()
260 wil_err(wil, "STA MID mismatch with VIF MID(%d)\n", in wil_disconnect_cid_complete()
284 wil_tid_ampdu_rx_free(wil, r); in wil_disconnect_cid_complete()
292 for (i = min_ring_id; i < ARRAY_SIZE(wil->ring_tx); i++) { in wil_disconnect_cid_complete()
293 if (wil->ring2cid_tid[i][0] == cid) in wil_disconnect_cid_complete()
294 wil_ring_fini_tx(wil, i); in wil_disconnect_cid_complete()
304 struct wil6210_priv *wil = vif_to_wil(vif); in _wil6210_disconnect_complete() local
313 wil_info(wil, "disconnect_complete: bssid=%pM, reason=%d\n", in _wil6210_disconnect_complete()
328 cid = wil_find_cid(wil, vif->mid, bssid); in _wil6210_disconnect_complete()
329 wil_dbg_misc(wil, in _wil6210_disconnect_complete()
332 if (wil_cid_valid(wil, cid)) /* disconnect 1 peer */ in _wil6210_disconnect_complete()
335 wil_dbg_misc(wil, "Disconnect complete all\n"); in _wil6210_disconnect_complete()
336 for (cid = 0; cid < wil->max_assoc_sta; cid++) in _wil6210_disconnect_complete()
345 wil_update_net_queues_bh(wil, vif, NULL, true); in _wil6210_disconnect_complete()
347 if (!wil_has_other_active_ifaces(wil, ndev, false, true)) in _wil6210_disconnect_complete()
348 wil6210_bus_request(wil, WIL_DEFAULT_BUS_REQUEST_KBPS); in _wil6210_disconnect_complete()
351 atomic_dec(&wil->connected_vifs); in _wil6210_disconnect_complete()
370 if (!wil_vif_is_connected(wil, vif->mid)) { in _wil6210_disconnect_complete()
371 wil_update_net_queues_bh(wil, vif, NULL, true); in _wil6210_disconnect_complete()
374 atomic_dec(&wil->connected_vifs); in _wil6210_disconnect_complete()
376 wil_update_net_queues_bh(wil, vif, NULL, false); in _wil6210_disconnect_complete()
387 struct wil6210_priv *wil = vif_to_wil(vif); in wil_disconnect_cid() local
389 struct wil_sta_info *sta = &wil->sta[cid]; in wil_disconnect_cid()
393 wil_dbg_misc(wil, "disconnect_cid: CID %d, MID %d, status %d\n", in wil_disconnect_cid()
400 wil_err(wil, "STA MID mismatch with VIF MID(%d)\n", vif->mid); in wil_disconnect_cid()
417 struct wil6210_priv *wil; in _wil6210_disconnect() local
424 wil = vif_to_wil(vif); in _wil6210_disconnect()
428 wil_info(wil, "disconnect bssid=%pM, reason=%d\n", bssid, reason_code); in _wil6210_disconnect()
442 cid = wil_find_cid(wil, vif->mid, bssid); in _wil6210_disconnect()
443 wil_dbg_misc(wil, "Disconnect %pM, CID=%d, reason=%d\n", in _wil6210_disconnect()
445 if (wil_cid_valid(wil, cid)) /* disconnect 1 peer */ in _wil6210_disconnect()
448 wil_dbg_misc(wil, "Disconnect all\n"); in _wil6210_disconnect()
449 for (cid = 0; cid < wil->max_assoc_sta; cid++) in _wil6210_disconnect()
464 struct wil6210_priv *wil = vif_to_wil(vif); in wil_disconnect_worker() local
482 rc = wmi_call(wil, WMI_DISCONNECT_CMDID, vif->mid, NULL, 0, in wil_disconnect_worker()
486 wil_err(wil, "disconnect error %d\n", rc); in wil_disconnect_worker()
490 wil_update_net_queues_bh(wil, vif, NULL, true); in wil_disconnect_worker()
497 static int wil_wait_for_recovery(struct wil6210_priv *wil) in wil_wait_for_recovery() argument
499 if (wait_event_interruptible(wil->wq, wil->recovery_state != in wil_wait_for_recovery()
501 wil_err(wil, "Interrupt, canceling recovery\n"); in wil_wait_for_recovery()
504 if (wil->recovery_state != fw_recovery_running) { in wil_wait_for_recovery()
505 wil_info(wil, "Recovery cancelled\n"); in wil_wait_for_recovery()
508 wil_info(wil, "Proceed with recovery\n"); in wil_wait_for_recovery()
512 void wil_set_recovery_state(struct wil6210_priv *wil, int state) in wil_set_recovery_state() argument
514 wil_dbg_misc(wil, "set_recovery_state: %d -> %d\n", in wil_set_recovery_state()
515 wil->recovery_state, state); in wil_set_recovery_state()
517 wil->recovery_state = state; in wil_set_recovery_state()
518 wake_up_interruptible(&wil->wq); in wil_set_recovery_state()
521 bool wil_is_recovery_blocked(struct wil6210_priv *wil) in wil_is_recovery_blocked() argument
523 return no_fw_recovery && (wil->recovery_state == fw_recovery_pending); in wil_is_recovery_blocked()
528 struct wil6210_priv *wil = container_of(work, struct wil6210_priv, in wil_fw_error_worker() local
530 struct net_device *ndev = wil->main_ndev; in wil_fw_error_worker()
533 wil_dbg_misc(wil, "fw error worker\n"); in wil_fw_error_worker()
536 wil_info(wil, "No recovery - interface is down\n"); in wil_fw_error_worker()
544 if (time_is_after_jiffies(wil->last_fw_recovery + in wil_fw_error_worker()
546 wil->recovery_count++; in wil_fw_error_worker()
548 wil->recovery_count = 1; /* fw was alive for a long time */ in wil_fw_error_worker()
550 if (wil->recovery_count > WIL6210_FW_RECOVERY_RETRIES) { in wil_fw_error_worker()
551 wil_err(wil, "too many recovery attempts (%d), giving up\n", in wil_fw_error_worker()
552 wil->recovery_count); in wil_fw_error_worker()
556 wil->last_fw_recovery = jiffies; in wil_fw_error_worker()
558 wil_info(wil, "fw error recovery requested (try %d)...\n", in wil_fw_error_worker()
559 wil->recovery_count); in wil_fw_error_worker()
561 wil->recovery_state = fw_recovery_running; in wil_fw_error_worker()
562 if (wil_wait_for_recovery(wil) != 0) in wil_fw_error_worker()
566 mutex_lock(&wil->mutex); in wil_fw_error_worker()
576 __wil_down(wil); in wil_fw_error_worker()
577 __wil_up(wil); in wil_fw_error_worker()
584 __wil_down(wil); in wil_fw_error_worker()
585 __wil_up(wil); in wil_fw_error_worker()
586 mutex_unlock(&wil->mutex); in wil_fw_error_worker()
587 wil_cfg80211_ap_recovery(wil); in wil_fw_error_worker()
588 mutex_lock(&wil->mutex); in wil_fw_error_worker()
589 wil_info(wil, "... completed\n"); in wil_fw_error_worker()
592 wil_err(wil, "No recovery - unknown interface type %d\n", in wil_fw_error_worker()
597 mutex_unlock(&wil->mutex); in wil_fw_error_worker()
601 static int wil_find_free_ring(struct wil6210_priv *wil) in wil_find_free_ring() argument
604 int min_ring_id = wil_get_min_tx_ring_id(wil); in wil_find_free_ring()
607 if (!wil->ring_tx[i].va) in wil_find_free_ring()
615 struct wil6210_priv *wil = vif_to_wil(vif); in wil_ring_init_tx() local
619 wil_err(wil, "No connection pending\n"); in wil_ring_init_tx()
622 ringid = wil_find_free_ring(wil); in wil_ring_init_tx()
624 wil_err(wil, "No free vring found\n"); in wil_ring_init_tx()
628 wil_dbg_wmi(wil, "Configure for connection CID %d MID %d ring %d\n", in wil_ring_init_tx()
631 rc = wil->txrx_ops.ring_init_tx(vif, ringid, 1 << tx_ring_order, in wil_ring_init_tx()
634 wil_err(wil, "init TX for CID %d MID %d vring %d failed\n", in wil_ring_init_tx()
643 struct wil6210_priv *wil = vif_to_wil(vif); in wil_bcast_init() local
646 if (ri >= 0 && wil->ring_tx[ri].va) in wil_bcast_init()
649 ri = wil_find_free_ring(wil); in wil_bcast_init()
654 rc = wil->txrx_ops.ring_init_bcast(vif, ri, 1 << bcast_ring_order); in wil_bcast_init()
663 struct wil6210_priv *wil = vif_to_wil(vif); in wil_bcast_fini() local
670 wil_ring_fini_tx(wil, ri); in wil_bcast_fini()
673 void wil_bcast_fini_all(struct wil6210_priv *wil) in wil_bcast_fini_all() argument
678 for (i = 0; i < GET_MAX_VIFS(wil); i++) { in wil_bcast_fini_all()
679 vif = wil->vifs[i]; in wil_bcast_fini_all()
685 int wil_priv_init(struct wil6210_priv *wil) in wil_priv_init() argument
689 wil_dbg_misc(wil, "priv_init\n"); in wil_priv_init()
691 memset(wil->sta, 0, sizeof(wil->sta)); in wil_priv_init()
693 spin_lock_init(&wil->sta[i].tid_rx_lock); in wil_priv_init()
694 wil->sta[i].mid = U8_MAX; in wil_priv_init()
698 spin_lock_init(&wil->ring_tx_data[i].lock); in wil_priv_init()
699 wil->ring2cid_tid[i][0] = WIL6210_MAX_CID; in wil_priv_init()
702 mutex_init(&wil->mutex); in wil_priv_init()
703 mutex_init(&wil->vif_mutex); in wil_priv_init()
704 mutex_init(&wil->wmi_mutex); in wil_priv_init()
705 mutex_init(&wil->halp.lock); in wil_priv_init()
707 init_completion(&wil->wmi_ready); in wil_priv_init()
708 init_completion(&wil->wmi_call); in wil_priv_init()
709 init_completion(&wil->halp.comp); in wil_priv_init()
711 INIT_WORK(&wil->wmi_event_worker, wmi_event_worker); in wil_priv_init()
712 INIT_WORK(&wil->fw_error_worker, wil_fw_error_worker); in wil_priv_init()
714 INIT_LIST_HEAD(&wil->pending_wmi_ev); in wil_priv_init()
715 spin_lock_init(&wil->wmi_ev_lock); in wil_priv_init()
716 spin_lock_init(&wil->net_queue_lock); in wil_priv_init()
717 spin_lock_init(&wil->eap_lock); in wil_priv_init()
719 init_waitqueue_head(&wil->wq); in wil_priv_init()
720 init_rwsem(&wil->mem_lock); in wil_priv_init()
722 wil->wmi_wq = create_singlethread_workqueue(WIL_NAME "_wmi"); in wil_priv_init()
723 if (!wil->wmi_wq) in wil_priv_init()
726 wil->wq_service = create_singlethread_workqueue(WIL_NAME "_service"); in wil_priv_init()
727 if (!wil->wq_service) in wil_priv_init()
730 wil->last_fw_recovery = jiffies; in wil_priv_init()
731 wil->tx_interframe_timeout = WIL6210_ITR_TX_INTERFRAME_TIMEOUT_DEFAULT; in wil_priv_init()
732 wil->rx_interframe_timeout = WIL6210_ITR_RX_INTERFRAME_TIMEOUT_DEFAULT; in wil_priv_init()
733 wil->tx_max_burst_duration = WIL6210_ITR_TX_MAX_BURST_DURATION_DEFAULT; in wil_priv_init()
734 wil->rx_max_burst_duration = WIL6210_ITR_RX_MAX_BURST_DURATION_DEFAULT; in wil_priv_init()
739 wil->ps_profile = WMI_PS_PROFILE_TYPE_DEFAULT; in wil_priv_init()
741 wil->wakeup_trigger = WMI_WAKEUP_TRIGGER_UCAST | in wil_priv_init()
743 memset(&wil->suspend_stats, 0, sizeof(wil->suspend_stats)); in wil_priv_init()
744 wil->ring_idle_trsh = 16; in wil_priv_init()
746 wil->reply_mid = U8_MAX; in wil_priv_init()
747 wil->max_vifs = 1; in wil_priv_init()
748 wil->max_assoc_sta = max_assoc_sta; in wil_priv_init()
751 wil->num_rx_status_rings = WIL_DEFAULT_NUM_RX_STATUS_RINGS; in wil_priv_init()
752 wil->tx_status_ring_order = WIL_TX_SRING_SIZE_ORDER_DEFAULT; in wil_priv_init()
758 wil->rx_status_ring_order = WIL_RX_SRING_SIZE_ORDER_DEFAULT; in wil_priv_init()
763 wil->rx_buff_id_count = WIL_RX_BUFF_ARR_SIZE_DEFAULT; in wil_priv_init()
765 wil->amsdu_en = true; in wil_priv_init()
770 destroy_workqueue(wil->wmi_wq); in wil_priv_init()
775 void wil6210_bus_request(struct wil6210_priv *wil, u32 kbps) in wil6210_bus_request() argument
777 if (wil->platform_ops.bus_request) { in wil6210_bus_request()
778 wil->bus_request_kbps = kbps; in wil6210_bus_request()
779 wil->platform_ops.bus_request(wil->platform_handle, kbps); in wil6210_bus_request()
797 struct wil6210_priv *wil = vif_to_wil(vif); in wil6210_disconnect() local
799 wil_dbg_misc(wil, "disconnecting\n"); in wil6210_disconnect()
817 struct wil6210_priv *wil = vif_to_wil(vif); in wil6210_disconnect_complete() local
819 wil_dbg_misc(wil, "got disconnect\n"); in wil6210_disconnect_complete()
825 void wil_priv_deinit(struct wil6210_priv *wil) in wil_priv_deinit() argument
827 wil_dbg_misc(wil, "priv_deinit\n"); in wil_priv_deinit()
829 wil_set_recovery_state(wil, fw_recovery_idle); in wil_priv_deinit()
830 cancel_work_sync(&wil->fw_error_worker); in wil_priv_deinit()
831 wmi_event_flush(wil); in wil_priv_deinit()
832 destroy_workqueue(wil->wq_service); in wil_priv_deinit()
833 destroy_workqueue(wil->wmi_wq); in wil_priv_deinit()
834 kfree(wil->brd_info); in wil_priv_deinit()
837 static void wil_shutdown_bl(struct wil6210_priv *wil) in wil_shutdown_bl() argument
841 wil_s(wil, RGF_USER_BL + in wil_shutdown_bl()
847 val = wil_r(wil, RGF_USER_BL + in wil_shutdown_bl()
851 wil_dbg_misc(wil, "BL is ready for halt\n"); in wil_shutdown_bl()
855 wil_err(wil, "BL did not report ready for halt\n"); in wil_shutdown_bl()
869 static void wil_freeze_bl(struct wil6210_priv *wil) in wil_freeze_bl() argument
874 jal = wil_r(wil, wil->iccm_base + ivt3); in wil_freeze_bl()
876 wil_dbg_misc(wil, "invalid IVT entry found, skipping\n"); in wil_freeze_bl()
883 saved = wil_r(wil, RGF_USER_USAGE_8); in wil_freeze_bl()
884 wil_w(wil, RGF_USER_USAGE_8, saved | BIT_USER_PREVENT_DEEP_SLEEP); in wil_freeze_bl()
888 wil_w(wil, wil->iccm_base + ivt3 + 4, ARC_me_imm32(ivt3)); in wil_freeze_bl()
892 upc = wil_r(wil, RGF_USER_CPU_PC); in wil_freeze_bl()
894 wil_dbg_misc(wil, "BL freeze failed, PC=0x%08X\n", upc); in wil_freeze_bl()
896 wil_w(wil, RGF_USER_USAGE_8, saved); in wil_freeze_bl()
899 static void wil_bl_prepare_halt(struct wil6210_priv *wil) in wil_bl_prepare_halt() argument
910 tmp = wil_r(wil, RGF_USER_BL + in wil_bl_prepare_halt()
914 wil_dbg_misc(wil, "old BL, skipping halt preparation\n"); in wil_bl_prepare_halt()
918 tmp = wil_r(wil, RGF_USER_BL + in wil_bl_prepare_halt()
924 wil_shutdown_bl(wil); in wil_bl_prepare_halt()
926 wil_freeze_bl(wil); in wil_bl_prepare_halt()
929 static inline void wil_halt_cpu(struct wil6210_priv *wil) in wil_halt_cpu() argument
931 if (wil->hw_version >= HW_VER_TALYN_MB) { in wil_halt_cpu()
932 wil_w(wil, RGF_USER_USER_CPU_0_TALYN_MB, in wil_halt_cpu()
934 wil_w(wil, RGF_USER_MAC_CPU_0_TALYN_MB, in wil_halt_cpu()
937 wil_w(wil, RGF_USER_USER_CPU_0, BIT_USER_USER_CPU_MAN_RST); in wil_halt_cpu()
938 wil_w(wil, RGF_USER_MAC_CPU_0, BIT_USER_MAC_CPU_MAN_RST); in wil_halt_cpu()
942 static inline void wil_release_cpu(struct wil6210_priv *wil) in wil_release_cpu() argument
945 if (wil->hw_version >= HW_VER_TALYN_MB) in wil_release_cpu()
946 wil_w(wil, RGF_USER_USER_CPU_0_TALYN_MB, 1); in wil_release_cpu()
948 wil_w(wil, RGF_USER_USER_CPU_0, 1); in wil_release_cpu()
951 static void wil_set_oob_mode(struct wil6210_priv *wil, u8 mode) in wil_set_oob_mode() argument
953 wil_info(wil, "oob_mode to %d\n", mode); in wil_set_oob_mode()
956 wil_c(wil, RGF_USER_USAGE_6, BIT_USER_OOB_MODE | in wil_set_oob_mode()
960 wil_c(wil, RGF_USER_USAGE_6, BIT_USER_OOB_R2_MODE); in wil_set_oob_mode()
961 wil_s(wil, RGF_USER_USAGE_6, BIT_USER_OOB_MODE); in wil_set_oob_mode()
964 wil_c(wil, RGF_USER_USAGE_6, BIT_USER_OOB_MODE); in wil_set_oob_mode()
965 wil_s(wil, RGF_USER_USAGE_6, BIT_USER_OOB_R2_MODE); in wil_set_oob_mode()
968 wil_err(wil, "invalid oob_mode: %d\n", mode); in wil_set_oob_mode()
972 static int wil_wait_device_ready(struct wil6210_priv *wil, int no_flash) in wil_wait_device_ready() argument
981 wil_dbg_misc(wil, "Reset completed\n"); in wil_wait_device_ready()
985 x = wil_r(wil, RGF_USER_BL + in wil_wait_device_ready()
989 wil_dbg_misc(wil, "BL.ready 0x%08x => 0x%08x\n", in wil_wait_device_ready()
994 wil_err(wil, "Reset not completed, bl.ready 0x%08x\n", in wil_wait_device_ready()
1000 wil_dbg_misc(wil, "Reset completed in %d ms\n", in wil_wait_device_ready()
1007 static int wil_wait_device_ready_talyn_mb(struct wil6210_priv *wil) in wil_wait_device_ready_talyn_mb() argument
1019 wil->boot_config = WIL_BOOT_ERR; in wil_wait_device_ready_talyn_mb()
1028 otp_hw = wil_r(wil, RGF_USER_OTP_HW_RD_MACHINE_1); in wil_wait_device_ready_talyn_mb()
1034 wil->boot_config = WIL_BOOT_VANILLA; in wil_wait_device_ready_talyn_mb()
1039 wil->boot_config = WIL_BOOT_DEVELOPMENT; in wil_wait_device_ready_talyn_mb()
1044 wil->boot_config = WIL_BOOT_PRODUCTION; in wil_wait_device_ready_talyn_mb()
1055 wil->boot_config = WIL_BOOT_PRODUCTION; in wil_wait_device_ready_talyn_mb()
1064 if (wil->boot_config == WIL_BOOT_ERR) { in wil_wait_device_ready_talyn_mb()
1065 wil_err(wil, in wil_wait_device_ready_talyn_mb()
1071 wil_dbg_misc(wil, in wil_wait_device_ready_talyn_mb()
1073 delay * OTP_HW_DELAY, otp_hw, wil->boot_config); in wil_wait_device_ready_talyn_mb()
1075 if (wil->boot_config == WIL_BOOT_VANILLA) in wil_wait_device_ready_talyn_mb()
1085 otp_hw = wil_r(wil, RGF_USER_OTP_HW_RD_MACHINE_1); in wil_wait_device_ready_talyn_mb()
1089 wil_err(wil, "TO waiting for hw_section_done\n"); in wil_wait_device_ready_talyn_mb()
1094 wil_dbg_misc(wil, "HW section done in %d ms\n", delay * RST_DELAY); in wil_wait_device_ready_talyn_mb()
1096 otp_qc_secured = wil_r(wil, RGF_OTP_QC_SECURED); in wil_wait_device_ready_talyn_mb()
1097 wil->secured_boot = otp_qc_secured & BIT_BOOT_FROM_ROM ? 1 : 0; in wil_wait_device_ready_talyn_mb()
1098 wil_dbg_misc(wil, "secured boot is %sabled\n", in wil_wait_device_ready_talyn_mb()
1099 wil->secured_boot ? "en" : "dis"); in wil_wait_device_ready_talyn_mb()
1102 wil_dbg_misc(wil, "Reset completed\n"); in wil_wait_device_ready_talyn_mb()
1107 static int wil_target_reset(struct wil6210_priv *wil, int no_flash) in wil_target_reset() argument
1112 wil_dbg_misc(wil, "Resetting \"%s\"...\n", wil->hw_name); in wil_target_reset()
1114 if (wil->hw_version < HW_VER_TALYN) { in wil_target_reset()
1116 wil_s(wil, RGF_HP_CTRL, BIT(15)); in wil_target_reset()
1117 wil_s(wil, RGF_USER_CLKS_CTL_SW_RST_MASK_0, in wil_target_reset()
1119 wil_s(wil, RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT_CAR_PERST_RST); in wil_target_reset()
1122 wil_halt_cpu(wil); in wil_target_reset()
1126 wil_w(wil, RGF_USER_BL + in wil_target_reset()
1130 wil_w(wil, RGF_USER_BL + in wil_target_reset()
1135 wil_c(wil, RGF_USER_USAGE_6, BIT(0)); in wil_target_reset()
1137 wil_s(wil, RGF_CAF_OSC_CONTROL, BIT_CAF_OSC_XTAL_EN); in wil_target_reset()
1140 x = wil_r(wil, RGF_CAF_PLL_LOCK_STATUS); in wil_target_reset()
1142 wil_err(wil, "Xtal stabilization timeout\n" in wil_target_reset()
1147 wil_c(wil, RGF_USER_SPARROW_M_4, BIT_SPARROW_M_4_SEL_SLEEP_OR_REF); in wil_target_reset()
1149 wil_c(wil, RGF_USER_CLKS_CTL_0, BIT_USER_CLKS_CAR_AHB_SW_SEL); in wil_target_reset()
1151 wil_w(wil, RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_0, 0x3ff81f); in wil_target_reset()
1152 wil_w(wil, RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_1, 0xf); in wil_target_reset()
1154 if (wil->hw_version >= HW_VER_TALYN_MB) { in wil_target_reset()
1155 wil_w(wil, RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x7e000000); in wil_target_reset()
1156 wil_w(wil, RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0x0000003f); in wil_target_reset()
1157 wil_w(wil, RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0xc00000f0); in wil_target_reset()
1158 wil_w(wil, RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0xffe7fe00); in wil_target_reset()
1160 wil_w(wil, RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0xfe000000); in wil_target_reset()
1161 wil_w(wil, RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0x0000003f); in wil_target_reset()
1162 wil_w(wil, RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x000000f0); in wil_target_reset()
1163 wil_w(wil, RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0xffe7fe00); in wil_target_reset()
1166 wil_w(wil, RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_0, 0x0); in wil_target_reset()
1167 wil_w(wil, RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_1, 0x0); in wil_target_reset()
1169 wil_w(wil, RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0); in wil_target_reset()
1170 wil_w(wil, RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0); in wil_target_reset()
1171 wil_w(wil, RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0); in wil_target_reset()
1172 wil_w(wil, RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0); in wil_target_reset()
1174 wil_w(wil, RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000003); in wil_target_reset()
1176 wil_w(wil, RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00008000); in wil_target_reset()
1178 wil_w(wil, RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0); in wil_target_reset()
1180 if (wil->hw_version == HW_VER_TALYN_MB) in wil_target_reset()
1181 rc = wil_wait_device_ready_talyn_mb(wil); in wil_target_reset()
1183 rc = wil_wait_device_ready(wil, no_flash); in wil_target_reset()
1187 wil_c(wil, RGF_USER_CLKS_CTL_0, BIT_USER_CLKS_RST_PWGD); in wil_target_reset()
1190 wil_s(wil, RGF_DMA_OFUL_NID_0, BIT_DMA_OFUL_NID_0_RX_EXT_TR_EN | in wil_target_reset()
1193 if (wil->hw_version < HW_VER_TALYN_MB && no_flash) { in wil_target_reset()
1195 wil_w(wil, RGF_USER_XPM_IFC_RD_TIME1, 0x60001); in wil_target_reset()
1196 wil_w(wil, RGF_USER_XPM_IFC_RD_TIME2, 0x20027); in wil_target_reset()
1197 wil_w(wil, RGF_USER_XPM_IFC_RD_TIME3, 0x1); in wil_target_reset()
1198 wil_w(wil, RGF_USER_XPM_IFC_RD_TIME4, 0x20027); in wil_target_reset()
1199 wil_w(wil, RGF_USER_XPM_IFC_RD_TIME5, 0x30003); in wil_target_reset()
1200 wil_w(wil, RGF_USER_XPM_IFC_RD_TIME6, 0x20002); in wil_target_reset()
1201 wil_w(wil, RGF_USER_XPM_IFC_RD_TIME7, 0x60001); in wil_target_reset()
1202 wil_w(wil, RGF_USER_XPM_IFC_RD_TIME8, 0x60001); in wil_target_reset()
1203 wil_w(wil, RGF_USER_XPM_IFC_RD_TIME9, 0x60001); in wil_target_reset()
1204 wil_w(wil, RGF_USER_XPM_IFC_RD_TIME10, 0x60001); in wil_target_reset()
1205 wil_w(wil, RGF_USER_XPM_RD_DOUT_SAMPLE_TIME, 0x57); in wil_target_reset()
1211 static void wil_collect_fw_info(struct wil6210_priv *wil) in wil_collect_fw_info() argument
1213 struct wiphy *wiphy = wil_to_wiphy(wil); in wil_collect_fw_info()
1217 wil_refresh_fw_capabilities(wil); in wil_collect_fw_info()
1219 rc = wmi_get_mgmt_retry(wil, &retry_short); in wil_collect_fw_info()
1222 wil_dbg_misc(wil, "FW retry_short: %d\n", retry_short); in wil_collect_fw_info()
1226 void wil_refresh_fw_capabilities(struct wil6210_priv *wil) in wil_refresh_fw_capabilities() argument
1228 struct wiphy *wiphy = wil_to_wiphy(wil); in wil_refresh_fw_capabilities()
1231 wil->keep_radio_on_during_sleep = in wil_refresh_fw_capabilities()
1233 wil->platform_capa) && in wil_refresh_fw_capabilities()
1234 test_bit(WMI_FW_CAPABILITY_D3_SUSPEND, wil->fw_capabilities); in wil_refresh_fw_capabilities()
1236 wil_info(wil, "keep_radio_on_during_sleep (%d)\n", in wil_refresh_fw_capabilities()
1237 wil->keep_radio_on_during_sleep); in wil_refresh_fw_capabilities()
1239 if (test_bit(WMI_FW_CAPABILITY_RSSI_REPORTING, wil->fw_capabilities)) in wil_refresh_fw_capabilities()
1244 if (test_bit(WMI_FW_CAPABILITY_PNO, wil->fw_capabilities)) { in wil_refresh_fw_capabilities()
1252 if (test_bit(WMI_FW_CAPABILITY_TX_REQ_EXT, wil->fw_capabilities)) in wil_refresh_fw_capabilities()
1255 if (wil->platform_ops.set_features) { in wil_refresh_fw_capabilities()
1257 wil->fw_capabilities) && in wil_refresh_fw_capabilities()
1259 wil->platform_capa)) ? in wil_refresh_fw_capabilities()
1262 if (wil->n_msi == 3) in wil_refresh_fw_capabilities()
1265 wil->platform_ops.set_features(wil->platform_handle, features); in wil_refresh_fw_capabilities()
1269 wil->fw_capabilities)) { in wil_refresh_fw_capabilities()
1270 wil->max_agg_wsize = WIL_MAX_AGG_WSIZE_64; in wil_refresh_fw_capabilities()
1271 wil->max_ampdu_size = WIL_MAX_AMPDU_SIZE_128; in wil_refresh_fw_capabilities()
1273 wil->max_agg_wsize = WIL_MAX_AGG_WSIZE; in wil_refresh_fw_capabilities()
1274 wil->max_ampdu_size = WIL_MAX_AMPDU_SIZE; in wil_refresh_fw_capabilities()
1277 update_supported_bands(wil); in wil_refresh_fw_capabilities()
1290 void wil_get_board_file(struct wil6210_priv *wil, char *buf, size_t len) in wil_get_board_file() argument
1296 if (wil->board_file) { in wil_get_board_file()
1297 board_file = wil->board_file; in wil_get_board_file()
1302 if (strcmp(wil->wil_fw_name, wil_talyn_fw_name) == 0) in wil_get_board_file()
1311 static int wil_get_bl_info(struct wil6210_priv *wil) in wil_get_bl_info() argument
1313 struct net_device *ndev = wil->main_ndev; in wil_get_bl_info()
1314 struct wiphy *wiphy = wil_to_wiphy(wil); in wil_get_bl_info()
1323 wil_memcpy_fromio_32(&bl, wil->csr + HOSTADDR(RGF_USER_BL), in wil_get_bl_info()
1332 wil_info(wil, in wil_get_bl_info()
1336 wil_info(wil, "Boot Loader build unknown for struct v0\n"); in wil_get_bl_info()
1343 wil_info(wil, in wil_get_bl_info()
1348 wil_info(wil, "Boot Loader build %d.%d.%d.%d\n", in wil_get_bl_info()
1354 wil_err(wil, "BL: Invalid MAC %pM\n", mac); in wil_get_bl_info()
1364 wil_err(wil, "RF communication error 0x%04x", in wil_get_bl_info()
1372 static void wil_bl_crash_info(struct wil6210_priv *wil, bool is_err) in wil_bl_crash_info() argument
1375 u32 bl_ver = wil_r(wil, RGF_USER_BL + in wil_bl_crash_info()
1382 bl_assert_code = wil_r(wil, RGF_USER_BL + in wil_bl_crash_info()
1385 bl_assert_blink = wil_r(wil, RGF_USER_BL + in wil_bl_crash_info()
1388 bl_magic_number = wil_r(wil, RGF_USER_BL + in wil_bl_crash_info()
1393 wil_err(wil, in wil_bl_crash_info()
1397 wil_dbg_misc(wil, in wil_bl_crash_info()
1403 static int wil_get_otp_info(struct wil6210_priv *wil) in wil_get_otp_info() argument
1405 struct net_device *ndev = wil->main_ndev; in wil_get_otp_info()
1406 struct wiphy *wiphy = wil_to_wiphy(wil); in wil_get_otp_info()
1412 wil_memcpy_fromio_32(mac, wil->csr + HOSTADDR(mac_addr), sizeof(mac)); in wil_get_otp_info()
1415 wil_info(wil, "using OEM MAC %pM\n", mac); in wil_get_otp_info()
1417 if (wil->hw_version >= HW_VER_TALYN_MB) in wil_get_otp_info()
1422 wil_memcpy_fromio_32(mac, wil->csr + HOSTADDR(mac_addr), in wil_get_otp_info()
1427 wil_err(wil, "Invalid MAC %pM\n", mac); in wil_get_otp_info()
1439 static int wil_wait_for_fw_ready(struct wil6210_priv *wil) in wil_wait_for_fw_ready() argument
1442 ulong left = wait_for_completion_timeout(&wil->wmi_ready, to); in wil_wait_for_fw_ready()
1445 wil_err(wil, "Firmware not ready\n"); in wil_wait_for_fw_ready()
1448 wil_info(wil, "FW ready after %d ms. HW version 0x%08x\n", in wil_wait_for_fw_ready()
1449 jiffies_to_msecs(to-left), wil->hw_version); in wil_wait_for_fw_ready()
1456 struct wil6210_priv *wil = vif_to_wil(vif); in wil_abort_scan() local
1462 lockdep_assert_held(&wil->vif_mutex); in wil_abort_scan()
1467 wil_dbg_misc(wil, "Abort scan_request 0x%p\n", vif->scan_request); in wil_abort_scan()
1469 mutex_unlock(&wil->vif_mutex); in wil_abort_scan()
1472 wait_event_interruptible_timeout(wil->wq, !vif->scan_request, in wil_abort_scan()
1476 mutex_lock(&wil->vif_mutex); in wil_abort_scan()
1483 void wil_abort_scan_all_vifs(struct wil6210_priv *wil, bool sync) in wil_abort_scan_all_vifs() argument
1487 lockdep_assert_held(&wil->vif_mutex); in wil_abort_scan_all_vifs()
1489 for (i = 0; i < GET_MAX_VIFS(wil); i++) { in wil_abort_scan_all_vifs()
1490 struct wil6210_vif *vif = wil->vifs[i]; in wil_abort_scan_all_vifs()
1497 int wil_ps_update(struct wil6210_priv *wil, enum wmi_ps_profile_type ps_profile) in wil_ps_update() argument
1501 if (!test_bit(WMI_FW_CAPABILITY_PS_CONFIG, wil->fw_capabilities)) { in wil_ps_update()
1502 wil_err(wil, "set_power_mgmt not supported\n"); in wil_ps_update()
1506 rc = wmi_ps_dev_profile_cfg(wil, ps_profile); in wil_ps_update()
1508 wil_err(wil, "wmi_ps_dev_profile_cfg failed (%d)\n", rc); in wil_ps_update()
1510 wil->ps_profile = ps_profile; in wil_ps_update()
1515 static void wil_pre_fw_config(struct wil6210_priv *wil) in wil_pre_fw_config() argument
1517 wil_clear_fw_log_addr(wil); in wil_pre_fw_config()
1519 wil_s(wil, RGF_USER_USAGE_6, 1); in wil_pre_fw_config()
1524 wil6210_clear_irq(wil); in wil_pre_fw_config()
1527 if (wil->hw_version < HW_VER_TALYN_MB) { in wil_pre_fw_config()
1528 wil_s(wil, RGF_CAF_ICR + offsetof(struct RGF_ICR, ICR), 0); in wil_pre_fw_config()
1529 wil_w(wil, RGF_CAF_ICR + offsetof(struct RGF_ICR, IMV), ~0); in wil_pre_fw_config()
1535 if (wil->hw_version < HW_VER_TALYN_MB) in wil_pre_fw_config()
1536 wil_s(wil, RGF_PAL_UNIT_ICR + offsetof(struct RGF_ICR, ICR), in wil_pre_fw_config()
1539 if (wil->fw_calib_result > 0) { in wil_pre_fw_config()
1540 __le32 val = cpu_to_le32(wil->fw_calib_result | in wil_pre_fw_config()
1542 wil_w(wil, RGF_USER_FW_CALIB_RESULT, (u32 __force)val); in wil_pre_fw_config()
1546 static int wil_restore_vifs(struct wil6210_priv *wil) in wil_restore_vifs() argument
1553 for (i = 0; i < GET_MAX_VIFS(wil); i++) { in wil_restore_vifs()
1554 vif = wil->vifs[i]; in wil_restore_vifs()
1561 rc = wmi_port_allocate(wil, vif->mid, ndev->dev_addr, in wil_restore_vifs()
1564 wil_err(wil, "fail to restore VIF %d type %d, rc %d\n", in wil_restore_vifs()
1579 void wil_clear_fw_log_addr(struct wil6210_priv *wil) in wil_clear_fw_log_addr() argument
1582 wil_w(wil, RGF_USER_USAGE_1, 0); in wil_clear_fw_log_addr()
1584 wil_w(wil, RGF_USER_USAGE_2, 0); in wil_clear_fw_log_addr()
1585 wil_dbg_misc(wil, "Cleared FW and ucode log address"); in wil_clear_fw_log_addr()
1593 int wil_reset(struct wil6210_priv *wil, bool load_fw) in wil_reset() argument
1600 wil_dbg_misc(wil, "reset\n"); in wil_reset()
1602 WARN_ON(!mutex_is_locked(&wil->mutex)); in wil_reset()
1603 WARN_ON(test_bit(wil_status_napi_en, wil->status)); in wil_reset()
1609 struct net_device *ndev = wil->main_ndev; in wil_reset()
1616 if (wil->hw_version == HW_VER_UNKNOWN) in wil_reset()
1619 if (test_bit(WIL_PLATFORM_CAPA_T_PWR_ON_0, wil->platform_capa) && in wil_reset()
1620 wil->hw_version < HW_VER_TALYN_MB) { in wil_reset()
1621 wil_dbg_misc(wil, "Notify FW to set T_POWER_ON=0\n"); in wil_reset()
1622 wil_s(wil, RGF_USER_USAGE_8, BIT_USER_SUPPORT_T_POWER_ON_0); in wil_reset()
1625 if (test_bit(WIL_PLATFORM_CAPA_EXT_CLK, wil->platform_capa)) { in wil_reset()
1626 wil_dbg_misc(wil, "Notify FW on ext clock configuration\n"); in wil_reset()
1627 wil_s(wil, RGF_USER_USAGE_8, BIT_USER_EXT_CLK); in wil_reset()
1630 if (wil->platform_ops.notify) { in wil_reset()
1631 rc = wil->platform_ops.notify(wil->platform_handle, in wil_reset()
1634 wil_err(wil, "PRE_RESET platform notify failed, rc %d\n", in wil_reset()
1638 set_bit(wil_status_resetting, wil->status); in wil_reset()
1639 mutex_lock(&wil->vif_mutex); in wil_reset()
1640 wil_abort_scan_all_vifs(wil, false); in wil_reset()
1641 mutex_unlock(&wil->vif_mutex); in wil_reset()
1643 for (i = 0; i < GET_MAX_VIFS(wil); i++) { in wil_reset()
1644 vif = wil->vifs[i]; in wil_reset()
1652 wil_bcast_fini_all(wil); in wil_reset()
1655 wmi_led_cfg(wil, false); in wil_reset()
1657 down_write(&wil->mem_lock); in wil_reset()
1660 mutex_lock(&wil->wmi_mutex); in wil_reset()
1661 if (test_bit(wil_status_suspending, wil->status)) in wil_reset()
1663 bitmap_and(wil->status, wil->status, &status_flags, in wil_reset()
1665 wil_dbg_misc(wil, "wil->status (0x%lx)\n", *wil->status); in wil_reset()
1666 mutex_unlock(&wil->wmi_mutex); in wil_reset()
1668 wil_mask_irq(wil); in wil_reset()
1670 wmi_event_flush(wil); in wil_reset()
1672 flush_workqueue(wil->wq_service); in wil_reset()
1673 flush_workqueue(wil->wmi_wq); in wil_reset()
1675 no_flash = test_bit(hw_capa_no_flash, wil->hw_capa); in wil_reset()
1677 wil_bl_crash_info(wil, false); in wil_reset()
1678 wil_disable_irq(wil); in wil_reset()
1679 rc = wil_target_reset(wil, no_flash); in wil_reset()
1680 wil6210_clear_irq(wil); in wil_reset()
1681 wil_enable_irq(wil); in wil_reset()
1682 wil->txrx_ops.rx_fini(wil); in wil_reset()
1683 wil->txrx_ops.tx_fini(wil); in wil_reset()
1686 wil_bl_crash_info(wil, true); in wil_reset()
1691 rc = wil_get_otp_info(wil); in wil_reset()
1693 rc = wil_get_bl_info(wil); in wil_reset()
1701 wil_set_oob_mode(wil, oob_mode); in wil_reset()
1705 if (wil->secured_boot) { in wil_reset()
1706 wil_err(wil, "secured boot is not supported\n"); in wil_reset()
1707 up_write(&wil->mem_lock); in wil_reset()
1712 wil_get_board_file(wil, board_file, sizeof(board_file)); in wil_reset()
1713 wil_info(wil, "Use firmware <%s> + board <%s>\n", in wil_reset()
1714 wil->wil_fw_name, board_file); in wil_reset()
1717 wil_bl_prepare_halt(wil); in wil_reset()
1719 wil_halt_cpu(wil); in wil_reset()
1720 memset(wil->fw_version, 0, sizeof(wil->fw_version)); in wil_reset()
1722 rc = wil_request_firmware(wil, wil->wil_fw_name, true); in wil_reset()
1725 if (wil->num_of_brd_entries) in wil_reset()
1726 rc = wil_request_board(wil, board_file); in wil_reset()
1728 rc = wil_request_firmware(wil, board_file, true); in wil_reset()
1732 wil_pre_fw_config(wil); in wil_reset()
1733 wil_release_cpu(wil); in wil_reset()
1737 reinit_completion(&wil->wmi_ready); in wil_reset()
1738 reinit_completion(&wil->wmi_call); in wil_reset()
1739 reinit_completion(&wil->halp.comp); in wil_reset()
1741 clear_bit(wil_status_resetting, wil->status); in wil_reset()
1743 up_write(&wil->mem_lock); in wil_reset()
1746 wil_unmask_irq(wil); in wil_reset()
1749 rc = wil_wait_for_fw_ready(wil); in wil_reset()
1754 rc = wmi_echo(wil); in wil_reset()
1756 wil_err(wil, "wmi_echo failed, rc %d\n", rc); in wil_reset()
1760 wil->txrx_ops.configure_interrupt_moderation(wil); in wil_reset()
1765 if (wil->hw_version >= HW_VER_TALYN_MB) in wil_reset()
1766 wil_s(wil, RGF_DMA_MISC_CTL, in wil_reset()
1769 rc = wil_restore_vifs(wil); in wil_reset()
1771 wil_err(wil, "failed to restore vifs, rc %d\n", rc); in wil_reset()
1775 wil_collect_fw_info(wil); in wil_reset()
1777 if (wil->ps_profile != WMI_PS_PROFILE_TYPE_DEFAULT) in wil_reset()
1778 wil_ps_update(wil, wil->ps_profile); in wil_reset()
1780 if (wil->platform_ops.notify) { in wil_reset()
1781 rc = wil->platform_ops.notify(wil->platform_handle, in wil_reset()
1784 wil_err(wil, "FW_RDY notify failed, rc %d\n", in wil_reset()
1794 up_write(&wil->mem_lock); in wil_reset()
1795 clear_bit(wil_status_resetting, wil->status); in wil_reset()
1799 void wil_fw_error_recovery(struct wil6210_priv *wil) in wil_fw_error_recovery() argument
1801 wil_dbg_misc(wil, "starting fw error recovery\n"); in wil_fw_error_recovery()
1803 if (test_bit(wil_status_resetting, wil->status)) { in wil_fw_error_recovery()
1804 wil_info(wil, "Reset already in progress\n"); in wil_fw_error_recovery()
1808 wil->recovery_state = fw_recovery_pending; in wil_fw_error_recovery()
1809 schedule_work(&wil->fw_error_worker); in wil_fw_error_recovery()
1812 int __wil_up(struct wil6210_priv *wil) in __wil_up() argument
1814 struct net_device *ndev = wil->main_ndev; in __wil_up()
1818 WARN_ON(!mutex_is_locked(&wil->mutex)); in __wil_up()
1820 rc = wil_reset(wil, true); in __wil_up()
1826 rx_ring_order = wil->hw_version < HW_VER_TALYN_MB ? in __wil_up()
1830 rc = wil->txrx_ops.rx_init(wil, rx_ring_order); in __wil_up()
1834 rc = wil->txrx_ops.tx_init(wil); in __wil_up()
1840 wil_dbg_misc(wil, "type: STATION\n"); in __wil_up()
1844 wil_dbg_misc(wil, "type: AP\n"); in __wil_up()
1848 wil_dbg_misc(wil, "type: P2P_CLIENT\n"); in __wil_up()
1852 wil_dbg_misc(wil, "type: P2P_GO\n"); in __wil_up()
1856 wil_dbg_misc(wil, "type: Monitor\n"); in __wil_up()
1865 wmi_set_mac_address(wil, ndev->dev_addr); in __wil_up()
1867 wil_dbg_misc(wil, "NAPI enable\n"); in __wil_up()
1868 napi_enable(&wil->napi_rx); in __wil_up()
1869 napi_enable(&wil->napi_tx); in __wil_up()
1870 set_bit(wil_status_napi_en, wil->status); in __wil_up()
1872 wil6210_bus_request(wil, WIL_DEFAULT_BUS_REQUEST_KBPS); in __wil_up()
1877 int wil_up(struct wil6210_priv *wil) in wil_up() argument
1881 wil_dbg_misc(wil, "up\n"); in wil_up()
1883 mutex_lock(&wil->mutex); in wil_up()
1884 rc = __wil_up(wil); in wil_up()
1885 mutex_unlock(&wil->mutex); in wil_up()
1890 int __wil_down(struct wil6210_priv *wil) in __wil_down() argument
1893 WARN_ON(!mutex_is_locked(&wil->mutex)); in __wil_down()
1895 set_bit(wil_status_resetting, wil->status); in __wil_down()
1897 wil6210_bus_request(wil, 0); in __wil_down()
1899 wil_disable_irq(wil); in __wil_down()
1900 if (test_and_clear_bit(wil_status_napi_en, wil->status)) { in __wil_down()
1901 napi_disable(&wil->napi_rx); in __wil_down()
1902 napi_disable(&wil->napi_tx); in __wil_down()
1903 wil_dbg_misc(wil, "NAPI disable\n"); in __wil_down()
1905 wil_enable_irq(wil); in __wil_down()
1907 mutex_lock(&wil->vif_mutex); in __wil_down()
1908 wil_p2p_stop_radio_operations(wil); in __wil_down()
1909 wil_abort_scan_all_vifs(wil, false); in __wil_down()
1910 mutex_unlock(&wil->vif_mutex); in __wil_down()
1912 rc = wil_reset(wil, false); in __wil_down()
1917 int wil_down(struct wil6210_priv *wil) in wil_down() argument
1921 wil_dbg_misc(wil, "down\n"); in wil_down()
1923 wil_set_recovery_state(wil, fw_recovery_idle); in wil_down()
1924 mutex_lock(&wil->mutex); in wil_down()
1925 rc = __wil_down(wil); in wil_down()
1926 mutex_unlock(&wil->mutex); in wil_down()
1931 int wil_find_cid(struct wil6210_priv *wil, u8 mid, const u8 *mac) in wil_find_cid() argument
1936 for (i = 0; i < wil->max_assoc_sta; i++) { in wil_find_cid()
1937 if (wil->sta[i].mid == mid && in wil_find_cid()
1938 wil->sta[i].status != wil_sta_unused && in wil_find_cid()
1939 ether_addr_equal(wil->sta[i].addr, mac)) { in wil_find_cid()
1948 void wil_halp_vote(struct wil6210_priv *wil) in wil_halp_vote() argument
1953 if (wil->hw_version >= HW_VER_TALYN_MB) in wil_halp_vote()
1956 mutex_lock(&wil->halp.lock); in wil_halp_vote()
1958 wil_dbg_irq(wil, "halp_vote: start, HALP ref_cnt (%d)\n", in wil_halp_vote()
1959 wil->halp.ref_cnt); in wil_halp_vote()
1961 if (++wil->halp.ref_cnt == 1) { in wil_halp_vote()
1962 reinit_completion(&wil->halp.comp); in wil_halp_vote()
1964 wil->halp.handle_icr = true; in wil_halp_vote()
1965 wil6210_set_halp(wil); in wil_halp_vote()
1966 rc = wait_for_completion_timeout(&wil->halp.comp, to_jiffies); in wil_halp_vote()
1968 wil_err(wil, "HALP vote timed out\n"); in wil_halp_vote()
1970 wil->halp.handle_icr = false; in wil_halp_vote()
1971 wil6210_mask_halp(wil); in wil_halp_vote()
1973 wil_dbg_irq(wil, in wil_halp_vote()
1979 wil_dbg_irq(wil, "halp_vote: end, HALP ref_cnt (%d)\n", in wil_halp_vote()
1980 wil->halp.ref_cnt); in wil_halp_vote()
1982 mutex_unlock(&wil->halp.lock); in wil_halp_vote()
1985 void wil_halp_unvote(struct wil6210_priv *wil) in wil_halp_unvote() argument
1987 if (wil->hw_version >= HW_VER_TALYN_MB) in wil_halp_unvote()
1990 WARN_ON(wil->halp.ref_cnt == 0); in wil_halp_unvote()
1992 mutex_lock(&wil->halp.lock); in wil_halp_unvote()
1994 wil_dbg_irq(wil, "halp_unvote: start, HALP ref_cnt (%d)\n", in wil_halp_unvote()
1995 wil->halp.ref_cnt); in wil_halp_unvote()
1997 if (--wil->halp.ref_cnt == 0) { in wil_halp_unvote()
1998 wil6210_clear_halp(wil); in wil_halp_unvote()
1999 wil_dbg_irq(wil, "HALP unvote\n"); in wil_halp_unvote()
2002 wil_dbg_irq(wil, "halp_unvote:end, HALP ref_cnt (%d)\n", in wil_halp_unvote()
2003 wil->halp.ref_cnt); in wil_halp_unvote()
2005 mutex_unlock(&wil->halp.lock); in wil_halp_unvote()
2008 void wil_init_txrx_ops(struct wil6210_priv *wil) in wil_init_txrx_ops() argument
2010 if (wil->use_enhanced_dma_hw) in wil_init_txrx_ops()
2011 wil_init_txrx_ops_edma(wil); in wil_init_txrx_ops()
2013 wil_init_txrx_ops_legacy_dma(wil); in wil_init_txrx_ops()