summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2012-08-17 10:18:55 +0000
committerAndy Fleming <afleming@freescale.com>2012-09-05 17:33:25 -0500
commit470dcc7511431db4210a79ea4e6b14cf109a24dc (patch)
tree44b636911e65911f781519fe7cb855ca2ba9084c /drivers/mmc
parent073cfd1c040b9cce9289cacf4d4963460322dc2b (diff)
downloadu-boot-imx-470dcc7511431db4210a79ea4e6b14cf109a24dc.zip
u-boot-imx-470dcc7511431db4210a79ea4e6b14cf109a24dc.tar.gz
u-boot-imx-470dcc7511431db4210a79ea4e6b14cf109a24dc.tar.bz2
mmc: Add a SDHCI quirk for boards that have no CD
Some boards have no Card Detect wired. In that case, set the CD test bits in the standard interface. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Andy Fleming <afleming@freescale.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/sdhci.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index b07dc00..3bb0ad0 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -381,12 +381,25 @@ int sdhci_init(struct mmc *mmc)
}
}
+ sdhci_set_power(host, fls(mmc->voltages) - 1);
+
+ if (host->quirks & SDHCI_QUIRK_NO_CD) {
+ unsigned int status;
+
+ sdhci_writel(host, SDHCI_CTRL_CD_TEST_INS | SDHCI_CTRL_CD_TEST,
+ SDHCI_HOST_CONTROL);
+
+ status = sdhci_readl(host, SDHCI_PRESENT_STATE);
+ while ((!(status & SDHCI_CARD_PRESENT)) ||
+ (!(status & SDHCI_CARD_STATE_STABLE)) ||
+ (!(status & SDHCI_CARD_DETECT_PIN_LEVEL)))
+ status = sdhci_readl(host, SDHCI_PRESENT_STATE);
+ }
+
/* Eable all state */
sdhci_writel(host, SDHCI_INT_ALL_MASK, SDHCI_INT_ENABLE);
sdhci_writel(host, SDHCI_INT_ALL_MASK, SDHCI_SIGNAL_ENABLE);
- sdhci_set_power(host, fls(mmc->voltages) - 1);
-
return 0;
}