Skip to content

Commit 04f2f45

Browse files
committed
mmc: sdricoh_cs: Respect the cmd->busy_timeout from the mmc core
Using a fixed 1s polling timeout for all commands is a bit problematic. For some commands it means waiting longer than needed for the polling to be aborted, which may not a big issue, but still. For other commands, like for an erase (CMD38) that uses a R1B response, may require longer timeouts than 1s. In these cases, we may end up treating the command as it failed, while it just needed some more time to complete successfully. Fix the problem by respecting the cmd->busy_timeout, which is provided by the mmc core. Note that, even if the sdricoh_cs driver may currently not support HW busy detection on DAT0, some comments in the code refer to that the HW may support it. Therefore, it seems better to be proactive in this case. Cc: Sascha Sommer <[email protected]> Signed-off-by: Ulf Hansson <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 3eea697 commit 04f2f45

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/mmc/host/sdricoh_cs.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static int sdricoh_query_status(struct sdricoh_host *host, unsigned int wanted)
157157

158158
static int sdricoh_mmc_cmd(struct sdricoh_host *host, struct mmc_command *cmd)
159159
{
160-
unsigned int status;
160+
unsigned int status, timeout_us;
161161
int ret;
162162
unsigned char opcode = cmd->opcode;
163163

@@ -179,9 +179,12 @@ static int sdricoh_mmc_cmd(struct sdricoh_host *host, struct mmc_command *cmd)
179179
if (!opcode)
180180
return 0;
181181

182+
timeout_us = cmd->busy_timeout ? cmd->busy_timeout * 1000 :
183+
SDRICOH_CMD_TIMEOUT_US;
184+
182185
ret = read_poll_timeout(sdricoh_readl, status,
183186
sdricoh_status_ok(host, status, STATUS_CMD_FINISHED),
184-
32, SDRICOH_CMD_TIMEOUT_US, false,
187+
32, timeout_us, false,
185188
host, R21C_STATUS);
186189

187190
/*

0 commit comments

Comments
 (0)