Skip to content

Commit 5d3f6ef

Browse files
jwrdegoedestorulf
authored andcommitted
mmc: Wait for card_busy before starting sdio requests
Some sdio wifi chips will not work properly if we try to start new sdio-rw requests while the device is signalling that it is busy. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent de98c55 commit 5d3f6ef

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

drivers/mmc/core/core.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,23 @@ static void __mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
206206
return;
207207
}
208208

209+
/*
210+
* For sdio rw commands we must wait for card busy otherwise some
211+
* sdio devices won't work properly.
212+
*/
213+
if (mmc_is_io_op(mrq->cmd->opcode) && host->ops->card_busy) {
214+
int tries = 500; /* Wait aprox 500ms at maximum */
215+
216+
while (host->ops->card_busy(host) && --tries)
217+
mmc_delay(1);
218+
219+
if (tries == 0) {
220+
mrq->cmd->error = -EBUSY;
221+
mmc_request_done(host, mrq);
222+
return;
223+
}
224+
}
225+
209226
host->ops->request(host, mrq);
210227
}
211228

0 commit comments

Comments
 (0)