Lines Matching +full:deep +full:- +full:touch
1 // SPDX-License-Identifier: ISC
3 * Copyright (c) 2012-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
47 unsigned int mtu_max = TXRX_BUF_LEN_DEFAULT - WIL_MAX_MPDU_OVERHEAD;
60 ret = -EINVAL; in mtu_max_set()
87 return -EINVAL; in ring_order_set()
89 *((uint *)kp->arg) = x; in ring_order_set()
131 * one has to read/write to/from NIC in 32-bit chunks;
133 * not work on 64-bit platform - it uses 64-bit transactions
135 * Force 32-bit transactions to enable NIC on 64-bit platforms
138 * should be used - {read|write}l would swap bytes to provide
147 for (; count >= 4; count -= 4) in wil_memcpy_fromio_32()
164 for (; count >= 4; count -= 4) in wil_memcpy_toio_32()
181 if (!down_read_trylock(&wil->mem_lock)) in wil_mem_access_lock()
182 return -EBUSY; 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()
187 return -EBUSY; in wil_mem_access_lock()
195 up_read(&wil->mem_lock); in wil_mem_access_unlock()
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()
205 if (!ring->va) in wil_ring_fini_tx()
210 spin_lock_bh(&txdata->lock); in wil_ring_fini_tx()
211 txdata->dot1x_open = false; in wil_ring_fini_tx()
212 txdata->mid = U8_MAX; in wil_ring_fini_tx()
213 txdata->enabled = 0; /* no Tx can be in progress or start anew */ in wil_ring_fini_tx()
214 spin_unlock_bh(&txdata->lock); in wil_ring_fini_tx()
217 * Add a memory barrier to guarantee that txdata->enabled is zeroed in wil_ring_fini_tx()
222 /* make sure NAPI won't touch this vring */ 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()
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()
244 __acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock) in wil_disconnect_cid_complete()
250 struct wil_sta_info *sta = &wil->sta[cid]; in wil_disconnect_cid_complete()
256 cid, sta->mid, sta->status); in wil_disconnect_cid_complete()
258 if (sta->status != wil_sta_unused) { in wil_disconnect_cid_complete()
259 if (vif->mid != sta->mid) { in wil_disconnect_cid_complete()
261 vif->mid); in wil_disconnect_cid_complete()
264 switch (wdev->iftype) { in wil_disconnect_cid_complete()
267 /* AP-like interface */ in wil_disconnect_cid_complete()
268 cfg80211_del_sta(ndev, sta->addr, GFP_KERNEL); in wil_disconnect_cid_complete()
273 sta->status = wil_sta_unused; in wil_disconnect_cid_complete()
274 sta->mid = U8_MAX; in wil_disconnect_cid_complete()
280 spin_lock_bh(&sta->tid_rx_lock); in wil_disconnect_cid_complete()
282 r = sta->tid_rx[i]; in wil_disconnect_cid_complete()
283 sta->tid_rx[i] = NULL; in wil_disconnect_cid_complete()
286 spin_unlock_bh(&sta->tid_rx_lock); in wil_disconnect_cid_complete()
289 memset(sta->tid_crypto_rx, 0, sizeof(sta->tid_crypto_rx)); in wil_disconnect_cid_complete()
290 memset(&sta->group_crypto_rx, 0, sizeof(sta->group_crypto_rx)); 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()
297 memset(&sta->stats, 0, sizeof(sta->stats)); in wil_disconnect_cid_complete()
298 sta->stats.tx_latency_min_us = U32_MAX; in wil_disconnect_cid_complete()
305 int cid = -ENOENT; in _wil6210_disconnect_complete()
317 * - disconnect single STA, still connected in _wil6210_disconnect_complete()
318 * - disconnect single STA, already disconnected in _wil6210_disconnect_complete()
319 * - disconnect all in _wil6210_disconnect_complete()
322 * - bssid == NULL in _wil6210_disconnect_complete()
323 * - bssid is broadcast address (ff:ff:ff:ff:ff:ff) in _wil6210_disconnect_complete()
324 * - bssid is our MAC address in _wil6210_disconnect_complete()
327 !ether_addr_equal_unaligned(ndev->dev_addr, bssid)) { in _wil6210_disconnect_complete()
328 cid = wil_find_cid(wil, vif->mid, bssid); in _wil6210_disconnect_complete()
336 for (cid = 0; cid < wil->max_assoc_sta; cid++) in _wil6210_disconnect_complete()
341 switch (wdev->iftype) { in _wil6210_disconnect_complete()
350 if (test_and_clear_bit(wil_vif_fwconnected, vif->status)) { in _wil6210_disconnect_complete()
351 atomic_dec(&wil->connected_vifs); in _wil6210_disconnect_complete()
354 vif->locally_generated_disc, in _wil6210_disconnect_complete()
356 vif->locally_generated_disc = false; in _wil6210_disconnect_complete()
357 } else if (test_bit(wil_vif_fwconnecting, vif->status)) { in _wil6210_disconnect_complete()
361 vif->bss = NULL; in _wil6210_disconnect_complete()
363 clear_bit(wil_vif_fwconnecting, vif->status); in _wil6210_disconnect_complete()
364 clear_bit(wil_vif_ft_roam, vif->status); in _wil6210_disconnect_complete()
365 vif->ptk_rekey_state = WIL_REKEY_IDLE; in _wil6210_disconnect_complete()
370 if (!wil_vif_is_connected(wil, vif->mid)) { in _wil6210_disconnect_complete()
373 vif->status)) in _wil6210_disconnect_complete()
374 atomic_dec(&wil->connected_vifs); in _wil6210_disconnect_complete()
389 struct wil_sta_info *sta = &wil->sta[cid]; in wil_disconnect_cid()
394 cid, sta->mid, sta->status); in wil_disconnect_cid()
396 if (sta->status == wil_sta_unused) in wil_disconnect_cid()
399 if (vif->mid != sta->mid) { in wil_disconnect_cid()
400 wil_err(wil, "STA MID mismatch with VIF MID(%d)\n", vif->mid); in wil_disconnect_cid()
401 return -EINVAL; in wil_disconnect_cid()
405 if (wdev->iftype == NL80211_IFTYPE_AP && disable_ap_sme) in wil_disconnect_cid()
411 return wmi_disconnect_sta(vif, sta->addr, reason_code, del_sta); in wil_disconnect_cid()
419 int cid = -ENOENT; in _wil6210_disconnect()
431 * - disconnect single STA, still connected in _wil6210_disconnect()
432 * - disconnect single STA, already disconnected in _wil6210_disconnect()
433 * - disconnect all in _wil6210_disconnect()
436 * - bssid == NULL in _wil6210_disconnect()
437 * - bssid is broadcast address (ff:ff:ff:ff:ff:ff) in _wil6210_disconnect()
438 * - bssid is our MAC address in _wil6210_disconnect()
441 !ether_addr_equal_unaligned(ndev->dev_addr, bssid)) { in _wil6210_disconnect()
442 cid = wil_find_cid(wil, vif->mid, bssid); in _wil6210_disconnect()
449 for (cid = 0; cid < wil->max_assoc_sta; cid++) in _wil6210_disconnect()
454 * to avoid deadlock - disconnect event handler acquires in _wil6210_disconnect()
455 * wil->mutex while it is already held here in _wil6210_disconnect()
472 if (test_bit(wil_vif_fwconnected, vif->status)) in wil_disconnect_worker()
476 if (!test_bit(wil_vif_fwconnecting, vif->status)) in wil_disconnect_worker()
482 rc = wmi_call(wil, WMI_DISCONNECT_CMDID, vif->mid, NULL, 0, in wil_disconnect_worker()
494 clear_bit(wil_vif_fwconnecting, vif->status); in wil_disconnect_worker()
499 if (wait_event_interruptible(wil->wq, wil->recovery_state != in wil_wait_for_recovery()
502 return -ERESTARTSYS; in wil_wait_for_recovery()
504 if (wil->recovery_state != fw_recovery_running) { in wil_wait_for_recovery()
506 return -EINTR; in wil_wait_for_recovery()
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()
523 return no_fw_recovery && (wil->recovery_state == fw_recovery_pending); in wil_is_recovery_blocked()
530 struct net_device *ndev = wil->main_ndev; in wil_fw_error_worker()
535 if (!ndev || !(ndev->flags & IFF_UP)) { in wil_fw_error_worker()
536 wil_info(wil, "No recovery - interface is down\n"); in wil_fw_error_worker()
539 wdev = ndev->ieee80211_ptr; 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()
552 wil->recovery_count); in wil_fw_error_worker()
556 wil->last_fw_recovery = jiffies; 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()
566 mutex_lock(&wil->mutex); in wil_fw_error_worker()
571 switch (wdev->iftype) { in wil_fw_error_worker()
586 mutex_unlock(&wil->mutex); in wil_fw_error_worker()
588 mutex_lock(&wil->mutex); in wil_fw_error_worker()
592 wil_err(wil, "No recovery - unknown interface type %d\n", in wil_fw_error_worker()
593 wdev->iftype); in wil_fw_error_worker()
597 mutex_unlock(&wil->mutex); in wil_fw_error_worker()
607 if (!wil->ring_tx[i].va) in wil_find_free_ring()
610 return -EINVAL; in wil_find_free_ring()
616 int rc = -EINVAL, ringid; in wil_ring_init_tx()
629 cid, vif->mid, ringid); in wil_ring_init_tx()
631 rc = wil->txrx_ops.ring_init_tx(vif, ringid, 1 << tx_ring_order, in wil_ring_init_tx()
635 cid, vif->mid, ringid); in wil_ring_init_tx()
644 int ri = vif->bcast_ring, rc; in wil_bcast_init()
646 if (ri >= 0 && wil->ring_tx[ri].va) in wil_bcast_init()
653 vif->bcast_ring = ri; in wil_bcast_init()
654 rc = wil->txrx_ops.ring_init_bcast(vif, ri, 1 << bcast_ring_order); in wil_bcast_init()
656 vif->bcast_ring = -1; in wil_bcast_init()
664 int ri = vif->bcast_ring; in wil_bcast_fini()
669 vif->bcast_ring = -1; in wil_bcast_fini()
679 vif = wil->vifs[i]; in wil_bcast_fini_all()
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()
724 return -EAGAIN; 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()
772 return -EAGAIN; in wil_priv_init()
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()
784 * wil6210_disconnect - disconnect one connection
801 del_timer_sync(&vif->connect_timer); in wil6210_disconnect()
806 * wil6210_disconnect_complete - handle disconnect event
821 del_timer_sync(&vif->connect_timer); in wil6210_disconnect_complete()
830 cancel_work_sync(&wil->fw_error_worker); 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()
874 jal = wil_r(wil, wil->iccm_base + ivt3); in wil_freeze_bl()
880 /* prevent the target from entering deep sleep in wil_freeze_bl()
888 wil_w(wil, wil->iccm_base + ivt3 + 4, ARC_me_imm32(ivt3)); in wil_freeze_bl()
931 if (wil->hw_version >= HW_VER_TALYN_MB) { in wil_halt_cpu()
945 if (wil->hw_version >= HW_VER_TALYN_MB) in wil_release_cpu()
996 return -ETIME; in wil_wait_device_ready()
1019 wil->boot_config = WIL_BOOT_ERR; 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()
1068 return -ETIME; 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()
1090 return -ETIME; 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()
1099 wil->secured_boot ? "en" : "dis"); in wil_wait_device_ready_talyn_mb()
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()
1144 return -ETIME; in wil_target_reset()
1154 if (wil->hw_version >= HW_VER_TALYN_MB) { in wil_target_reset()
1180 if (wil->hw_version == HW_VER_TALYN_MB) in wil_target_reset()
1193 if (wil->hw_version < HW_VER_TALYN_MB && no_flash) { in wil_target_reset()
1221 wiphy->retry_short = retry_short; in wil_collect_fw_info()
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()
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()
1240 wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; in wil_refresh_fw_capabilities()
1242 wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC; in wil_refresh_fw_capabilities()
1244 if (test_bit(WMI_FW_CAPABILITY_PNO, wil->fw_capabilities)) { in wil_refresh_fw_capabilities()
1245 wiphy->max_sched_scan_reqs = 1; in wil_refresh_fw_capabilities()
1246 wiphy->max_sched_scan_ssids = WMI_MAX_PNO_SSID_NUM; in wil_refresh_fw_capabilities()
1247 wiphy->max_match_sets = WMI_MAX_PNO_SSID_NUM; in wil_refresh_fw_capabilities()
1248 wiphy->max_sched_scan_ie_len = WMI_MAX_IE_LEN; in wil_refresh_fw_capabilities()
1249 wiphy->max_sched_scan_plans = WMI_MAX_PLANS_NUM; in wil_refresh_fw_capabilities()
1252 if (test_bit(WMI_FW_CAPABILITY_TX_REQ_EXT, wil->fw_capabilities)) in wil_refresh_fw_capabilities()
1253 wiphy->flags |= WIPHY_FLAG_OFFCHAN_TX; 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()
1282 le32_to_cpus(&r->base); in wil_mbox_ring_le2cpus()
1283 le16_to_cpus(&r->entry_size); in wil_mbox_ring_le2cpus()
1284 le16_to_cpus(&r->size); in wil_mbox_ring_le2cpus()
1285 le32_to_cpus(&r->tail); in wil_mbox_ring_le2cpus()
1286 le32_to_cpus(&r->head); in wil_mbox_ring_le2cpus()
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()
1313 struct net_device *ndev = wil->main_ndev; in wil_get_bl_info()
1323 wil_memcpy_fromio_32(&bl, wil->csr + HOSTADDR(RGF_USER_BL), in wil_get_bl_info()
1355 return -EINVAL; in wil_get_bl_info()
1358 ether_addr_copy(ndev->perm_addr, mac); in wil_get_bl_info()
1359 ether_addr_copy(wiphy->perm_addr, mac); in wil_get_bl_info()
1360 if (!is_valid_ether_addr(ndev->dev_addr)) in wil_get_bl_info()
1361 ether_addr_copy(ndev->dev_addr, mac); in wil_get_bl_info()
1366 return -EAGAIN; in wil_get_bl_info()
1405 struct net_device *ndev = wil->main_ndev; in wil_get_otp_info()
1412 wil_memcpy_fromio_32(mac, wil->csr + HOSTADDR(mac_addr), sizeof(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()
1428 return -EINVAL; in wil_get_otp_info()
1431 ether_addr_copy(ndev->perm_addr, mac); in wil_get_otp_info()
1432 ether_addr_copy(wiphy->perm_addr, mac); in wil_get_otp_info()
1433 if (!is_valid_ether_addr(ndev->dev_addr)) in wil_get_otp_info()
1434 ether_addr_copy(ndev->dev_addr, mac); in wil_get_otp_info()
1442 ulong left = wait_for_completion_timeout(&wil->wmi_ready, to); in wil_wait_for_fw_ready()
1446 return -ETIME; in wil_wait_for_fw_ready()
1449 jiffies_to_msecs(to-left), wil->hw_version); in wil_wait_for_fw_ready()
1462 lockdep_assert_held(&wil->vif_mutex); in wil_abort_scan()
1464 if (!vif->scan_request) in wil_abort_scan()
1467 wil_dbg_misc(wil, "Abort scan_request 0x%p\n", vif->scan_request); in wil_abort_scan()
1468 del_timer_sync(&vif->scan_timer); 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()
1477 if (vif->scan_request) { in wil_abort_scan()
1478 cfg80211_scan_done(vif->scan_request, &info); in wil_abort_scan()
1479 vif->scan_request = NULL; in wil_abort_scan()
1487 lockdep_assert_held(&wil->vif_mutex); in wil_abort_scan_all_vifs()
1490 struct wil6210_vif *vif = wil->vifs[i]; in wil_abort_scan_all_vifs()
1501 if (!test_bit(WMI_FW_CAPABILITY_PS_CONFIG, wil->fw_capabilities)) { in wil_ps_update()
1503 return -EOPNOTSUPP; in wil_ps_update()
1510 wil->ps_profile = ps_profile; in wil_ps_update()
1521 /* clear any interrupts which on-card-firmware in wil_pre_fw_config()
1525 /* CAF_ICR - clear and mask */ in wil_pre_fw_config()
1527 if (wil->hw_version < HW_VER_TALYN_MB) { in wil_pre_fw_config()
1531 /* clear PAL_UNIT_ICR (potential D0->D3 leftover) in wil_pre_fw_config()
1532 * In Talyn-MB host cannot access this register due to in wil_pre_fw_config()
1535 if (wil->hw_version < HW_VER_TALYN_MB) 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()
1554 vif = wil->vifs[i]; in wil_restore_vifs()
1557 vif->ap_isolate = 0; in wil_restore_vifs()
1558 if (vif->mid) { in wil_restore_vifs()
1561 rc = wmi_port_allocate(wil, vif->mid, ndev->dev_addr, in wil_restore_vifs()
1562 wdev->iftype); in wil_restore_vifs()
1565 i, wdev->iftype, rc); in wil_restore_vifs()
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()
1611 ether_addr_copy(ndev->perm_addr, mac); in wil_reset()
1612 ether_addr_copy(ndev->dev_addr, ndev->perm_addr); in wil_reset()
1616 if (wil->hw_version == HW_VER_UNKNOWN) in wil_reset()
1617 return -ENODEV; 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()
1625 if (test_bit(WIL_PLATFORM_CAPA_EXT_CLK, wil->platform_capa)) { in wil_reset()
1630 if (wil->platform_ops.notify) { in wil_reset()
1631 rc = wil->platform_ops.notify(wil->platform_handle, in wil_reset()
1638 set_bit(wil_status_resetting, wil->status); in wil_reset()
1639 mutex_lock(&wil->vif_mutex); in wil_reset()
1641 mutex_unlock(&wil->vif_mutex); in wil_reset()
1644 vif = wil->vifs[i]; in wil_reset()
1646 cancel_work_sync(&vif->disconnect_worker); in wil_reset()
1649 vif->ptk_rekey_state = WIL_REKEY_IDLE; 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()
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()
1682 wil->txrx_ops.rx_fini(wil); in wil_reset()
1683 wil->txrx_ops.tx_fini(wil); in wil_reset()
1694 if (rc == -EAGAIN && !load_fw) in wil_reset()
1705 if (wil->secured_boot) { in wil_reset()
1707 up_write(&wil->mem_lock); in wil_reset()
1708 return -ENOTSUPP; in wil_reset()
1714 wil->wil_fw_name, board_file); 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()
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()
1760 wil->txrx_ops.configure_interrupt_moderation(wil); in wil_reset()
1763 * while there is back-pressure from Host during RX in wil_reset()
1765 if (wil->hw_version >= HW_VER_TALYN_MB) 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()
1794 up_write(&wil->mem_lock); in wil_reset()
1795 clear_bit(wil_status_resetting, wil->status); in wil_reset()
1803 if (test_bit(wil_status_resetting, wil->status)) { 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()
1814 struct net_device *ndev = wil->main_ndev; in __wil_up()
1815 struct wireless_dev *wdev = ndev->ieee80211_ptr; in __wil_up()
1818 WARN_ON(!mutex_is_locked(&wil->mutex)); 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()
1838 switch (wdev->iftype) { in __wil_up()
1841 ndev->type = ARPHRD_ETHER; in __wil_up()
1845 ndev->type = ARPHRD_ETHER; in __wil_up()
1849 ndev->type = ARPHRD_ETHER; in __wil_up()
1853 ndev->type = ARPHRD_ETHER; in __wil_up()
1857 ndev->type = ARPHRD_IEEE80211_RADIOTAP; in __wil_up()
1861 return -EOPNOTSUPP; in __wil_up()
1864 /* MAC address - pre-requisite for other commands */ in __wil_up()
1865 wmi_set_mac_address(wil, ndev->dev_addr); 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()
1883 mutex_lock(&wil->mutex); in wil_up()
1885 mutex_unlock(&wil->mutex); in wil_up()
1893 WARN_ON(!mutex_is_locked(&wil->mutex)); in __wil_down()
1895 set_bit(wil_status_resetting, wil->status); 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()
1907 mutex_lock(&wil->vif_mutex); in __wil_down()
1910 mutex_unlock(&wil->vif_mutex); in __wil_down()
1924 mutex_lock(&wil->mutex); in wil_down()
1926 mutex_unlock(&wil->mutex); in wil_down()
1934 int rc = -ENOENT; in wil_find_cid()
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()
1953 if (wil->hw_version >= HW_VER_TALYN_MB) in wil_halp_vote()
1956 mutex_lock(&wil->halp.lock); 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()
1966 rc = wait_for_completion_timeout(&wil->halp.comp, to_jiffies); in wil_halp_vote()
1970 wil->halp.handle_icr = false; in wil_halp_vote()
1975 jiffies_to_msecs(to_jiffies - rc)); in wil_halp_vote()
1980 wil->halp.ref_cnt); in wil_halp_vote()
1982 mutex_unlock(&wil->halp.lock); in wil_halp_vote()
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()
1995 wil->halp.ref_cnt); in wil_halp_unvote()
1997 if (--wil->halp.ref_cnt == 0) { in wil_halp_unvote()
2003 wil->halp.ref_cnt); in wil_halp_unvote()
2005 mutex_unlock(&wil->halp.lock); in wil_halp_unvote()
2010 if (wil->use_enhanced_dma_hw) in wil_init_txrx_ops()