Skip to content

Commit

Permalink
spi: core: Increase timeout value
Browse files Browse the repository at this point in the history
The existing timeout value in wait_for_completion_timeout is
calculated from the transfer length and speed with tolerance of 10msec.
This is too low because this is used for error conditions such as
hardware hang etc.
The xfer->speed_hz considered may not be the actual speed set
because the best clock divisor is chosen from a limited set such that
the actual speed <= requested speed. This will lead to timeout being
less than actual transfer time.
Considering acceptable latencies, this timeout can be set to a
value double the expected transfer plus 100 msecs.
This patch adds the same in the core.

Signed-off-by: Harini Katakam <harinik@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Harini Katakam authored and Mark Brown committed Apr 14, 2014
1 parent c9eaa44 commit eee668a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/spi/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ static int spi_transfer_one_message(struct spi_master *master,
if (ret > 0) {
ret = 0;
ms = xfer->len * 8 * 1000 / xfer->speed_hz;
ms += 10; /* some tolerance */
ms += ms + 100; /* some tolerance */

ms = wait_for_completion_timeout(&master->xfer_completion,
msecs_to_jiffies(ms));
Expand Down

0 comments on commit eee668a

Please sign in to comment.