Re: [PATCH][MMC][1/6] Secure Digital (SD) support : protocol

Pierre Ossman
2005-03-06T01:37:19Z

[-- Attachment #1: Type: text/plain, Size: 152 bytes --]

Protocol definitions.

The basic commands needed for the later patches. The R1_APP_CMD seems to
be misdefined in protocol.h so this patch changes it.

[-- Attachment #2: mmc-sd-protocol.patch --]
[-- Type: text/x-patch, Size: 1778 bytes --]

Index: linux-sd/include/linux/mmc/mmc.h
===================================================================
--- linux-sd/include/linux/mmc/mmc.h (revision 135)
+++ linux-sd/include/linux/mmc/mmc.h (working copy)
@@ -37,6 +37,7 @@
#define MMC_RSP_R1B (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_BUSY)
#define MMC_RSP_R2 (MMC_RSP_LONG|MMC_RSP_CRC)
#define MMC_RSP_R3 (MMC_RSP_SHORT)
+#define MMC_RSP_R6 (MMC_RSP_SHORT|MMC_RSP_CRC)

unsigned int retries; /* max number of retries */
unsigned int error; /* command error */
Index: linux-sd/include/linux/mmc/protocol.h
===================================================================
--- linux-sd/include/linux/mmc/protocol.h (revision 135)
+++ linux-sd/include/linux/mmc/protocol.h (working copy)
@@ -76,6 +76,16 @@
#define MMC_APP_CMD 55 /* ac [31:16] RCA R1 */
#define MMC_GEN_CMD 56 /* adtc [0] RD/WR R1b */

+/* SD commands type argument response */
+ /* class 8 */
+/* This is basically the same command as for MMC with some quirks. */
+#define SD_SEND_RELATIVE_ADDR 3 /* ac R6 */
+
+ /* Application commands */
+#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */
+#define SD_APP_OP_COND 41 /* bcr [31:0] OCR R3 */
+#define SD_APP_SEND_SCR 51 /* adtc R1 */
+
/*
MMC status in R1
Type
@@ -113,7 +123,7 @@
#define R1_STATUS(x) (x & 0xFFFFE000)
#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
-#define R1_APP_CMD (1 << 7) /* sr, c */
+#define R1_APP_CMD (1 << 5) /* sr, c */

/* These are unpacked versions of the actual responses */