Commit a9408ad7 authored by Jérôme Pouiller's avatar Jérôme Pouiller Committed by Greg Kroah-Hartman

staging: wfx: load the firmware faster

During the loading of the firmware, the WFX_DCA_GET register provide the
number available bytes in the receiving buffer. It is not necessary to
access to the WFX_DCA_GET after sent of each firmware fragment.

This patch allows to send the firmware:
  - in 64ms instead of 130ms using SDIO bus
  - in 78ms instead of 115ms using SPI bus
Signed-off-by: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200701150707.222985-6-Jerome.Pouiller@silabs.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b64d1054
...@@ -188,15 +188,14 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len) ...@@ -188,15 +188,14 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len)
while (offs < len) { while (offs < len) {
start = ktime_get(); start = ktime_get();
for (;;) { for (;;) {
ret = sram_reg_read(wdev, WFX_DCA_GET, &bytes_done);
if (ret < 0)
return ret;
now = ktime_get(); now = ktime_get();
if (offs + if (offs + DNLD_BLOCK_SIZE - bytes_done < DNLD_FIFO_SIZE)
DNLD_BLOCK_SIZE - bytes_done < DNLD_FIFO_SIZE)
break; break;
if (ktime_after(now, ktime_add_ms(start, DCA_TIMEOUT))) if (ktime_after(now, ktime_add_ms(start, DCA_TIMEOUT)))
return -ETIMEDOUT; return -ETIMEDOUT;
ret = sram_reg_read(wdev, WFX_DCA_GET, &bytes_done);
if (ret < 0)
return ret;
} }
if (ktime_compare(now, start)) if (ktime_compare(now, start))
dev_dbg(wdev->dev, "answer after %lldus\n", dev_dbg(wdev->dev, "answer after %lldus\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment