[PATCH] myri10ge - Write the firmware in 256-bytes chunks
When writing the firmware to the NIC, the FIFO is 256-bytes long, so we use 256-bytes chunks and a read to wait until the previous write is done. Signed-off-by: Brice Goglin <brice@myri.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
parent
817acf5ebd
commit
e454358ace
@ -448,6 +448,7 @@ static int myri10ge_load_hotplug_firmware(struct myri10ge_priv *mgp, u32 * size)
|
|||||||
struct mcp_gen_header *hdr;
|
struct mcp_gen_header *hdr;
|
||||||
size_t hdr_offset;
|
size_t hdr_offset;
|
||||||
int status;
|
int status;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
if ((status = request_firmware(&fw, mgp->fw_name, dev)) < 0) {
|
if ((status = request_firmware(&fw, mgp->fw_name, dev)) < 0) {
|
||||||
dev_err(dev, "Unable to load %s firmware image via hotplug\n",
|
dev_err(dev, "Unable to load %s firmware image via hotplug\n",
|
||||||
@ -479,18 +480,12 @@ static int myri10ge_load_hotplug_firmware(struct myri10ge_priv *mgp, u32 * size)
|
|||||||
goto abort_with_fw;
|
goto abort_with_fw;
|
||||||
|
|
||||||
crc = crc32(~0, fw->data, fw->size);
|
crc = crc32(~0, fw->data, fw->size);
|
||||||
if (mgp->tx.boundary == 2048) {
|
for (i = 0; i < fw->size; i += 256) {
|
||||||
/* Avoid PCI burst on chipset with unaligned completions. */
|
myri10ge_pio_copy(mgp->sram + MYRI10GE_FW_OFFSET + i,
|
||||||
int i;
|
fw->data + i,
|
||||||
__iomem u32 *ptr = (__iomem u32 *) (mgp->sram +
|
min(256U, (unsigned)(fw->size - i)));
|
||||||
MYRI10GE_FW_OFFSET);
|
mb();
|
||||||
for (i = 0; i < fw->size / 4; i++) {
|
readb(mgp->sram);
|
||||||
__raw_writel(((u32 *) fw->data)[i], ptr + i);
|
|
||||||
wmb();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
myri10ge_pio_copy(mgp->sram + MYRI10GE_FW_OFFSET, fw->data,
|
|
||||||
fw->size);
|
|
||||||
}
|
}
|
||||||
/* corruption checking is good for parity recovery and buggy chipset */
|
/* corruption checking is good for parity recovery and buggy chipset */
|
||||||
memcpy_fromio(fw->data, mgp->sram + MYRI10GE_FW_OFFSET, fw->size);
|
memcpy_fromio(fw->data, mgp->sram + MYRI10GE_FW_OFFSET, fw->size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user