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,
72 .mode = UMAC_MODE_BSS,
74 /* UMAC configuration */
76 .frag_threshold = IEEE80211_MAX_FRAG_THRESHOLD,
77 .rts_threshold = IEEE80211_MAX_RTS_THRESHOLD,
82 .wireless_mode = WIRELESS_MODE_11A | WIRELESS_MODE_11G |
86 .ibss_band = UMAC_BAND_2GHZ,
89 .mac_addr = {0x00, 0x02, 0xb3, 0x01, 0x02, 0x03},
92 static int modparam_reset;
93 module_param_named(reset, modparam_reset, bool, 0644);
94 MODULE_PARM_DESC(reset, "reset on firmware errors (default 0 [not reset])");
96 static int modparam_wimax_enable = 1;
97 module_param_named(wimax_enable, modparam_wimax_enable, bool, 0644);
98 MODULE_PARM_DESC(wimax_enable, "Enable wimax core (default 1 [wimax enabled])");
100 int iwm_mode_to_nl80211_iftype(int mode)
104 return NL80211_IFTYPE_STATION;
106 return NL80211_IFTYPE_ADHOC;
108 return NL80211_IFTYPE_UNSPECIFIED;
114 static void iwm_statistics_request(struct work_struct *work)
116 struct iwm_priv *iwm =
117 container_of(work, struct iwm_priv, stats_request.work);
119 iwm_send_umac_stats_req(iwm, 0);
122 static void iwm_disconnect_work(struct work_struct *work)
124 struct iwm_priv *iwm =
125 container_of(work, struct iwm_priv, disconnect.work);
127 if (iwm->umac_profile_active)
128 iwm_invalidate_mlme_profile(iwm);
130 clear_bit(IWM_STATUS_ASSOCIATED, &iwm->status);
131 iwm->umac_profile_active = 0;
132 memset(iwm->bssid, 0, ETH_ALEN);
137 wake_up_interruptible(&iwm->mlme_queue);
139 cfg80211_disconnected(iwm_to_ndev(iwm), 0, NULL, 0, GFP_KERNEL);
142 static void iwm_ct_kill_work(struct work_struct *work)
144 struct iwm_priv *iwm =
145 container_of(work, struct iwm_priv, ct_kill_delay.work);
146 struct wiphy *wiphy = iwm_to_wiphy(iwm);
148 IWM_INFO(iwm, "CT kill delay timeout\n");
150 wiphy_rfkill_set_hw_state(wiphy, false);
153 static int __iwm_up(struct iwm_priv *iwm);
154 static int __iwm_down(struct iwm_priv *iwm);
156 static void iwm_reset_worker(struct work_struct *work)
158 struct iwm_priv *iwm;
159 struct iwm_umac_profile *profile = NULL;
160 int uninitialized_var(ret), retry = 0;
162 iwm = container_of(work, struct iwm_priv, reset_worker);
165 * XXX: The iwm->mutex is introduced purely for this reset work,
166 * because the other users for iwm_up and iwm_down are only netdev
167 * ndo_open and ndo_stop which are already protected by rtnl.
168 * Please remove iwm->mutex together if iwm_reset_worker() is not
169 * required in the future.
171 if (!mutex_trylock(&iwm->mutex)) {
172 IWM_WARN(iwm, "We are in the middle of interface bringing "
173 "UP/DOWN. Skip driver resetting.\n");
177 if (iwm->umac_profile_active) {
178 profile = kmalloc(sizeof(struct iwm_umac_profile), GFP_KERNEL);
180 memcpy(profile, iwm->umac_profile, sizeof(*profile));
182 IWM_ERR(iwm, "Couldn't alloc memory for profile\n");
187 while (retry++ < 3) {
192 schedule_timeout_uninterruptible(10 * HZ);
196 IWM_WARN(iwm, "iwm_up() failed: %d\n", ret);
203 IWM_DBG_MLME(iwm, DBG, "Resend UMAC profile\n");
204 memcpy(iwm->umac_profile, profile, sizeof(*profile));
205 iwm_send_mlme_profile(iwm);
208 clear_bit(IWM_STATUS_RESETTING, &iwm->status);
211 mutex_unlock(&iwm->mutex);
214 static void iwm_auth_retry_worker(struct work_struct *work)
216 struct iwm_priv *iwm;
219 iwm = container_of(work, struct iwm_priv, auth_retry_worker);
220 if (iwm->umac_profile_active) {
221 ret = iwm_invalidate_mlme_profile(iwm);
226 iwm->umac_profile->sec.auth_type = UMAC_AUTH_TYPE_LEGACY_PSK;
228 ret = iwm_send_mlme_profile(iwm);
232 for (i = 0; i < IWM_NUM_KEYS; i++)
233 if (iwm->keys[i].key_len)
234 iwm_set_key(iwm, 0, &iwm->keys[i]);
236 iwm_set_tx_key(iwm, iwm->default_key);
241 static void iwm_watchdog(unsigned long data)
243 struct iwm_priv *iwm = (struct iwm_priv *)data;
245 IWM_WARN(iwm, "Watchdog expired: UMAC stalls!\n");
251 int iwm_priv_init(struct iwm_priv *iwm)
257 INIT_LIST_HEAD(&iwm->pending_notif);
258 init_waitqueue_head(&iwm->notif_queue);
259 init_waitqueue_head(&iwm->nonwifi_queue);
260 init_waitqueue_head(&iwm->wifi_ntfy_queue);
261 init_waitqueue_head(&iwm->mlme_queue);
262 memcpy(&iwm->conf, &def_iwm_conf, sizeof(struct iwm_conf));
263 spin_lock_init(&iwm->tx_credit.lock);
264 INIT_LIST_HEAD(&iwm->wifi_pending_cmd);
265 INIT_LIST_HEAD(&iwm->nonwifi_pending_cmd);
266 iwm->wifi_seq_num = UMAC_WIFI_SEQ_NUM_BASE;
267 iwm->nonwifi_seq_num = UMAC_NONWIFI_SEQ_NUM_BASE;
268 spin_lock_init(&iwm->cmd_lock);
270 INIT_DELAYED_WORK(&iwm->stats_request, iwm_statistics_request);
271 INIT_DELAYED_WORK(&iwm->disconnect, iwm_disconnect_work);
272 INIT_DELAYED_WORK(&iwm->ct_kill_delay, iwm_ct_kill_work);
273 INIT_WORK(&iwm->reset_worker, iwm_reset_worker);
274 INIT_WORK(&iwm->auth_retry_worker, iwm_auth_retry_worker);
275 INIT_LIST_HEAD(&iwm->bss_list);
277 skb_queue_head_init(&iwm->rx_list);
278 INIT_LIST_HEAD(&iwm->rx_tickets);
279 spin_lock_init(&iwm->ticket_lock);
280 for (i = 0; i < IWM_RX_ID_HASH; i++) {
281 INIT_LIST_HEAD(&iwm->rx_packets[i]);
282 spin_lock_init(&iwm->packet_lock[i]);
285 INIT_WORK(&iwm->rx_worker, iwm_rx_worker);
287 iwm->rx_wq = create_singlethread_workqueue(KBUILD_MODNAME "_rx");
291 for (i = 0; i < IWM_TX_QUEUES; i++) {
292 INIT_WORK(&iwm->txq[i].worker, iwm_tx_worker);
293 snprintf(name, 32, KBUILD_MODNAME "_tx_%d", i);
295 iwm->txq[i].wq = create_singlethread_workqueue(name);
299 skb_queue_head_init(&iwm->txq[i].queue);
300 skb_queue_head_init(&iwm->txq[i].stopped_queue);
301 spin_lock_init(&iwm->txq[i].lock);
304 for (i = 0; i < IWM_NUM_KEYS; i++)
305 memset(&iwm->keys[i], 0, sizeof(struct iwm_key));
307 iwm->default_key = -1;
309 for (i = 0; i < IWM_STA_TABLE_NUM; i++)
310 for (j = 0; j < IWM_UMAC_TID_NR; j++) {
311 mutex_init(&iwm->sta_table[i].tid_info[j].mutex);
312 iwm->sta_table[i].tid_info[j].stopped = false;
315 init_timer(&iwm->watchdog);
316 iwm->watchdog.function = iwm_watchdog;
317 iwm->watchdog.data = (unsigned long)iwm;
318 mutex_init(&iwm->mutex);
320 iwm->last_fw_err = kzalloc(sizeof(struct iwm_fw_error_hdr),
322 if (iwm->last_fw_err == NULL)
328 void iwm_priv_deinit(struct iwm_priv *iwm)
332 for (i = 0; i < IWM_TX_QUEUES; i++)
333 destroy_workqueue(iwm->txq[i].wq);
335 destroy_workqueue(iwm->rx_wq);
336 kfree(iwm->last_fw_err);
340 * We reset all the structures, and we reset the UMAC.
341 * After calling this routine, you're expected to reload
344 void iwm_reset(struct iwm_priv *iwm)
346 struct iwm_notif *notif, *next;
348 if (test_bit(IWM_STATUS_READY, &iwm->status))
349 iwm_target_reset(iwm);
351 if (test_bit(IWM_STATUS_RESETTING, &iwm->status)) {
353 set_bit(IWM_STATUS_RESETTING, &iwm->status);
358 list_for_each_entry_safe(notif, next, &iwm->pending_notif, pending) {
359 list_del(¬if->pending);
366 flush_workqueue(iwm->rx_wq);
371 void iwm_resetting(struct iwm_priv *iwm)
373 set_bit(IWM_STATUS_RESETTING, &iwm->status);
375 schedule_work(&iwm->reset_worker);
381 * We're faced with the following issue: Any host command can
382 * have an answer or not, and if there's an answer to expect,
383 * it can be treated synchronously or asynchronously.
384 * To work around the synchronous answer case, we implemented
385 * our notification mechanism.
386 * When a code path needs to wait for a command response
387 * synchronously, it calls notif_handle(), which waits for the
388 * right notification to show up, and then process it. Before
389 * starting to wait, it registered as a waiter for this specific
390 * answer (by toggling a bit in on of the handler_map), so that
391 * the rx code knows that it needs to send a notification to the
392 * waiting processes. It does so by calling iwm_notif_send(),
393 * which adds the notification to the pending notifications list,
394 * and then wakes the waiting processes up.
396 int iwm_notif_send(struct iwm_priv *iwm, struct iwm_wifi_cmd *cmd,
397 u8 cmd_id, u8 source, u8 *buf, unsigned long buf_size)
399 struct iwm_notif *notif;
401 notif = kzalloc(sizeof(struct iwm_notif), GFP_KERNEL);
403 IWM_ERR(iwm, "Couldn't alloc memory for notification\n");
407 INIT_LIST_HEAD(¬if->pending);
409 notif->cmd_id = cmd_id;
411 notif->buf = kzalloc(buf_size, GFP_KERNEL);
413 IWM_ERR(iwm, "Couldn't alloc notification buffer\n");
417 notif->buf_size = buf_size;
418 memcpy(notif->buf, buf, buf_size);
419 list_add_tail(¬if->pending, &iwm->pending_notif);
421 wake_up_interruptible(&iwm->notif_queue);
426 static struct iwm_notif *iwm_notif_find(struct iwm_priv *iwm, u32 cmd,
429 struct iwm_notif *notif;
431 list_for_each_entry(notif, &iwm->pending_notif, pending) {
432 if ((notif->cmd_id == cmd) && (notif->src == source)) {
433 list_del(¬if->pending);
441 static struct iwm_notif *iwm_notif_wait(struct iwm_priv *iwm, u32 cmd,
442 u8 source, long timeout)
445 struct iwm_notif *notif;
446 unsigned long *map = NULL;
450 map = &iwm->lmac_handler_map[0];
453 map = &iwm->umac_handler_map[0];
456 map = &iwm->udma_handler_map[0];
462 ret = wait_event_interruptible_timeout(iwm->notif_queue,
463 ((notif = iwm_notif_find(iwm, cmd, source)) != NULL),
473 int iwm_notif_handle(struct iwm_priv *iwm, u32 cmd, u8 source, long timeout)
476 struct iwm_notif *notif;
478 notif = iwm_notif_wait(iwm, cmd, source, timeout);
482 ret = iwm_rx_handle_resp(iwm, notif->buf, notif->buf_size, notif->cmd);
489 static int iwm_config_boot_params(struct iwm_priv *iwm)
491 struct iwm_udma_nonwifi_cmd target_cmd;
494 /* check Wimax is off and config debug monitor */
495 if (!modparam_wimax_enable) {
497 u32 addr1 = 0x606BE258;
501 u32 addr2 = 0x606BE100;
504 u32 addr3 = 0x606BEC00;
507 target_cmd.handle_by_hw = 0;
510 target_cmd.opcode = UMAC_HDI_OUT_OPCODE_WRITE;
511 target_cmd.addr = cpu_to_le32(addr1);
512 target_cmd.op1_sz = cpu_to_le32(sizeof(u32));
515 ret = iwm_hal_send_target_cmd(iwm, &target_cmd, &data1);
517 IWM_ERR(iwm, "iwm_hal_send_target_cmd failed\n");
521 target_cmd.opcode = UMAC_HDI_OUT_OPCODE_READ_MODIFY_WRITE;
522 target_cmd.addr = cpu_to_le32(addr2);
523 target_cmd.op1_sz = cpu_to_le32(data2_set);
524 target_cmd.op2 = cpu_to_le32(data2_clr);
526 ret = iwm_hal_send_target_cmd(iwm, &target_cmd, &data1);
528 IWM_ERR(iwm, "iwm_hal_send_target_cmd failed\n");
532 target_cmd.opcode = UMAC_HDI_OUT_OPCODE_WRITE;
533 target_cmd.addr = cpu_to_le32(addr3);
534 target_cmd.op1_sz = cpu_to_le32(sizeof(u32));
537 ret = iwm_hal_send_target_cmd(iwm, &target_cmd, &data3);
539 IWM_ERR(iwm, "iwm_hal_send_target_cmd failed\n");
547 void iwm_init_default_profile(struct iwm_priv *iwm,
548 struct iwm_umac_profile *profile)
550 memset(profile, 0, sizeof(struct iwm_umac_profile));
552 profile->sec.auth_type = UMAC_AUTH_TYPE_OPEN;
553 profile->sec.flags = UMAC_SEC_FLG_LEGACY_PROFILE;
554 profile->sec.ucast_cipher = UMAC_CIPHER_TYPE_NONE;
555 profile->sec.mcast_cipher = UMAC_CIPHER_TYPE_NONE;
557 if (iwm->conf.enable_qos)
558 profile->flags |= cpu_to_le16(UMAC_PROFILE_QOS_ALLOWED);
560 profile->wireless_mode = iwm->conf.wireless_mode;
561 profile->mode = cpu_to_le32(iwm->conf.mode);
563 profile->ibss.atim = 0;
564 profile->ibss.beacon_interval = 100;
565 profile->ibss.join_only = 0;
566 profile->ibss.band = iwm->conf.ibss_band;
567 profile->ibss.channel = iwm->conf.ibss_channel;
570 void iwm_link_on(struct iwm_priv *iwm)
572 netif_carrier_on(iwm_to_ndev(iwm));
573 netif_tx_wake_all_queues(iwm_to_ndev(iwm));
575 iwm_send_umac_stats_req(iwm, 0);
578 void iwm_link_off(struct iwm_priv *iwm)
580 struct iw_statistics *wstats = &iwm->wstats;
583 netif_tx_stop_all_queues(iwm_to_ndev(iwm));
584 netif_carrier_off(iwm_to_ndev(iwm));
586 for (i = 0; i < IWM_TX_QUEUES; i++) {
587 skb_queue_purge(&iwm->txq[i].queue);
588 skb_queue_purge(&iwm->txq[i].stopped_queue);
590 iwm->txq[i].concat_count = 0;
591 iwm->txq[i].concat_ptr = iwm->txq[i].concat_buf;
593 flush_workqueue(iwm->txq[i].wq);
598 cancel_delayed_work_sync(&iwm->stats_request);
599 memset(wstats, 0, sizeof(struct iw_statistics));
600 wstats->qual.updated = IW_QUAL_ALL_INVALID;
607 iwm->resp_ie_len = 0;
609 del_timer_sync(&iwm->watchdog);
612 static void iwm_bss_list_clean(struct iwm_priv *iwm)
614 struct iwm_bss_info *bss, *next;
616 list_for_each_entry_safe(bss, next, &iwm->bss_list, node) {
617 list_del(&bss->node);
623 static int iwm_channels_init(struct iwm_priv *iwm)
627 ret = iwm_send_umac_channel_list(iwm);
629 IWM_ERR(iwm, "Send channel list failed\n");
633 ret = iwm_notif_handle(iwm, UMAC_CMD_OPCODE_GET_CHAN_INFO_LIST,
634 IWM_SRC_UMAC, WAIT_NOTIF_TIMEOUT);
636 IWM_ERR(iwm, "Didn't get a channel list notification\n");
643 static int __iwm_up(struct iwm_priv *iwm)
646 struct iwm_notif *notif_reboot, *notif_ack = NULL;
647 struct wiphy *wiphy = iwm_to_wiphy(iwm);
650 ret = iwm_bus_enable(iwm);
652 IWM_ERR(iwm, "Couldn't enable function\n");
656 iwm_rx_setup_handlers(iwm);
658 /* Wait for initial BARKER_REBOOT from hardware */
659 notif_reboot = iwm_notif_wait(iwm, IWM_BARKER_REBOOT_NOTIFICATION,
660 IWM_SRC_UDMA, 2 * HZ);
662 IWM_ERR(iwm, "Wait for REBOOT_BARKER timeout\n");
666 /* We send the barker back */
667 ret = iwm_bus_send_chunk(iwm, notif_reboot->buf, 16);
669 IWM_ERR(iwm, "REBOOT barker response failed\n");
674 kfree(notif_reboot->buf);
677 /* Wait for ACK_BARKER from hardware */
678 notif_ack = iwm_notif_wait(iwm, IWM_ACK_BARKER_NOTIFICATION,
679 IWM_SRC_UDMA, 2 * HZ);
681 IWM_ERR(iwm, "Wait for ACK_BARKER timeout\n");
685 kfree(notif_ack->buf);
688 /* We start to config static boot parameters */
689 ret = iwm_config_boot_params(iwm);
691 IWM_ERR(iwm, "Config boot parameters failed\n");
695 ret = iwm_read_mac(iwm, iwm_to_ndev(iwm)->dev_addr);
697 IWM_ERR(iwm, "MAC reading failed\n");
700 memcpy(iwm_to_ndev(iwm)->perm_addr, iwm_to_ndev(iwm)->dev_addr,
703 /* We can load the FWs */
704 ret = iwm_load_fw(iwm);
706 IWM_ERR(iwm, "FW loading failed\n");
710 ret = iwm_eeprom_fat_channels(iwm);
712 IWM_ERR(iwm, "Couldnt read HT channels EEPROM entries\n");
717 * Read our SKU capabilities.
718 * If it's valid, we AND the configured wireless mode with the
719 * device EEPROM value as the current profile wireless mode.
721 wireless_mode = iwm_eeprom_wireless_mode(iwm);
723 iwm->conf.wireless_mode &= wireless_mode;
724 if (iwm->umac_profile)
725 iwm->umac_profile->wireless_mode =
726 iwm->conf.wireless_mode;
728 IWM_ERR(iwm, "Wrong SKU capabilities: 0x%x\n",
729 *((u16 *)iwm_eeprom_access(iwm, IWM_EEPROM_SKU_CAP)));
731 snprintf(wiphy->fw_version, sizeof(wiphy->fw_version), "L%s_U%s",
732 iwm->lmac_version, iwm->umac_version);
734 /* We configure the UMAC and enable the wifi module */
735 ret = iwm_send_umac_config(iwm,
736 cpu_to_le32(UMAC_RST_CTRL_FLG_WIFI_CORE_EN) |
737 cpu_to_le32(UMAC_RST_CTRL_FLG_WIFI_LINK_EN) |
738 cpu_to_le32(UMAC_RST_CTRL_FLG_WIFI_MLME_EN));
740 IWM_ERR(iwm, "UMAC config failed\n");
744 ret = iwm_notif_handle(iwm, UMAC_NOTIFY_OPCODE_WIFI_CORE_STATUS,
745 IWM_SRC_UMAC, WAIT_NOTIF_TIMEOUT);
747 IWM_ERR(iwm, "Didn't get a wifi core status notification\n");
751 if (iwm->core_enabled != (UMAC_NTFY_WIFI_CORE_STATUS_LINK_EN |
752 UMAC_NTFY_WIFI_CORE_STATUS_MLME_EN)) {
753 IWM_DBG_BOOT(iwm, DBG, "Not all cores enabled:0x%x\n",
755 ret = iwm_notif_handle(iwm, UMAC_NOTIFY_OPCODE_WIFI_CORE_STATUS,
756 IWM_SRC_UMAC, WAIT_NOTIF_TIMEOUT);
758 IWM_ERR(iwm, "Didn't get a core status notification\n");
762 if (iwm->core_enabled != (UMAC_NTFY_WIFI_CORE_STATUS_LINK_EN |
763 UMAC_NTFY_WIFI_CORE_STATUS_MLME_EN)) {
764 IWM_ERR(iwm, "Not all cores enabled: 0x%x\n",
768 IWM_INFO(iwm, "All cores enabled\n");
772 ret = iwm_channels_init(iwm);
774 IWM_ERR(iwm, "Couldn't init channels\n");
778 /* Set the READY bit to indicate interface is brought up successfully */
779 set_bit(IWM_STATUS_READY, &iwm->status);
784 iwm_eeprom_exit(iwm);
787 ret = iwm_bus_disable(iwm);
789 IWM_ERR(iwm, "Couldn't disable function\n");
794 int iwm_up(struct iwm_priv *iwm)
798 mutex_lock(&iwm->mutex);
800 mutex_unlock(&iwm->mutex);
805 static int __iwm_down(struct iwm_priv *iwm)
809 /* The interface is already down */
810 if (!test_bit(IWM_STATUS_READY, &iwm->status))
813 if (iwm->scan_request) {
814 cfg80211_scan_done(iwm->scan_request, true);
815 iwm->scan_request = NULL;
818 clear_bit(IWM_STATUS_READY, &iwm->status);
820 iwm_eeprom_exit(iwm);
821 iwm_bss_list_clean(iwm);
822 iwm_init_default_profile(iwm, iwm->umac_profile);
823 iwm->umac_profile_active = false;
824 iwm->default_key = -1;
825 iwm->core_enabled = 0;
827 ret = iwm_bus_disable(iwm);
829 IWM_ERR(iwm, "Couldn't disable function\n");
836 int iwm_down(struct iwm_priv *iwm)
840 mutex_lock(&iwm->mutex);
841 ret = __iwm_down(iwm);
842 mutex_unlock(&iwm->mutex);