diff options
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_boot.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_boot.c | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c index b58657750716..a27601dc9c0d 100644 --- a/drivers/net/wireless/wl12xx/wl1271_boot.c +++ b/drivers/net/wireless/wl12xx/wl1271_boot.c | |||
@@ -93,19 +93,19 @@ static void wl1271_boot_set_ecpu_ctrl(struct wl1271 *wl, u32 flag) | |||
93 | u32 cpu_ctrl; | 93 | u32 cpu_ctrl; |
94 | 94 | ||
95 | /* 10.5.0 run the firmware (I) */ | 95 | /* 10.5.0 run the firmware (I) */ |
96 | cpu_ctrl = wl1271_reg_read32(wl, ACX_REG_ECPU_CONTROL); | 96 | cpu_ctrl = wl1271_spi_read32(wl, ACX_REG_ECPU_CONTROL); |
97 | 97 | ||
98 | /* 10.5.1 run the firmware (II) */ | 98 | /* 10.5.1 run the firmware (II) */ |
99 | cpu_ctrl |= flag; | 99 | cpu_ctrl |= flag; |
100 | wl1271_reg_write32(wl, ACX_REG_ECPU_CONTROL, cpu_ctrl); | 100 | wl1271_spi_write32(wl, ACX_REG_ECPU_CONTROL, cpu_ctrl); |
101 | } | 101 | } |
102 | 102 | ||
103 | static void wl1271_boot_fw_version(struct wl1271 *wl) | 103 | static void wl1271_boot_fw_version(struct wl1271 *wl) |
104 | { | 104 | { |
105 | struct wl1271_static_data static_data; | 105 | struct wl1271_static_data static_data; |
106 | 106 | ||
107 | wl1271_spi_mem_read(wl, wl->cmd_box_addr, | 107 | wl1271_spi_read(wl, wl->cmd_box_addr, |
108 | &static_data, sizeof(static_data)); | 108 | &static_data, sizeof(static_data), false); |
109 | 109 | ||
110 | strncpy(wl->chip.fw_ver, static_data.fw_version, | 110 | strncpy(wl->chip.fw_ver, static_data.fw_version, |
111 | sizeof(wl->chip.fw_ver)); | 111 | sizeof(wl->chip.fw_ver)); |
@@ -164,7 +164,7 @@ static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf, | |||
164 | memcpy(chunk, p, CHUNK_SIZE); | 164 | memcpy(chunk, p, CHUNK_SIZE); |
165 | wl1271_debug(DEBUG_BOOT, "uploading fw chunk 0x%p to 0x%x", | 165 | wl1271_debug(DEBUG_BOOT, "uploading fw chunk 0x%p to 0x%x", |
166 | p, addr); | 166 | p, addr); |
167 | wl1271_spi_mem_write(wl, addr, chunk, CHUNK_SIZE); | 167 | wl1271_spi_write(wl, addr, chunk, CHUNK_SIZE, false); |
168 | 168 | ||
169 | chunk_num++; | 169 | chunk_num++; |
170 | } | 170 | } |
@@ -175,7 +175,7 @@ static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf, | |||
175 | memcpy(chunk, p, fw_data_len % CHUNK_SIZE); | 175 | memcpy(chunk, p, fw_data_len % CHUNK_SIZE); |
176 | wl1271_debug(DEBUG_BOOT, "uploading fw last chunk (%zd B) 0x%p to 0x%x", | 176 | wl1271_debug(DEBUG_BOOT, "uploading fw last chunk (%zd B) 0x%p to 0x%x", |
177 | fw_data_len % CHUNK_SIZE, p, addr); | 177 | fw_data_len % CHUNK_SIZE, p, addr); |
178 | wl1271_spi_mem_write(wl, addr, chunk, fw_data_len % CHUNK_SIZE); | 178 | wl1271_spi_write(wl, addr, chunk, fw_data_len % CHUNK_SIZE, false); |
179 | 179 | ||
180 | kfree(chunk); | 180 | kfree(chunk); |
181 | return 0; | 181 | return 0; |
@@ -262,7 +262,7 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl) | |||
262 | wl1271_debug(DEBUG_BOOT, | 262 | wl1271_debug(DEBUG_BOOT, |
263 | "nvs burst write 0x%x: 0x%x", | 263 | "nvs burst write 0x%x: 0x%x", |
264 | dest_addr, val); | 264 | dest_addr, val); |
265 | wl1271_reg_write32(wl, dest_addr, val); | 265 | wl1271_spi_write32(wl, dest_addr, val); |
266 | 266 | ||
267 | nvs_ptr += 4; | 267 | nvs_ptr += 4; |
268 | dest_addr += 4; | 268 | dest_addr += 4; |
@@ -289,7 +289,7 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl) | |||
289 | /* FIXME: In wl1271, we upload everything at once. | 289 | /* FIXME: In wl1271, we upload everything at once. |
290 | No endianness handling needed here?! The ref driver doesn't do | 290 | No endianness handling needed here?! The ref driver doesn't do |
291 | anything about it at this point */ | 291 | anything about it at this point */ |
292 | wl1271_spi_mem_write(wl, CMD_MBOX_ADDRESS, nvs_aligned, nvs_len); | 292 | wl1271_spi_write(wl, CMD_MBOX_ADDRESS, nvs_aligned, nvs_len, false); |
293 | 293 | ||
294 | kfree(nvs_aligned); | 294 | kfree(nvs_aligned); |
295 | return 0; | 295 | return 0; |
@@ -298,9 +298,9 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl) | |||
298 | static void wl1271_boot_enable_interrupts(struct wl1271 *wl) | 298 | static void wl1271_boot_enable_interrupts(struct wl1271 *wl) |
299 | { | 299 | { |
300 | enable_irq(wl->irq); | 300 | enable_irq(wl->irq); |
301 | wl1271_reg_write32(wl, ACX_REG_INTERRUPT_MASK, | 301 | wl1271_spi_write32(wl, ACX_REG_INTERRUPT_MASK, |
302 | WL1271_ACX_INTR_ALL & ~(WL1271_INTR_MASK)); | 302 | WL1271_ACX_INTR_ALL & ~(WL1271_INTR_MASK)); |
303 | wl1271_reg_write32(wl, HI_CFG, HI_CFG_DEF_VAL); | 303 | wl1271_spi_write32(wl, HI_CFG, HI_CFG_DEF_VAL); |
304 | } | 304 | } |
305 | 305 | ||
306 | static int wl1271_boot_soft_reset(struct wl1271 *wl) | 306 | static int wl1271_boot_soft_reset(struct wl1271 *wl) |
@@ -309,12 +309,13 @@ static int wl1271_boot_soft_reset(struct wl1271 *wl) | |||
309 | u32 boot_data; | 309 | u32 boot_data; |
310 | 310 | ||
311 | /* perform soft reset */ | 311 | /* perform soft reset */ |
312 | wl1271_reg_write32(wl, ACX_REG_SLV_SOFT_RESET, ACX_SLV_SOFT_RESET_BIT); | 312 | wl1271_spi_write32(wl, ACX_REG_SLV_SOFT_RESET, |
313 | ACX_SLV_SOFT_RESET_BIT); | ||
313 | 314 | ||
314 | /* SOFT_RESET is self clearing */ | 315 | /* SOFT_RESET is self clearing */ |
315 | timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME); | 316 | timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME); |
316 | while (1) { | 317 | while (1) { |
317 | boot_data = wl1271_reg_read32(wl, ACX_REG_SLV_SOFT_RESET); | 318 | boot_data = wl1271_spi_read32(wl, ACX_REG_SLV_SOFT_RESET); |
318 | wl1271_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data); | 319 | wl1271_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data); |
319 | if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0) | 320 | if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0) |
320 | break; | 321 | break; |
@@ -330,10 +331,10 @@ static int wl1271_boot_soft_reset(struct wl1271 *wl) | |||
330 | } | 331 | } |
331 | 332 | ||
332 | /* disable Rx/Tx */ | 333 | /* disable Rx/Tx */ |
333 | wl1271_reg_write32(wl, ENABLE, 0x0); | 334 | wl1271_spi_write32(wl, ENABLE, 0x0); |
334 | 335 | ||
335 | /* disable auto calibration on start*/ | 336 | /* disable auto calibration on start*/ |
336 | wl1271_reg_write32(wl, SPARE_A2, 0xffff); | 337 | wl1271_spi_write32(wl, SPARE_A2, 0xffff); |
337 | 338 | ||
338 | return 0; | 339 | return 0; |
339 | } | 340 | } |
@@ -345,7 +346,7 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl) | |||
345 | 346 | ||
346 | wl1271_boot_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT); | 347 | wl1271_boot_set_ecpu_ctrl(wl, ECPU_CONTROL_HALT); |
347 | 348 | ||
348 | chip_id = wl1271_reg_read32(wl, CHIP_ID_B); | 349 | chip_id = wl1271_spi_read32(wl, CHIP_ID_B); |
349 | 350 | ||
350 | wl1271_debug(DEBUG_BOOT, "chip id after firmware boot: 0x%x", chip_id); | 351 | wl1271_debug(DEBUG_BOOT, "chip id after firmware boot: 0x%x", chip_id); |
351 | 352 | ||
@@ -358,7 +359,8 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl) | |||
358 | loop = 0; | 359 | loop = 0; |
359 | while (loop++ < INIT_LOOP) { | 360 | while (loop++ < INIT_LOOP) { |
360 | udelay(INIT_LOOP_DELAY); | 361 | udelay(INIT_LOOP_DELAY); |
361 | interrupt = wl1271_reg_read32(wl, ACX_REG_INTERRUPT_NO_CLEAR); | 362 | interrupt = wl1271_spi_read32(wl, |
363 | ACX_REG_INTERRUPT_NO_CLEAR); | ||
362 | 364 | ||
363 | if (interrupt == 0xffffffff) { | 365 | if (interrupt == 0xffffffff) { |
364 | wl1271_error("error reading hardware complete " | 366 | wl1271_error("error reading hardware complete " |
@@ -367,7 +369,7 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl) | |||
367 | } | 369 | } |
368 | /* check that ACX_INTR_INIT_COMPLETE is enabled */ | 370 | /* check that ACX_INTR_INIT_COMPLETE is enabled */ |
369 | else if (interrupt & WL1271_ACX_INTR_INIT_COMPLETE) { | 371 | else if (interrupt & WL1271_ACX_INTR_INIT_COMPLETE) { |
370 | wl1271_reg_write32(wl, ACX_REG_INTERRUPT_ACK, | 372 | wl1271_spi_write32(wl, ACX_REG_INTERRUPT_ACK, |
371 | WL1271_ACX_INTR_INIT_COMPLETE); | 373 | WL1271_ACX_INTR_INIT_COMPLETE); |
372 | break; | 374 | break; |
373 | } | 375 | } |
@@ -380,10 +382,10 @@ static int wl1271_boot_run_firmware(struct wl1271 *wl) | |||
380 | } | 382 | } |
381 | 383 | ||
382 | /* get hardware config command mail box */ | 384 | /* get hardware config command mail box */ |
383 | wl->cmd_box_addr = wl1271_reg_read32(wl, REG_COMMAND_MAILBOX_PTR); | 385 | wl->cmd_box_addr = wl1271_spi_read32(wl, REG_COMMAND_MAILBOX_PTR); |
384 | 386 | ||
385 | /* get hardware config event mail box */ | 387 | /* get hardware config event mail box */ |
386 | wl->event_box_addr = wl1271_reg_read32(wl, REG_EVENT_MAILBOX_PTR); | 388 | wl->event_box_addr = wl1271_spi_read32(wl, REG_EVENT_MAILBOX_PTR); |
387 | 389 | ||
388 | /* set the working partition to its "running" mode offset */ | 390 | /* set the working partition to its "running" mode offset */ |
389 | wl1271_set_partition(wl, &part_table[PART_WORK]); | 391 | wl1271_set_partition(wl, &part_table[PART_WORK]); |
@@ -458,9 +460,9 @@ int wl1271_boot(struct wl1271 *wl) | |||
458 | wl1271_top_reg_write(wl, OCP_REG_CLK_POLARITY, val); | 460 | wl1271_top_reg_write(wl, OCP_REG_CLK_POLARITY, val); |
459 | } | 461 | } |
460 | 462 | ||
461 | wl1271_reg_write32(wl, PLL_PARAMETERS, clk); | 463 | wl1271_spi_write32(wl, PLL_PARAMETERS, clk); |
462 | 464 | ||
463 | pause = wl1271_reg_read32(wl, PLL_PARAMETERS); | 465 | pause = wl1271_spi_read32(wl, PLL_PARAMETERS); |
464 | 466 | ||
465 | wl1271_debug(DEBUG_BOOT, "pause1 0x%x", pause); | 467 | wl1271_debug(DEBUG_BOOT, "pause1 0x%x", pause); |
466 | 468 | ||
@@ -469,10 +471,10 @@ int wl1271_boot(struct wl1271 *wl) | |||
469 | * 0x3ff (magic number ). How does | 471 | * 0x3ff (magic number ). How does |
470 | * this work?! */ | 472 | * this work?! */ |
471 | pause |= WU_COUNTER_PAUSE_VAL; | 473 | pause |= WU_COUNTER_PAUSE_VAL; |
472 | wl1271_reg_write32(wl, WU_COUNTER_PAUSE, pause); | 474 | wl1271_spi_write32(wl, WU_COUNTER_PAUSE, pause); |
473 | 475 | ||
474 | /* Continue the ELP wake up sequence */ | 476 | /* Continue the ELP wake up sequence */ |
475 | wl1271_reg_write32(wl, WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); | 477 | wl1271_spi_write32(wl, WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); |
476 | udelay(500); | 478 | udelay(500); |
477 | 479 | ||
478 | wl1271_set_partition(wl, &part_table[PART_DRPW]); | 480 | wl1271_set_partition(wl, &part_table[PART_DRPW]); |
@@ -482,18 +484,18 @@ int wl1271_boot(struct wl1271 *wl) | |||
482 | before taking DRPw out of reset */ | 484 | before taking DRPw out of reset */ |
483 | 485 | ||
484 | wl1271_debug(DEBUG_BOOT, "DRPW_SCRATCH_START %08x", DRPW_SCRATCH_START); | 486 | wl1271_debug(DEBUG_BOOT, "DRPW_SCRATCH_START %08x", DRPW_SCRATCH_START); |
485 | clk = wl1271_reg_read32(wl, DRPW_SCRATCH_START); | 487 | clk = wl1271_spi_read32(wl, DRPW_SCRATCH_START); |
486 | 488 | ||
487 | wl1271_debug(DEBUG_BOOT, "clk2 0x%x", clk); | 489 | wl1271_debug(DEBUG_BOOT, "clk2 0x%x", clk); |
488 | 490 | ||
489 | /* 2 */ | 491 | /* 2 */ |
490 | clk |= (REF_CLOCK << 1) << 4; | 492 | clk |= (REF_CLOCK << 1) << 4; |
491 | wl1271_reg_write32(wl, DRPW_SCRATCH_START, clk); | 493 | wl1271_spi_write32(wl, DRPW_SCRATCH_START, clk); |
492 | 494 | ||
493 | wl1271_set_partition(wl, &part_table[PART_WORK]); | 495 | wl1271_set_partition(wl, &part_table[PART_WORK]); |
494 | 496 | ||
495 | /* Disable interrupts */ | 497 | /* Disable interrupts */ |
496 | wl1271_reg_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); | 498 | wl1271_spi_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); |
497 | 499 | ||
498 | ret = wl1271_boot_soft_reset(wl); | 500 | ret = wl1271_boot_soft_reset(wl); |
499 | if (ret < 0) | 501 | if (ret < 0) |
@@ -508,21 +510,22 @@ int wl1271_boot(struct wl1271 *wl) | |||
508 | * ACX_EEPROMLESS_IND_REG */ | 510 | * ACX_EEPROMLESS_IND_REG */ |
509 | wl1271_debug(DEBUG_BOOT, "ACX_EEPROMLESS_IND_REG"); | 511 | wl1271_debug(DEBUG_BOOT, "ACX_EEPROMLESS_IND_REG"); |
510 | 512 | ||
511 | wl1271_reg_write32(wl, ACX_EEPROMLESS_IND_REG, ACX_EEPROMLESS_IND_REG); | 513 | wl1271_spi_write32(wl, ACX_EEPROMLESS_IND_REG, |
514 | ACX_EEPROMLESS_IND_REG); | ||
512 | 515 | ||
513 | tmp = wl1271_reg_read32(wl, CHIP_ID_B); | 516 | tmp = wl1271_spi_read32(wl, CHIP_ID_B); |
514 | 517 | ||
515 | wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp); | 518 | wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp); |
516 | 519 | ||
517 | /* 6. read the EEPROM parameters */ | 520 | /* 6. read the EEPROM parameters */ |
518 | tmp = wl1271_reg_read32(wl, SCR_PAD2); | 521 | tmp = wl1271_spi_read32(wl, SCR_PAD2); |
519 | 522 | ||
520 | ret = wl1271_boot_write_irq_polarity(wl); | 523 | ret = wl1271_boot_write_irq_polarity(wl); |
521 | if (ret < 0) | 524 | if (ret < 0) |
522 | goto out; | 525 | goto out; |
523 | 526 | ||
524 | /* FIXME: Need to check whether this is really what we want */ | 527 | /* FIXME: Need to check whether this is really what we want */ |
525 | wl1271_reg_write32(wl, ACX_REG_INTERRUPT_MASK, | 528 | wl1271_spi_write32(wl, ACX_REG_INTERRUPT_MASK, |
526 | WL1271_ACX_ALL_EVENTS_VECTOR); | 529 | WL1271_ACX_ALL_EVENTS_VECTOR); |
527 | 530 | ||
528 | /* WL1271: The reference driver skips steps 7 to 10 (jumps directly | 531 | /* WL1271: The reference driver skips steps 7 to 10 (jumps directly |