Lines Matching refs:wl
35 static int wl1271_boot_set_ecpu_ctrl(struct wl1271 *wl, u32 flag) in wl1271_boot_set_ecpu_ctrl() argument
41 ret = wlcore_read_reg(wl, REG_ECPU_CONTROL, &cpu_ctrl); in wl1271_boot_set_ecpu_ctrl()
47 ret = wlcore_write_reg(wl, REG_ECPU_CONTROL, cpu_ctrl); in wl1271_boot_set_ecpu_ctrl()
53 static int wlcore_boot_parse_fw_ver(struct wl1271 *wl, in wlcore_boot_parse_fw_ver() argument
58 strncpy(wl->chip.fw_ver_str, static_data->fw_version, in wlcore_boot_parse_fw_ver()
59 sizeof(wl->chip.fw_ver_str)); in wlcore_boot_parse_fw_ver()
62 wl->chip.fw_ver_str[sizeof(wl->chip.fw_ver_str) - 1] = '\0'; in wlcore_boot_parse_fw_ver()
64 ret = sscanf(wl->chip.fw_ver_str + 4, "%u.%u.%u.%u.%u", in wlcore_boot_parse_fw_ver()
65 &wl->chip.fw_ver[0], &wl->chip.fw_ver[1], in wlcore_boot_parse_fw_ver()
66 &wl->chip.fw_ver[2], &wl->chip.fw_ver[3], in wlcore_boot_parse_fw_ver()
67 &wl->chip.fw_ver[4]); in wlcore_boot_parse_fw_ver()
71 memset(wl->chip.fw_ver, 0, sizeof(wl->chip.fw_ver)); in wlcore_boot_parse_fw_ver()
76 ret = wlcore_identify_fw(wl); in wlcore_boot_parse_fw_ver()
83 static int wlcore_validate_fw_ver(struct wl1271 *wl) in wlcore_validate_fw_ver() argument
85 unsigned int *fw_ver = wl->chip.fw_ver; in wlcore_validate_fw_ver()
86 unsigned int *min_ver = (wl->fw_type == WL12XX_FW_TYPE_MULTI) ? in wlcore_validate_fw_ver()
87 wl->min_mr_fw_ver : wl->min_sr_fw_ver; in wlcore_validate_fw_ver()
140 static int wlcore_boot_static_data(struct wl1271 *wl) in wlcore_boot_static_data() argument
143 size_t len = sizeof(*static_data) + wl->static_data_priv_len; in wlcore_boot_static_data()
152 ret = wlcore_read(wl, wl->cmd_box_addr, static_data, len, false); in wlcore_boot_static_data()
156 ret = wlcore_boot_parse_fw_ver(wl, static_data); in wlcore_boot_static_data()
160 ret = wlcore_validate_fw_ver(wl); in wlcore_boot_static_data()
164 ret = wlcore_handle_static_data(wl, static_data); in wlcore_boot_static_data()
174 static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf, in wl1271_boot_upload_firmware_chunk() argument
200 memcpy(&partition, &wl->ptable[PART_DOWN], sizeof(partition)); in wl1271_boot_upload_firmware_chunk()
202 ret = wlcore_set_partition(wl, &partition); in wl1271_boot_upload_firmware_chunk()
208 partition_limit = wl->ptable[PART_DOWN].mem.size; in wl1271_boot_upload_firmware_chunk()
216 wl->ptable[PART_DOWN].mem.size; in wl1271_boot_upload_firmware_chunk()
218 ret = wlcore_set_partition(wl, &partition); in wl1271_boot_upload_firmware_chunk()
229 ret = wlcore_write(wl, addr, chunk, CHUNK_SIZE, false); in wl1271_boot_upload_firmware_chunk()
242 ret = wlcore_write(wl, addr, chunk, fw_data_len % CHUNK_SIZE, false); in wl1271_boot_upload_firmware_chunk()
249 int wlcore_boot_upload_firmware(struct wl1271 *wl) in wlcore_boot_upload_firmware() argument
255 fw = wl->fw; in wlcore_boot_upload_firmware()
273 ret = wl1271_boot_upload_firmware_chunk(wl, fw, len, addr); in wlcore_boot_upload_firmware()
283 int wlcore_boot_upload_nvs(struct wl1271 *wl) in wlcore_boot_upload_nvs() argument
285 struct platform_device *pdev = wl->pdev; in wlcore_boot_upload_nvs()
294 if (wl->nvs == NULL) { in wlcore_boot_upload_nvs()
302 if (wl->quirks & WLCORE_QUIRK_LEGACY_NVS) { in wlcore_boot_upload_nvs()
304 (struct wl1271_nvs_file *)wl->nvs; in wlcore_boot_upload_nvs()
310 if (wl->nvs_len == sizeof(struct wl1271_nvs_file) || in wlcore_boot_upload_nvs()
311 wl->nvs_len == WL1271_INI_LEGACY_NVS_FILE_SIZE) { in wlcore_boot_upload_nvs()
313 wl->enable_11a = true; in wlcore_boot_upload_nvs()
316 if (wl->nvs_len != sizeof(struct wl1271_nvs_file) && in wlcore_boot_upload_nvs()
317 (wl->nvs_len != WL1271_INI_LEGACY_NVS_FILE_SIZE || in wlcore_boot_upload_nvs()
318 wl->enable_11a)) { in wlcore_boot_upload_nvs()
320 nvs_name, wl->nvs_len, in wlcore_boot_upload_nvs()
322 kfree(wl->nvs); in wlcore_boot_upload_nvs()
323 wl->nvs = NULL; in wlcore_boot_upload_nvs()
324 wl->nvs_len = 0; in wlcore_boot_upload_nvs()
332 struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs; in wlcore_boot_upload_nvs()
334 if (wl->nvs_len == sizeof(struct wl128x_nvs_file)) { in wlcore_boot_upload_nvs()
336 wl->enable_11a = true; in wlcore_boot_upload_nvs()
339 nvs_name, wl->nvs_len, in wlcore_boot_upload_nvs()
341 kfree(wl->nvs); in wlcore_boot_upload_nvs()
342 wl->nvs = NULL; in wlcore_boot_upload_nvs()
343 wl->nvs_len = 0; in wlcore_boot_upload_nvs()
353 nvs_ptr[11] = wl->addresses[0].addr[0]; in wlcore_boot_upload_nvs()
354 nvs_ptr[10] = wl->addresses[0].addr[1]; in wlcore_boot_upload_nvs()
355 nvs_ptr[6] = wl->addresses[0].addr[2]; in wlcore_boot_upload_nvs()
356 nvs_ptr[5] = wl->addresses[0].addr[3]; in wlcore_boot_upload_nvs()
357 nvs_ptr[4] = wl->addresses[0].addr[4]; in wlcore_boot_upload_nvs()
358 nvs_ptr[3] = wl->addresses[0].addr[5]; in wlcore_boot_upload_nvs()
379 dest_addr += wl->curr_part.reg.start; in wlcore_boot_upload_nvs()
385 if (nvs_ptr + 3 >= (u8 *) wl->nvs + nvs_len) in wlcore_boot_upload_nvs()
394 ret = wlcore_write32(wl, dest_addr, val); in wlcore_boot_upload_nvs()
402 if (nvs_ptr >= (u8 *) wl->nvs + nvs_len) in wlcore_boot_upload_nvs()
413 nvs_ptr = (u8 *)wl->nvs + in wlcore_boot_upload_nvs()
414 ALIGN(nvs_ptr - (u8 *)wl->nvs + 7, 4); in wlcore_boot_upload_nvs()
416 if (nvs_ptr >= (u8 *) wl->nvs + nvs_len) in wlcore_boot_upload_nvs()
419 nvs_len -= nvs_ptr - (u8 *)wl->nvs; in wlcore_boot_upload_nvs()
422 ret = wlcore_set_partition(wl, &wl->ptable[PART_WORK]); in wlcore_boot_upload_nvs()
432 ret = wlcore_write_data(wl, REG_CMD_MBOX_ADDRESS, nvs_aligned, nvs_len, in wlcore_boot_upload_nvs()
444 int wlcore_boot_run_firmware(struct wl1271 *wl) in wlcore_boot_run_firmware() argument
450 ret = wlcore_set_partition(wl, &wl->ptable[PART_BOOT]); in wlcore_boot_run_firmware()
454 ret = wl1271_boot_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT); in wlcore_boot_run_firmware()
458 ret = wlcore_read_reg(wl, REG_CHIP_ID_B, &chip_id); in wlcore_boot_run_firmware()
464 if (chip_id != wl->chip.id) { in wlcore_boot_run_firmware()
473 ret = wlcore_read_reg(wl, REG_INTERRUPT_NO_CLEAR, &intr); in wlcore_boot_run_firmware()
484 ret = wlcore_write_reg(wl, REG_INTERRUPT_ACK, in wlcore_boot_run_firmware()
499 ret = wlcore_read_reg(wl, REG_COMMAND_MAILBOX_PTR, &wl->cmd_box_addr); in wlcore_boot_run_firmware()
503 wl1271_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x", wl->cmd_box_addr); in wlcore_boot_run_firmware()
506 ret = wlcore_read_reg(wl, REG_EVENT_MAILBOX_PTR, &wl->mbox_ptr[0]); in wlcore_boot_run_firmware()
510 wl->mbox_ptr[1] = wl->mbox_ptr[0] + wl->mbox_size; in wlcore_boot_run_firmware()
513 wl->mbox_ptr[0], wl->mbox_ptr[1]); in wlcore_boot_run_firmware()
515 ret = wlcore_boot_static_data(wl); in wlcore_boot_run_firmware()
527 ret = wl1271_event_unmask(wl); in wlcore_boot_run_firmware()
534 ret = wlcore_set_partition(wl, &wl->ptable[PART_WORK]); in wlcore_boot_run_firmware()