aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorJohn Grossman <johngro@google.com>2011-10-26 18:48:31 -0700
committerMike J. Chen <mjchen@google.com>2012-03-03 17:29:18 -0800
commit6c28c50a72d4844e318869b4a54e58136c8fbfec (patch)
tree2bca1f0e9ff351fb778504d98849d413d1914153 /drivers/mmc
parent33a3e60d8c15aa5cdd629ce2c692aadf9d3a88bf (diff)
downloaduboot-6c28c50a72d4844e318869b4a54e58136c8fbfec.tar.gz
MMC: Make sure PBIAS config matches VMMC supply.
Depending on the system, VMMC may end up being 3 or 1.8v. It is important that the PBIAS cell be configured to match the supply. Fortunately, the PBIAS cell contains a handy detector which can determine what the supply is set to after PWRDNZ has been released. Use this detector to make sure that the cell is properly configured and does not damage itself. Change-Id: I96d8aff3d19f5ea783ae7eb646a7e3fa920a64be Signed-off-by: John Grossman <johngro@google.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/omap_hsmmc.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index cd73e99e7..e2bd2cf23 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -58,6 +58,7 @@ unsigned char mmc_board_init(struct mmc *mmc)
#if defined(CONFIG_OMAP44XX)
unsigned char data;
+ unsigned int reg;
t2_t *t2_base = (t2_t *)T2_BASE;
switch (mmc->block_dev.dev) {
@@ -73,10 +74,37 @@ unsigned char mmc_board_init(struct mmc *mmc)
data = 0x15;
i2c_write(0x48, 0x9B, 1, &data, 1);
- /* SLOT-0 PBIAS config */
- writel(readl(&t2_base->pbias_lite) |
- MMC1_PBIASLITE_PWRDNZ | MMC1_PWRDNZ,
- &t2_base->pbias_lite);
+ /* Wait for the power to stabilize before setting PWRDNZ */
+ udelay(100);
+
+ /* SLOT-0 PBIAS config - 3v IO */
+ reg = readl(&t2_base->pbias_lite);
+ reg |= MMC1_PBIASLITE_VMODE |
+ MMC1_PBIASLITE_PWRDNZ |
+ MMC1_PWRDNZ;
+ writel(reg, &t2_base->pbias_lite);
+
+ /* Wait for the the supply detector to tell us if there is a
+ * mismatch between the PBIAS supply and what we have configured
+ * IO for
+ */
+ udelay(100);
+ reg = readl(&t2_base->pbias_lite);
+ if (!(reg & MMC1_PBIASLITE_SUPPLY_HI_OUT)) {
+ printf("Warning: 1.8v PBIAS supply detected after"
+ " configuring for 3v. Switching to 1.8v"
+ " configuration.\n");
+ reg &= ~(MMC1_PBIASLITE_VMODE |
+ MMC1_PBIASLITE_PWRDNZ |
+ MMC1_PWRDNZ);
+ writel(reg, &t2_base->pbias_lite);
+
+ udelay(100);
+ reg = readl(&t2_base->pbias_lite);
+ reg |= MMC1_PBIASLITE_PWRDNZ |
+ MMC1_PWRDNZ;
+ writel(reg, &t2_base->pbias_lite);
+ }
writel(readl(&t2_base->control_mmc1) | SDMMC1_DR2_SPEEDCTRL |
SDMMC1_DR1_SPEEDCTRL | SDMMC1_DR0_SPEEDCTRL |