Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+5 -10
+5 -10
drivers/mmc/host/mmc_spi.c
··· 77 77 78 78 #define MMC_SPI_BLOCKSIZE 512 79 79 80 - 81 - /* These fixed timeouts come from the latest SD specs, which say to ignore 82 - * the CSD values. The R1B value is for card erase (e.g. the "I forgot the 83 - * card's password" scenario); it's mostly applied to STOP_TRANSMISSION after 84 - * reads which takes nowhere near that long. Older cards may be able to use 85 - * shorter timeouts ... but why bother? 86 - */ 87 - #define r1b_timeout (HZ * 3) 80 + #define MMC_SPI_R1B_TIMEOUT_MS 3000 81 + #define MMC_SPI_INIT_TIMEOUT_MS 3000 88 82 89 83 /* One of the critical speed parameters is the amount of data which may 90 84 * be transferred in one command. If this value is too low, the SD card ··· 341 347 while (cp < end && *cp == 0) 342 348 cp++; 343 349 if (cp == end) 344 - mmc_spi_wait_unbusy(host, r1b_timeout); 350 + mmc_spi_wait_unbusy(host, 351 + msecs_to_jiffies(MMC_SPI_R1B_TIMEOUT_MS)); 345 352 break; 346 353 347 354 /* SPI R2 == R1 + second status byte; SEND_STATUS ··· 1113 1118 /* Try to be very sure any previous command has completed; 1114 1119 * wait till not-busy, skip debris from any old commands. 1115 1120 */ 1116 - mmc_spi_wait_unbusy(host, r1b_timeout); 1121 + mmc_spi_wait_unbusy(host, msecs_to_jiffies(MMC_SPI_INIT_TIMEOUT_MS)); 1117 1122 mmc_spi_readbytes(host, 10); 1118 1123 1119 1124 /*