ucode.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. /******************************************************************************
  2. *
  3. * GPL LICENSE SUMMARY
  4. *
  5. * Copyright(c) 2008 - 2012 Intel Corporation. All rights reserved.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of version 2 of the GNU General Public License as
  9. * published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  19. * USA
  20. *
  21. * The full GNU General Public License is included in this distribution
  22. * in the file called LICENSE.GPL.
  23. *
  24. * Contact Information:
  25. * Intel Linux Wireless <ilw@linux.intel.com>
  26. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  27. *
  28. *****************************************************************************/
  29. #include <linux/kernel.h>
  30. #include <linux/init.h>
  31. #include "iwl-io.h"
  32. #include "iwl-agn-hw.h"
  33. #include "iwl-trans.h"
  34. #include "iwl-fh.h"
  35. #include "iwl-op-mode.h"
  36. #include "dev.h"
  37. #include "agn.h"
  38. #include "calib.h"
  39. /******************************************************************************
  40. *
  41. * uCode download functions
  42. *
  43. ******************************************************************************/
  44. static inline const struct fw_img *
  45. iwl_get_ucode_image(struct iwl_priv *priv, enum iwl_ucode_type ucode_type)
  46. {
  47. if (ucode_type >= IWL_UCODE_TYPE_MAX)
  48. return NULL;
  49. return &priv->fw->img[ucode_type];
  50. }
  51. /*
  52. * Calibration
  53. */
  54. static int iwl_set_Xtal_calib(struct iwl_priv *priv)
  55. {
  56. struct iwl_calib_xtal_freq_cmd cmd;
  57. __le16 *xtal_calib = priv->nvm_data->xtal_calib;
  58. iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD);
  59. cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]);
  60. cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]);
  61. return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd));
  62. }
  63. static int iwl_set_temperature_offset_calib(struct iwl_priv *priv)
  64. {
  65. struct iwl_calib_temperature_offset_cmd cmd;
  66. memset(&cmd, 0, sizeof(cmd));
  67. iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
  68. cmd.radio_sensor_offset = priv->nvm_data->raw_temperature;
  69. if (!(cmd.radio_sensor_offset))
  70. cmd.radio_sensor_offset = DEFAULT_RADIO_SENSOR_OFFSET;
  71. IWL_DEBUG_CALIB(priv, "Radio sensor offset: %d\n",
  72. le16_to_cpu(cmd.radio_sensor_offset));
  73. return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd));
  74. }
  75. static int iwl_set_temperature_offset_calib_v2(struct iwl_priv *priv)
  76. {
  77. struct iwl_calib_temperature_offset_v2_cmd cmd;
  78. memset(&cmd, 0, sizeof(cmd));
  79. iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
  80. cmd.radio_sensor_offset_high = priv->nvm_data->kelvin_temperature;
  81. cmd.radio_sensor_offset_low = priv->nvm_data->raw_temperature;
  82. if (!cmd.radio_sensor_offset_low) {
  83. IWL_DEBUG_CALIB(priv, "no info in EEPROM, use default\n");
  84. cmd.radio_sensor_offset_low = DEFAULT_RADIO_SENSOR_OFFSET;
  85. cmd.radio_sensor_offset_high = DEFAULT_RADIO_SENSOR_OFFSET;
  86. }
  87. cmd.burntVoltageRef = priv->nvm_data->calib_voltage;
  88. IWL_DEBUG_CALIB(priv, "Radio sensor offset high: %d\n",
  89. le16_to_cpu(cmd.radio_sensor_offset_high));
  90. IWL_DEBUG_CALIB(priv, "Radio sensor offset low: %d\n",
  91. le16_to_cpu(cmd.radio_sensor_offset_low));
  92. IWL_DEBUG_CALIB(priv, "Voltage Ref: %d\n",
  93. le16_to_cpu(cmd.burntVoltageRef));
  94. return iwl_calib_set(priv, (void *)&cmd, sizeof(cmd));
  95. }
  96. static int iwl_send_calib_cfg(struct iwl_priv *priv)
  97. {
  98. struct iwl_calib_cfg_cmd calib_cfg_cmd;
  99. struct iwl_host_cmd cmd = {
  100. .id = CALIBRATION_CFG_CMD,
  101. .len = { sizeof(struct iwl_calib_cfg_cmd), },
  102. .data = { &calib_cfg_cmd, },
  103. };
  104. memset(&calib_cfg_cmd, 0, sizeof(calib_cfg_cmd));
  105. calib_cfg_cmd.ucd_calib_cfg.once.is_enable = IWL_CALIB_INIT_CFG_ALL;
  106. calib_cfg_cmd.ucd_calib_cfg.once.start = IWL_CALIB_INIT_CFG_ALL;
  107. calib_cfg_cmd.ucd_calib_cfg.once.send_res = IWL_CALIB_INIT_CFG_ALL;
  108. calib_cfg_cmd.ucd_calib_cfg.flags =
  109. IWL_CALIB_CFG_FLAG_SEND_COMPLETE_NTFY_MSK;
  110. return iwl_dvm_send_cmd(priv, &cmd);
  111. }
  112. int iwl_init_alive_start(struct iwl_priv *priv)
  113. {
  114. int ret;
  115. if (priv->cfg->bt_params &&
  116. priv->cfg->bt_params->advanced_bt_coexist) {
  117. /*
  118. * Tell uCode we are ready to perform calibration
  119. * need to perform this before any calibration
  120. * no need to close the envlope since we are going
  121. * to load the runtime uCode later.
  122. */
  123. ret = iwl_send_bt_env(priv, IWL_BT_COEX_ENV_OPEN,
  124. BT_COEX_PRIO_TBL_EVT_INIT_CALIB2);
  125. if (ret)
  126. return ret;
  127. }
  128. ret = iwl_send_calib_cfg(priv);
  129. if (ret)
  130. return ret;
  131. /**
  132. * temperature offset calibration is only needed for runtime ucode,
  133. * so prepare the value now.
  134. */
  135. if (priv->cfg->need_temp_offset_calib) {
  136. if (priv->cfg->temp_offset_v2)
  137. return iwl_set_temperature_offset_calib_v2(priv);
  138. else
  139. return iwl_set_temperature_offset_calib(priv);
  140. }
  141. return 0;
  142. }
  143. static int iwl_send_wimax_coex(struct iwl_priv *priv)
  144. {
  145. struct iwl_wimax_coex_cmd coex_cmd;
  146. /* coexistence is disabled */
  147. memset(&coex_cmd, 0, sizeof(coex_cmd));
  148. return iwl_dvm_send_cmd_pdu(priv,
  149. COEX_PRIORITY_TABLE_CMD, CMD_SYNC,
  150. sizeof(coex_cmd), &coex_cmd);
  151. }
  152. static const u8 iwl_bt_prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX] = {
  153. ((BT_COEX_PRIO_TBL_PRIO_BYPASS << IWL_BT_COEX_PRIO_TBL_PRIO_POS) |
  154. (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)),
  155. ((BT_COEX_PRIO_TBL_PRIO_BYPASS << IWL_BT_COEX_PRIO_TBL_PRIO_POS) |
  156. (1 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)),
  157. ((BT_COEX_PRIO_TBL_PRIO_LOW << IWL_BT_COEX_PRIO_TBL_PRIO_POS) |
  158. (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)),
  159. ((BT_COEX_PRIO_TBL_PRIO_LOW << IWL_BT_COEX_PRIO_TBL_PRIO_POS) |
  160. (1 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)),
  161. ((BT_COEX_PRIO_TBL_PRIO_HIGH << IWL_BT_COEX_PRIO_TBL_PRIO_POS) |
  162. (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)),
  163. ((BT_COEX_PRIO_TBL_PRIO_HIGH << IWL_BT_COEX_PRIO_TBL_PRIO_POS) |
  164. (1 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)),
  165. ((BT_COEX_PRIO_TBL_PRIO_BYPASS << IWL_BT_COEX_PRIO_TBL_PRIO_POS) |
  166. (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)),
  167. ((BT_COEX_PRIO_TBL_PRIO_COEX_OFF << IWL_BT_COEX_PRIO_TBL_PRIO_POS) |
  168. (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)),
  169. ((BT_COEX_PRIO_TBL_PRIO_COEX_ON << IWL_BT_COEX_PRIO_TBL_PRIO_POS) |
  170. (0 << IWL_BT_COEX_PRIO_TBL_SHARED_ANTENNA_POS)),
  171. 0, 0, 0, 0, 0, 0, 0
  172. };
  173. void iwl_send_prio_tbl(struct iwl_priv *priv)
  174. {
  175. struct iwl_bt_coex_prio_table_cmd prio_tbl_cmd;
  176. memcpy(prio_tbl_cmd.prio_tbl, iwl_bt_prio_tbl,
  177. sizeof(iwl_bt_prio_tbl));
  178. if (iwl_dvm_send_cmd_pdu(priv,
  179. REPLY_BT_COEX_PRIO_TABLE, CMD_SYNC,
  180. sizeof(prio_tbl_cmd), &prio_tbl_cmd))
  181. IWL_ERR(priv, "failed to send BT prio tbl command\n");
  182. }
  183. int iwl_send_bt_env(struct iwl_priv *priv, u8 action, u8 type)
  184. {
  185. struct iwl_bt_coex_prot_env_cmd env_cmd;
  186. int ret;
  187. env_cmd.action = action;
  188. env_cmd.type = type;
  189. ret = iwl_dvm_send_cmd_pdu(priv,
  190. REPLY_BT_COEX_PROT_ENV, CMD_SYNC,
  191. sizeof(env_cmd), &env_cmd);
  192. if (ret)
  193. IWL_ERR(priv, "failed to send BT env command\n");
  194. return ret;
  195. }
  196. static const u8 iwlagn_default_queue_to_tx_fifo[] = {
  197. IWL_TX_FIFO_VO,
  198. IWL_TX_FIFO_VI,
  199. IWL_TX_FIFO_BE,
  200. IWL_TX_FIFO_BK,
  201. };
  202. static const u8 iwlagn_ipan_queue_to_tx_fifo[] = {
  203. IWL_TX_FIFO_VO,
  204. IWL_TX_FIFO_VI,
  205. IWL_TX_FIFO_BE,
  206. IWL_TX_FIFO_BK,
  207. IWL_TX_FIFO_BK_IPAN,
  208. IWL_TX_FIFO_BE_IPAN,
  209. IWL_TX_FIFO_VI_IPAN,
  210. IWL_TX_FIFO_VO_IPAN,
  211. IWL_TX_FIFO_BE_IPAN,
  212. IWL_TX_FIFO_UNUSED,
  213. IWL_TX_FIFO_AUX,
  214. };
  215. static int iwl_alive_notify(struct iwl_priv *priv)
  216. {
  217. const u8 *queue_to_txf;
  218. u8 n_queues;
  219. int ret;
  220. int i;
  221. iwl_trans_fw_alive(priv->trans, 0);
  222. if (priv->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PAN &&
  223. priv->nvm_data->sku_cap_ipan_enable) {
  224. n_queues = ARRAY_SIZE(iwlagn_ipan_queue_to_tx_fifo);
  225. queue_to_txf = iwlagn_ipan_queue_to_tx_fifo;
  226. } else {
  227. n_queues = ARRAY_SIZE(iwlagn_default_queue_to_tx_fifo);
  228. queue_to_txf = iwlagn_default_queue_to_tx_fifo;
  229. }
  230. for (i = 0; i < n_queues; i++)
  231. if (queue_to_txf[i] != IWL_TX_FIFO_UNUSED)
  232. iwl_trans_ac_txq_enable(priv->trans, i,
  233. queue_to_txf[i]);
  234. priv->passive_no_rx = false;
  235. priv->transport_queue_stop = 0;
  236. ret = iwl_send_wimax_coex(priv);
  237. if (ret)
  238. return ret;
  239. if (!priv->cfg->no_xtal_calib) {
  240. ret = iwl_set_Xtal_calib(priv);
  241. if (ret)
  242. return ret;
  243. }
  244. return iwl_send_calib_results(priv);
  245. }
  246. /**
  247. * iwl_verify_inst_sparse - verify runtime uCode image in card vs. host,
  248. * using sample data 100 bytes apart. If these sample points are good,
  249. * it's a pretty good bet that everything between them is good, too.
  250. */
  251. static int iwl_verify_sec_sparse(struct iwl_priv *priv,
  252. const struct fw_desc *fw_desc)
  253. {
  254. __le32 *image = (__le32 *)fw_desc->data;
  255. u32 len = fw_desc->len;
  256. u32 val;
  257. u32 i;
  258. IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len);
  259. for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) {
  260. /* read data comes through single port, auto-incr addr */
  261. /* NOTE: Use the debugless read so we don't flood kernel log
  262. * if IWL_DL_IO is set */
  263. iwl_write_direct32(priv->trans, HBUS_TARG_MEM_RADDR,
  264. i + fw_desc->offset);
  265. val = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT);
  266. if (val != le32_to_cpu(*image))
  267. return -EIO;
  268. }
  269. return 0;
  270. }
  271. static void iwl_print_mismatch_sec(struct iwl_priv *priv,
  272. const struct fw_desc *fw_desc)
  273. {
  274. __le32 *image = (__le32 *)fw_desc->data;
  275. u32 len = fw_desc->len;
  276. u32 val;
  277. u32 offs;
  278. int errors = 0;
  279. IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len);
  280. iwl_write_direct32(priv->trans, HBUS_TARG_MEM_RADDR,
  281. fw_desc->offset);
  282. for (offs = 0;
  283. offs < len && errors < 20;
  284. offs += sizeof(u32), image++) {
  285. /* read data comes through single port, auto-incr addr */
  286. val = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT);
  287. if (val != le32_to_cpu(*image)) {
  288. IWL_ERR(priv, "uCode INST section at "
  289. "offset 0x%x, is 0x%x, s/b 0x%x\n",
  290. offs, val, le32_to_cpu(*image));
  291. errors++;
  292. }
  293. }
  294. }
  295. /**
  296. * iwl_verify_ucode - determine which instruction image is in SRAM,
  297. * and verify its contents
  298. */
  299. static int iwl_verify_ucode(struct iwl_priv *priv,
  300. enum iwl_ucode_type ucode_type)
  301. {
  302. const struct fw_img *img = iwl_get_ucode_image(priv, ucode_type);
  303. if (!img) {
  304. IWL_ERR(priv, "Invalid ucode requested (%d)\n", ucode_type);
  305. return -EINVAL;
  306. }
  307. if (!iwl_verify_sec_sparse(priv, &img->sec[IWL_UCODE_SECTION_INST])) {
  308. IWL_DEBUG_FW(priv, "uCode is good in inst SRAM\n");
  309. return 0;
  310. }
  311. IWL_ERR(priv, "UCODE IMAGE IN INSTRUCTION SRAM NOT VALID!!\n");
  312. iwl_print_mismatch_sec(priv, &img->sec[IWL_UCODE_SECTION_INST]);
  313. return -EIO;
  314. }
  315. struct iwl_alive_data {
  316. bool valid;
  317. u8 subtype;
  318. };
  319. static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait,
  320. struct iwl_rx_packet *pkt, void *data)
  321. {
  322. struct iwl_priv *priv =
  323. container_of(notif_wait, struct iwl_priv, notif_wait);
  324. struct iwl_alive_data *alive_data = data;
  325. struct iwl_alive_resp *palive;
  326. palive = (void *)pkt->data;
  327. IWL_DEBUG_FW(priv, "Alive ucode status 0x%08X revision "
  328. "0x%01X 0x%01X\n",
  329. palive->is_valid, palive->ver_type,
  330. palive->ver_subtype);
  331. priv->device_pointers.error_event_table =
  332. le32_to_cpu(palive->error_event_table_ptr);
  333. priv->device_pointers.log_event_table =
  334. le32_to_cpu(palive->log_event_table_ptr);
  335. alive_data->subtype = palive->ver_subtype;
  336. alive_data->valid = palive->is_valid == UCODE_VALID_OK;
  337. return true;
  338. }
  339. #define UCODE_ALIVE_TIMEOUT HZ
  340. #define UCODE_CALIB_TIMEOUT (2*HZ)
  341. int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
  342. enum iwl_ucode_type ucode_type)
  343. {
  344. struct iwl_notification_wait alive_wait;
  345. struct iwl_alive_data alive_data;
  346. const struct fw_img *fw;
  347. int ret;
  348. enum iwl_ucode_type old_type;
  349. static const u8 alive_cmd[] = { REPLY_ALIVE };
  350. old_type = priv->cur_ucode;
  351. priv->cur_ucode = ucode_type;
  352. fw = iwl_get_ucode_image(priv, ucode_type);
  353. priv->ucode_loaded = false;
  354. if (!fw)
  355. return -EINVAL;
  356. iwl_init_notification_wait(&priv->notif_wait, &alive_wait,
  357. alive_cmd, ARRAY_SIZE(alive_cmd),
  358. iwl_alive_fn, &alive_data);
  359. ret = iwl_trans_start_fw(priv->trans, fw);
  360. if (ret) {
  361. priv->cur_ucode = old_type;
  362. iwl_remove_notification(&priv->notif_wait, &alive_wait);
  363. return ret;
  364. }
  365. /*
  366. * Some things may run in the background now, but we
  367. * just wait for the ALIVE notification here.
  368. */
  369. ret = iwl_wait_notification(&priv->notif_wait, &alive_wait,
  370. UCODE_ALIVE_TIMEOUT);
  371. if (ret) {
  372. priv->cur_ucode = old_type;
  373. return ret;
  374. }
  375. if (!alive_data.valid) {
  376. IWL_ERR(priv, "Loaded ucode is not valid!\n");
  377. priv->cur_ucode = old_type;
  378. return -EIO;
  379. }
  380. /*
  381. * This step takes a long time (60-80ms!!) and
  382. * WoWLAN image should be loaded quickly, so
  383. * skip it for WoWLAN.
  384. */
  385. if (ucode_type != IWL_UCODE_WOWLAN) {
  386. ret = iwl_verify_ucode(priv, ucode_type);
  387. if (ret) {
  388. priv->cur_ucode = old_type;
  389. return ret;
  390. }
  391. /* delay a bit to give rfkill time to run */
  392. msleep(5);
  393. }
  394. ret = iwl_alive_notify(priv);
  395. if (ret) {
  396. IWL_WARN(priv,
  397. "Could not complete ALIVE transition: %d\n", ret);
  398. priv->cur_ucode = old_type;
  399. return ret;
  400. }
  401. priv->ucode_loaded = true;
  402. return 0;
  403. }
  404. static bool iwlagn_wait_calib(struct iwl_notif_wait_data *notif_wait,
  405. struct iwl_rx_packet *pkt, void *data)
  406. {
  407. struct iwl_priv *priv = data;
  408. struct iwl_calib_hdr *hdr;
  409. int len;
  410. if (pkt->hdr.cmd != CALIBRATION_RES_NOTIFICATION) {
  411. WARN_ON(pkt->hdr.cmd != CALIBRATION_COMPLETE_NOTIFICATION);
  412. return true;
  413. }
  414. hdr = (struct iwl_calib_hdr *)pkt->data;
  415. len = le32_to_cpu(pkt->len_n_flags) & FH_RSCSR_FRAME_SIZE_MSK;
  416. /* reduce the size by the length field itself */
  417. len -= sizeof(__le32);
  418. if (iwl_calib_set(priv, hdr, len))
  419. IWL_ERR(priv, "Failed to record calibration data %d\n",
  420. hdr->op_code);
  421. return false;
  422. }
  423. int iwl_run_init_ucode(struct iwl_priv *priv)
  424. {
  425. struct iwl_notification_wait calib_wait;
  426. static const u8 calib_complete[] = {
  427. CALIBRATION_RES_NOTIFICATION,
  428. CALIBRATION_COMPLETE_NOTIFICATION
  429. };
  430. int ret;
  431. lockdep_assert_held(&priv->mutex);
  432. /* No init ucode required? Curious, but maybe ok */
  433. if (!priv->fw->img[IWL_UCODE_INIT].sec[0].len)
  434. return 0;
  435. if (priv->init_ucode_run)
  436. return 0;
  437. iwl_init_notification_wait(&priv->notif_wait, &calib_wait,
  438. calib_complete, ARRAY_SIZE(calib_complete),
  439. iwlagn_wait_calib, priv);
  440. /* Will also start the device */
  441. ret = iwl_load_ucode_wait_alive(priv, IWL_UCODE_INIT);
  442. if (ret)
  443. goto error;
  444. ret = iwl_init_alive_start(priv);
  445. if (ret)
  446. goto error;
  447. /*
  448. * Some things may run in the background now, but we
  449. * just wait for the calibration complete notification.
  450. */
  451. ret = iwl_wait_notification(&priv->notif_wait, &calib_wait,
  452. UCODE_CALIB_TIMEOUT);
  453. if (!ret)
  454. priv->init_ucode_run = true;
  455. goto out;
  456. error:
  457. iwl_remove_notification(&priv->notif_wait, &calib_wait);
  458. out:
  459. /* Whatever happened, stop the device */
  460. iwl_trans_stop_device(priv->trans);
  461. priv->ucode_loaded = false;
  462. return ret;
  463. }