|
21 | 21 |
|
22 | 22 | #define MMC_BKOPS_TIMEOUT_MS (120 * 1000) /* 120s */ |
23 | 23 | #define MMC_SANITIZE_TIMEOUT_MS (240 * 1000) /* 240s */ |
| 24 | +#define MMC_OP_COND_PERIOD_US (1 * 1000) /* 1ms */ |
| 25 | +#define MMC_OP_COND_TIMEOUT_MS 1000 /* 1s */ |
24 | 26 |
|
25 | 27 | static const u8 tuning_blk_pattern_4bit[] = { |
26 | 28 | 0xff, 0x0f, 0xff, 0x00, 0xff, 0xcc, 0xc3, 0xcc, |
@@ -232,7 +234,9 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) |
232 | 234 | cmd.arg = mmc_host_is_spi(host) ? 0 : ocr; |
233 | 235 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R3 | MMC_CMD_BCR; |
234 | 236 |
|
235 | | - err = __mmc_poll_for_busy(host, 1000, &__mmc_send_op_cond_cb, &cb_data); |
| 237 | + err = __mmc_poll_for_busy(host, MMC_OP_COND_PERIOD_US, |
| 238 | + MMC_OP_COND_TIMEOUT_MS, |
| 239 | + &__mmc_send_op_cond_cb, &cb_data); |
236 | 240 | if (err) |
237 | 241 | return err; |
238 | 242 |
|
@@ -495,13 +499,14 @@ static int mmc_busy_cb(void *cb_data, bool *busy) |
495 | 499 | return 0; |
496 | 500 | } |
497 | 501 |
|
498 | | -int __mmc_poll_for_busy(struct mmc_host *host, unsigned int timeout_ms, |
| 502 | +int __mmc_poll_for_busy(struct mmc_host *host, unsigned int period_us, |
| 503 | + unsigned int timeout_ms, |
499 | 504 | int (*busy_cb)(void *cb_data, bool *busy), |
500 | 505 | void *cb_data) |
501 | 506 | { |
502 | 507 | int err; |
503 | 508 | unsigned long timeout; |
504 | | - unsigned int udelay = 32, udelay_max = 32768; |
| 509 | + unsigned int udelay = period_us ? period_us : 32, udelay_max = 32768; |
505 | 510 | bool expired = false; |
506 | 511 | bool busy = false; |
507 | 512 |
|
@@ -546,7 +551,7 @@ int mmc_poll_for_busy(struct mmc_card *card, unsigned int timeout_ms, |
546 | 551 | cb_data.retry_crc_err = retry_crc_err; |
547 | 552 | cb_data.busy_cmd = busy_cmd; |
548 | 553 |
|
549 | | - return __mmc_poll_for_busy(host, timeout_ms, &mmc_busy_cb, &cb_data); |
| 554 | + return __mmc_poll_for_busy(host, 0, timeout_ms, &mmc_busy_cb, &cb_data); |
550 | 555 | } |
551 | 556 | EXPORT_SYMBOL_GPL(mmc_poll_for_busy); |
552 | 557 |
|
|
0 commit comments