Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Intel Wireless Multicomm 3200 WiFi driver |
| 3 | * |
| 4 | * Copyright (C) 2009 Intel Corporation. All rights reserved. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions |
| 8 | * are met: |
| 9 | * |
| 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 |
| 15 | * distribution. |
| 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. |
| 19 | * |
| 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. |
| 31 | * |
| 32 | * |
| 33 | * Intel Corporation <ilw@linux.intel.com> |
| 34 | * Samuel Ortiz <samuel.ortiz@intel.com> |
| 35 | * Zhu Yi <yi.zhu@intel.com> |
| 36 | * |
| 37 | */ |
| 38 | |
| 39 | #include <linux/kernel.h> |
| 40 | #include <linux/netdevice.h> |
Alexey Dobriyan | d43c36d | 2009-10-07 17:09:06 +0400 | [diff] [blame] | 41 | #include <linux/sched.h> |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 42 | #include <linux/ieee80211.h> |
| 43 | #include <linux/wireless.h> |
| 44 | |
| 45 | #include "iwm.h" |
| 46 | #include "debug.h" |
| 47 | #include "bus.h" |
| 48 | #include "umac.h" |
| 49 | #include "commands.h" |
| 50 | #include "hal.h" |
| 51 | #include "fw.h" |
| 52 | #include "rx.h" |
| 53 | |
| 54 | static struct iwm_conf def_iwm_conf = { |
| 55 | |
| 56 | .sdio_ior_timeout = 5000, |
Samuel Ortiz | d04bd62 | 2009-09-01 15:14:04 +0200 | [diff] [blame] | 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) | |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 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), |
Samuel Ortiz | e85498b21 | 2009-10-16 13:18:48 +0800 | [diff] [blame] | 67 | .ct_kill_entry = 110, |
| 68 | .ct_kill_exit = 110, |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 69 | .reset_on_fatal_err = 1, |
| 70 | .auto_connect = 1, |
| 71 | .wimax_not_present = 0, |
| 72 | .enable_qos = 1, |
| 73 | .mode = UMAC_MODE_BSS, |
| 74 | |
| 75 | /* UMAC configuration */ |
| 76 | .power_index = 0, |
| 77 | .frag_threshold = IEEE80211_MAX_FRAG_THRESHOLD, |
| 78 | .rts_threshold = IEEE80211_MAX_RTS_THRESHOLD, |
| 79 | .cts_to_self = 0, |
| 80 | |
| 81 | .assoc_timeout = 2, |
| 82 | .roam_timeout = 10, |
Samuel Ortiz | 0bed08d | 2009-11-24 11:33:29 +0800 | [diff] [blame] | 83 | .wireless_mode = WIRELESS_MODE_11A | WIRELESS_MODE_11G | |
| 84 | WIRELESS_MODE_11N, |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 85 | .coexist_mode = COEX_MODE_CM, |
| 86 | |
| 87 | /* IBSS */ |
| 88 | .ibss_band = UMAC_BAND_2GHZ, |
| 89 | .ibss_channel = 1, |
| 90 | |
| 91 | .mac_addr = {0x00, 0x02, 0xb3, 0x01, 0x02, 0x03}, |
| 92 | }; |
| 93 | |
| 94 | static int modparam_reset; |
| 95 | module_param_named(reset, modparam_reset, bool, 0644); |
| 96 | MODULE_PARM_DESC(reset, "reset on firmware errors (default 0 [not reset])"); |
| 97 | |
| 98 | int iwm_mode_to_nl80211_iftype(int mode) |
| 99 | { |
| 100 | switch (mode) { |
| 101 | case UMAC_MODE_BSS: |
| 102 | return NL80211_IFTYPE_STATION; |
| 103 | case UMAC_MODE_IBSS: |
| 104 | return NL80211_IFTYPE_ADHOC; |
| 105 | default: |
| 106 | return NL80211_IFTYPE_UNSPECIFIED; |
| 107 | } |
| 108 | |
| 109 | return 0; |
| 110 | } |
| 111 | |
| 112 | static void iwm_statistics_request(struct work_struct *work) |
| 113 | { |
| 114 | struct iwm_priv *iwm = |
| 115 | container_of(work, struct iwm_priv, stats_request.work); |
| 116 | |
| 117 | iwm_send_umac_stats_req(iwm, 0); |
| 118 | } |
| 119 | |
Zhu Yi | c743627 | 2009-09-01 15:14:02 +0200 | [diff] [blame] | 120 | static void iwm_disconnect_work(struct work_struct *work) |
| 121 | { |
| 122 | struct iwm_priv *iwm = |
| 123 | container_of(work, struct iwm_priv, disconnect.work); |
| 124 | |
| 125 | if (iwm->umac_profile_active) |
| 126 | iwm_invalidate_mlme_profile(iwm); |
| 127 | |
| 128 | clear_bit(IWM_STATUS_ASSOCIATED, &iwm->status); |
| 129 | iwm->umac_profile_active = 0; |
| 130 | memset(iwm->bssid, 0, ETH_ALEN); |
| 131 | iwm->channel = 0; |
| 132 | |
| 133 | iwm_link_off(iwm); |
| 134 | |
| 135 | wake_up_interruptible(&iwm->mlme_queue); |
| 136 | |
| 137 | cfg80211_disconnected(iwm_to_ndev(iwm), 0, NULL, 0, GFP_KERNEL); |
| 138 | } |
| 139 | |
Samuel Ortiz | e85498b21 | 2009-10-16 13:18:48 +0800 | [diff] [blame] | 140 | static void iwm_ct_kill_work(struct work_struct *work) |
| 141 | { |
| 142 | struct iwm_priv *iwm = |
| 143 | container_of(work, struct iwm_priv, ct_kill_delay.work); |
| 144 | struct wiphy *wiphy = iwm_to_wiphy(iwm); |
| 145 | |
| 146 | IWM_INFO(iwm, "CT kill delay timeout\n"); |
| 147 | |
| 148 | wiphy_rfkill_set_hw_state(wiphy, false); |
| 149 | } |
| 150 | |
Zhu Yi | 31452420 | 2009-09-01 15:14:03 +0200 | [diff] [blame] | 151 | static int __iwm_up(struct iwm_priv *iwm); |
| 152 | static int __iwm_down(struct iwm_priv *iwm); |
Zhu Yi | 68810c5 | 2009-06-15 21:59:49 +0200 | [diff] [blame] | 153 | |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 154 | static void iwm_reset_worker(struct work_struct *work) |
| 155 | { |
| 156 | struct iwm_priv *iwm; |
| 157 | struct iwm_umac_profile *profile = NULL; |
| 158 | int uninitialized_var(ret), retry = 0; |
| 159 | |
| 160 | iwm = container_of(work, struct iwm_priv, reset_worker); |
| 161 | |
Zhu Yi | 68810c5 | 2009-06-15 21:59:49 +0200 | [diff] [blame] | 162 | /* |
| 163 | * XXX: The iwm->mutex is introduced purely for this reset work, |
| 164 | * because the other users for iwm_up and iwm_down are only netdev |
| 165 | * ndo_open and ndo_stop which are already protected by rtnl. |
| 166 | * Please remove iwm->mutex together if iwm_reset_worker() is not |
| 167 | * required in the future. |
| 168 | */ |
| 169 | if (!mutex_trylock(&iwm->mutex)) { |
| 170 | IWM_WARN(iwm, "We are in the middle of interface bringing " |
| 171 | "UP/DOWN. Skip driver resetting.\n"); |
| 172 | return; |
| 173 | } |
| 174 | |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 175 | if (iwm->umac_profile_active) { |
| 176 | profile = kmalloc(sizeof(struct iwm_umac_profile), GFP_KERNEL); |
| 177 | if (profile) |
| 178 | memcpy(profile, iwm->umac_profile, sizeof(*profile)); |
| 179 | else |
| 180 | IWM_ERR(iwm, "Couldn't alloc memory for profile\n"); |
| 181 | } |
| 182 | |
Zhu Yi | 68810c5 | 2009-06-15 21:59:49 +0200 | [diff] [blame] | 183 | __iwm_down(iwm); |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 184 | |
| 185 | while (retry++ < 3) { |
Zhu Yi | 68810c5 | 2009-06-15 21:59:49 +0200 | [diff] [blame] | 186 | ret = __iwm_up(iwm); |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 187 | if (!ret) |
| 188 | break; |
| 189 | |
| 190 | schedule_timeout_uninterruptible(10 * HZ); |
| 191 | } |
| 192 | |
| 193 | if (ret) { |
| 194 | IWM_WARN(iwm, "iwm_up() failed: %d\n", ret); |
| 195 | |
| 196 | kfree(profile); |
Zhu Yi | 68810c5 | 2009-06-15 21:59:49 +0200 | [diff] [blame] | 197 | goto out; |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 198 | } |
| 199 | |
| 200 | if (profile) { |
| 201 | IWM_DBG_MLME(iwm, DBG, "Resend UMAC profile\n"); |
| 202 | memcpy(iwm->umac_profile, profile, sizeof(*profile)); |
| 203 | iwm_send_mlme_profile(iwm); |
| 204 | kfree(profile); |
Samuel Ortiz | d210176 | 2009-09-01 15:14:05 +0200 | [diff] [blame] | 205 | } else |
| 206 | clear_bit(IWM_STATUS_RESETTING, &iwm->status); |
Zhu Yi | 68810c5 | 2009-06-15 21:59:49 +0200 | [diff] [blame] | 207 | |
| 208 | out: |
| 209 | mutex_unlock(&iwm->mutex); |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 210 | } |
| 211 | |
Samuel Ortiz | 9829e1b | 2009-10-16 13:18:57 +0800 | [diff] [blame] | 212 | static void iwm_auth_retry_worker(struct work_struct *work) |
| 213 | { |
| 214 | struct iwm_priv *iwm; |
| 215 | int i, ret; |
| 216 | |
| 217 | iwm = container_of(work, struct iwm_priv, auth_retry_worker); |
| 218 | if (iwm->umac_profile_active) { |
| 219 | ret = iwm_invalidate_mlme_profile(iwm); |
| 220 | if (ret < 0) |
| 221 | return; |
| 222 | } |
| 223 | |
| 224 | iwm->umac_profile->sec.auth_type = UMAC_AUTH_TYPE_LEGACY_PSK; |
| 225 | |
| 226 | ret = iwm_send_mlme_profile(iwm); |
| 227 | if (ret < 0) |
| 228 | return; |
| 229 | |
| 230 | for (i = 0; i < IWM_NUM_KEYS; i++) |
| 231 | if (iwm->keys[i].key_len) |
| 232 | iwm_set_key(iwm, 0, &iwm->keys[i]); |
| 233 | |
| 234 | iwm_set_tx_key(iwm, iwm->default_key); |
| 235 | } |
| 236 | |
| 237 | |
| 238 | |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 239 | static void iwm_watchdog(unsigned long data) |
| 240 | { |
| 241 | struct iwm_priv *iwm = (struct iwm_priv *)data; |
| 242 | |
| 243 | IWM_WARN(iwm, "Watchdog expired: UMAC stalls!\n"); |
| 244 | |
| 245 | if (modparam_reset) |
Samuel Ortiz | d210176 | 2009-09-01 15:14:05 +0200 | [diff] [blame] | 246 | iwm_resetting(iwm); |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 247 | } |
| 248 | |
| 249 | int iwm_priv_init(struct iwm_priv *iwm) |
| 250 | { |
Samuel Ortiz | a7af530 | 2009-11-24 11:33:31 +0800 | [diff] [blame^] | 251 | int i, j; |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 252 | char name[32]; |
| 253 | |
| 254 | iwm->status = 0; |
| 255 | INIT_LIST_HEAD(&iwm->pending_notif); |
| 256 | init_waitqueue_head(&iwm->notif_queue); |
| 257 | init_waitqueue_head(&iwm->nonwifi_queue); |
Samuel Ortiz | a70742f | 2009-06-15 21:59:51 +0200 | [diff] [blame] | 258 | init_waitqueue_head(&iwm->wifi_ntfy_queue); |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 259 | init_waitqueue_head(&iwm->mlme_queue); |
| 260 | memcpy(&iwm->conf, &def_iwm_conf, sizeof(struct iwm_conf)); |
| 261 | spin_lock_init(&iwm->tx_credit.lock); |
| 262 | INIT_LIST_HEAD(&iwm->wifi_pending_cmd); |
| 263 | INIT_LIST_HEAD(&iwm->nonwifi_pending_cmd); |
| 264 | iwm->wifi_seq_num = UMAC_WIFI_SEQ_NUM_BASE; |
| 265 | iwm->nonwifi_seq_num = UMAC_NONWIFI_SEQ_NUM_BASE; |
| 266 | spin_lock_init(&iwm->cmd_lock); |
| 267 | iwm->scan_id = 1; |
| 268 | INIT_DELAYED_WORK(&iwm->stats_request, iwm_statistics_request); |
Zhu Yi | c743627 | 2009-09-01 15:14:02 +0200 | [diff] [blame] | 269 | INIT_DELAYED_WORK(&iwm->disconnect, iwm_disconnect_work); |
Samuel Ortiz | e85498b21 | 2009-10-16 13:18:48 +0800 | [diff] [blame] | 270 | INIT_DELAYED_WORK(&iwm->ct_kill_delay, iwm_ct_kill_work); |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 271 | INIT_WORK(&iwm->reset_worker, iwm_reset_worker); |
Samuel Ortiz | 9829e1b | 2009-10-16 13:18:57 +0800 | [diff] [blame] | 272 | INIT_WORK(&iwm->auth_retry_worker, iwm_auth_retry_worker); |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 273 | INIT_LIST_HEAD(&iwm->bss_list); |
| 274 | |
| 275 | skb_queue_head_init(&iwm->rx_list); |
| 276 | INIT_LIST_HEAD(&iwm->rx_tickets); |
| 277 | for (i = 0; i < IWM_RX_ID_HASH; i++) |
| 278 | INIT_LIST_HEAD(&iwm->rx_packets[i]); |
| 279 | |
| 280 | INIT_WORK(&iwm->rx_worker, iwm_rx_worker); |
| 281 | |
| 282 | iwm->rx_wq = create_singlethread_workqueue(KBUILD_MODNAME "_rx"); |
| 283 | if (!iwm->rx_wq) |
| 284 | return -EAGAIN; |
| 285 | |
| 286 | for (i = 0; i < IWM_TX_QUEUES; i++) { |
| 287 | INIT_WORK(&iwm->txq[i].worker, iwm_tx_worker); |
| 288 | snprintf(name, 32, KBUILD_MODNAME "_tx_%d", i); |
| 289 | iwm->txq[i].id = i; |
| 290 | iwm->txq[i].wq = create_singlethread_workqueue(name); |
| 291 | if (!iwm->txq[i].wq) |
| 292 | return -EAGAIN; |
| 293 | |
| 294 | skb_queue_head_init(&iwm->txq[i].queue); |
Samuel Ortiz | a7af530 | 2009-11-24 11:33:31 +0800 | [diff] [blame^] | 295 | skb_queue_head_init(&iwm->txq[i].stopped_queue); |
| 296 | spin_lock_init(&iwm->txq[i].lock); |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | for (i = 0; i < IWM_NUM_KEYS; i++) |
| 300 | memset(&iwm->keys[i], 0, sizeof(struct iwm_key)); |
| 301 | |
Samuel Ortiz | 13e0fe70 | 2009-06-15 21:59:52 +0200 | [diff] [blame] | 302 | iwm->default_key = -1; |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 303 | |
Samuel Ortiz | a7af530 | 2009-11-24 11:33:31 +0800 | [diff] [blame^] | 304 | for (i = 0; i < IWM_STA_TABLE_NUM; i++) |
| 305 | for (j = 0; j < IWM_UMAC_TID_NR; j++) { |
| 306 | mutex_init(&iwm->sta_table[i].tid_info[j].mutex); |
| 307 | iwm->sta_table[i].tid_info[j].stopped = false; |
| 308 | } |
| 309 | |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 310 | init_timer(&iwm->watchdog); |
| 311 | iwm->watchdog.function = iwm_watchdog; |
| 312 | iwm->watchdog.data = (unsigned long)iwm; |
Zhu Yi | 68810c5 | 2009-06-15 21:59:49 +0200 | [diff] [blame] | 313 | mutex_init(&iwm->mutex); |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 314 | |
Samuel Ortiz | 04e715c | 2009-09-01 15:14:06 +0200 | [diff] [blame] | 315 | iwm->last_fw_err = kzalloc(sizeof(struct iwm_fw_error_hdr), |
| 316 | GFP_KERNEL); |
| 317 | if (iwm->last_fw_err == NULL) |
| 318 | return -ENOMEM; |
| 319 | |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 320 | return 0; |
| 321 | } |
| 322 | |
Zhu Yi | 8d96e79 | 2009-06-15 21:36:13 +0200 | [diff] [blame] | 323 | void iwm_priv_deinit(struct iwm_priv *iwm) |
| 324 | { |
| 325 | int i; |
| 326 | |
| 327 | for (i = 0; i < IWM_TX_QUEUES; i++) |
| 328 | destroy_workqueue(iwm->txq[i].wq); |
| 329 | |
| 330 | destroy_workqueue(iwm->rx_wq); |
Samuel Ortiz | 04e715c | 2009-09-01 15:14:06 +0200 | [diff] [blame] | 331 | kfree(iwm->last_fw_err); |
Zhu Yi | 8d96e79 | 2009-06-15 21:36:13 +0200 | [diff] [blame] | 332 | } |
| 333 | |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 334 | /* |
| 335 | * We reset all the structures, and we reset the UMAC. |
| 336 | * After calling this routine, you're expected to reload |
| 337 | * the firmware. |
| 338 | */ |
| 339 | void iwm_reset(struct iwm_priv *iwm) |
| 340 | { |
| 341 | struct iwm_notif *notif, *next; |
| 342 | |
| 343 | if (test_bit(IWM_STATUS_READY, &iwm->status)) |
| 344 | iwm_target_reset(iwm); |
| 345 | |
Samuel Ortiz | d210176 | 2009-09-01 15:14:05 +0200 | [diff] [blame] | 346 | if (test_bit(IWM_STATUS_RESETTING, &iwm->status)) { |
| 347 | iwm->status = 0; |
| 348 | set_bit(IWM_STATUS_RESETTING, &iwm->status); |
| 349 | } else |
| 350 | iwm->status = 0; |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 351 | iwm->scan_id = 1; |
| 352 | |
| 353 | list_for_each_entry_safe(notif, next, &iwm->pending_notif, pending) { |
| 354 | list_del(¬if->pending); |
| 355 | kfree(notif->buf); |
| 356 | kfree(notif); |
| 357 | } |
| 358 | |
| 359 | iwm_cmd_flush(iwm); |
| 360 | |
| 361 | flush_workqueue(iwm->rx_wq); |
| 362 | |
| 363 | iwm_link_off(iwm); |
| 364 | } |
| 365 | |
Samuel Ortiz | d210176 | 2009-09-01 15:14:05 +0200 | [diff] [blame] | 366 | void iwm_resetting(struct iwm_priv *iwm) |
| 367 | { |
| 368 | set_bit(IWM_STATUS_RESETTING, &iwm->status); |
| 369 | |
| 370 | schedule_work(&iwm->reset_worker); |
| 371 | } |
| 372 | |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 373 | /* |
| 374 | * Notification code: |
| 375 | * |
| 376 | * We're faced with the following issue: Any host command can |
| 377 | * have an answer or not, and if there's an answer to expect, |
| 378 | * it can be treated synchronously or asynchronously. |
| 379 | * To work around the synchronous answer case, we implemented |
| 380 | * our notification mechanism. |
| 381 | * When a code path needs to wait for a command response |
| 382 | * synchronously, it calls notif_handle(), which waits for the |
| 383 | * right notification to show up, and then process it. Before |
| 384 | * starting to wait, it registered as a waiter for this specific |
| 385 | * answer (by toggling a bit in on of the handler_map), so that |
| 386 | * the rx code knows that it needs to send a notification to the |
| 387 | * waiting processes. It does so by calling iwm_notif_send(), |
| 388 | * which adds the notification to the pending notifications list, |
| 389 | * and then wakes the waiting processes up. |
| 390 | */ |
| 391 | int iwm_notif_send(struct iwm_priv *iwm, struct iwm_wifi_cmd *cmd, |
| 392 | u8 cmd_id, u8 source, u8 *buf, unsigned long buf_size) |
| 393 | { |
| 394 | struct iwm_notif *notif; |
| 395 | |
| 396 | notif = kzalloc(sizeof(struct iwm_notif), GFP_KERNEL); |
| 397 | if (!notif) { |
| 398 | IWM_ERR(iwm, "Couldn't alloc memory for notification\n"); |
| 399 | return -ENOMEM; |
| 400 | } |
| 401 | |
| 402 | INIT_LIST_HEAD(¬if->pending); |
| 403 | notif->cmd = cmd; |
| 404 | notif->cmd_id = cmd_id; |
| 405 | notif->src = source; |
| 406 | notif->buf = kzalloc(buf_size, GFP_KERNEL); |
| 407 | if (!notif->buf) { |
| 408 | IWM_ERR(iwm, "Couldn't alloc notification buffer\n"); |
| 409 | kfree(notif); |
| 410 | return -ENOMEM; |
| 411 | } |
| 412 | notif->buf_size = buf_size; |
| 413 | memcpy(notif->buf, buf, buf_size); |
| 414 | list_add_tail(¬if->pending, &iwm->pending_notif); |
| 415 | |
| 416 | wake_up_interruptible(&iwm->notif_queue); |
| 417 | |
| 418 | return 0; |
| 419 | } |
| 420 | |
| 421 | static struct iwm_notif *iwm_notif_find(struct iwm_priv *iwm, u32 cmd, |
| 422 | u8 source) |
| 423 | { |
| 424 | struct iwm_notif *notif, *next; |
| 425 | |
| 426 | list_for_each_entry_safe(notif, next, &iwm->pending_notif, pending) { |
| 427 | if ((notif->cmd_id == cmd) && (notif->src == source)) { |
| 428 | list_del(¬if->pending); |
| 429 | return notif; |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | return NULL; |
| 434 | } |
| 435 | |
| 436 | static struct iwm_notif *iwm_notif_wait(struct iwm_priv *iwm, u32 cmd, |
| 437 | u8 source, long timeout) |
| 438 | { |
| 439 | int ret; |
| 440 | struct iwm_notif *notif; |
| 441 | unsigned long *map = NULL; |
| 442 | |
| 443 | switch (source) { |
| 444 | case IWM_SRC_LMAC: |
| 445 | map = &iwm->lmac_handler_map[0]; |
| 446 | break; |
| 447 | case IWM_SRC_UMAC: |
| 448 | map = &iwm->umac_handler_map[0]; |
| 449 | break; |
| 450 | case IWM_SRC_UDMA: |
| 451 | map = &iwm->udma_handler_map[0]; |
| 452 | break; |
| 453 | } |
| 454 | |
| 455 | set_bit(cmd, map); |
| 456 | |
| 457 | ret = wait_event_interruptible_timeout(iwm->notif_queue, |
| 458 | ((notif = iwm_notif_find(iwm, cmd, source)) != NULL), |
| 459 | timeout); |
| 460 | clear_bit(cmd, map); |
| 461 | |
| 462 | if (!ret) |
| 463 | return NULL; |
| 464 | |
| 465 | return notif; |
| 466 | } |
| 467 | |
| 468 | int iwm_notif_handle(struct iwm_priv *iwm, u32 cmd, u8 source, long timeout) |
| 469 | { |
| 470 | int ret; |
| 471 | struct iwm_notif *notif; |
| 472 | |
| 473 | notif = iwm_notif_wait(iwm, cmd, source, timeout); |
| 474 | if (!notif) |
| 475 | return -ETIME; |
| 476 | |
| 477 | ret = iwm_rx_handle_resp(iwm, notif->buf, notif->buf_size, notif->cmd); |
| 478 | kfree(notif->buf); |
| 479 | kfree(notif); |
| 480 | |
| 481 | return ret; |
| 482 | } |
| 483 | |
| 484 | static int iwm_config_boot_params(struct iwm_priv *iwm) |
| 485 | { |
| 486 | struct iwm_udma_nonwifi_cmd target_cmd; |
| 487 | int ret; |
| 488 | |
| 489 | /* check Wimax is off and config debug monitor */ |
| 490 | if (iwm->conf.wimax_not_present) { |
| 491 | u32 data1 = 0x1f; |
| 492 | u32 addr1 = 0x606BE258; |
| 493 | |
| 494 | u32 data2_set = 0x0; |
| 495 | u32 data2_clr = 0x1; |
| 496 | u32 addr2 = 0x606BE100; |
| 497 | |
| 498 | u32 data3 = 0x1; |
| 499 | u32 addr3 = 0x606BEC00; |
| 500 | |
| 501 | target_cmd.resp = 0; |
| 502 | target_cmd.handle_by_hw = 0; |
| 503 | target_cmd.eop = 1; |
| 504 | |
| 505 | target_cmd.opcode = UMAC_HDI_OUT_OPCODE_WRITE; |
| 506 | target_cmd.addr = cpu_to_le32(addr1); |
| 507 | target_cmd.op1_sz = cpu_to_le32(sizeof(u32)); |
| 508 | target_cmd.op2 = 0; |
| 509 | |
| 510 | ret = iwm_hal_send_target_cmd(iwm, &target_cmd, &data1); |
| 511 | if (ret < 0) { |
| 512 | IWM_ERR(iwm, "iwm_hal_send_target_cmd failed\n"); |
| 513 | return ret; |
| 514 | } |
| 515 | |
| 516 | target_cmd.opcode = UMAC_HDI_OUT_OPCODE_READ_MODIFY_WRITE; |
| 517 | target_cmd.addr = cpu_to_le32(addr2); |
| 518 | target_cmd.op1_sz = cpu_to_le32(data2_set); |
| 519 | target_cmd.op2 = cpu_to_le32(data2_clr); |
| 520 | |
| 521 | ret = iwm_hal_send_target_cmd(iwm, &target_cmd, &data1); |
| 522 | if (ret < 0) { |
| 523 | IWM_ERR(iwm, "iwm_hal_send_target_cmd failed\n"); |
| 524 | return ret; |
| 525 | } |
| 526 | |
| 527 | target_cmd.opcode = UMAC_HDI_OUT_OPCODE_WRITE; |
| 528 | target_cmd.addr = cpu_to_le32(addr3); |
| 529 | target_cmd.op1_sz = cpu_to_le32(sizeof(u32)); |
| 530 | target_cmd.op2 = 0; |
| 531 | |
| 532 | ret = iwm_hal_send_target_cmd(iwm, &target_cmd, &data3); |
| 533 | if (ret < 0) { |
| 534 | IWM_ERR(iwm, "iwm_hal_send_target_cmd failed\n"); |
| 535 | return ret; |
| 536 | } |
| 537 | } |
| 538 | |
| 539 | return 0; |
| 540 | } |
| 541 | |
| 542 | void iwm_init_default_profile(struct iwm_priv *iwm, |
| 543 | struct iwm_umac_profile *profile) |
| 544 | { |
| 545 | memset(profile, 0, sizeof(struct iwm_umac_profile)); |
| 546 | |
| 547 | profile->sec.auth_type = UMAC_AUTH_TYPE_OPEN; |
| 548 | profile->sec.flags = UMAC_SEC_FLG_LEGACY_PROFILE; |
| 549 | profile->sec.ucast_cipher = UMAC_CIPHER_TYPE_NONE; |
| 550 | profile->sec.mcast_cipher = UMAC_CIPHER_TYPE_NONE; |
| 551 | |
| 552 | if (iwm->conf.enable_qos) |
| 553 | profile->flags |= cpu_to_le16(UMAC_PROFILE_QOS_ALLOWED); |
| 554 | |
| 555 | profile->wireless_mode = iwm->conf.wireless_mode; |
| 556 | profile->mode = cpu_to_le32(iwm->conf.mode); |
| 557 | |
| 558 | profile->ibss.atim = 0; |
| 559 | profile->ibss.beacon_interval = 100; |
| 560 | profile->ibss.join_only = 0; |
| 561 | profile->ibss.band = iwm->conf.ibss_band; |
| 562 | profile->ibss.channel = iwm->conf.ibss_channel; |
| 563 | } |
| 564 | |
| 565 | void iwm_link_on(struct iwm_priv *iwm) |
| 566 | { |
| 567 | netif_carrier_on(iwm_to_ndev(iwm)); |
| 568 | netif_tx_wake_all_queues(iwm_to_ndev(iwm)); |
| 569 | |
| 570 | iwm_send_umac_stats_req(iwm, 0); |
| 571 | } |
| 572 | |
| 573 | void iwm_link_off(struct iwm_priv *iwm) |
| 574 | { |
| 575 | struct iw_statistics *wstats = &iwm->wstats; |
| 576 | int i; |
| 577 | |
| 578 | netif_tx_stop_all_queues(iwm_to_ndev(iwm)); |
| 579 | netif_carrier_off(iwm_to_ndev(iwm)); |
| 580 | |
| 581 | for (i = 0; i < IWM_TX_QUEUES; i++) { |
| 582 | skb_queue_purge(&iwm->txq[i].queue); |
Samuel Ortiz | a7af530 | 2009-11-24 11:33:31 +0800 | [diff] [blame^] | 583 | skb_queue_purge(&iwm->txq[i].stopped_queue); |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 584 | |
| 585 | iwm->txq[i].concat_count = 0; |
| 586 | iwm->txq[i].concat_ptr = iwm->txq[i].concat_buf; |
| 587 | |
| 588 | flush_workqueue(iwm->txq[i].wq); |
| 589 | } |
| 590 | |
| 591 | iwm_rx_free(iwm); |
| 592 | |
Zhu Yi | 68810c5 | 2009-06-15 21:59:49 +0200 | [diff] [blame] | 593 | cancel_delayed_work_sync(&iwm->stats_request); |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 594 | memset(wstats, 0, sizeof(struct iw_statistics)); |
| 595 | wstats->qual.updated = IW_QUAL_ALL_INVALID; |
| 596 | |
Zhu Yi | b68518f | 2009-07-20 11:47:45 +0800 | [diff] [blame] | 597 | kfree(iwm->req_ie); |
| 598 | iwm->req_ie = NULL; |
| 599 | iwm->req_ie_len = 0; |
| 600 | kfree(iwm->resp_ie); |
| 601 | iwm->resp_ie = NULL; |
| 602 | iwm->resp_ie_len = 0; |
| 603 | |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 604 | del_timer_sync(&iwm->watchdog); |
| 605 | } |
| 606 | |
| 607 | static void iwm_bss_list_clean(struct iwm_priv *iwm) |
| 608 | { |
| 609 | struct iwm_bss_info *bss, *next; |
| 610 | |
| 611 | list_for_each_entry_safe(bss, next, &iwm->bss_list, node) { |
| 612 | list_del(&bss->node); |
| 613 | kfree(bss->bss); |
| 614 | kfree(bss); |
| 615 | } |
| 616 | } |
| 617 | |
| 618 | static int iwm_channels_init(struct iwm_priv *iwm) |
| 619 | { |
| 620 | int ret; |
| 621 | |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 622 | ret = iwm_send_umac_channel_list(iwm); |
| 623 | if (ret) { |
| 624 | IWM_ERR(iwm, "Send channel list failed\n"); |
| 625 | return ret; |
| 626 | } |
| 627 | |
| 628 | ret = iwm_notif_handle(iwm, UMAC_CMD_OPCODE_GET_CHAN_INFO_LIST, |
| 629 | IWM_SRC_UMAC, WAIT_NOTIF_TIMEOUT); |
| 630 | if (ret) { |
| 631 | IWM_ERR(iwm, "Didn't get a channel list notification\n"); |
| 632 | return ret; |
| 633 | } |
| 634 | |
| 635 | return 0; |
| 636 | } |
| 637 | |
Zhu Yi | 31452420 | 2009-09-01 15:14:03 +0200 | [diff] [blame] | 638 | static int __iwm_up(struct iwm_priv *iwm) |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 639 | { |
| 640 | int ret; |
| 641 | struct iwm_notif *notif_reboot, *notif_ack = NULL; |
Samuel Ortiz | 5dc5316 | 2009-10-16 13:18:59 +0800 | [diff] [blame] | 642 | struct wiphy *wiphy = iwm_to_wiphy(iwm); |
Samuel Ortiz | 0bed08d | 2009-11-24 11:33:29 +0800 | [diff] [blame] | 643 | u32 wireless_mode; |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 644 | |
| 645 | ret = iwm_bus_enable(iwm); |
| 646 | if (ret) { |
| 647 | IWM_ERR(iwm, "Couldn't enable function\n"); |
| 648 | return ret; |
| 649 | } |
| 650 | |
| 651 | iwm_rx_setup_handlers(iwm); |
| 652 | |
| 653 | /* Wait for initial BARKER_REBOOT from hardware */ |
| 654 | notif_reboot = iwm_notif_wait(iwm, IWM_BARKER_REBOOT_NOTIFICATION, |
| 655 | IWM_SRC_UDMA, 2 * HZ); |
| 656 | if (!notif_reboot) { |
| 657 | IWM_ERR(iwm, "Wait for REBOOT_BARKER timeout\n"); |
| 658 | goto err_disable; |
| 659 | } |
| 660 | |
| 661 | /* We send the barker back */ |
| 662 | ret = iwm_bus_send_chunk(iwm, notif_reboot->buf, 16); |
| 663 | if (ret) { |
| 664 | IWM_ERR(iwm, "REBOOT barker response failed\n"); |
| 665 | kfree(notif_reboot); |
| 666 | goto err_disable; |
| 667 | } |
| 668 | |
| 669 | kfree(notif_reboot->buf); |
| 670 | kfree(notif_reboot); |
| 671 | |
| 672 | /* Wait for ACK_BARKER from hardware */ |
| 673 | notif_ack = iwm_notif_wait(iwm, IWM_ACK_BARKER_NOTIFICATION, |
| 674 | IWM_SRC_UDMA, 2 * HZ); |
| 675 | if (!notif_ack) { |
| 676 | IWM_ERR(iwm, "Wait for ACK_BARKER timeout\n"); |
| 677 | goto err_disable; |
| 678 | } |
| 679 | |
| 680 | kfree(notif_ack->buf); |
| 681 | kfree(notif_ack); |
| 682 | |
| 683 | /* We start to config static boot parameters */ |
| 684 | ret = iwm_config_boot_params(iwm); |
| 685 | if (ret) { |
| 686 | IWM_ERR(iwm, "Config boot parameters failed\n"); |
| 687 | goto err_disable; |
| 688 | } |
| 689 | |
| 690 | ret = iwm_read_mac(iwm, iwm_to_ndev(iwm)->dev_addr); |
| 691 | if (ret) { |
| 692 | IWM_ERR(iwm, "MAC reading failed\n"); |
| 693 | goto err_disable; |
| 694 | } |
John W. Linville | 5b36737 | 2009-10-06 16:41:21 -0400 | [diff] [blame] | 695 | memcpy(iwm_to_ndev(iwm)->perm_addr, iwm_to_ndev(iwm)->dev_addr, |
| 696 | ETH_ALEN); |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 697 | |
| 698 | /* We can load the FWs */ |
| 699 | ret = iwm_load_fw(iwm); |
| 700 | if (ret) { |
| 701 | IWM_ERR(iwm, "FW loading failed\n"); |
| 702 | goto err_disable; |
| 703 | } |
| 704 | |
Samuel Ortiz | 902b666 | 2009-11-24 11:33:27 +0800 | [diff] [blame] | 705 | ret = iwm_eeprom_fat_channels(iwm); |
| 706 | if (ret) { |
| 707 | IWM_ERR(iwm, "Couldnt read HT channels EEPROM entries\n"); |
| 708 | goto err_fw; |
| 709 | } |
| 710 | |
Samuel Ortiz | 0bed08d | 2009-11-24 11:33:29 +0800 | [diff] [blame] | 711 | /* |
| 712 | * Read our SKU capabilities. |
Zhu Yi | 2351178 | 2009-11-24 11:33:30 +0800 | [diff] [blame] | 713 | * If it's valid, we AND the configured wireless mode with the |
| 714 | * device EEPROM value as the current profile wireless mode. |
Samuel Ortiz | 0bed08d | 2009-11-24 11:33:29 +0800 | [diff] [blame] | 715 | */ |
| 716 | wireless_mode = iwm_eeprom_wireless_mode(iwm); |
| 717 | if (wireless_mode) { |
Zhu Yi | 2351178 | 2009-11-24 11:33:30 +0800 | [diff] [blame] | 718 | iwm->conf.wireless_mode &= wireless_mode; |
Samuel Ortiz | 0bed08d | 2009-11-24 11:33:29 +0800 | [diff] [blame] | 719 | if (iwm->umac_profile) |
| 720 | iwm->umac_profile->wireless_mode = |
| 721 | iwm->conf.wireless_mode; |
| 722 | } else |
| 723 | IWM_ERR(iwm, "Wrong SKU capabilities: 0x%x\n", |
| 724 | *((u16 *)iwm_eeprom_access(iwm, IWM_EEPROM_SKU_CAP))); |
| 725 | |
Samuel Ortiz | 5dc5316 | 2009-10-16 13:18:59 +0800 | [diff] [blame] | 726 | snprintf(wiphy->fw_version, sizeof(wiphy->fw_version), "L%s_U%s", |
| 727 | iwm->lmac_version, iwm->umac_version); |
| 728 | |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 729 | /* We configure the UMAC and enable the wifi module */ |
| 730 | ret = iwm_send_umac_config(iwm, |
| 731 | cpu_to_le32(UMAC_RST_CTRL_FLG_WIFI_CORE_EN) | |
| 732 | cpu_to_le32(UMAC_RST_CTRL_FLG_WIFI_LINK_EN) | |
| 733 | cpu_to_le32(UMAC_RST_CTRL_FLG_WIFI_MLME_EN)); |
| 734 | if (ret) { |
| 735 | IWM_ERR(iwm, "UMAC config failed\n"); |
| 736 | goto err_fw; |
| 737 | } |
| 738 | |
| 739 | ret = iwm_notif_handle(iwm, UMAC_NOTIFY_OPCODE_WIFI_CORE_STATUS, |
| 740 | IWM_SRC_UMAC, WAIT_NOTIF_TIMEOUT); |
| 741 | if (ret) { |
| 742 | IWM_ERR(iwm, "Didn't get a wifi core status notification\n"); |
| 743 | goto err_fw; |
| 744 | } |
| 745 | |
| 746 | if (iwm->core_enabled != (UMAC_NTFY_WIFI_CORE_STATUS_LINK_EN | |
| 747 | UMAC_NTFY_WIFI_CORE_STATUS_MLME_EN)) { |
| 748 | IWM_DBG_BOOT(iwm, DBG, "Not all cores enabled:0x%x\n", |
| 749 | iwm->core_enabled); |
| 750 | ret = iwm_notif_handle(iwm, UMAC_NOTIFY_OPCODE_WIFI_CORE_STATUS, |
| 751 | IWM_SRC_UMAC, WAIT_NOTIF_TIMEOUT); |
| 752 | if (ret) { |
| 753 | IWM_ERR(iwm, "Didn't get a core status notification\n"); |
| 754 | goto err_fw; |
| 755 | } |
| 756 | |
| 757 | if (iwm->core_enabled != (UMAC_NTFY_WIFI_CORE_STATUS_LINK_EN | |
| 758 | UMAC_NTFY_WIFI_CORE_STATUS_MLME_EN)) { |
| 759 | IWM_ERR(iwm, "Not all cores enabled: 0x%x\n", |
| 760 | iwm->core_enabled); |
| 761 | goto err_fw; |
| 762 | } else { |
| 763 | IWM_INFO(iwm, "All cores enabled\n"); |
| 764 | } |
| 765 | } |
| 766 | |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 767 | ret = iwm_channels_init(iwm); |
| 768 | if (ret < 0) { |
| 769 | IWM_ERR(iwm, "Couldn't init channels\n"); |
Samuel Ortiz | 3549716 | 2009-06-15 21:59:54 +0200 | [diff] [blame] | 770 | goto err_fw; |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 771 | } |
| 772 | |
| 773 | /* Set the READY bit to indicate interface is brought up successfully */ |
| 774 | set_bit(IWM_STATUS_READY, &iwm->status); |
| 775 | |
| 776 | return 0; |
| 777 | |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 778 | err_fw: |
| 779 | iwm_eeprom_exit(iwm); |
| 780 | |
| 781 | err_disable: |
| 782 | ret = iwm_bus_disable(iwm); |
| 783 | if (ret < 0) |
| 784 | IWM_ERR(iwm, "Couldn't disable function\n"); |
| 785 | |
| 786 | return -EIO; |
| 787 | } |
| 788 | |
Zhu Yi | 68810c5 | 2009-06-15 21:59:49 +0200 | [diff] [blame] | 789 | int iwm_up(struct iwm_priv *iwm) |
| 790 | { |
| 791 | int ret; |
| 792 | |
| 793 | mutex_lock(&iwm->mutex); |
| 794 | ret = __iwm_up(iwm); |
| 795 | mutex_unlock(&iwm->mutex); |
| 796 | |
| 797 | return ret; |
| 798 | } |
| 799 | |
Zhu Yi | 31452420 | 2009-09-01 15:14:03 +0200 | [diff] [blame] | 800 | static int __iwm_down(struct iwm_priv *iwm) |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 801 | { |
| 802 | int ret; |
| 803 | |
| 804 | /* The interface is already down */ |
| 805 | if (!test_bit(IWM_STATUS_READY, &iwm->status)) |
| 806 | return 0; |
| 807 | |
| 808 | if (iwm->scan_request) { |
| 809 | cfg80211_scan_done(iwm->scan_request, true); |
| 810 | iwm->scan_request = NULL; |
| 811 | } |
| 812 | |
| 813 | clear_bit(IWM_STATUS_READY, &iwm->status); |
| 814 | |
| 815 | iwm_eeprom_exit(iwm); |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 816 | iwm_bss_list_clean(iwm); |
Samuel Ortiz | 3549716 | 2009-06-15 21:59:54 +0200 | [diff] [blame] | 817 | iwm_init_default_profile(iwm, iwm->umac_profile); |
| 818 | iwm->umac_profile_active = false; |
Samuel Ortiz | 13e0fe70 | 2009-06-15 21:59:52 +0200 | [diff] [blame] | 819 | iwm->default_key = -1; |
Zhu Yi | bb9f869 | 2009-05-21 21:20:45 +0800 | [diff] [blame] | 820 | iwm->core_enabled = 0; |
| 821 | |
| 822 | ret = iwm_bus_disable(iwm); |
| 823 | if (ret < 0) { |
| 824 | IWM_ERR(iwm, "Couldn't disable function\n"); |
| 825 | return ret; |
| 826 | } |
| 827 | |
| 828 | return 0; |
| 829 | } |
Zhu Yi | 68810c5 | 2009-06-15 21:59:49 +0200 | [diff] [blame] | 830 | |
| 831 | int iwm_down(struct iwm_priv *iwm) |
| 832 | { |
| 833 | int ret; |
| 834 | |
| 835 | mutex_lock(&iwm->mutex); |
| 836 | ret = __iwm_down(iwm); |
| 837 | mutex_unlock(&iwm->mutex); |
| 838 | |
| 839 | return ret; |
| 840 | } |