Skip to content

Commit 1292e3e

Browse files
author
Ulf Hansson
committed
mmc: core: Allow host controllers to require R1B for CMD6
It has turned out that some host controllers can't use R1B for CMD6 and other commands that have R1B associated with them. Therefore invent a new host cap, MMC_CAP_NEED_RSP_BUSY to let them specify this. In __mmc_switch(), let's check the flag and use it to prevent R1B responses from being converted into R1. Note that, this also means that the host are on its own, when it comes to manage the busy timeout. Suggested-by: Sowjanya Komatineni <skomatineni@nvidia.com> Cc: <stable@vger.kernel.org> Tested-by: Anders Roxell <anders.roxell@linaro.org> Tested-by: Sowjanya Komatineni <skomatineni@nvidia.com> Tested-by: Faiz Abbas <faiz_abbas@ti.com> Tested-By: Peter Geis <pgwipeout@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 31e43f3 commit 1292e3e

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎drivers/mmc/core/mmc_ops.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,11 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
542542
* If the max_busy_timeout of the host is specified, make sure it's
543543
* enough to fit the used timeout_ms. In case it's not, let's instruct
544544
* the host to avoid HW busy detection, by converting to a R1 response
545-
* instead of a R1B.
545+
* instead of a R1B. Note, some hosts requires R1B, which also means
546+
* they are on their own when it comes to deal with the busy timeout.
546547
*/
547-
if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout))
548+
if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && host->max_busy_timeout &&
549+
(timeout_ms > host->max_busy_timeout))
548550
use_r1b_resp = false;
549551

550552
cmd.opcode = MMC_SWITCH;

‎include/linux/mmc/host.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ struct mmc_host {
333333
MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \
334334
MMC_CAP_UHS_DDR50)
335335
#define MMC_CAP_SYNC_RUNTIME_PM (1 << 21) /* Synced runtime PM suspends. */
336+
#define MMC_CAP_NEED_RSP_BUSY (1 << 22) /* Commands with R1B can't use R1. */
336337
#define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */
337338
#define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */
338339
#define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */

0 commit comments

Comments
 (0)