diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2014-12-05 12:40:59 -0500 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2015-01-19 03:56:30 -0500 |
commit | 63e415c64003fd62a302a1dc19f082e2c6f1b7cc (patch) | |
tree | 87a6a228a7f2b2fc19c9e3f67b1339181b930f05 /drivers/mmc/core/core.c | |
parent | fdb9de129e1d68e1b804bc9c8b3027bea9b88bc8 (diff) |
mmc: core: Simplify by adding mmc_execute_tuning()
For each MMC, SD and SDIO there is code that
holds the clock, calls ops->execute_tuning, and
releases the clock. Simplify the code a bit by
providing a separate function to do that.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/core/core.c')
-rw-r--r-- | drivers/mmc/core/core.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 2cdb06e0643e..dc9eb013db5f 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -1077,6 +1077,30 @@ void mmc_set_ungated(struct mmc_host *host) | |||
1077 | } | 1077 | } |
1078 | #endif | 1078 | #endif |
1079 | 1079 | ||
1080 | int mmc_execute_tuning(struct mmc_card *card) | ||
1081 | { | ||
1082 | struct mmc_host *host = card->host; | ||
1083 | u32 opcode; | ||
1084 | int err; | ||
1085 | |||
1086 | if (!host->ops->execute_tuning) | ||
1087 | return 0; | ||
1088 | |||
1089 | if (mmc_card_mmc(card)) | ||
1090 | opcode = MMC_SEND_TUNING_BLOCK_HS200; | ||
1091 | else | ||
1092 | opcode = MMC_SEND_TUNING_BLOCK; | ||
1093 | |||
1094 | mmc_host_clk_hold(host); | ||
1095 | err = host->ops->execute_tuning(host, opcode); | ||
1096 | mmc_host_clk_release(host); | ||
1097 | |||
1098 | if (err) | ||
1099 | pr_err("%s: tuning execution failed\n", mmc_hostname(host)); | ||
1100 | |||
1101 | return err; | ||
1102 | } | ||
1103 | |||
1080 | /* | 1104 | /* |
1081 | * Change the bus mode (open drain/push-pull) of a host. | 1105 | * Change the bus mode (open drain/push-pull) of a host. |
1082 | */ | 1106 | */ |