Commit cec2e216 authored by Kevin Liu's avatar Kevin Liu Committed by Chris Ball

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: default avatarJialing Fu <jlfu@marvell.com>
Signed-off-by: default avatarKevin Liu <kliu5@marvell.com>
Tested-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 3a96dff0
...@@ -1618,7 +1618,7 @@ static int sdhci_do_3_3v_signal_voltage_switch(struct sdhci_host *host, ...@@ -1618,7 +1618,7 @@ static int sdhci_do_3_3v_signal_voltage_switch(struct sdhci_host *host,
sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2); sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2);
if (host->vqmmc) { if (host->vqmmc) {
ret = regulator_set_voltage(host->vqmmc, 3300000, 3300000); ret = regulator_set_voltage(host->vqmmc, 2700000, 3600000);
if (ret) { if (ret) {
pr_warning("%s: Switching to 3.3V signalling voltage " pr_warning("%s: Switching to 3.3V signalling voltage "
" failed\n", mmc_hostname(host->mmc)); " failed\n", mmc_hostname(host->mmc));
...@@ -1662,7 +1662,7 @@ static int sdhci_do_1_8v_signal_voltage_switch(struct sdhci_host *host, ...@@ -1662,7 +1662,7 @@ static int sdhci_do_1_8v_signal_voltage_switch(struct sdhci_host *host,
*/ */
if (host->vqmmc) if (host->vqmmc)
ret = regulator_set_voltage(host->vqmmc, ret = regulator_set_voltage(host->vqmmc,
1800000, 1800000); 1700000, 1950000);
else else
ret = 0; ret = 0;
...@@ -2860,8 +2860,8 @@ int sdhci_add_host(struct sdhci_host *host) ...@@ -2860,8 +2860,8 @@ int sdhci_add_host(struct sdhci_host *host)
} }
} else { } else {
regulator_enable(host->vqmmc); regulator_enable(host->vqmmc);
if (!regulator_is_supported_voltage(host->vqmmc, 1800000, if (!regulator_is_supported_voltage(host->vqmmc, 1700000,
1800000)) 1950000))
caps[1] &= ~(SDHCI_SUPPORT_SDR104 | caps[1] &= ~(SDHCI_SUPPORT_SDR104 |
SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR50 |
SDHCI_SUPPORT_DDR50); SDHCI_SUPPORT_DDR50);
...@@ -2925,16 +2925,14 @@ int sdhci_add_host(struct sdhci_host *host) ...@@ -2925,16 +2925,14 @@ int sdhci_add_host(struct sdhci_host *host)
#ifdef CONFIG_REGULATOR #ifdef CONFIG_REGULATOR
if (host->vmmc) { if (host->vmmc) {
ret = regulator_is_supported_voltage(host->vmmc, 3300000, ret = regulator_is_supported_voltage(host->vmmc, 2700000,
3300000); 3600000);
if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_330))) if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_330)))
caps[0] &= ~SDHCI_CAN_VDD_330; caps[0] &= ~SDHCI_CAN_VDD_330;
ret = regulator_is_supported_voltage(host->vmmc, 3000000,
3000000);
if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_300))) if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_300)))
caps[0] &= ~SDHCI_CAN_VDD_300; caps[0] &= ~SDHCI_CAN_VDD_300;
ret = regulator_is_supported_voltage(host->vmmc, 1800000, ret = regulator_is_supported_voltage(host->vmmc, 1700000,
1800000); 1950000);
if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_180))) if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_180)))
caps[0] &= ~SDHCI_CAN_VDD_180; caps[0] &= ~SDHCI_CAN_VDD_180;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment