Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 171865
b: refs/heads/master
c: c74ddfd
h: refs/heads/master
i:
  171863: f4c878a
v: v3
  • Loading branch information
Kalle Valo authored and John W. Linville committed Nov 18, 2009
1 parent d9bebd1 commit 0220b74
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 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: d5da79ac1f5050cccaa68d814ccce292371f25fa
refs/heads/master: c74ddfd5ea9c0c67d0aae77eeb5b610188cb8bc4
27 changes: 22 additions & 5 deletions trunk/drivers/net/wireless/wl12xx/wl1251_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ int wl1251_boot_run_firmware(struct wl1251 *wl)
static int wl1251_boot_upload_firmware(struct wl1251 *wl)
{
int addr, chunk_num, partition_limit;
size_t fw_data_len;
u8 *p;
size_t fw_data_len, len;
u8 *p, *buf;

/* whal_FwCtrl_LoadFwImageSm() */

Expand All @@ -334,6 +334,12 @@ static int wl1251_boot_upload_firmware(struct wl1251 *wl)
return -EIO;
}

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

wl1251_set_partition(wl, WL1251_PART_DOWN_MEM_START,
WL1251_PART_DOWN_MEM_SIZE,
WL1251_PART_DOWN_REG_START,
Expand Down Expand Up @@ -364,17 +370,28 @@ static int wl1251_boot_upload_firmware(struct wl1251 *wl)
p = wl->fw + FW_HDR_SIZE + chunk_num * CHUNK_SIZE;
wl1251_debug(DEBUG_BOOT, "uploading fw chunk 0x%p to 0x%x",
p, addr);
wl1251_mem_write(wl, addr, p, CHUNK_SIZE);

/* need to copy the chunk for dma */
len = CHUNK_SIZE;
memcpy(buf, p, len);
wl1251_mem_write(wl, addr, buf, len);

chunk_num++;
}

/* 10.4 upload the last chunk */
addr = WL1251_PART_DOWN_MEM_START + chunk_num * CHUNK_SIZE;
p = wl->fw + FW_HDR_SIZE + chunk_num * CHUNK_SIZE;

/* need to copy the chunk for dma */
len = fw_data_len % CHUNK_SIZE;
memcpy(buf, p, len);

wl1251_debug(DEBUG_BOOT, "uploading fw last chunk (%zu B) 0x%p to 0x%x",
fw_data_len % CHUNK_SIZE, p, addr);
wl1251_mem_write(wl, addr, p, fw_data_len % CHUNK_SIZE);
len, p, addr);
wl1251_mem_write(wl, addr, buf, len);

kfree(buf);

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

#include "wl1251.h"
#include "wl12xx_80211.h"
Expand Down Expand Up @@ -83,7 +84,7 @@ static int wl1251_fetch_firmware(struct wl1251 *wl)
}

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

if (!wl->fw) {
wl1251_error("could not allocate memory for the firmware");
Expand Down Expand Up @@ -1427,7 +1428,7 @@ int wl1251_free_hw(struct wl1251 *wl)

kfree(wl->target_mem_map);
kfree(wl->data_path);
kfree(wl->fw);
vfree(wl->fw);
wl->fw = NULL;
kfree(wl->nvs);
wl->nvs = NULL;
Expand Down

0 comments on commit 0220b74

Please sign in to comment.