summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmandeep Singh <amansing@codeaurora.org>2019-07-24 11:46:12 +0530
committerAmandeep Singh <amansing@codeaurora.org>2019-09-03 11:33:13 +0530
commit2ca7eb28dcac93fcf0818232e10fe51f43acfac1 (patch)
treee0ac01a2d34c7bc16c4825310ace3ac9b6b32333
parentae6070aa42bfab695c8e94c23944e6c28b6deb6f (diff)
mmc: sdhci-msm: Ping with known good phase
Ping with known good phase if last phase of tuning fails. Change-Id: I3d8d8ce3d8a4dc00146668b815b69619d3a4cea8 Signed-off-by: Amandeep Singh <amansing@codeaurora.org>
-rw-r--r--drivers/mmc/host/sdhci-msm.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index a7bd93f4eedb..a7afa467d32f 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -2,7 +2,7 @@
* drivers/mmc/host/sdhci-msm.c - Qualcomm Technologies, Inc. MSM SDHCI Platform
* driver source file
*
- * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -1288,6 +1288,34 @@ retry:
} else {
pr_debug("%s: %s: found ## bad ## phase = %d\n",
mmc_hostname(mmc), __func__, phase);
+
+ if (phase == 15 && tuned_phase_cnt) {
+ pr_err("%s: %s: Ping with known good phase\n",
+ mmc_hostname(mmc), __func__);
+ /* set the phase in delay line hw block */
+ rc = msm_config_cm_dll_phase(host,
+ tuned_phases[tuned_phase_cnt - 1]);
+ if (rc)
+ goto kfree;
+
+ cmd.opcode = opcode;
+ cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
+
+ data.blksz = size;
+ data.blocks = 1;
+ data.flags = MMC_DATA_READ;
+ data.timeout_ns = 1000 * 1000 * 1000;
+
+ data.sg = &sg;
+ data.sg_len = 1;
+ sg_init_one(&sg, data_buf, size);
+ memset(data_buf, 0, size);
+ mmc_wait_for_req(mmc, &mrq);
+
+ if ((cmd.error || data.error))
+ pr_err("%s: %s: Ping with known good phase failed\n",
+ mmc_hostname(mmc), __func__);
+ }
}
} while (++phase < 16);