mmc: block: prefer the host's capability(card_busy) than send_status

According to the specification, the controller should check the device
status before data transport. Generally, it can get the status of device
via CMD13. It's upset that command communication will produce a little
interrupt inside the controller.

To avoid interrupt storm whilst heavily I/O request, use card_busy
instead of send_status(CMD13).

Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
Change-Id: I3ba79ba2f563006112b0157b78aab5b31911b61a
This commit is contained in:
Ziyuan Xu
2021-05-15 16:31:49 +08:00
committed by Tao Huang
parent ddf2490cc9
commit feb6da4129

View File

@@ -458,16 +458,22 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms,
do {
bool done = time_after(jiffies, timeout);
err = __mmc_send_status(card, &status, 5);
if (err) {
dev_err(mmc_dev(card->host),
"error %d requesting status\n", err);
return err;
}
if (card->host->ops->card_busy) {
status = card->host->ops->card_busy(card->host) ?
0 : R1_READY_FOR_DATA | R1_STATE_TRAN << 9;
usleep_range(100, 150);
} else {
err = __mmc_send_status(card, &status, 5);
if (err) {
dev_err(mmc_dev(card->host),
"error %d requesting status\n", err);
return err;
}
/* Accumulate any response error bits seen */
if (resp_errs)
*resp_errs |= status;
/* Accumulate any response error bits seen */
if (resp_errs)
*resp_errs |= status;
}
/*
* Timeout if the device never becomes ready for data and never