summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mci/mci-core.c24
-rw-r--r--include/mci.h4
2 files changed, 27 insertions, 1 deletions
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 6c7293a21e..7fb13e7e5a 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -326,6 +326,15 @@ static int mci_go_idle(struct mci *mci)
return 0;
}
+static int sdio_send_op_cond(struct mci *mci)
+{
+ struct mci_cmd cmd;
+
+ mci_setup_cmd(&cmd, SD_IO_SEND_OP_COND, 0, MMC_RSP_SPI_R4 | MMC_RSP_R4 | MMC_CMD_BCR);
+
+ return mci_send_cmd(mci, &cmd, NULL);
+}
+
/**
* FIXME
* @param mci MCI instance
@@ -1690,7 +1699,9 @@ static void mci_info(struct device_d *dev)
mci_print_caps(host->host_caps);
printf("Card information:\n");
- printf(" Attached is a %s card\n", IS_SD(mci) ? "SD" : "MMC");
+ printf(" Card type: %s\n", mci->sdio ? "SDIO" : IS_SD(mci) ? "SD" : "MMC");
+ if (mci->sdio)
+ return;
printf(" Version: %s\n", mci_version_string(mci));
printf(" Capacity: %u MiB\n", (unsigned)(mci->capacity >> 20));
@@ -1903,6 +1914,16 @@ static int mci_card_probe(struct mci *mci)
goto on_error;
}
+ if (!host->no_sdio) {
+ rc = sdio_send_op_cond(mci);
+ if (!rc) {
+ mci->ready_for_use = true;
+ mci->sdio = true;
+ dev_info(&mci->dev, "SDIO card detected, ignoring\n");
+ return 0;
+ }
+ }
+
/* Check if this card can handle the "SD Card Physical Layer Specification 2.0" */
if (!host->no_sd) {
rc = sd_send_if_cond(mci);
@@ -2180,6 +2201,7 @@ void mci_of_parse_node(struct mci_host *host,
host->broken_cd = of_property_read_bool(np, "broken-cd");
host->non_removable = of_property_read_bool(np, "non-removable");
host->no_sd = of_property_read_bool(np, "no-sd");
+ host->no_sdio = of_property_read_bool(np, "no-sdio");
host->disable_wp = of_property_read_bool(np, "disable-wp");
}
diff --git a/include/mci.h b/include/mci.h
index 11651d58e0..d7217fcc99 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -91,6 +91,8 @@
#define SD_CMD_APP_SEND_OP_COND 41
#define SD_CMD_APP_SEND_SCR 51
+#define SD_IO_SEND_OP_COND 5 /* bcr [23:0] OCR R4 */
+
/* SCR definitions in different words */
#define SD_HIGHSPEED_BUSY 0x00020000
#define SD_HIGHSPEED_SUPPORTED 0x00020000
@@ -446,6 +448,7 @@ struct mci_host {
int broken_cd; /**< card detect is broken */
bool non_removable; /**< device is non removable */
bool no_sd; /**< do not send SD commands during initialization */
+ bool no_sdio; /**< do not send SDIO commands during initialization */
bool disable_wp; /**< ignore write-protect detection logic */
struct regulator *supply;
@@ -484,6 +487,7 @@ struct mci {
struct mci_host *host; /**< the host for this card */
struct device_d dev; /**< the device for our disk (mcix) */
unsigned version;
+ bool sdio; /**< card is a SDIO card */
/** != 0 when a high capacity card is connected (OCR -> OCR_HCS) */
int high_capacity;
unsigned card_caps; /**< Card's capabilities */