summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mci/mci-core.c5
-rw-r--r--include/mci.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 7d43fe3ec3..fd052f16da 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1352,6 +1352,11 @@ static int mci_card_probe(struct mci *mci)
struct mci_host *host = mci->host;
int rc, disknum;
+ if (host->card_present && !host->card_present(host)) {
+ dev_err(mci->mci_dev, "no card inserted\n");
+ return -ENODEV;
+ }
+
/* start with a host interface reset */
rc = (host->init)(host, mci->mci_dev);
if (rc) {
diff --git a/include/mci.h b/include/mci.h
index 0041e2714f..c0d179b592 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -300,6 +300,8 @@ struct mci_host {
void (*set_ios)(struct mci_host*, struct mci_ios *);
/** handle a command */
int (*send_cmd)(struct mci_host*, struct mci_cmd*, struct mci_data*);
+ /** check if a card is inserted */
+ int (*card_present)(struct mci_host *);
};
/** MMC/SD and interface instance information */