aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/core/core.c')
-rw-r--r--drivers/mmc/core/core.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 51e611f2f3..092fa906ab 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -32,9 +32,11 @@
32 32
33#include "mmc_ops.h" 33#include "mmc_ops.h"
34#include "sd_ops.h" 34#include "sd_ops.h"
35#include "sdio_ops.h"
35 36
36extern int mmc_attach_mmc(struct mmc_host *host, u32 ocr); 37extern int mmc_attach_mmc(struct mmc_host *host, u32 ocr);
37extern int mmc_attach_sd(struct mmc_host *host, u32 ocr); 38extern int mmc_attach_sd(struct mmc_host *host, u32 ocr);
39extern int mmc_attach_sdio(struct mmc_host *host, u32 ocr);
38 40
39static struct workqueue_struct *workqueue; 41static struct workqueue_struct *workqueue;
40 42
@@ -595,24 +597,38 @@ void mmc_rescan(struct work_struct *work)
595 597
596 mmc_send_if_cond(host, host->ocr_avail); 598 mmc_send_if_cond(host, host->ocr_avail);
597 599
600 /*
601 * First we search for SDIO...
602 */
603 err = mmc_send_io_op_cond(host, 0, &ocr);
604 if (!err) {
605 if (mmc_attach_sdio(host, ocr))
606 mmc_power_off(host);
607 return;
608 }
609
610 /*
611 * ...then normal SD...
612 */
598 err = mmc_send_app_op_cond(host, 0, &ocr); 613 err = mmc_send_app_op_cond(host, 0, &ocr);
599 if (!err) { 614 if (!err) {
600 if (mmc_attach_sd(host, ocr)) 615 if (mmc_attach_sd(host, ocr))
601 mmc_power_off(host); 616 mmc_power_off(host);
602 } else { 617 return;
603 /* 618 }
604 * If we fail to detect any SD cards then try 619
605 * searching for MMC cards. 620 /*
606 */ 621 * ...and finally MMC.
607 err = mmc_send_op_cond(host, 0, &ocr); 622 */
608 if (!err) { 623 err = mmc_send_op_cond(host, 0, &ocr);
609 if (mmc_attach_mmc(host, ocr)) 624 if (!err) {
610 mmc_power_off(host); 625 if (mmc_attach_mmc(host, ocr))
611 } else {
612 mmc_power_off(host); 626 mmc_power_off(host);
613 mmc_release_host(host); 627 return;
614 }
615 } 628 }
629
630 mmc_release_host(host);
631 mmc_power_off(host);
616 } else { 632 } else {
617 if (host->bus_ops->detect && !host->bus_dead) 633 if (host->bus_ops->detect && !host->bus_dead)
618 host->bus_ops->detect(host); 634 host->bus_ops->detect(host);