summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZiyuan Xu <xzy.xu@rock-chips.com>2017-05-15 09:07:12 +0300
committerKever Yang <kever.yang@rock-chips.com>2017-07-18 17:05:01 +0300
commit3911f57ab6d33a4a9116d4db9d7656b9f66dd534 (patch)
treeaec904bc501302160268e10c8b8013468a814b62
parentfa1b1f8241bd725d7ed3c3a2e4429fca6e7446d9 (diff)
downloadu-boot-3911f57ab6d33a4a9116d4db9d7656b9f66dd534.tar.xz
mmc: dw_mmc: add the support for the tuning scheme
For the HS200/HS400/SDR104, tuning is needed to determine the optimal sampling point. Actual tuning procedure is provided by specific host controller driver. Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
-rw-r--r--drivers/mmc/dw_mmc.c18
-rw-r--r--include/dwmmc.h1
2 files changed, 19 insertions, 0 deletions
diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index 7e9ffc2b85..c05288c8cb 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -404,6 +404,22 @@ static bool dwmci_card_busy(struct mmc *mmc)
}
#ifdef CONFIG_DM_MMC_OPS
+static int dwmci_execute_tuning(struct udevice *dev, u32 opcode)
+{
+ struct mmc *mmc = mmc_get_mmc_dev(dev);
+#else
+static int dwmci_execute_tuning(struct mmc *mmc, u32 opcode)
+{
+#endif
+ struct dwmci_host *host = (struct dwmci_host *)mmc->priv;
+
+ if (!host->execute_tuning)
+ return -EIO;
+
+ return host->execute_tuning(host, opcode);
+}
+
+#ifdef CONFIG_DM_MMC_OPS
static int dwmci_set_ios(struct udevice *dev)
{
struct mmc *mmc = mmc_get_mmc_dev(dev);
@@ -498,6 +514,7 @@ const struct dm_mmc_ops dm_dwmci_ops = {
.card_busy = dwmci_card_busy,
.send_cmd = dwmci_send_cmd,
.set_ios = dwmci_set_ios,
+ .execute_tuning = dwmci_execute_tuning,
};
#else
@@ -506,6 +523,7 @@ static const struct mmc_ops dwmci_ops = {
.send_cmd = dwmci_send_cmd,
.set_ios = dwmci_set_ios,
.init = dwmci_init,
+ .execute_tuning = dwmci_execute_tuning,
};
#endif
diff --git a/include/dwmmc.h b/include/dwmmc.h
index 4dda0091ce..95be7c2092 100644
--- a/include/dwmmc.h
+++ b/include/dwmmc.h
@@ -180,6 +180,7 @@ struct dwmci_host {
* @freq: Frequency the host is trying to achieve
*/
unsigned int (*get_mmc_clk)(struct dwmci_host *host, uint freq);
+ int (*execute_tuning)(struct dwmci_host *host, u32 opcode);
#ifndef CONFIG_BLK
struct mmc_config cfg;
#endif