brcmfmac: simplify sdio code download routine.
brcmf_sdio_download_code_file is using a loop to send small blobs of data. This is unnecessarily complex and was simplified with this patch. Reviewed-by: Arend Van Spriel <arend@broadcom.com> Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com> Signed-off-by: Hante Meuleman <meuleman@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>hifive-unleashed-5.1
parent
79c868e5ad
commit
f9951c1334
|
@ -3291,32 +3291,17 @@ static int brcmf_sdio_download_code_file(struct brcmf_sdio *bus,
|
||||||
const struct firmware *fw)
|
const struct firmware *fw)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
int offset;
|
|
||||||
int address;
|
|
||||||
int len;
|
|
||||||
|
|
||||||
brcmf_dbg(TRACE, "Enter\n");
|
brcmf_dbg(TRACE, "Enter\n");
|
||||||
|
|
||||||
err = 0;
|
err = brcmf_sdiod_ramrw(bus->sdiodev, true, bus->ci->rambase,
|
||||||
offset = 0;
|
(u8 *)fw->data, fw->size);
|
||||||
address = bus->ci->rambase;
|
if (err)
|
||||||
while (offset < fw->size) {
|
brcmf_err("error %d on writing %d membytes at 0x%08x\n",
|
||||||
len = ((offset + MEMBLOCK) < fw->size) ? MEMBLOCK :
|
err, (int)fw->size, bus->ci->rambase);
|
||||||
fw->size - offset;
|
else if (!brcmf_sdio_verifymemory(bus->sdiodev, bus->ci->rambase,
|
||||||
err = brcmf_sdiod_ramrw(bus->sdiodev, true, address,
|
(u8 *)fw->data, fw->size))
|
||||||
(u8 *)&fw->data[offset], len);
|
err = -EIO;
|
||||||
if (err) {
|
|
||||||
brcmf_err("error %d on writing %d membytes at 0x%08x\n",
|
|
||||||
err, len, address);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
offset += len;
|
|
||||||
address += len;
|
|
||||||
}
|
|
||||||
if (!err)
|
|
||||||
if (!brcmf_sdio_verifymemory(bus->sdiodev, bus->ci->rambase,
|
|
||||||
(u8 *)fw->data, fw->size))
|
|
||||||
err = -EIO;
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue