@@ -945,9 +945,19 @@ static int mmc_blk_cmd_recovery(struct mmc_card *card, struct request *req,
*/
if (R1_CURRENT_STATE(status) == R1_STATE_DATA ||
R1_CURRENT_STATE(status) == R1_STATE_RCV) {
- err = send_stop(card,
- DIV_ROUND_UP(brq->data.timeout_ns, 1000000),
- req, gen_err, &stop_status);
+ unsigned int timeout_ms, clock;
+
+ timeout_ms = DIV_ROUND_UP(brq->data.timeout_ns, 1000000);
+ if (brq->data.timeout_clks) {
+ clock = card->host->actual_clock;
+ if (!clock)
+ clock = card->host->ios.clock;
+ if (clock) {
+ clock = DIV_ROUND_UP(clock, 1000);
+ timeout_ms += brq->data.timeout_clks / clock;
+ }
+ }
+ err = send_stop(card, timeout_ms, req, gen_err, &stop_status);
if (err) {
pr_err("%s: error %d sending stop command\n",
req->rq_disk->disk_name, err);
Data timeout has two components: one in nanoseconds and one in clock cycles. Clock cycles were not being added when using the data timeout for the error recovery stop cmd timeout. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> --- drivers/mmc/card/block.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)