Commit 68737043 authored by Philip Rakity's avatar Philip Rakity Committed by Chris Ball

mmc: only support voltage (vdd) that regulator agrees with

If we are using a regulator the SD Host Controller and the
regulator should agree about the voltages supported.  Use
the common subset that is supported.
Signed-off-by: default avatarPhilip Rakity <prakity@marvell.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 0aa67700
...@@ -2844,6 +2844,23 @@ int sdhci_add_host(struct sdhci_host *host) ...@@ -2844,6 +2844,23 @@ int sdhci_add_host(struct sdhci_host *host)
host->vmmc = NULL; host->vmmc = NULL;
} }
#ifdef CONFIG_REGULATOR
if (host->vmmc) {
ret = regulator_is_supported_voltage(host->vmmc, 3300000,
3300000);
if ((ret <= 0) || (!(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)))
caps[0] &= ~SDHCI_CAN_VDD_300;
ret = regulator_is_supported_voltage(host->vmmc, 1800000,
1800000);
if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_180)))
caps[0] &= ~SDHCI_CAN_VDD_180;
}
#endif /* CONFIG_REGULATOR */
/* /*
* According to SD Host Controller spec v3.00, if the Host System * According to SD Host Controller spec v3.00, if the Host System
* can afford more than 150mA, Host Driver should set XPC to 1. Also * can afford more than 150mA, Host Driver should set XPC to 1. Also
......
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