Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312835
b: refs/heads/master
c: bad37e1
h: refs/heads/master
i:
  312833: 352ff66
  312831: fe104cd
v: v3
  • Loading branch information
Philip Rakity authored and Chris Ball committed Jul 21, 2012
1 parent c1e4a2f commit 156737d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e480606ad43bb72fd82a9bd99cdcf21829a6e9c0
refs/heads/master: bad37e1ac6b1a73ed30702b24a45c27c4f53aada
28 changes: 22 additions & 6 deletions trunk/drivers/mmc/host/sdhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -2837,6 +2837,13 @@ int sdhci_add_host(struct sdhci_host *host)
SDHCI_RETUNING_MODE_SHIFT;

ocr_avail = 0;

host->vmmc = regulator_get(mmc_dev(mmc), "vmmc");
if (IS_ERR(host->vmmc)) {
pr_info("%s: no vmmc regulator found\n", mmc_hostname(mmc));
host->vmmc = NULL;
}

/*
* 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
Expand All @@ -2845,6 +2852,21 @@ int sdhci_add_host(struct sdhci_host *host)
* value.
*/
max_current_caps = sdhci_readl(host, SDHCI_MAX_CURRENT);
if (!max_current_caps && host->vmmc) {
u32 curr = regulator_get_current_limit(host->vmmc);
if (curr > 0) {

/* convert to SDHCI_MAX_CURRENT format */
curr = curr/1000; /* convert to mA */
curr = curr/SDHCI_MAX_CURRENT_MULTIPLIER;

curr = min_t(u32, curr, SDHCI_MAX_CURRENT_LIMIT);
max_current_caps =
(curr << SDHCI_MAX_CURRENT_330_SHIFT) |
(curr << SDHCI_MAX_CURRENT_300_SHIFT) |
(curr << SDHCI_MAX_CURRENT_180_SHIFT);
}
}

if (caps[0] & SDHCI_CAN_VDD_330) {
int max_current_330;
Expand Down Expand Up @@ -2995,12 +3017,6 @@ int sdhci_add_host(struct sdhci_host *host)
if (ret)
goto untasklet;

host->vmmc = regulator_get(mmc_dev(mmc), "vmmc");
if (IS_ERR(host->vmmc)) {
pr_info("%s: no vmmc regulator found\n", mmc_hostname(mmc));
host->vmmc = NULL;
}

sdhci_init(host, 0);

#ifdef CONFIG_MMC_DEBUG
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/mmc/host/sdhci.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
#define SDHCI_CAPABILITIES_1 0x44

#define SDHCI_MAX_CURRENT 0x48
#define SDHCI_MAX_CURRENT_LIMIT 0xFF
#define SDHCI_MAX_CURRENT_330_MASK 0x0000FF
#define SDHCI_MAX_CURRENT_330_SHIFT 0
#define SDHCI_MAX_CURRENT_300_MASK 0x00FF00
Expand Down

0 comments on commit 156737d

Please sign in to comment.