diff options
author | Tobias Schramm <t.schramm@manjaro.org> | 2020-08-14 21:50:11 +0300 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2020-09-07 10:11:29 +0300 |
commit | 81e41be92ad43b268910dcae78c5a72f79f3d467 (patch) | |
tree | 1a5a8ded0ee8777fe4e829924b3d027c9208a6fb /drivers/mmc/host/mmc_spi.c | |
parent | b698f6abb7b3de2fd04ebbb86527ab1ea95405e0 (diff) | |
download | linux-81e41be92ad43b268910dcae78c5a72f79f3d467.tar.xz |
mmc: mmc_spi: fix timeout calculation
Previously the cycle timeout was converted to a microsecond value but
then incorrectly treated as a nanosecond timeout. This patch changes
the code to convert both the nanosecond timeout and the cycle timeout
to a microsecond value and use that directly.
Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
Link: https://lore.kernel.org/r/20200814185011.3252020-1-t.schramm@manjaro.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/mmc_spi.c')
-rw-r--r-- | drivers/mmc/host/mmc_spi.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index 39bb1e30c2d7..f85e0ad896a9 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c @@ -882,9 +882,9 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd, else clock_rate = spi->max_speed_hz; - timeout = data->timeout_ns + + timeout = data->timeout_ns / 1000 + data->timeout_clks * 1000000 / clock_rate; - timeout = usecs_to_jiffies((unsigned int)(timeout / 1000)) + 1; + timeout = usecs_to_jiffies((unsigned int)timeout) + 1; /* Handle scatterlist segments one at a time, with synch for * each 512-byte block |