Commit 5d3f6ef0 authored by Hans de Goede's avatar Hans de Goede Committed by Ulf Hansson

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: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent de98c556
...@@ -206,6 +206,23 @@ static void __mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) ...@@ -206,6 +206,23 @@ static void __mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
return; return;
} }
/*
* For sdio rw commands we must wait for card busy otherwise some
* sdio devices won't work properly.
*/
if (mmc_is_io_op(mrq->cmd->opcode) && host->ops->card_busy) {
int tries = 500; /* Wait aprox 500ms at maximum */
while (host->ops->card_busy(host) && --tries)
mmc_delay(1);
if (tries == 0) {
mrq->cmd->error = -EBUSY;
mmc_request_done(host, mrq);
return;
}
}
host->ops->request(host, mrq); host->ops->request(host, mrq);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment