aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/mmc_ops.c
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2017-01-13 06:05:03 -0500
committerUlf Hansson <ulf.hansson@linaro.org>2017-01-16 10:17:42 -0500
commitee6ff743e3a4b697e8286054667d7e4e1b56510d (patch)
tree6258986622ca4d4c6db346c48bd317c4650ab583 /drivers/mmc/core/mmc_ops.c
parent01167c7b9cbf099c69fe411a228e4e9c7104e123 (diff)
mmc: core: Restore parts of the polling policy when switch to HS/HS DDR
Regressions for not being able to detect an eMMC HS DDR mode card has been reported for the sdhci-esdhc-imx driver, but potentially other sdhci variants may suffer from the similar problem. The commit e173f8911f09 ("mmc: core: Update CMD13 polling policy when switch to HS DDR mode"), is causing the problem. It seems that change moved one step to far, regarding changing the host's timing before polling for a busy card. To fix this, let's move back to the behaviour when the host's timing is updated after the polling, but before the switch status is fetched and validated. In cases when polling with CMD13, we keep validating the switch status at each attempt. However, to align with the other card busy detections mechanism, let's fetch and validate the switch status also after the host's timing is updated. Reported-by: Clemens Gruber <clemens.gruber@pqgruber.com> Reported-by: Gary Bisson <gary.bisson@boundarydevices.com> Fixes: e173f8911f09 ("mmc: core: Update CMD13 polling policy when switch..") Cc: Shawn Lin <shawn.lin@rock-chips.com> Cc: Dong Aisheng <aisheng.dong@nxp.com> Cc: Haibo Chen <haibo.chen@nxp.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Clemens Gruber <clemens.gruber@pqgruber.com> Tested-by: Jagan Teki <jagan@amarulasolutions.com> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com> Tested-by: Haibo Chen <haibo.chen@nxp.com> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Diffstat (limited to 'drivers/mmc/core/mmc_ops.c')
-rw-r--r--drivers/mmc/core/mmc_ops.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index b11c3455b040..e6ea8503f40c 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -506,9 +506,6 @@ static int mmc_poll_for_busy(struct mmc_card *card, unsigned int timeout_ms,
506 } 506 }
507 } while (busy); 507 } while (busy);
508 508
509 if (host->ops->card_busy && send_status)
510 return mmc_switch_status(card);
511
512 return 0; 509 return 0;
513} 510}
514 511
@@ -577,24 +574,26 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
577 if (!use_busy_signal) 574 if (!use_busy_signal)
578 goto out; 575 goto out;
579 576
580 /* Switch to new timing before poll and check switch status. */
581 if (timing)
582 mmc_set_timing(host, timing);
583
584 /*If SPI or used HW busy detection above, then we don't need to poll. */ 577 /*If SPI or used HW busy detection above, then we don't need to poll. */
585 if (((host->caps & MMC_CAP_WAIT_WHILE_BUSY) && use_r1b_resp) || 578 if (((host->caps & MMC_CAP_WAIT_WHILE_BUSY) && use_r1b_resp) ||
586 mmc_host_is_spi(host)) { 579 mmc_host_is_spi(host))
587 if (send_status)
588 err = mmc_switch_status(card);
589 goto out_tim; 580 goto out_tim;
590 }
591 581
592 /* Let's try to poll to find out when the command is completed. */ 582 /* Let's try to poll to find out when the command is completed. */
593 err = mmc_poll_for_busy(card, timeout_ms, send_status, retry_crc_err); 583 err = mmc_poll_for_busy(card, timeout_ms, send_status, retry_crc_err);
584 if (err)
585 goto out;
594 586
595out_tim: 587out_tim:
596 if (err && timing) 588 /* Switch to new timing before check switch status. */
597 mmc_set_timing(host, old_timing); 589 if (timing)
590 mmc_set_timing(host, timing);
591
592 if (send_status) {
593 err = mmc_switch_status(card);
594 if (err && timing)
595 mmc_set_timing(host, old_timing);
596 }
598out: 597out:
599 mmc_retune_release(host); 598 mmc_retune_release(host);
600 599