boot.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. /*
  2. * This file is part of wl1271
  3. *
  4. * Copyright (C) 2008-2010 Nokia Corporation
  5. *
  6. * Contact: Luciano Coelho <luciano.coelho@nokia.com>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * version 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA
  21. *
  22. */
  23. #include <linux/slab.h>
  24. #include "acx.h"
  25. #include "reg.h"
  26. #include "boot.h"
  27. #include "io.h"
  28. #include "event.h"
  29. #include "rx.h"
  30. static struct wl1271_partition_set part_table[PART_TABLE_LEN] = {
  31. [PART_DOWN] = {
  32. .mem = {
  33. .start = 0x00000000,
  34. .size = 0x000177c0
  35. },
  36. .reg = {
  37. .start = REGISTERS_BASE,
  38. .size = 0x00008800
  39. },
  40. .mem2 = {
  41. .start = 0x00000000,
  42. .size = 0x00000000
  43. },
  44. .mem3 = {
  45. .start = 0x00000000,
  46. .size = 0x00000000
  47. },
  48. },
  49. [PART_WORK] = {
  50. .mem = {
  51. .start = 0x00040000,
  52. .size = 0x00014fc0
  53. },
  54. .reg = {
  55. .start = REGISTERS_BASE,
  56. .size = 0x0000a000
  57. },
  58. .mem2 = {
  59. .start = 0x003004f8,
  60. .size = 0x00000004
  61. },
  62. .mem3 = {
  63. .start = 0x00040404,
  64. .size = 0x00000000
  65. },
  66. },
  67. [PART_DRPW] = {
  68. .mem = {
  69. .start = 0x00040000,
  70. .size = 0x00014fc0
  71. },
  72. .reg = {
  73. .start = DRPW_BASE,
  74. .size = 0x00006000
  75. },
  76. .mem2 = {
  77. .start = 0x00000000,
  78. .size = 0x00000000
  79. },
  80. .mem3 = {
  81. .start = 0x00000000,
  82. .size = 0x00000000
  83. }
  84. }
  85. };
  86. static void wl1271_boot_set_ecpu_ctrl(struct wl1271 *wl, u32 flag)
  87. {
  88. u32 cpu_ctrl;
  89. /* 10.5.0 run the firmware (I) */
  90. cpu_ctrl = wl1271_read32(wl, ACX_REG_ECPU_CONTROL);
  91. /* 10.5.1 run the firmware (II) */
  92. cpu_ctrl |= flag;
  93. wl1271_write32(wl, ACX_REG_ECPU_CONTROL, cpu_ctrl);
  94. }
  95. static void wl1271_parse_fw_ver(struct wl1271 *wl)
  96. {
  97. int ret;
  98. ret = sscanf(wl->chip.fw_ver_str + 4, "%u.%u.%u.%u.%u",
  99. &wl->chip.fw_ver[0], &wl->chip.fw_ver[1],
  100. &wl->chip.fw_ver[2], &wl->chip.fw_ver[3],
  101. &wl->chip.fw_ver[4]);
  102. if (ret != 5) {
  103. wl1271_warning("fw version incorrect value");
  104. memset(wl->chip.fw_ver, 0, sizeof(wl->chip.fw_ver));
  105. return;
  106. }
  107. }
  108. static void wl1271_boot_fw_version(struct wl1271 *wl)
  109. {
  110. struct wl1271_static_data static_data;
  111. wl1271_read(wl, wl->cmd_box_addr, &static_data, sizeof(static_data),
  112. false);
  113. strncpy(wl->chip.fw_ver_str, static_data.fw_version,
  114. sizeof(wl->chip.fw_ver_str));
  115. /* make sure the string is NULL-terminated */
  116. wl->chip.fw_ver_str[sizeof(wl->chip.fw_ver_str) - 1] = '\0';
  117. wl1271_parse_fw_ver(wl);
  118. }
  119. static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf,
  120. size_t fw_data_len, u32 dest)
  121. {
  122. struct wl1271_partition_set partition;
  123. int addr, chunk_num, partition_limit;
  124. u8 *p, *chunk;
  125. /* whal_FwCtrl_LoadFwImageSm() */
  126. wl1271_debug(DEBUG_BOOT, "starting firmware upload");
  127. wl1271_debug(DEBUG_BOOT, "fw_data_len %zd chunk_size %d",
  128. fw_data_len, CHUNK_SIZE);
  129. if ((fw_data_len % 4) != 0) {
  130. wl1271_error("firmware length not multiple of four");
  131. return -EIO;
  132. }
  133. chunk = kmalloc(CHUNK_SIZE, GFP_KERNEL);
  134. if (!chunk) {
  135. wl1271_error("allocation for firmware upload chunk failed");
  136. return -ENOMEM;
  137. }
  138. memcpy(&partition, &part_table[PART_DOWN], sizeof(partition));
  139. partition.mem.start = dest;
  140. wl1271_set_partition(wl, &partition);
  141. /* 10.1 set partition limit and chunk num */
  142. chunk_num = 0;
  143. partition_limit = part_table[PART_DOWN].mem.size;
  144. while (chunk_num < fw_data_len / CHUNK_SIZE) {
  145. /* 10.2 update partition, if needed */
  146. addr = dest + (chunk_num + 2) * CHUNK_SIZE;
  147. if (addr > partition_limit) {
  148. addr = dest + chunk_num * CHUNK_SIZE;
  149. partition_limit = chunk_num * CHUNK_SIZE +
  150. part_table[PART_DOWN].mem.size;
  151. partition.mem.start = addr;
  152. wl1271_set_partition(wl, &partition);
  153. }
  154. /* 10.3 upload the chunk */
  155. addr = dest + chunk_num * CHUNK_SIZE;
  156. p = buf + chunk_num * CHUNK_SIZE;
  157. memcpy(chunk, p, CHUNK_SIZE);
  158. wl1271_debug(DEBUG_BOOT, "uploading fw chunk 0x%p to 0x%x",
  159. p, addr);
  160. wl1271_write(wl, addr, chunk, CHUNK_SIZE, false);
  161. chunk_num++;
  162. }
  163. /* 10.4 upload the last chunk */
  164. addr = dest + chunk_num * CHUNK_SIZE;
  165. p = buf + chunk_num * CHUNK_SIZE;
  166. memcpy(chunk, p, fw_data_len % CHUNK_SIZE);
  167. wl1271_debug(DEBUG_BOOT, "uploading fw last chunk (%zd B) 0x%p to 0x%x",
  168. fw_data_len % CHUNK_SIZE, p, addr);
  169. wl1271_write(wl, addr, chunk, fw_data_len % CHUNK_SIZE, false);
  170. kfree(chunk);
  171. return 0;
  172. }
  173. static int wl1271_boot_upload_firmware(struct wl1271 *wl)
  174. {
  175. u32 chunks, addr, len;
  176. int ret = 0;
  177. u8 *fw;
  178. fw = wl->fw;
  179. chunks = be32_to_cpup((__be32 *) fw);
  180. fw += sizeof(u32);
  181. wl1271_debug(DEBUG_BOOT, "firmware chunks to be uploaded: %u", chunks);
  182. while (chunks--) {
  183. addr = be32_to_cpup((__be32 *) fw);
  184. fw += sizeof(u32);
  185. len = be32_to_cpup((__be32 *) fw);
  186. fw += sizeof(u32);
  187. if (len > 300000) {
  188. wl1271_info("firmware chunk too long: %u", len);
  189. return -EINVAL;
  190. }
  191. wl1271_debug(DEBUG_BOOT, "chunk %d addr 0x%x len %u",
  192. chunks, addr, len);
  193. ret = wl1271_boot_upload_firmware_chunk(wl, fw, len, addr);
  194. if (ret != 0)
  195. break;
  196. fw += len;
  197. }
  198. return ret;
  199. }
  200. static int wl1271_boot_upload_nvs(struct wl1271 *wl)
  201. {
  202. size_t nvs_len, burst_len;
  203. int i;
  204. u32 dest_addr, val;
  205. u8 *nvs_ptr, *nvs_aligned;
  206. if (wl->nvs == NULL)
  207. return -ENODEV;
  208. /*
  209. * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band
  210. * configurations) can be removed when those NVS files stop floating
  211. * around.
  212. */
  213. if (wl->nvs_len == sizeof(struct wl1271_nvs_file) ||
  214. wl->nvs_len == WL1271_INI_LEGACY_NVS_FILE_SIZE) {
  215. /* for now 11a is unsupported in AP mode */
  216. if (wl->bss_type != BSS_TYPE_AP_BSS &&
  217. wl->nvs->general_params.dual_mode_select)
  218. wl->enable_11a = true;
  219. }
  220. if (wl->nvs_len != sizeof(struct wl1271_nvs_file) &&
  221. (wl->nvs_len != WL1271_INI_LEGACY_NVS_FILE_SIZE ||
  222. wl->enable_11a)) {
  223. wl1271_error("nvs size is not as expected: %zu != %zu",
  224. wl->nvs_len, sizeof(struct wl1271_nvs_file));
  225. kfree(wl->nvs);
  226. wl->nvs = NULL;
  227. wl->nvs_len = 0;
  228. return -EILSEQ;
  229. }
  230. /* only the first part of the NVS needs to be uploaded */
  231. nvs_len = sizeof(wl->nvs->nvs);
  232. nvs_ptr = (u8 *)wl->nvs->nvs;
  233. /* update current MAC address to NVS */
  234. nvs_ptr[11] = wl->mac_addr[0];
  235. nvs_ptr[10] = wl->mac_addr[1];
  236. nvs_ptr[6] = wl->mac_addr[2];
  237. nvs_ptr[5] = wl->mac_addr[3];
  238. nvs_ptr[4] = wl->mac_addr[4];
  239. nvs_ptr[3] = wl->mac_addr[5];
  240. /*
  241. * Layout before the actual NVS tables:
  242. * 1 byte : burst length.
  243. * 2 bytes: destination address.
  244. * n bytes: data to burst copy.
  245. *
  246. * This is ended by a 0 length, then the NVS tables.
  247. */
  248. /* FIXME: Do we need to check here whether the LSB is 1? */
  249. while (nvs_ptr[0]) {
  250. burst_len = nvs_ptr[0];
  251. dest_addr = (nvs_ptr[1] & 0xfe) | ((u32)(nvs_ptr[2] << 8));
  252. /*
  253. * Due to our new wl1271_translate_reg_addr function,
  254. * we need to add the REGISTER_BASE to the destination
  255. */
  256. dest_addr += REGISTERS_BASE;
  257. /* We move our pointer to the data */
  258. nvs_ptr += 3;
  259. for (i = 0; i < burst_len; i++) {
  260. val = (nvs_ptr[0] | (nvs_ptr[1] << 8)
  261. | (nvs_ptr[2] << 16) | (nvs_ptr[3] << 24));
  262. wl1271_debug(DEBUG_BOOT,
  263. "nvs burst write 0x%x: 0x%x",
  264. dest_addr, val);
  265. wl1271_write32(wl, dest_addr, val);
  266. nvs_ptr += 4;
  267. dest_addr += 4;
  268. }
  269. }
  270. /*
  271. * We've reached the first zero length, the first NVS table
  272. * is located at an aligned offset which is at least 7 bytes further.
  273. */
  274. nvs_ptr = (u8 *)wl->nvs->nvs +
  275. ALIGN(nvs_ptr - (u8 *)wl->nvs->nvs + 7, 4);
  276. nvs_len -= nvs_ptr - (u8 *)wl->nvs->nvs;
  277. /* Now we must set the partition correctly */
  278. wl1271_set_partition(wl, &part_table[PART_WORK]);
  279. /* Copy the NVS tables to a new block to ensure alignment */
  280. nvs_aligned = kmemdup(nvs_ptr, nvs_len, GFP_KERNEL);
  281. if (!nvs_aligned)
  282. return -ENOMEM;
  283. /* And finally we upload the NVS tables */
  284. wl1271_write(wl, CMD_MBOX_ADDRESS, nvs_aligned, nvs_len, false);
  285. kfree(nvs_aligned);
  286. return 0;
  287. }
  288. static void wl1271_boot_enable_interrupts(struct wl1271 *wl)
  289. {
  290. wl1271_enable_interrupts(wl);
  291. wl1271_write32(wl, ACX_REG_INTERRUPT_MASK,
  292. WL1271_ACX_INTR_ALL & ~(WL1271_INTR_MASK));
  293. wl1271_write32(wl, HI_CFG, HI_CFG_DEF_VAL);
  294. }
  295. static int wl1271_boot_soft_reset(struct wl1271 *wl)
  296. {
  297. unsigned long timeout;
  298. u32 boot_data;
  299. /* perform soft reset */
  300. wl1271_write32(wl, ACX_REG_SLV_SOFT_RESET, ACX_SLV_SOFT_RESET_BIT);
  301. /* SOFT_RESET is self clearing */
  302. timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME);
  303. while (1) {
  304. boot_data = wl1271_read32(wl, ACX_REG_SLV_SOFT_RESET);
  305. wl1271_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data);
  306. if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0)
  307. break;
  308. if (time_after(jiffies, timeout)) {
  309. /* 1.2 check pWhalBus->uSelfClearTime if the
  310. * timeout was reached */
  311. wl1271_error("soft reset timeout");
  312. return -1;
  313. }
  314. udelay(SOFT_RESET_STALL_TIME);
  315. }
  316. /* disable Rx/Tx */
  317. wl1271_write32(wl, ENABLE, 0x0);
  318. /* disable auto calibration on start*/
  319. wl1271_write32(wl, SPARE_A2, 0xffff);
  320. return 0;
  321. }
  322. static int wl1271_boot_run_firmware(struct wl1271 *wl)
  323. {
  324. int loop, ret;
  325. u32 chip_id, intr;
  326. wl1271_boot_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT);
  327. chip_id = wl1271_read32(wl, CHIP_ID_B);
  328. wl1271_debug(DEBUG_BOOT, "chip id after firmware boot: 0x%x", chip_id);
  329. if (chip_id != wl->chip.id) {
  330. wl1271_error("chip id doesn't match after firmware boot");
  331. return -EIO;
  332. }
  333. /* wait for init to complete */
  334. loop = 0;
  335. while (loop++ < INIT_LOOP) {
  336. udelay(INIT_LOOP_DELAY);
  337. intr = wl1271_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR);
  338. if (intr == 0xffffffff) {
  339. wl1271_error("error reading hardware complete "
  340. "init indication");
  341. return -EIO;
  342. }
  343. /* check that ACX_INTR_INIT_COMPLETE is enabled */
  344. else if (intr & WL1271_ACX_INTR_INIT_COMPLETE) {
  345. wl1271_write32(wl, ACX_REG_INTERRUPT_ACK,
  346. WL1271_ACX_INTR_INIT_COMPLETE);
  347. break;
  348. }
  349. }
  350. if (loop > INIT_LOOP) {
  351. wl1271_error("timeout waiting for the hardware to "
  352. "complete initialization");
  353. return -EIO;
  354. }
  355. /* get hardware config command mail box */
  356. wl->cmd_box_addr = wl1271_read32(wl, REG_COMMAND_MAILBOX_PTR);
  357. /* get hardware config event mail box */
  358. wl->event_box_addr = wl1271_read32(wl, REG_EVENT_MAILBOX_PTR);
  359. /* set the working partition to its "running" mode offset */
  360. wl1271_set_partition(wl, &part_table[PART_WORK]);
  361. wl1271_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x event_box_addr 0x%x",
  362. wl->cmd_box_addr, wl->event_box_addr);
  363. wl1271_boot_fw_version(wl);
  364. /*
  365. * in case of full asynchronous mode the firmware event must be
  366. * ready to receive event from the command mailbox
  367. */
  368. /* unmask required mbox events */
  369. wl->event_mask = BSS_LOSE_EVENT_ID |
  370. SCAN_COMPLETE_EVENT_ID |
  371. PS_REPORT_EVENT_ID |
  372. JOIN_EVENT_COMPLETE_ID |
  373. DISCONNECT_EVENT_COMPLETE_ID |
  374. RSSI_SNR_TRIGGER_0_EVENT_ID |
  375. PSPOLL_DELIVERY_FAILURE_EVENT_ID |
  376. SOFT_GEMINI_SENSE_EVENT_ID;
  377. if (wl->bss_type == BSS_TYPE_AP_BSS)
  378. wl->event_mask |= STA_REMOVE_COMPLETE_EVENT_ID;
  379. ret = wl1271_event_unmask(wl);
  380. if (ret < 0) {
  381. wl1271_error("EVENT mask setting failed");
  382. return ret;
  383. }
  384. wl1271_event_mbox_config(wl);
  385. /* firmware startup completed */
  386. return 0;
  387. }
  388. static int wl1271_boot_write_irq_polarity(struct wl1271 *wl)
  389. {
  390. u32 polarity;
  391. polarity = wl1271_top_reg_read(wl, OCP_REG_POLARITY);
  392. /* We use HIGH polarity, so unset the LOW bit */
  393. polarity &= ~POLARITY_LOW;
  394. wl1271_top_reg_write(wl, OCP_REG_POLARITY, polarity);
  395. return 0;
  396. }
  397. static void wl1271_boot_hw_version(struct wl1271 *wl)
  398. {
  399. u32 fuse;
  400. fuse = wl1271_top_reg_read(wl, REG_FUSE_DATA_2_1);
  401. fuse = (fuse & PG_VER_MASK) >> PG_VER_OFFSET;
  402. wl->hw_pg_ver = (s8)fuse;
  403. if (((wl->hw_pg_ver & PG_MAJOR_VER_MASK) >> PG_MAJOR_VER_OFFSET) < 3)
  404. wl->quirks |= WL12XX_QUIRK_END_OF_TRANSACTION;
  405. }
  406. /* uploads NVS and firmware */
  407. int wl1271_load_firmware(struct wl1271 *wl)
  408. {
  409. int ret = 0;
  410. u32 tmp, clk, pause;
  411. wl1271_boot_hw_version(wl);
  412. if (wl->ref_clock == 0 || wl->ref_clock == 2 || wl->ref_clock == 4)
  413. /* ref clk: 19.2/38.4/38.4-XTAL */
  414. clk = 0x3;
  415. else if (wl->ref_clock == 1 || wl->ref_clock == 3)
  416. /* ref clk: 26/52 */
  417. clk = 0x5;
  418. else
  419. return -EINVAL;
  420. if (wl->ref_clock != 0) {
  421. u16 val;
  422. /* Set clock type (open drain) */
  423. val = wl1271_top_reg_read(wl, OCP_REG_CLK_TYPE);
  424. val &= FREF_CLK_TYPE_BITS;
  425. wl1271_top_reg_write(wl, OCP_REG_CLK_TYPE, val);
  426. /* Set clock pull mode (no pull) */
  427. val = wl1271_top_reg_read(wl, OCP_REG_CLK_PULL);
  428. val |= NO_PULL;
  429. wl1271_top_reg_write(wl, OCP_REG_CLK_PULL, val);
  430. } else {
  431. u16 val;
  432. /* Set clock polarity */
  433. val = wl1271_top_reg_read(wl, OCP_REG_CLK_POLARITY);
  434. val &= FREF_CLK_POLARITY_BITS;
  435. val |= CLK_REQ_OUTN_SEL;
  436. wl1271_top_reg_write(wl, OCP_REG_CLK_POLARITY, val);
  437. }
  438. wl1271_write32(wl, PLL_PARAMETERS, clk);
  439. pause = wl1271_read32(wl, PLL_PARAMETERS);
  440. wl1271_debug(DEBUG_BOOT, "pause1 0x%x", pause);
  441. pause &= ~(WU_COUNTER_PAUSE_VAL);
  442. pause |= WU_COUNTER_PAUSE_VAL;
  443. wl1271_write32(wl, WU_COUNTER_PAUSE, pause);
  444. /* Continue the ELP wake up sequence */
  445. wl1271_write32(wl, WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL);
  446. udelay(500);
  447. wl1271_set_partition(wl, &part_table[PART_DRPW]);
  448. /* Read-modify-write DRPW_SCRATCH_START register (see next state)
  449. to be used by DRPw FW. The RTRIM value will be added by the FW
  450. before taking DRPw out of reset */
  451. wl1271_debug(DEBUG_BOOT, "DRPW_SCRATCH_START %08x", DRPW_SCRATCH_START);
  452. clk = wl1271_read32(wl, DRPW_SCRATCH_START);
  453. wl1271_debug(DEBUG_BOOT, "clk2 0x%x", clk);
  454. clk |= (wl->ref_clock << 1) << 4;
  455. wl1271_write32(wl, DRPW_SCRATCH_START, clk);
  456. wl1271_set_partition(wl, &part_table[PART_WORK]);
  457. /* Disable interrupts */
  458. wl1271_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL);
  459. ret = wl1271_boot_soft_reset(wl);
  460. if (ret < 0)
  461. goto out;
  462. /* 2. start processing NVS file */
  463. ret = wl1271_boot_upload_nvs(wl);
  464. if (ret < 0)
  465. goto out;
  466. /* write firmware's last address (ie. it's length) to
  467. * ACX_EEPROMLESS_IND_REG */
  468. wl1271_debug(DEBUG_BOOT, "ACX_EEPROMLESS_IND_REG");
  469. wl1271_write32(wl, ACX_EEPROMLESS_IND_REG, ACX_EEPROMLESS_IND_REG);
  470. tmp = wl1271_read32(wl, CHIP_ID_B);
  471. wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp);
  472. /* 6. read the EEPROM parameters */
  473. tmp = wl1271_read32(wl, SCR_PAD2);
  474. ret = wl1271_boot_write_irq_polarity(wl);
  475. if (ret < 0)
  476. goto out;
  477. wl1271_write32(wl, ACX_REG_INTERRUPT_MASK,
  478. WL1271_ACX_ALL_EVENTS_VECTOR);
  479. /* WL1271: The reference driver skips steps 7 to 10 (jumps directly
  480. * to upload_fw) */
  481. ret = wl1271_boot_upload_firmware(wl);
  482. if (ret < 0)
  483. goto out;
  484. out:
  485. return ret;
  486. }
  487. EXPORT_SYMBOL_GPL(wl1271_load_firmware);
  488. int wl1271_boot(struct wl1271 *wl)
  489. {
  490. int ret;
  491. /* upload NVS and firmware */
  492. ret = wl1271_load_firmware(wl);
  493. if (ret)
  494. return ret;
  495. /* 10.5 start firmware */
  496. ret = wl1271_boot_run_firmware(wl);
  497. if (ret < 0)
  498. goto out;
  499. /* Enable firmware interrupts now */
  500. wl1271_boot_enable_interrupts(wl);
  501. /* set the wl1271 default filters */
  502. wl1271_set_default_filters(wl);
  503. wl1271_event_mbox_config(wl);
  504. out:
  505. return ret;
  506. }