diff options
author | Jérôme Pouiller <jerome.pouiller@silabs.com> | 2020-07-01 17:06:59 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-07-03 10:33:07 +0200 |
commit | a9408ad79ff3d77542a5cfdd76d21fd12bf8b46a (patch) | |
tree | f317958f399ae8f624e82792fe011873e4e2bf35 /drivers/staging/wfx | |
parent | b64d1054bccbbcb435901e20f564292214373f87 (diff) | |
download | linux-a9408ad79ff3d77542a5cfdd76d21fd12bf8b46a.tar.bz2 |
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: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200701150707.222985-6-Jerome.Pouiller@silabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wfx')
-rw-r--r-- | drivers/staging/wfx/fwio.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c index 72bb3d2a9613..d9a886f3e64b 100644 --- a/drivers/staging/wfx/fwio.c +++ b/drivers/staging/wfx/fwio.c @@ -188,15 +188,14 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len) while (offs < len) { start = ktime_get(); for (;;) { - ret = sram_reg_read(wdev, WFX_DCA_GET, &bytes_done); - if (ret < 0) - return ret; now = ktime_get(); - if (offs + - DNLD_BLOCK_SIZE - bytes_done < DNLD_FIFO_SIZE) + if (offs + DNLD_BLOCK_SIZE - bytes_done < DNLD_FIFO_SIZE) break; if (ktime_after(now, ktime_add_ms(start, DCA_TIMEOUT))) return -ETIMEDOUT; + ret = sram_reg_read(wdev, WFX_DCA_GET, &bytes_done); + if (ret < 0) + return ret; } if (ktime_compare(now, start)) dev_dbg(wdev->dev, "answer after %lldus\n", |