aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/sdio_ops.c
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-05-21 20:23:20 +0200
committerPierre Ossman <drzeus@drzeus.cx>2007-09-23 19:40:07 +0200
commit5c4e6f1301649d5b29dd0f70e6da83e728ab5ca5 (patch)
tree97d612d990f3b5255b6ea59150f91622699e124f /drivers/mmc/core/sdio_ops.c
parent1d4de9edd6c9ad676b20729ab15c04b78e9a50c5 (diff)
downloadkernel_samsung_tuna-5c4e6f1301649d5b29dd0f70e6da83e728ab5ca5.zip
kernel_samsung_tuna-5c4e6f1301649d5b29dd0f70e6da83e728ab5ca5.tar.gz
kernel_samsung_tuna-5c4e6f1301649d5b29dd0f70e6da83e728ab5ca5.tar.bz2
mmc: detect SDIO cards
Really basic init sequence for SDIO cards. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/core/sdio_ops.c')
-rw-r--r--drivers/mmc/core/sdio_ops.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c
new file mode 100644
index 0000000..d6f9f9d
--- /dev/null
+++ b/drivers/mmc/core/sdio_ops.c
@@ -0,0 +1,49 @@
+/*
+ * linux/drivers/mmc/sdio_ops.c
+ *
+ * Copyright 2006-2007 Pierre Ossman
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
+
+#include <linux/mmc/host.h>
+#include <linux/mmc/mmc.h>
+#include <linux/mmc/sdio.h>
+
+#include "core.h"
+
+int mmc_send_io_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
+{
+ struct mmc_command cmd;
+ int i, err = 0;
+
+ BUG_ON(!host);
+
+ memset(&cmd, 0, sizeof(struct mmc_command));
+
+ cmd.opcode = SD_IO_SEND_OP_COND;
+ cmd.arg = ocr;
+ cmd.flags = MMC_RSP_R4 | MMC_CMD_BCR;
+
+ for (i = 100; i; i--) {
+ err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
+ if (err)
+ break;
+
+ if (cmd.resp[0] & MMC_CARD_BUSY || ocr == 0)
+ break;
+
+ err = -ETIMEDOUT;
+
+ mmc_delay(10);
+ }
+
+ if (rocr)
+ *rocr = cmd.resp[0];
+
+ return err;
+}
+