diff options
| author | Nicolas Boichat <drinkcat@chromium.org> | 2016-03-03 05:19:45 -0500 |
|---|---|---|
| committer | Ulf Hansson <ulf.hansson@linaro.org> | 2016-03-17 09:54:36 -0400 |
| commit | fac49ce575cd86dc5e91049f274750923dfb6840 (patch) | |
| tree | 428341d4f19f8fc4519c3c07eb090597dfe283ac /drivers/mmc | |
| parent | f9bab9d2b169a9e80c1a710b19d792974787e899 (diff) | |
mmc: mediatek: Use mmc_regulator_set_vqmmc in start_signal_voltage_switch
We've introduced a new helper in the MMC core:
mmc_regulator_set_vqmmc(). Let's use this in mtk-sd. Using this new
helper has some advantages:
1. We get the mmc_regulator_set_vqmmc() behavior of trying to match
VQMMC and VMMC when the signal voltage is 3.3V. This ensures max
compatibility.
2. We get rid of a few more warnings when probing unsupported
voltages.
3. We get rid of some non-mediatek specific code in mtk-sd.
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
| -rw-r--r-- | drivers/mmc/host/mtk-sd.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 07809f4007be..b17f30da97da 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c | |||
| @@ -1021,26 +1021,19 @@ static void msdc_set_buswidth(struct msdc_host *host, u32 width) | |||
| 1021 | static int msdc_ops_switch_volt(struct mmc_host *mmc, struct mmc_ios *ios) | 1021 | static int msdc_ops_switch_volt(struct mmc_host *mmc, struct mmc_ios *ios) |
| 1022 | { | 1022 | { |
| 1023 | struct msdc_host *host = mmc_priv(mmc); | 1023 | struct msdc_host *host = mmc_priv(mmc); |
| 1024 | int min_uv, max_uv; | ||
| 1025 | int ret = 0; | 1024 | int ret = 0; |
| 1026 | 1025 | ||
| 1027 | if (!IS_ERR(mmc->supply.vqmmc)) { | 1026 | if (!IS_ERR(mmc->supply.vqmmc)) { |
| 1028 | if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) { | 1027 | if (ios->signal_voltage != MMC_SIGNAL_VOLTAGE_330 && |
| 1029 | min_uv = 3300000; | 1028 | ios->signal_voltage != MMC_SIGNAL_VOLTAGE_180) { |
| 1030 | max_uv = 3300000; | ||
| 1031 | } else if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180) { | ||
| 1032 | min_uv = 1800000; | ||
| 1033 | max_uv = 1800000; | ||
| 1034 | } else { | ||
| 1035 | dev_err(host->dev, "Unsupported signal voltage!\n"); | 1029 | dev_err(host->dev, "Unsupported signal voltage!\n"); |
| 1036 | return -EINVAL; | 1030 | return -EINVAL; |
| 1037 | } | 1031 | } |
| 1038 | 1032 | ||
| 1039 | ret = regulator_set_voltage(mmc->supply.vqmmc, min_uv, max_uv); | 1033 | ret = mmc_regulator_set_vqmmc(mmc, ios); |
| 1040 | if (ret) { | 1034 | if (ret) { |
| 1041 | dev_dbg(host->dev, | 1035 | dev_dbg(host->dev, "Regulator set error %d (%d)\n", |
| 1042 | "Regulator set error %d: %d - %d\n", | 1036 | ret, ios->signal_voltage); |
| 1043 | ret, min_uv, max_uv); | ||
| 1044 | } else { | 1037 | } else { |
| 1045 | /* Apply different pinctrl settings for different signal voltage */ | 1038 | /* Apply different pinctrl settings for different signal voltage */ |
| 1046 | if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180) | 1039 | if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180) |
