aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-09-22 17:30:25 +0200
committerUlf Hansson <ulf.hansson@linaro.org>2015-10-26 16:00:01 +0100
commit5d3f6ef04d65dda92a3573841a7215fb05c347de (patch)
tree84a4d767e9570826bf39ccc15dab87445f01e77d /drivers/mmc
parentmmc: Add mmc_is_io_op helper function (diff)
downloadlinux-dev-5d3f6ef04d65dda92a3573841a7215fb05c347de.tar.xz
linux-dev-5d3f6ef04d65dda92a3573841a7215fb05c347de.zip
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>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/core.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 2092a89dcf76..21cda23b247c 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -206,6 +206,23 @@ static void __mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
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);
}