Possibly a command is failing because re-tuning is needed.
Use mmc_retune_retry() to check re-tuning. At that point
re-tuning is held, at least by the request, so
mmc_retune_retry() does a mmc_retune_release() and
mmc_retune_hold().

Signed-off-by: Adrian Hunter <adrian.hun...@intel.com>
---
 drivers/mmc/core/core.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 263b2d6..2c10fb9 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -422,6 +422,11 @@ static int mmc_wait_for_data_req_done(struct mmc_host 
*host,
                                                            host->areq);
                                break; /* return err */
                        } else {
+                               err = mmc_retune_retry(host);
+                               if (err) {
+                                       mmc_host_clk_release(host);
+                                       break;
+                               }
                                pr_info("%s: req failed (CMD%u): %d, 
retrying...\n",
                                        mmc_hostname(host),
                                        cmd->opcode, cmd->error);
@@ -447,6 +452,7 @@ static void mmc_wait_for_req_done(struct mmc_host *host,
                                  struct mmc_request *mrq)
 {
        struct mmc_command *cmd;
+       int err;
 
        while (1) {
                wait_for_completion(&mrq->completion);
@@ -474,6 +480,12 @@ static void mmc_wait_for_req_done(struct mmc_host *host,
                    mmc_card_removed(host->card))
                        break;
 
+               err = mmc_retune_retry(host);
+               if (err) {
+                       mmc_host_clk_release(host);
+                       break;
+               }
+
                pr_debug("%s: req failed (CMD%u): %d, retrying...\n",
                         mmc_hostname(host), cmd->opcode, cmd->error);
                cmd->retries--;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to