aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/card
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2014-01-29 07:11:27 -0500
committerChris Ball <chris@printf.net>2014-02-23 10:41:04 -0500
commit95a91298fc09db0c21193ace96d1934598dd92dd (patch)
tree0dcfb9f86096f7ff4765591c6167fe6595c50392 /drivers/mmc/card
parentc49433fb66935bd01930e37c7f47d38b6f8135fc (diff)
mmc: block: Respect hw busy detection in card_busy_detect()
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>
Diffstat (limited to 'drivers/mmc/card')
-rw-r--r--drivers/mmc/card/block.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index fffa83359c67..813ec83b74c9 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -750,7 +750,7 @@ static int get_card_status(struct mmc_card *card, u32 *status, int retries)
750} 750}
751 751
752static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms, 752static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms,
753 struct request *req, int *gen_err) 753 bool hw_busy_detect, struct request *req, int *gen_err)
754{ 754{
755 unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms); 755 unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
756 int err = 0; 756 int err = 0;
@@ -770,6 +770,11 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms,
770 *gen_err = 1; 770 *gen_err = 1;
771 } 771 }
772 772
773 /* We may rely on the host hw to handle busy detection.*/
774 if ((card->host->caps & MMC_CAP_WAIT_WHILE_BUSY) &&
775 hw_busy_detect)
776 break;
777
773 /* 778 /*
774 * Timeout if the device never becomes ready for data and never 779 * Timeout if the device never becomes ready for data and never
775 * leaves the program state. 780 * leaves the program state.
@@ -1209,7 +1214,8 @@ static int mmc_blk_err_check(struct mmc_card *card,
1209 gen_err = 1; 1214 gen_err = 1;
1210 } 1215 }
1211 1216
1212 err = card_busy_detect(card, MMC_BLK_TIMEOUT_MS, req, &gen_err); 1217 err = card_busy_detect(card, MMC_BLK_TIMEOUT_MS, false, req,
1218 &gen_err);
1213 if (err) 1219 if (err)
1214 return MMC_BLK_CMD_ERR; 1220 return MMC_BLK_CMD_ERR;
1215 } 1221 }