2 * Intel Wireless Multicomm 3200 WiFi driver
4 * Copyright (C) 2009 Intel Corporation. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of Intel Corporation nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * Intel Corporation <ilw@linux.intel.com>
34 * Samuel Ortiz <samuel.ortiz@intel.com>
35 * Zhu Yi <yi.zhu@intel.com>
39 #include <linux/kernel.h>
40 #include <linux/netdevice.h>
41 #include <linux/sched.h>
42 #include <linux/ieee80211.h>
43 #include <linux/wireless.h>
54 static struct iwm_conf def_iwm_conf = {
56 .sdio_ior_timeout = 5000,
57 .calib_map = BIT(CALIB_CFG_DC_IDX) |
58 BIT(CALIB_CFG_LO_IDX) |
59 BIT(CALIB_CFG_TX_IQ_IDX) |
60 BIT(CALIB_CFG_RX_IQ_IDX) |
61 BIT(SHILOH_PHY_CALIBRATE_BASE_BAND_CMD),
62 .expected_calib_map = BIT(PHY_CALIBRATE_DC_CMD) |
63 BIT(PHY_CALIBRATE_LO_CMD) |
64 BIT(PHY_CALIBRATE_TX_IQ_CMD) |
65 BIT(PHY_CALIBRATE_RX_IQ_CMD) |
66 BIT(SHILOH_PHY_CALIBRATE_BASE_BAND_CMD),
69 .reset_on_fatal_err = 1,
71 .wimax_not_present = 0,
73 .mode = UMAC_MODE_BSS,
75 /* UMAC configuration */
77 .frag_threshold = IEEE80211_MAX_FRAG_THRESHOLD,
78 .rts_threshold = IEEE80211_MAX_RTS_THRESHOLD,
83 .wireless_mode = WIRELESS_MODE_11A | WIRELESS_MODE_11G |
87 .ibss_band = UMAC_BAND_2GHZ,
90 .mac_addr = {0x00, 0x02, 0xb3, 0x01, 0x02, 0x03},
93 static int modparam_reset;
94 module_param_named(reset, modparam_reset, bool, 0644);
95 MODULE_PARM_DESC(reset, "reset on firmware errors (default 0 [not reset])");
97 int iwm_mode_to_nl80211_iftype(int mode)
101 return NL80211_IFTYPE_STATION;
103 return NL80211_IFTYPE_ADHOC;
105 return NL80211_IFTYPE_UNSPECIFIED;
111 static void iwm_statistics_request(struct work_struct *work)
113 struct iwm_priv *iwm =
114 container_of(work, struct iwm_priv, stats_request.work);
116 iwm_send_umac_stats_req(iwm, 0);
119 static void iwm_disconnect_work(struct work_struct *work)
121 struct iwm_priv *iwm =
122 container_of(work, struct iwm_priv, disconnect.work);
124 if (iwm->umac_profile_active)
125 iwm_invalidate_mlme_profile(iwm);
127 clear_bit(IWM_STATUS_ASSOCIATED, &iwm->status);
128 iwm->umac_profile_active = 0;
129 memset(iwm->bssid, 0, ETH_ALEN);
134 wake_up_interruptible(&iwm->mlme_queue);
136 cfg80211_disconnected(iwm_to_ndev(iwm), 0, NULL, 0, GFP_KERNEL);
139 static void iwm_ct_kill_work(struct work_struct *work)
141 struct iwm_priv *iwm =
142 container_of(work, struct iwm_priv, ct_kill_delay.work);
143 struct wiphy *wiphy = iwm_to_wiphy(iwm);
145 IWM_INFO(iwm, "CT kill delay timeout\n");
147 wiphy_rfkill_set_hw_state(wiphy, false);
150 static int __iwm_up(struct iwm_priv *iwm);
151 static int __iwm_down(struct iwm_priv *iwm);
153 static void iwm_reset_worker(struct work_struct *work)
155 struct iwm_priv *iwm;
156 struct iwm_umac_profile *profile = NULL;
157 int uninitialized_var(ret), retry = 0;
159 iwm = container_of(work, struct iwm_priv, reset_worker);
162 * XXX: The iwm->mutex is introduced purely for this reset work,
163 * because the other users for iwm_up and iwm_down are only netdev
164 * ndo_open and ndo_stop which are already protected by rtnl.
165 * Please remove iwm->mutex together if iwm_reset_worker() is not
166 * required in the future.
168 if (!mutex_trylock(&iwm->mutex)) {
169 IWM_WARN(iwm, "We are in the middle of interface bringing "
170 "UP/DOWN. Skip driver resetting.\n");
174 if (iwm->umac_profile_active) {
175 profile = kmalloc(sizeof(struct iwm_umac_profile), GFP_KERNEL);
177 memcpy(profile, iwm->umac_profile, sizeof(*profile));
179 IWM_ERR(iwm, "Couldn't alloc memory for profile\n");
184 while (retry++ < 3) {
189 schedule_timeout_uninterruptible(10 * HZ);
193 IWM_WARN(iwm, "iwm_up() failed: %d\n", ret);
200 IWM_DBG_MLME(iwm, DBG, "Resend UMAC profile\n");
201 memcpy(iwm->umac_profile, profile, sizeof(*profile));
202 iwm_send_mlme_profile(iwm);
205 clear_bit(IWM_STATUS_RESETTING, &iwm->status);
208 mutex_unlock(&iwm->mutex);
211 static void iwm_auth_retry_worker(struct work_struct *work)
213 struct iwm_priv *iwm;
216 iwm = container_of(work, struct iwm_priv, auth_retry_worker);
217 if (iwm->umac_profile_active) {
218 ret = iwm_invalidate_mlme_profile(iwm);
223 iwm->umac_profile->sec.auth_type = UMAC_AUTH_TYPE_LEGACY_PSK;
225 ret = iwm_send_mlme_profile(iwm);
229 for (i = 0; i < IWM_NUM_KEYS; i++)
230 if (iwm->keys[i].key_len)
231 iwm_set_key(iwm, 0, &iwm->keys[i]);
233 iwm_set_tx_key(iwm, iwm->default_key);
238 static void iwm_watchdog(unsigned long data)
240 struct iwm_priv *iwm = (struct iwm_priv *)data;
242 IWM_WARN(iwm, "Watchdog expired: UMAC stalls!\n");
248 int iwm_priv_init(struct iwm_priv *iwm)
254 INIT_LIST_HEAD(&iwm->pending_notif);
255 init_waitqueue_head(&iwm->notif_queue);
256 init_waitqueue_head(&iwm->nonwifi_queue);
257 init_waitqueue_head(&iwm->wifi_ntfy_queue);
258 init_waitqueue_head(&iwm->mlme_queue);
259 memcpy(&iwm->conf, &def_iwm_conf, sizeof(struct iwm_conf));
260 spin_lock_init(&iwm->tx_credit.lock);
261 INIT_LIST_HEAD(&iwm->wifi_pending_cmd);
262 INIT_LIST_HEAD(&iwm->nonwifi_pending_cmd);
263 iwm->wifi_seq_num = UMAC_WIFI_SEQ_NUM_BASE;
264 iwm->nonwifi_seq_num = UMAC_NONWIFI_SEQ_NUM_BASE;
265 spin_lock_init(&iwm->cmd_lock);
267 INIT_DELAYED_WORK(&iwm->stats_request, iwm_statistics_request);
268 INIT_DELAYED_WORK(&iwm->disconnect, iwm_disconnect_work);
269 INIT_DELAYED_WORK(&iwm->ct_kill_delay, iwm_ct_kill_work);
270 INIT_WORK(&iwm->reset_worker, iwm_reset_worker);
271 INIT_WORK(&iwm->auth_retry_worker, iwm_auth_retry_worker);
272 INIT_LIST_HEAD(&iwm->bss_list);
274 skb_queue_head_init(&iwm->rx_list);
275 INIT_LIST_HEAD(&iwm->rx_tickets);
276 for (i = 0; i < IWM_RX_ID_HASH; i++)
277 INIT_LIST_HEAD(&iwm->rx_packets[i]);
279 INIT_WORK(&iwm->rx_worker, iwm_rx_worker);
281 iwm->rx_wq = create_singlethread_workqueue(KBUILD_MODNAME "_rx");
285 for (i = 0; i < IWM_TX_QUEUES; i++) {
286 INIT_WORK(&iwm->txq[i].worker, iwm_tx_worker);
287 snprintf(name, 32, KBUILD_MODNAME "_tx_%d", i);
289 iwm->txq[i].wq = create_singlethread_workqueue(name);
293 skb_queue_head_init(&iwm->txq[i].queue);
294 skb_queue_head_init(&iwm->txq[i].stopped_queue);
295 spin_lock_init(&iwm->txq[i].lock);
298 for (i = 0; i < IWM_NUM_KEYS; i++)
299 memset(&iwm->keys[i], 0, sizeof(struct iwm_key));
301 iwm->default_key = -1;
303 for (i = 0; i < IWM_STA_TABLE_NUM; i++)
304 for (j = 0; j < IWM_UMAC_TID_NR; j++) {
305 mutex_init(&iwm->sta_table[i].tid_info[j].mutex);
306 iwm->sta_table[i].tid_info[j].stopped = false;
309 init_timer(&iwm->watchdog);
310 iwm->watchdog.function = iwm_watchdog;
311 iwm->watchdog.data = (unsigned long)iwm;
312 mutex_init(&iwm->mutex);
314 iwm->last_fw_err = kzalloc(sizeof(struct iwm_fw_error_hdr),
316 if (iwm->last_fw_err == NULL)
322 void iwm_priv_deinit(struct iwm_priv *iwm)
326 for (i = 0; i < IWM_TX_QUEUES; i++)
327 destroy_workqueue(iwm->txq[i].wq);
329 destroy_workqueue(iwm->rx_wq);
330 kfree(iwm->last_fw_err);
334 * We reset all the structures, and we reset the UMAC.
335 * After calling this routine, you're expected to reload
338 void iwm_reset(struct iwm_priv *iwm)
340 struct iwm_notif *notif, *next;
342 if (test_bit(IWM_STATUS_READY, &iwm->status))
343 iwm_target_reset(iwm);
345 if (test_bit(IWM_STATUS_RESETTING, &iwm->status)) {
347 set_bit(IWM_STATUS_RESETTING, &iwm->status);
352 list_for_each_entry_safe(notif, next, &iwm->pending_notif, pending) {
353 list_del(¬if->pending);
360 flush_workqueue(iwm->rx_wq);
365 void iwm_resetting(struct iwm_priv *iwm)
367 set_bit(IWM_STATUS_RESETTING, &iwm->status);
369 schedule_work(&iwm->reset_worker);
375 * We're faced with the following issue: Any host command can
376 * have an answer or not, and if there's an answer to expect,
377 * it can be treated synchronously or asynchronously.
378 * To work around the synchronous answer case, we implemented
379 * our notification mechanism.
380 * When a code path needs to wait for a command response
381 * synchronously, it calls notif_handle(), which waits for the
382 * right notification to show up, and then process it. Before
383 * starting to wait, it registered as a waiter for this specific
384 * answer (by toggling a bit in on of the handler_map), so that
385 * the rx code knows that it needs to send a notification to the
386 * waiting processes. It does so by calling iwm_notif_send(),
387 * which adds the notification to the pending notifications list,
388 * and then wakes the waiting processes up.
390 int iwm_notif_send(struct iwm_priv *iwm, struct iwm_wifi_cmd *cmd,
391 u8 cmd_id, u8 source, u8 *buf, unsigned long buf_size)
393 struct iwm_notif *notif;
395 notif = kzalloc(sizeof(struct iwm_notif), GFP_KERNEL);
397 IWM_ERR(iwm, "Couldn't alloc memory for notification\n");
401 INIT_LIST_HEAD(¬if->pending);
403 notif->cmd_id = cmd_id;
405 notif->buf = kzalloc(buf_size, GFP_KERNEL);
407 IWM_ERR(iwm, "Couldn't alloc notification buffer\n");
411 notif->buf_size = buf_size;
412 memcpy(notif->buf, buf, buf_size);
413 list_add_tail(¬if->pending, &iwm->pending_notif);
415 wake_up_interruptible(&iwm->notif_queue);
420 static struct iwm_notif *iwm_notif_find(struct iwm_priv *iwm, u32 cmd,
423 struct iwm_notif *notif, *next;
425 list_for_each_entry_safe(notif, next, &iwm->pending_notif, pending) {
426 if ((notif->cmd_id == cmd) && (notif->src == source)) {
427 list_del(¬if->pending);
435 static struct iwm_notif *iwm_notif_wait(struct iwm_priv *iwm, u32 cmd,
436 u8 source, long timeout)
439 struct iwm_notif *notif;
440 unsigned long *map = NULL;
444 map = &iwm->lmac_handler_map[0];
447 map = &iwm->umac_handler_map[0];
450 map = &iwm->udma_handler_map[0];
456 ret = wait_event_interruptible_timeout(iwm->notif_queue,
457 ((notif = iwm_notif_find(iwm, cmd, source)) != NULL),
467 int iwm_notif_handle(struct iwm_priv *iwm, u32 cmd, u8 source, long timeout)
470 struct iwm_notif *notif;
472 notif = iwm_notif_wait(iwm, cmd, source, timeout);
476 ret = iwm_rx_handle_resp(iwm, notif->buf, notif->buf_size, notif->cmd);
483 static int iwm_config_boot_params(struct iwm_priv *iwm)
485 struct iwm_udma_nonwifi_cmd target_cmd;
488 /* check Wimax is off and config debug monitor */
489 if (iwm->conf.wimax_not_present) {
491 u32 addr1 = 0x606BE258;
495 u32 addr2 = 0x606BE100;
498 u32 addr3 = 0x606BEC00;
501 target_cmd.handle_by_hw = 0;
504 target_cmd.opcode = UMAC_HDI_OUT_OPCODE_WRITE;
505 target_cmd.addr = cpu_to_le32(addr1);
506 target_cmd.op1_sz = cpu_to_le32(sizeof(u32));
509 ret = iwm_hal_send_target_cmd(iwm, &target_cmd, &data1);
511 IWM_ERR(iwm, "iwm_hal_send_target_cmd failed\n");
515 target_cmd.opcode = UMAC_HDI_OUT_OPCODE_READ_MODIFY_WRITE;
516 target_cmd.addr = cpu_to_le32(addr2);
517 target_cmd.op1_sz = cpu_to_le32(data2_set);
518 target_cmd.op2 = cpu_to_le32(data2_clr);
520 ret = iwm_hal_send_target_cmd(iwm, &target_cmd, &data1);
522 IWM_ERR(iwm, "iwm_hal_send_target_cmd failed\n");
526 target_cmd.opcode = UMAC_HDI_OUT_OPCODE_WRITE;
527 target_cmd.addr = cpu_to_le32(addr3);
528 target_cmd.op1_sz = cpu_to_le32(sizeof(u32));
531 ret = iwm_hal_send_target_cmd(iwm, &target_cmd, &data3);
533 IWM_ERR(iwm, "iwm_hal_send_target_cmd failed\n");
541 void iwm_init_default_profile(struct iwm_priv *iwm,
542 struct iwm_umac_profile *profile)
544 memset(profile, 0, sizeof(struct iwm_umac_profile));
546 profile->sec.auth_type = UMAC_AUTH_TYPE_OPEN;
547 profile->sec.flags = UMAC_SEC_FLG_LEGACY_PROFILE;
548 profile->sec.ucast_cipher = UMAC_CIPHER_TYPE_NONE;
549 profile->sec.mcast_cipher = UMAC_CIPHER_TYPE_NONE;
551 if (iwm->conf.enable_qos)
552 profile->flags |= cpu_to_le16(UMAC_PROFILE_QOS_ALLOWED);
554 profile->wireless_mode = iwm->conf.wireless_mode;
555 profile->mode = cpu_to_le32(iwm->conf.mode);
557 profile->ibss.atim = 0;
558 profile->ibss.beacon_interval = 100;
559 profile->ibss.join_only = 0;
560 profile->ibss.band = iwm->conf.ibss_band;
561 profile->ibss.channel = iwm->conf.ibss_channel;
564 void iwm_link_on(struct iwm_priv *iwm)
566 netif_carrier_on(iwm_to_ndev(iwm));
567 netif_tx_wake_all_queues(iwm_to_ndev(iwm));
569 iwm_send_umac_stats_req(iwm, 0);
572 void iwm_link_off(struct iwm_priv *iwm)
574 struct iw_statistics *wstats = &iwm->wstats;
577 netif_tx_stop_all_queues(iwm_to_ndev(iwm));
578 netif_carrier_off(iwm_to_ndev(iwm));
580 for (i = 0; i < IWM_TX_QUEUES; i++) {
581 skb_queue_purge(&iwm->txq[i].queue);
582 skb_queue_purge(&iwm->txq[i].stopped_queue);
584 iwm->txq[i].concat_count = 0;
585 iwm->txq[i].concat_ptr = iwm->txq[i].concat_buf;
587 flush_workqueue(iwm->txq[i].wq);
592 cancel_delayed_work_sync(&iwm->stats_request);
593 memset(wstats, 0, sizeof(struct iw_statistics));
594 wstats->qual.updated = IW_QUAL_ALL_INVALID;
601 iwm->resp_ie_len = 0;
603 del_timer_sync(&iwm->watchdog);
606 static void iwm_bss_list_clean(struct iwm_priv *iwm)
608 struct iwm_bss_info *bss, *next;
610 list_for_each_entry_safe(bss, next, &iwm->bss_list, node) {
611 list_del(&bss->node);
617 static int iwm_channels_init(struct iwm_priv *iwm)
621 ret = iwm_send_umac_channel_list(iwm);
623 IWM_ERR(iwm, "Send channel list failed\n");
627 ret = iwm_notif_handle(iwm, UMAC_CMD_OPCODE_GET_CHAN_INFO_LIST,
628 IWM_SRC_UMAC, WAIT_NOTIF_TIMEOUT);
630 IWM_ERR(iwm, "Didn't get a channel list notification\n");
637 static int __iwm_up(struct iwm_priv *iwm)
640 struct iwm_notif *notif_reboot, *notif_ack = NULL;
641 struct wiphy *wiphy = iwm_to_wiphy(iwm);
644 ret = iwm_bus_enable(iwm);
646 IWM_ERR(iwm, "Couldn't enable function\n");
650 iwm_rx_setup_handlers(iwm);
652 /* Wait for initial BARKER_REBOOT from hardware */
653 notif_reboot = iwm_notif_wait(iwm, IWM_BARKER_REBOOT_NOTIFICATION,
654 IWM_SRC_UDMA, 2 * HZ);
656 IWM_ERR(iwm, "Wait for REBOOT_BARKER timeout\n");
660 /* We send the barker back */
661 ret = iwm_bus_send_chunk(iwm, notif_reboot->buf, 16);
663 IWM_ERR(iwm, "REBOOT barker response failed\n");
668 kfree(notif_reboot->buf);
671 /* Wait for ACK_BARKER from hardware */
672 notif_ack = iwm_notif_wait(iwm, IWM_ACK_BARKER_NOTIFICATION,
673 IWM_SRC_UDMA, 2 * HZ);
675 IWM_ERR(iwm, "Wait for ACK_BARKER timeout\n");
679 kfree(notif_ack->buf);
682 /* We start to config static boot parameters */
683 ret = iwm_config_boot_params(iwm);
685 IWM_ERR(iwm, "Config boot parameters failed\n");
689 ret = iwm_read_mac(iwm, iwm_to_ndev(iwm)->dev_addr);
691 IWM_ERR(iwm, "MAC reading failed\n");
694 memcpy(iwm_to_ndev(iwm)->perm_addr, iwm_to_ndev(iwm)->dev_addr,
697 /* We can load the FWs */
698 ret = iwm_load_fw(iwm);
700 IWM_ERR(iwm, "FW loading failed\n");
704 ret = iwm_eeprom_fat_channels(iwm);
706 IWM_ERR(iwm, "Couldnt read HT channels EEPROM entries\n");
711 * Read our SKU capabilities.
712 * If it's valid, we AND the configured wireless mode with the
713 * device EEPROM value as the current profile wireless mode.
715 wireless_mode = iwm_eeprom_wireless_mode(iwm);
717 iwm->conf.wireless_mode &= wireless_mode;
718 if (iwm->umac_profile)
719 iwm->umac_profile->wireless_mode =
720 iwm->conf.wireless_mode;
722 IWM_ERR(iwm, "Wrong SKU capabilities: 0x%x\n",
723 *((u16 *)iwm_eeprom_access(iwm, IWM_EEPROM_SKU_CAP)));
725 snprintf(wiphy->fw_version, sizeof(wiphy->fw_version), "L%s_U%s",
726 iwm->lmac_version, iwm->umac_version);
728 /* We configure the UMAC and enable the wifi module */
729 ret = iwm_send_umac_config(iwm,
730 cpu_to_le32(UMAC_RST_CTRL_FLG_WIFI_CORE_EN) |
731 cpu_to_le32(UMAC_RST_CTRL_FLG_WIFI_LINK_EN) |
732 cpu_to_le32(UMAC_RST_CTRL_FLG_WIFI_MLME_EN));
734 IWM_ERR(iwm, "UMAC config failed\n");
738 ret = iwm_notif_handle(iwm, UMAC_NOTIFY_OPCODE_WIFI_CORE_STATUS,
739 IWM_SRC_UMAC, WAIT_NOTIF_TIMEOUT);
741 IWM_ERR(iwm, "Didn't get a wifi core status notification\n");
745 if (iwm->core_enabled != (UMAC_NTFY_WIFI_CORE_STATUS_LINK_EN |
746 UMAC_NTFY_WIFI_CORE_STATUS_MLME_EN)) {
747 IWM_DBG_BOOT(iwm, DBG, "Not all cores enabled:0x%x\n",
749 ret = iwm_notif_handle(iwm, UMAC_NOTIFY_OPCODE_WIFI_CORE_STATUS,
750 IWM_SRC_UMAC, WAIT_NOTIF_TIMEOUT);
752 IWM_ERR(iwm, "Didn't get a core status notification\n");
756 if (iwm->core_enabled != (UMAC_NTFY_WIFI_CORE_STATUS_LINK_EN |
757 UMAC_NTFY_WIFI_CORE_STATUS_MLME_EN)) {
758 IWM_ERR(iwm, "Not all cores enabled: 0x%x\n",
762 IWM_INFO(iwm, "All cores enabled\n");
766 ret = iwm_channels_init(iwm);
768 IWM_ERR(iwm, "Couldn't init channels\n");
772 /* Set the READY bit to indicate interface is brought up successfully */
773 set_bit(IWM_STATUS_READY, &iwm->status);
778 iwm_eeprom_exit(iwm);
781 ret = iwm_bus_disable(iwm);
783 IWM_ERR(iwm, "Couldn't disable function\n");
788 int iwm_up(struct iwm_priv *iwm)
792 mutex_lock(&iwm->mutex);
794 mutex_unlock(&iwm->mutex);
799 static int __iwm_down(struct iwm_priv *iwm)
803 /* The interface is already down */
804 if (!test_bit(IWM_STATUS_READY, &iwm->status))
807 if (iwm->scan_request) {
808 cfg80211_scan_done(iwm->scan_request, true);
809 iwm->scan_request = NULL;
812 clear_bit(IWM_STATUS_READY, &iwm->status);
814 iwm_eeprom_exit(iwm);
815 iwm_bss_list_clean(iwm);
816 iwm_init_default_profile(iwm, iwm->umac_profile);
817 iwm->umac_profile_active = false;
818 iwm->default_key = -1;
819 iwm->core_enabled = 0;
821 ret = iwm_bus_disable(iwm);
823 IWM_ERR(iwm, "Couldn't disable function\n");
830 int iwm_down(struct iwm_priv *iwm)
834 mutex_lock(&iwm->mutex);
835 ret = __iwm_down(iwm);
836 mutex_unlock(&iwm->mutex);