summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorŁukasz Stelmach <l.stelmach@samsung.com>2020-10-02 14:22:42 +0200
committerMark Brown <broonie@kernel.org>2020-10-02 22:54:23 +0200
commit9fe26adbe37fddeddb87e45adbc94ce2cd470ff1 (patch)
tree7f82a90d6fd2f9e94c4c8b7566a1f4488753744d
parentspi: spi-s3c64xx: Ensure cur_speed holds actual clock value (diff)
downloadlinux-9fe26adbe37fddeddb87e45adbc94ce2cd470ff1.tar.xz
linux-9fe26adbe37fddeddb87e45adbc94ce2cd470ff1.zip
spi: spi-s3c64xx: Increase transfer timeout
Increase timeout by 30 ms for some wiggle room and set the minimum value to 100 ms. This ensures a non-zero value for short transfers which may take less than 1 ms. The timeout value does not affect performance because it is used with a completion. Similar formula is used in other drivers e.g. sun4i, sun6i. Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com> Link: https://lore.kernel.org/r/20201002122243.26849-9-l.stelmach@samsung.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-s3c64xx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 0bd3e230350c..9f728a7c59a1 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -473,7 +473,8 @@ static int s3c64xx_wait_for_dma(struct s3c64xx_spi_driver_data *sdd,
/* millisecs to xfer 'len' bytes @ 'cur_speed' */
ms = xfer->len * 8 * 1000 / sdd->cur_speed;
- ms += 10; /* some tolerance */
+ ms += 30; /* some tolerance */
+ ms = max(ms, 100); /* minimum timeout */
val = msecs_to_jiffies(ms) + 10;
val = wait_for_completion_timeout(&sdd->xfer_completion, val);