1 /******************************************************************************
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
25 * The full GNU General Public License is included in this distribution
26 * in the file called COPYING.
28 * Contact Information:
29 * Intel Linux Wireless <ilw@linux.intel.com>
30 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
34 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
35 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
36 * All rights reserved.
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
42 * * Redistributions of source code must retain the above copyright
43 * notice, this list of conditions and the following disclaimer.
44 * * Redistributions in binary form must reproduce the above copyright
45 * notice, this list of conditions and the following disclaimer in
46 * the documentation and/or other materials provided with the
48 * * Neither the name Intel Corporation nor the names of its
49 * contributors may be used to endorse or promote products derived
50 * from this software without specific prior written permission.
52 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
53 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
54 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
55 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
56 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
57 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
58 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
59 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
60 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
62 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64 *****************************************************************************/
65 #include <net/mac80211.h>
67 #include "iwl-trans.h"
68 #include "iwl-op-mode.h"
70 #include "iwl-debug.h"
71 #include "iwl-csr.h" /* for iwl_mvm_rx_card_state_notif */
72 #include "iwl-io.h" /* for iwl_mvm_rx_card_state_notif */
74 #include "iwl-eeprom-parse.h"
77 #include "iwl-phy-db.h"
79 #define MVM_UCODE_ALIVE_TIMEOUT HZ
80 #define MVM_UCODE_CALIB_TIMEOUT (2*HZ)
82 #define UCODE_VALID_OK cpu_to_le32(0x1)
84 struct iwl_mvm_alive_data
{
89 static inline const struct fw_img
*
90 iwl_get_ucode_image(struct iwl_mvm
*mvm
, enum iwl_ucode_type ucode_type
)
92 if (ucode_type
>= IWL_UCODE_TYPE_MAX
)
95 return &mvm
->fw
->img
[ucode_type
];
98 static int iwl_send_tx_ant_cfg(struct iwl_mvm
*mvm
, u8 valid_tx_ant
)
100 struct iwl_tx_ant_cfg_cmd tx_ant_cmd
= {
101 .valid
= cpu_to_le32(valid_tx_ant
),
104 IWL_DEBUG_FW(mvm
, "select valid tx ant: %u\n", valid_tx_ant
);
105 return iwl_mvm_send_cmd_pdu(mvm
, TX_ANT_CONFIGURATION_CMD
, 0,
106 sizeof(tx_ant_cmd
), &tx_ant_cmd
);
109 static bool iwl_alive_fn(struct iwl_notif_wait_data
*notif_wait
,
110 struct iwl_rx_packet
*pkt
, void *data
)
112 struct iwl_mvm
*mvm
=
113 container_of(notif_wait
, struct iwl_mvm
, notif_wait
);
114 struct iwl_mvm_alive_data
*alive_data
= data
;
115 struct mvm_alive_resp
*palive
;
116 struct mvm_alive_resp_ver2
*palive2
;
118 if (iwl_rx_packet_payload_len(pkt
) == sizeof(*palive
)) {
119 palive
= (void *)pkt
->data
;
121 mvm
->support_umac_log
= false;
122 mvm
->error_event_table
=
123 le32_to_cpu(palive
->error_event_table_ptr
);
124 mvm
->log_event_table
= le32_to_cpu(palive
->log_event_table_ptr
);
125 alive_data
->scd_base_addr
= le32_to_cpu(palive
->scd_base_ptr
);
127 alive_data
->valid
= le16_to_cpu(palive
->status
) ==
130 "Alive VER1 ucode status 0x%04x revision 0x%01X 0x%01X flags 0x%01X\n",
131 le16_to_cpu(palive
->status
), palive
->ver_type
,
132 palive
->ver_subtype
, palive
->flags
);
134 palive2
= (void *)pkt
->data
;
136 mvm
->error_event_table
=
137 le32_to_cpu(palive2
->error_event_table_ptr
);
138 mvm
->log_event_table
=
139 le32_to_cpu(palive2
->log_event_table_ptr
);
140 alive_data
->scd_base_addr
= le32_to_cpu(palive2
->scd_base_ptr
);
141 mvm
->umac_error_event_table
=
142 le32_to_cpu(palive2
->error_info_addr
);
143 mvm
->sf_space
.addr
= le32_to_cpu(palive2
->st_fwrd_addr
);
144 mvm
->sf_space
.size
= le32_to_cpu(palive2
->st_fwrd_size
);
146 alive_data
->valid
= le16_to_cpu(palive2
->status
) ==
148 if (mvm
->umac_error_event_table
)
149 mvm
->support_umac_log
= true;
152 "Alive VER2 ucode status 0x%04x revision 0x%01X 0x%01X flags 0x%01X\n",
153 le16_to_cpu(palive2
->status
), palive2
->ver_type
,
154 palive2
->ver_subtype
, palive2
->flags
);
157 "UMAC version: Major - 0x%x, Minor - 0x%x\n",
158 palive2
->umac_major
, palive2
->umac_minor
);
164 static bool iwl_wait_phy_db_entry(struct iwl_notif_wait_data
*notif_wait
,
165 struct iwl_rx_packet
*pkt
, void *data
)
167 struct iwl_phy_db
*phy_db
= data
;
169 if (pkt
->hdr
.cmd
!= CALIB_RES_NOTIF_PHY_DB
) {
170 WARN_ON(pkt
->hdr
.cmd
!= INIT_COMPLETE_NOTIF
);
174 WARN_ON(iwl_phy_db_set_section(phy_db
, pkt
, GFP_ATOMIC
));
179 static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm
*mvm
,
180 enum iwl_ucode_type ucode_type
)
182 struct iwl_notification_wait alive_wait
;
183 struct iwl_mvm_alive_data alive_data
;
184 const struct fw_img
*fw
;
186 enum iwl_ucode_type old_type
= mvm
->cur_ucode
;
187 static const u8 alive_cmd
[] = { MVM_ALIVE
};
188 struct iwl_sf_region st_fwrd_space
;
190 if (ucode_type
== IWL_UCODE_REGULAR
&&
191 iwl_fw_dbg_conf_usniffer(mvm
->fw
, FW_DBG_CUSTOM
) &&
192 iwl_fw_dbg_conf_enabled(mvm
->fw
, FW_DBG_CUSTOM
))
193 fw
= iwl_get_ucode_image(mvm
, IWL_UCODE_REGULAR_USNIFFER
);
195 fw
= iwl_get_ucode_image(mvm
, ucode_type
);
198 mvm
->cur_ucode
= ucode_type
;
199 mvm
->ucode_loaded
= false;
201 iwl_init_notification_wait(&mvm
->notif_wait
, &alive_wait
,
202 alive_cmd
, ARRAY_SIZE(alive_cmd
),
203 iwl_alive_fn
, &alive_data
);
205 ret
= iwl_trans_start_fw(mvm
->trans
, fw
, ucode_type
== IWL_UCODE_INIT
);
207 mvm
->cur_ucode
= old_type
;
208 iwl_remove_notification(&mvm
->notif_wait
, &alive_wait
);
213 * Some things may run in the background now, but we
214 * just wait for the ALIVE notification here.
216 ret
= iwl_wait_notification(&mvm
->notif_wait
, &alive_wait
,
217 MVM_UCODE_ALIVE_TIMEOUT
);
219 mvm
->cur_ucode
= old_type
;
223 if (!alive_data
.valid
) {
224 IWL_ERR(mvm
, "Loaded ucode is not valid!\n");
225 mvm
->cur_ucode
= old_type
;
230 * update the sdio allocation according to the pointer we get in the
231 * alive notification.
233 st_fwrd_space
.addr
= mvm
->sf_space
.addr
;
234 st_fwrd_space
.size
= mvm
->sf_space
.size
;
235 ret
= iwl_trans_update_sf(mvm
->trans
, &st_fwrd_space
);
237 IWL_ERR(mvm
, "Failed to update SF size. ret %d\n", ret
);
241 iwl_trans_fw_alive(mvm
->trans
, alive_data
.scd_base_addr
);
244 * Note: all the queues are enabled as part of the interface
245 * initialization, but in firmware restart scenarios they
246 * could be stopped, so wake them up. In firmware restart,
247 * mac80211 will have the queues stopped as well until the
248 * reconfiguration completes. During normal startup, they
252 for (i
= 0; i
< IWL_MAX_HW_QUEUES
; i
++) {
253 if (i
< mvm
->first_agg_queue
&& i
!= IWL_MVM_CMD_QUEUE
)
254 mvm
->queue_to_mac80211
[i
] = i
;
256 mvm
->queue_to_mac80211
[i
] = IWL_INVALID_MAC80211_QUEUE
;
259 for (i
= 0; i
< IEEE80211_MAX_QUEUES
; i
++)
260 atomic_set(&mvm
->mac80211_queue_stop_count
[i
], 0);
262 mvm
->ucode_loaded
= true;
267 static int iwl_send_phy_cfg_cmd(struct iwl_mvm
*mvm
)
269 struct iwl_phy_cfg_cmd phy_cfg_cmd
;
270 enum iwl_ucode_type ucode_type
= mvm
->cur_ucode
;
273 phy_cfg_cmd
.phy_cfg
= cpu_to_le32(iwl_mvm_get_phy_config(mvm
));
274 phy_cfg_cmd
.calib_control
.event_trigger
=
275 mvm
->fw
->default_calib
[ucode_type
].event_trigger
;
276 phy_cfg_cmd
.calib_control
.flow_trigger
=
277 mvm
->fw
->default_calib
[ucode_type
].flow_trigger
;
279 IWL_DEBUG_INFO(mvm
, "Sending Phy CFG command: 0x%x\n",
280 phy_cfg_cmd
.phy_cfg
);
282 return iwl_mvm_send_cmd_pdu(mvm
, PHY_CONFIGURATION_CMD
, 0,
283 sizeof(phy_cfg_cmd
), &phy_cfg_cmd
);
286 int iwl_run_init_mvm_ucode(struct iwl_mvm
*mvm
, bool read_nvm
)
288 struct iwl_notification_wait calib_wait
;
289 static const u8 init_complete
[] = {
291 CALIB_RES_NOTIF_PHY_DB
295 lockdep_assert_held(&mvm
->mutex
);
297 if (WARN_ON_ONCE(mvm
->init_ucode_complete
|| mvm
->calibrating
))
300 iwl_init_notification_wait(&mvm
->notif_wait
,
303 ARRAY_SIZE(init_complete
),
304 iwl_wait_phy_db_entry
,
307 /* Will also start the device */
308 ret
= iwl_mvm_load_ucode_wait_alive(mvm
, IWL_UCODE_INIT
);
310 IWL_ERR(mvm
, "Failed to start INIT ucode: %d\n", ret
);
314 ret
= iwl_send_bt_init_conf(mvm
);
318 /* Read the NVM only at driver load time, no need to do this twice */
321 ret
= iwl_nvm_init(mvm
, true);
323 IWL_ERR(mvm
, "Failed to read NVM: %d\n", ret
);
328 /* In case we read the NVM from external file, load it to the NIC */
329 if (mvm
->nvm_file_name
)
330 iwl_mvm_load_nvm_to_nic(mvm
);
332 ret
= iwl_nvm_check_version(mvm
->nvm_data
, mvm
->trans
);
336 * abort after reading the nvm in case RF Kill is on, we will complete
337 * the init seq later when RF kill will switch to off
339 if (iwl_mvm_is_radio_killed(mvm
)) {
340 IWL_DEBUG_RF_KILL(mvm
,
341 "jump over all phy activities due to RF kill\n");
342 iwl_remove_notification(&mvm
->notif_wait
, &calib_wait
);
347 mvm
->calibrating
= true;
349 /* Send TX valid antennas before triggering calibrations */
350 ret
= iwl_send_tx_ant_cfg(mvm
, iwl_mvm_get_valid_tx_ant(mvm
));
355 * Send phy configurations command to init uCode
356 * to start the 16.0 uCode init image internal calibrations.
358 ret
= iwl_send_phy_cfg_cmd(mvm
);
360 IWL_ERR(mvm
, "Failed to run INIT calibrations: %d\n",
366 * Some things may run in the background now, but we
367 * just wait for the calibration complete notification.
369 ret
= iwl_wait_notification(&mvm
->notif_wait
, &calib_wait
,
370 MVM_UCODE_CALIB_TIMEOUT
);
372 mvm
->init_ucode_complete
= true;
374 if (ret
&& iwl_mvm_is_radio_killed(mvm
)) {
375 IWL_DEBUG_RF_KILL(mvm
, "RFKILL while calibrating.\n");
381 iwl_remove_notification(&mvm
->notif_wait
, &calib_wait
);
383 mvm
->calibrating
= false;
384 if (iwlmvm_mod_params
.init_dbg
&& !mvm
->nvm_data
) {
385 /* we want to debug INIT and we have no NVM - fake */
386 mvm
->nvm_data
= kzalloc(sizeof(struct iwl_nvm_data
) +
387 sizeof(struct ieee80211_channel
) +
388 sizeof(struct ieee80211_rate
),
392 mvm
->nvm_data
->bands
[0].channels
= mvm
->nvm_data
->channels
;
393 mvm
->nvm_data
->bands
[0].n_channels
= 1;
394 mvm
->nvm_data
->bands
[0].n_bitrates
= 1;
395 mvm
->nvm_data
->bands
[0].bitrates
=
396 (void *)mvm
->nvm_data
->channels
+ 1;
397 mvm
->nvm_data
->bands
[0].bitrates
->hw_value
= 10;
403 static void iwl_mvm_get_shared_mem_conf(struct iwl_mvm
*mvm
)
405 struct iwl_host_cmd cmd
= {
406 .id
= SHARED_MEM_CFG
,
407 .flags
= CMD_WANT_SKB
,
411 struct iwl_rx_packet
*pkt
;
412 struct iwl_shared_mem_cfg
*mem_cfg
;
415 lockdep_assert_held(&mvm
->mutex
);
417 if (WARN_ON(iwl_mvm_send_cmd(mvm
, &cmd
)))
421 if (pkt
->hdr
.flags
& IWL_CMD_FAILED_MSK
) {
422 IWL_ERR(mvm
, "Bad return from SHARED_MEM_CFG (0x%08X)\n",
427 mem_cfg
= (void *)pkt
->data
;
429 mvm
->shared_mem_cfg
.shared_mem_addr
=
430 le32_to_cpu(mem_cfg
->shared_mem_addr
);
431 mvm
->shared_mem_cfg
.shared_mem_size
=
432 le32_to_cpu(mem_cfg
->shared_mem_size
);
433 mvm
->shared_mem_cfg
.sample_buff_addr
=
434 le32_to_cpu(mem_cfg
->sample_buff_addr
);
435 mvm
->shared_mem_cfg
.sample_buff_size
=
436 le32_to_cpu(mem_cfg
->sample_buff_size
);
437 mvm
->shared_mem_cfg
.txfifo_addr
= le32_to_cpu(mem_cfg
->txfifo_addr
);
438 for (i
= 0; i
< ARRAY_SIZE(mvm
->shared_mem_cfg
.txfifo_size
); i
++)
439 mvm
->shared_mem_cfg
.txfifo_size
[i
] =
440 le32_to_cpu(mem_cfg
->txfifo_size
[i
]);
441 for (i
= 0; i
< ARRAY_SIZE(mvm
->shared_mem_cfg
.rxfifo_size
); i
++)
442 mvm
->shared_mem_cfg
.rxfifo_size
[i
] =
443 le32_to_cpu(mem_cfg
->rxfifo_size
[i
]);
444 mvm
->shared_mem_cfg
.page_buff_addr
=
445 le32_to_cpu(mem_cfg
->page_buff_addr
);
446 mvm
->shared_mem_cfg
.page_buff_size
=
447 le32_to_cpu(mem_cfg
->page_buff_size
);
448 IWL_DEBUG_INFO(mvm
, "SHARED MEM CFG: got memory offsets/sizes\n");
454 void iwl_mvm_fw_dbg_collect(struct iwl_mvm
*mvm
)
457 if (mvm
->cfg
->device_family
== IWL_DEVICE_FAMILY_7000
) {
458 iwl_set_bits_prph(mvm
->trans
, MON_BUFF_SAMPLE_CTL
, 0x100);
460 iwl_write_prph(mvm
->trans
, DBGC_IN_SAMPLE
, 0);
461 /* wait before we collect the data till the DBGC stop */
465 schedule_work(&mvm
->fw_error_dump_wk
);
468 int iwl_mvm_start_fw_dbg_conf(struct iwl_mvm
*mvm
, enum iwl_fw_dbg_conf conf_id
)
474 if (WARN_ONCE(conf_id
>= ARRAY_SIZE(mvm
->fw
->dbg_conf_tlv
),
475 "Invalid configuration %d\n", conf_id
))
478 if (!mvm
->fw
->dbg_conf_tlv
[conf_id
])
481 if (mvm
->fw_dbg_conf
!= FW_DBG_INVALID
)
482 IWL_WARN(mvm
, "FW already configured (%d) - re-configuring\n",
485 /* Send all HCMDs for configuring the FW debug */
486 ptr
= (void *)&mvm
->fw
->dbg_conf_tlv
[conf_id
]->hcmd
;
487 for (i
= 0; i
< mvm
->fw
->dbg_conf_tlv
[conf_id
]->num_of_hcmds
; i
++) {
488 struct iwl_fw_dbg_conf_hcmd
*cmd
= (void *)ptr
;
490 ret
= iwl_mvm_send_cmd_pdu(mvm
, cmd
->id
, 0,
491 le16_to_cpu(cmd
->len
), cmd
->data
);
496 ptr
+= le16_to_cpu(cmd
->len
);
499 mvm
->fw_dbg_conf
= conf_id
;
503 static int iwl_mvm_config_ltr_v1(struct iwl_mvm
*mvm
)
505 struct iwl_ltr_config_cmd_v1 cmd_v1
= {
506 .flags
= cpu_to_le32(LTR_CFG_FLAG_FEATURE_ENABLE
),
509 if (!mvm
->trans
->ltr_enabled
)
512 return iwl_mvm_send_cmd_pdu(mvm
, LTR_CONFIG
, 0,
513 sizeof(cmd_v1
), &cmd_v1
);
516 static int iwl_mvm_config_ltr(struct iwl_mvm
*mvm
)
518 struct iwl_ltr_config_cmd cmd
= {
519 .flags
= cpu_to_le32(LTR_CFG_FLAG_FEATURE_ENABLE
),
522 if (!mvm
->trans
->ltr_enabled
)
525 if (!(mvm
->fw
->ucode_capa
.api
[0] & IWL_UCODE_TLV_API_HDC_PHASE_0
))
526 return iwl_mvm_config_ltr_v1(mvm
);
528 return iwl_mvm_send_cmd_pdu(mvm
, LTR_CONFIG
, 0,
532 int iwl_mvm_up(struct iwl_mvm
*mvm
)
535 struct ieee80211_channel
*chan
;
536 struct cfg80211_chan_def chandef
;
538 lockdep_assert_held(&mvm
->mutex
);
540 ret
= iwl_trans_start_hw(mvm
->trans
);
545 * If we haven't completed the run of the init ucode during
546 * module loading, load init ucode now
547 * (for example, if we were in RFKILL)
549 if (!mvm
->init_ucode_complete
) {
550 ret
= iwl_run_init_mvm_ucode(mvm
, false);
551 if (ret
&& !iwlmvm_mod_params
.init_dbg
) {
552 IWL_ERR(mvm
, "Failed to run INIT ucode: %d\n", ret
);
553 /* this can't happen */
554 if (WARN_ON(ret
> 0))
558 if (!iwlmvm_mod_params
.init_dbg
) {
560 * should stop and start HW since that INIT
563 iwl_trans_stop_device(mvm
->trans
);
564 ret
= iwl_trans_start_hw(mvm
->trans
);
570 if (iwlmvm_mod_params
.init_dbg
)
573 ret
= iwl_mvm_load_ucode_wait_alive(mvm
, IWL_UCODE_REGULAR
);
575 IWL_ERR(mvm
, "Failed to start RT ucode: %d\n", ret
);
579 if (IWL_UCODE_API(mvm
->fw
->ucode_ver
) >= 10)
580 iwl_mvm_get_shared_mem_conf(mvm
);
582 ret
= iwl_mvm_sf_update(mvm
, NULL
, false);
584 IWL_ERR(mvm
, "Failed to initialize Smart Fifo\n");
586 mvm
->fw_dbg_conf
= FW_DBG_INVALID
;
587 iwl_mvm_start_fw_dbg_conf(mvm
, FW_DBG_CUSTOM
);
589 ret
= iwl_send_tx_ant_cfg(mvm
, iwl_mvm_get_valid_tx_ant(mvm
));
593 ret
= iwl_send_bt_init_conf(mvm
);
597 /* Send phy db control command and then phy db calibration*/
598 ret
= iwl_send_phy_db_data(mvm
->phy_db
);
602 ret
= iwl_send_phy_cfg_cmd(mvm
);
606 /* init the fw <-> mac80211 STA mapping */
607 for (i
= 0; i
< IWL_MVM_STATION_COUNT
; i
++)
608 RCU_INIT_POINTER(mvm
->fw_id_to_mac_id
[i
], NULL
);
610 mvm
->tdls_cs
.peer
.sta_id
= IWL_MVM_STATION_COUNT
;
612 /* reset quota debouncing buffer - 0xff will yield invalid data */
613 memset(&mvm
->last_quota_cmd
, 0xff, sizeof(mvm
->last_quota_cmd
));
615 /* Add auxiliary station for scanning */
616 ret
= iwl_mvm_add_aux_sta(mvm
);
620 /* Add all the PHY contexts */
621 chan
= &mvm
->hw
->wiphy
->bands
[IEEE80211_BAND_2GHZ
]->channels
[0];
622 cfg80211_chandef_create(&chandef
, chan
, NL80211_CHAN_NO_HT
);
623 for (i
= 0; i
< NUM_PHY_CTX
; i
++) {
625 * The channel used here isn't relevant as it's
626 * going to be overwritten in the other flows.
627 * For now use the first channel we have.
629 ret
= iwl_mvm_phy_ctxt_add(mvm
, &mvm
->phy_ctxts
[i
],
635 /* Initialize tx backoffs to the minimal possible */
636 iwl_mvm_tt_tx_backoff(mvm
, 0);
638 WARN_ON(iwl_mvm_config_ltr(mvm
));
640 ret
= iwl_mvm_power_update_device(mvm
);
644 if (mvm
->fw
->ucode_capa
.capa
[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN
) {
645 ret
= iwl_mvm_config_scan(mvm
);
650 /* allow FW/transport low power modes if not during restart */
651 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART
, &mvm
->status
))
652 iwl_mvm_unref(mvm
, IWL_MVM_REF_UCODE_DOWN
);
654 IWL_DEBUG_INFO(mvm
, "RT uCode started.\n");
657 iwl_trans_stop_device(mvm
->trans
);
661 int iwl_mvm_load_d3_fw(struct iwl_mvm
*mvm
)
665 lockdep_assert_held(&mvm
->mutex
);
667 ret
= iwl_trans_start_hw(mvm
->trans
);
671 ret
= iwl_mvm_load_ucode_wait_alive(mvm
, IWL_UCODE_WOWLAN
);
673 IWL_ERR(mvm
, "Failed to start WoWLAN firmware: %d\n", ret
);
677 ret
= iwl_send_tx_ant_cfg(mvm
, iwl_mvm_get_valid_tx_ant(mvm
));
681 /* Send phy db control command and then phy db calibration*/
682 ret
= iwl_send_phy_db_data(mvm
->phy_db
);
686 ret
= iwl_send_phy_cfg_cmd(mvm
);
690 /* init the fw <-> mac80211 STA mapping */
691 for (i
= 0; i
< IWL_MVM_STATION_COUNT
; i
++)
692 RCU_INIT_POINTER(mvm
->fw_id_to_mac_id
[i
], NULL
);
694 /* Add auxiliary station for scanning */
695 ret
= iwl_mvm_add_aux_sta(mvm
);
701 iwl_trans_stop_device(mvm
->trans
);
705 int iwl_mvm_rx_card_state_notif(struct iwl_mvm
*mvm
,
706 struct iwl_rx_cmd_buffer
*rxb
,
707 struct iwl_device_cmd
*cmd
)
709 struct iwl_rx_packet
*pkt
= rxb_addr(rxb
);
710 struct iwl_card_state_notif
*card_state_notif
= (void *)pkt
->data
;
711 u32 flags
= le32_to_cpu(card_state_notif
->flags
);
713 IWL_DEBUG_RF_KILL(mvm
, "Card state received: HW:%s SW:%s CT:%s\n",
714 (flags
& HW_CARD_DISABLED
) ? "Kill" : "On",
715 (flags
& SW_CARD_DISABLED
) ? "Kill" : "On",
716 (flags
& CT_KILL_CARD_DISABLED
) ?
717 "Reached" : "Not reached");
722 int iwl_mvm_rx_radio_ver(struct iwl_mvm
*mvm
, struct iwl_rx_cmd_buffer
*rxb
,
723 struct iwl_device_cmd
*cmd
)
725 struct iwl_rx_packet
*pkt
= rxb_addr(rxb
);
726 struct iwl_radio_version_notif
*radio_version
= (void *)pkt
->data
;
728 /* TODO: what to do with that? */
730 "Radio version: flavor: 0x%08x, step 0x%08x, dash 0x%08x\n",
731 le32_to_cpu(radio_version
->radio_flavor
),
732 le32_to_cpu(radio_version
->radio_step
),
733 le32_to_cpu(radio_version
->radio_dash
));
737 int iwl_mvm_rx_mfuart_notif(struct iwl_mvm
*mvm
,
738 struct iwl_rx_cmd_buffer
*rxb
,
739 struct iwl_device_cmd
*cmd
)
741 struct iwl_rx_packet
*pkt
= rxb_addr(rxb
);
742 struct iwl_mfuart_load_notif
*mfuart_notif
= (void *)pkt
->data
;
745 "MFUART: installed ver: 0x%08x, external ver: 0x%08x, status: 0x%08x, duration: 0x%08x\n",
746 le32_to_cpu(mfuart_notif
->installed_ver
),
747 le32_to_cpu(mfuart_notif
->external_ver
),
748 le32_to_cpu(mfuart_notif
->status
),
749 le32_to_cpu(mfuart_notif
->duration
));