]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mmc: block: Respect hw busy detection in card_busy_detect()
authorUlf Hansson <ulf.hansson@linaro.org>
Wed, 29 Jan 2014 12:11:27 +0000 (13:11 +0100)
committerChris Ball <chris@printf.net>
Sun, 23 Feb 2014 15:41:04 +0000 (10:41 -0500)
Currently for write request we don't trust the hw busy detection to be
fully handled by host, thus we also poll the card's status until we see
it's gets out of the busy state.

Still there are scenarios where it will a benefit to trust the hw busy
detection done by the host, since no additional polling is needed.
Let's prepare card_busy_detect() to be able to handle this.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
drivers/mmc/card/block.c

index fffa83359c677e35827da326e6cf749eea462b63..813ec83b74c959aedb68bed24d5e66f9b5b15313 100644 (file)
@@ -750,7 +750,7 @@ static int get_card_status(struct mmc_card *card, u32 *status, int retries)
 }
 
 static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms,
-               struct request *req, int *gen_err)
+               bool hw_busy_detect, struct request *req, int *gen_err)
 {
        unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
        int err = 0;
@@ -770,6 +770,11 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms,
                        *gen_err = 1;
                }
 
+               /* We may rely on the host hw to handle busy detection.*/
+               if ((card->host->caps & MMC_CAP_WAIT_WHILE_BUSY) &&
+                       hw_busy_detect)
+                       break;
+
                /*
                 * Timeout if the device never becomes ready for data and never
                 * leaves the program state.
@@ -1209,7 +1214,8 @@ static int mmc_blk_err_check(struct mmc_card *card,
                        gen_err = 1;
                }
 
-               err = card_busy_detect(card, MMC_BLK_TIMEOUT_MS, req, &gen_err);
+               err = card_busy_detect(card, MMC_BLK_TIMEOUT_MS, false, req,
+                                       &gen_err);
                if (err)
                        return MMC_BLK_CMD_ERR;
        }