Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170917
b: refs/heads/master
c: 1fba497
h: refs/heads/master
i:
  170915: 2cffc9d
v: v3
  • Loading branch information
Juuso Oikarinen authored and John W. Linville committed Oct 27, 2009
1 parent 241f8b0 commit 268caa1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c87dec9f189b884df215756e285b9281cf065206
refs/heads/master: 1fba49741dc50d13d2fe6cf04f5a547e6c5c81f6
16 changes: 12 additions & 4 deletions trunk/drivers/net/wireless/wl12xx/wl1271_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf,
size_t fw_data_len, u32 dest)
{
int addr, chunk_num, partition_limit;
u8 *p;
u8 *p, *chunk;

/* whal_FwCtrl_LoadFwImageSm() */

Expand All @@ -103,12 +103,17 @@ static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf,
wl1271_debug(DEBUG_BOOT, "fw_data_len %zd chunk_size %d",
fw_data_len, CHUNK_SIZE);


if ((fw_data_len % 4) != 0) {
wl1271_error("firmware length not multiple of four");
return -EIO;
}

chunk = kmalloc(CHUNK_SIZE, GFP_KERNEL);
if (!buf) {
wl1271_error("allocation for firmware upload chunk failed");
return -ENOMEM;
}

wl1271_set_partition(wl, dest,
part_table[PART_DOWN].mem.size,
part_table[PART_DOWN].reg.start,
Expand Down Expand Up @@ -137,20 +142,23 @@ static int wl1271_boot_upload_firmware_chunk(struct wl1271 *wl, void *buf,
/* 10.3 upload the chunk */
addr = dest + chunk_num * CHUNK_SIZE;
p = buf + chunk_num * CHUNK_SIZE;
memcpy(chunk, p, CHUNK_SIZE);
wl1271_debug(DEBUG_BOOT, "uploading fw chunk 0x%p to 0x%x",
p, addr);
wl1271_spi_mem_write(wl, addr, p, CHUNK_SIZE);
wl1271_spi_mem_write(wl, addr, chunk, CHUNK_SIZE);

chunk_num++;
}

/* 10.4 upload the last chunk */
addr = dest + chunk_num * CHUNK_SIZE;
p = buf + chunk_num * CHUNK_SIZE;
memcpy(chunk, p, fw_data_len % CHUNK_SIZE);
wl1271_debug(DEBUG_BOOT, "uploading fw last chunk (%zd B) 0x%p to 0x%x",
fw_data_len % CHUNK_SIZE, p, addr);
wl1271_spi_mem_write(wl, addr, p, fw_data_len % CHUNK_SIZE);
wl1271_spi_mem_write(wl, addr, chunk, fw_data_len % CHUNK_SIZE);

kfree(chunk);
return 0;
}

Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/net/wireless/wl12xx/wl1271_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/spi/spi.h>
#include <linux/crc32.h>
#include <linux/etherdevice.h>
#include <linux/vmalloc.h>
#include <linux/spi/wl12xx.h>

#include "wl1271.h"
Expand Down Expand Up @@ -231,7 +232,7 @@ static int wl1271_fetch_firmware(struct wl1271 *wl)
}

wl->fw_len = fw->size;
wl->fw = kmalloc(wl->fw_len, GFP_KERNEL);
wl->fw = vmalloc(wl->fw_len);

if (!wl->fw) {
wl1271_error("could not allocate memory for the firmware");
Expand Down Expand Up @@ -1484,7 +1485,7 @@ static int __devexit wl1271_remove(struct spi_device *spi)
platform_device_unregister(&wl1271_device);
free_irq(wl->irq, wl);
kfree(wl->target_mem_map);
kfree(wl->fw);
vfree(wl->fw);
wl->fw = NULL;
kfree(wl->nvs);
wl->nvs = NULL;
Expand Down

0 comments on commit 268caa1

Please sign in to comment.