summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2010-10-11 10:45:36 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2010-10-11 13:22:13 +0200
commitf78e8f84fec3dcaada1a8334c896a99b677bf24f (patch)
treeaecdef8259dd3fe6dbd125c4d3b86c25f56f14ee /drivers
parentc9ec81efa775be1980d125a7ab9ae5cf13cef2c3 (diff)
downloadbarebox-f78e8f84fec3dcaada1a8334c896a99b677bf24f.tar.gz
barebox-f78e8f84fec3dcaada1a8334c896a99b677bf24f.tar.xz
mci: handle SD cards < 2.0 correctly
With SD cards older than 2.0 the sd_send_if_cond() fails. Do not assume it's an MMC card in this case. Instead, assume it's a MMC card if sd_send_op_cond() fails. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mci/mci-core.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index a6c81b8231..57b82bfb0c 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1148,26 +1148,16 @@ static int mci_card_probe(struct device_d *mci_dev)
/* Check if this card can handle the "SD Card Physical Layer Specification 2.0" */
rc = sd_send_if_cond(mci_dev);
- if (rc) {
+ rc = sd_send_op_cond(mci_dev);
+ if (rc && rc == -ETIMEDOUT) {
/* If the command timed out, we check for an MMC card */
- if (rc == -ETIMEDOUT) {
- pr_debug("Card seems to be a MultiMediaCard\n");
- rc = mmc_send_op_cond(mci_dev);
- if (rc) {
- pr_err("MultiMediaCard voltage select failed with %d\n", rc);
- goto on_error;
- }
- } else
- goto on_error;
- } else {
- /* Its a 2.xx card. Setup operation conditions */
- rc = sd_send_op_cond(mci_dev);
- if (rc) {
- pr_debug("Cannot setup SD card's operation condition\n");
- goto on_error;
- }
+ pr_debug("Card seems to be a MultiMediaCard\n");
+ rc = mmc_send_op_cond(mci_dev);
}
+ if (rc)
+ goto on_error;
+
rc = mci_startup(mci_dev);
if (rc) {
printf("Card's startup fails with %d\n", rc);