summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci.c
diff options
context:
space:
mode:
authorPhilip Rakity2012-06-08 21:26:13 +0200
committerChris Ball2012-07-21 06:02:24 +0200
commit68737043bb155b42d54943d25153b901fd16e535 (patch)
treeff60fb287c75717b7e5521f89d09688c5ef13189 /drivers/mmc/host/sdhci.c
parentmmc: sdhci: only set 200mA support for 1.8v if 200mA is available (diff)
downloadkernel-qcow2-linux-68737043bb155b42d54943d25153b901fd16e535.tar.gz
kernel-qcow2-linux-68737043bb155b42d54943d25153b901fd16e535.tar.xz
kernel-qcow2-linux-68737043bb155b42d54943d25153b901fd16e535.zip
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: Philip Rakity <prakity@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/sdhci.c')
-rw-r--r--drivers/mmc/host/sdhci.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 8f61f8d6e0ca..f76736b50bc7 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2844,6 +2844,23 @@ int sdhci_add_host(struct sdhci_host *host)
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
* can afford more than 150mA, Host Driver should set XPC to 1. Also