summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/mmc_spi.c
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2020-04-14 18:14:11 +0200
committerUlf Hansson <ulf.hansson@linaro.org>2020-05-28 11:21:02 +0200
commit78a67b9224ade6da7d2d83c23a9858cb4dfcd64a (patch)
tree9a7edb204037c9e89238d9a3631432432d868d12 /drivers/mmc/host/mmc_spi.c
parent966244ccd2919e28f25555a77f204cd1c109cad8 (diff)
downloadlinux-78a67b9224ade6da7d2d83c23a9858cb4dfcd64a.tar.gz
linux-78a67b9224ade6da7d2d83c23a9858cb4dfcd64a.tar.bz2
linux-78a67b9224ade6da7d2d83c23a9858cb4dfcd64a.zip
mmc: mmc_spi: Add/rename defines for timeouts
Clarify the use of r1b_timeout, by renaming it to MMC_SPI_R1B_TIMEOUT_MS and by dropping the corresponding confusing comment about it. Additionally, let's also add a new define, MMC_SPI_INIT_TIMEOUT_MS and use it during the initialization. Even if these two defines are given the same value, the split makes it easier to understand them. Cc: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20200414161413.3036-18-ulf.hansson@linaro.org
Diffstat (limited to 'drivers/mmc/host/mmc_spi.c')
-rw-r--r--drivers/mmc/host/mmc_spi.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 951f76dc1ddd..5768fe9f8f6f 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -77,14 +77,8 @@
#define MMC_SPI_BLOCKSIZE 512
-
-/* These fixed timeouts come from the latest SD specs, which say to ignore
- * the CSD values. The R1B value is for card erase (e.g. the "I forgot the
- * card's password" scenario); it's mostly applied to STOP_TRANSMISSION after
- * reads which takes nowhere near that long. Older cards may be able to use
- * shorter timeouts ... but why bother?
- */
-#define r1b_timeout (HZ * 3)
+#define MMC_SPI_R1B_TIMEOUT_MS 3000
+#define MMC_SPI_INIT_TIMEOUT_MS 3000
/* One of the critical speed parameters is the amount of data which may
* be transferred in one command. If this value is too low, the SD card
@@ -347,7 +341,8 @@ checkstatus:
while (cp < end && *cp == 0)
cp++;
if (cp == end)
- mmc_spi_wait_unbusy(host, r1b_timeout);
+ mmc_spi_wait_unbusy(host,
+ msecs_to_jiffies(MMC_SPI_R1B_TIMEOUT_MS));
break;
/* SPI R2 == R1 + second status byte; SEND_STATUS
@@ -1118,7 +1113,7 @@ static void mmc_spi_initsequence(struct mmc_spi_host *host)
/* Try to be very sure any previous command has completed;
* wait till not-busy, skip debris from any old commands.
*/
- mmc_spi_wait_unbusy(host, r1b_timeout);
+ mmc_spi_wait_unbusy(host, msecs_to_jiffies(MMC_SPI_INIT_TIMEOUT_MS));
mmc_spi_readbytes(host, 10);
/*