22 #include <linux/slab.h>
74 u32 scr_pad6, init_data,
tmp, elp_cmd, ref_freq;
86 { 83, 87381, 0xB, 5, 0xF00, 3},
87 { 61, 141154, 0xB, 5, 0x1450, 2},
88 { 41, 174763, 0xC, 6, 0x2D00, 1},
89 { 40, 0, 0xC, 6, 0x2EE0, 1},
90 { 47, 162280, 0xC, 6, 0x2760, 1}
102 ref_freq = scr_pad6 & 0x000000FF;
117 tmp = ((scr_pad6 & 0x0000FF00) << 4) | 0x00004000;
121 elp_cmd |= 0x00000040;
135 if (init_data > 0x21)
136 tmp = init_data - 0x21;
210 static void wl1251_boot_set_ecpu_ctrl(
struct wl1251 *wl,
u32 flag)
234 wl1251_error(
"chip id doesn't match after firmware boot");
244 if (acx_intr == 0xffffffff) {
252 WL1251_ACX_INTR_INIT_COMPLETE);
259 "complete initialization");
316 static int wl1251_boot_upload_firmware(
struct wl1251 *wl)
318 int addr, chunk_num, partition_limit;
319 size_t fw_data_len,
len;
328 fw_data_len = (wl->
fw[4] << 24) | (wl->
fw[5] << 16) |
329 (wl->
fw[6] << 8) | (wl->
fw[7]);
334 if ((fw_data_len % 4) != 0) {
341 wl1251_error(
"allocation for firmware upload chunk failed");
354 while (chunk_num < fw_data_len /
CHUNK_SIZE) {
358 if (addr > partition_limit) {
361 partition_limit = chunk_num * CHUNK_SIZE +
365 WL1251_PART_DOWN_MEM_SIZE,
401 static int wl1251_boot_upload_nvs(
struct wl1251 *wl)
403 size_t nvs_len, nvs_bytes_written, burst_len;
427 burst_len = nvs_ptr[0];
428 dest_addr = (nvs_ptr[1] & 0xfe) | ((
u32)(nvs_ptr[2] << 8));
433 for (i = 0; i < burst_len; i++) {
434 val = (nvs_ptr[0] | (nvs_ptr[1] << 8)
435 | (nvs_ptr[2] << 16) | (nvs_ptr[3] << 24));
438 "nvs burst write 0x%x: 0x%x",
452 nvs_len -= nvs_ptr - nvs;
453 nvs_len =
ALIGN(nvs_len, 4);
462 nvs_bytes_written = 0;
463 while (nvs_bytes_written < nvs_len) {
464 val = (nvs_ptr[0] | (nvs_ptr[1] << 8)
465 | (nvs_ptr[2] << 16) | (nvs_ptr[3] << 24));
468 "nvs write table 0x%x: 0x%x",
473 nvs_bytes_written += 4;
482 int ret = 0, minor_minor_e2_ver;
499 ret = wl1251_boot_upload_nvs(wl);
512 wl->
boot_attr.radio_type = (tmp & 0x0000FF00) >> 8;
513 wl->
boot_attr.major = (tmp & 0x00FF0000) >> 16;
517 wl->
boot_attr.minor = (tmp & 0x00FF0000) >> 16;
518 minor_minor_e2_ver = (tmp & 0xFF000000) >> 24;
521 "minorE2Ver 0x%x minor_minor_e2_ver 0x%x",
523 wl->
boot_attr.minor, minor_minor_e2_ver);
543 ret = wl1251_boot_upload_firmware(wl);