diff options
author | Kevin Liu <kliu5@marvell.com> | 2012-11-20 08:24:32 -0500 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-12-06 13:54:50 -0500 |
commit | cec2e216f72c6b5ccdadb60aadbe99821d744503 (patch) | |
tree | 3868257e68abe81e4ca071290cca2c3e8ee507e2 /drivers/mmc/host/sdhci.c | |
parent | 3a96dff0f828ae9dfb43efd49a9b67a74c6dc360 (diff) |
mmc: sdhci: Use regulator min/max voltage range according to spec
For regulator vmmc/vmmcq, use voltage range as below
3.3v/3.0v: (2.7v, 3.6v)
1.8v: (1.7v, 1.95v)
Original code uses the precise value which may fail in regulator
driver if it does NOT support the precise voltage.
Signed-off-by: Jialing Fu <jlfu@marvell.com>
Signed-off-by: Kevin Liu <kliu5@marvell.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/sdhci.c')
-rw-r--r-- | drivers/mmc/host/sdhci.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 2f62fe4309f2..ec3e984129dc 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -1618,7 +1618,7 @@ static int sdhci_do_3_3v_signal_voltage_switch(struct sdhci_host *host, | |||
1618 | sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2); | 1618 | sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2); |
1619 | 1619 | ||
1620 | if (host->vqmmc) { | 1620 | if (host->vqmmc) { |
1621 | ret = regulator_set_voltage(host->vqmmc, 3300000, 3300000); | 1621 | ret = regulator_set_voltage(host->vqmmc, 2700000, 3600000); |
1622 | if (ret) { | 1622 | if (ret) { |
1623 | pr_warning("%s: Switching to 3.3V signalling voltage " | 1623 | pr_warning("%s: Switching to 3.3V signalling voltage " |
1624 | " failed\n", mmc_hostname(host->mmc)); | 1624 | " failed\n", mmc_hostname(host->mmc)); |
@@ -1662,7 +1662,7 @@ static int sdhci_do_1_8v_signal_voltage_switch(struct sdhci_host *host, | |||
1662 | */ | 1662 | */ |
1663 | if (host->vqmmc) | 1663 | if (host->vqmmc) |
1664 | ret = regulator_set_voltage(host->vqmmc, | 1664 | ret = regulator_set_voltage(host->vqmmc, |
1665 | 1800000, 1800000); | 1665 | 1700000, 1950000); |
1666 | else | 1666 | else |
1667 | ret = 0; | 1667 | ret = 0; |
1668 | 1668 | ||
@@ -2860,8 +2860,8 @@ int sdhci_add_host(struct sdhci_host *host) | |||
2860 | } | 2860 | } |
2861 | } else { | 2861 | } else { |
2862 | regulator_enable(host->vqmmc); | 2862 | regulator_enable(host->vqmmc); |
2863 | if (!regulator_is_supported_voltage(host->vqmmc, 1800000, | 2863 | if (!regulator_is_supported_voltage(host->vqmmc, 1700000, |
2864 | 1800000)) | 2864 | 1950000)) |
2865 | caps[1] &= ~(SDHCI_SUPPORT_SDR104 | | 2865 | caps[1] &= ~(SDHCI_SUPPORT_SDR104 | |
2866 | SDHCI_SUPPORT_SDR50 | | 2866 | SDHCI_SUPPORT_SDR50 | |
2867 | SDHCI_SUPPORT_DDR50); | 2867 | SDHCI_SUPPORT_DDR50); |
@@ -2925,16 +2925,14 @@ int sdhci_add_host(struct sdhci_host *host) | |||
2925 | 2925 | ||
2926 | #ifdef CONFIG_REGULATOR | 2926 | #ifdef CONFIG_REGULATOR |
2927 | if (host->vmmc) { | 2927 | if (host->vmmc) { |
2928 | ret = regulator_is_supported_voltage(host->vmmc, 3300000, | 2928 | ret = regulator_is_supported_voltage(host->vmmc, 2700000, |
2929 | 3300000); | 2929 | 3600000); |
2930 | if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_330))) | 2930 | if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_330))) |
2931 | caps[0] &= ~SDHCI_CAN_VDD_330; | 2931 | caps[0] &= ~SDHCI_CAN_VDD_330; |
2932 | ret = regulator_is_supported_voltage(host->vmmc, 3000000, | ||
2933 | 3000000); | ||
2934 | if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_300))) | 2932 | if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_300))) |
2935 | caps[0] &= ~SDHCI_CAN_VDD_300; | 2933 | caps[0] &= ~SDHCI_CAN_VDD_300; |
2936 | ret = regulator_is_supported_voltage(host->vmmc, 1800000, | 2934 | ret = regulator_is_supported_voltage(host->vmmc, 1700000, |
2937 | 1800000); | 2935 | 1950000); |
2938 | if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_180))) | 2936 | if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_180))) |
2939 | caps[0] &= ~SDHCI_CAN_VDD_180; | 2937 | caps[0] &= ~SDHCI_CAN_VDD_180; |
2940 | } | 2938 | } |