aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/au1xmmc.c59
-rw-r--r--drivers/mmc/mmc.c28
-rw-r--r--drivers/mmc/mmc_block.c8
-rw-r--r--drivers/mmc/mmci.c11
-rw-r--r--drivers/mmc/pxamci.c9
-rw-r--r--drivers/mmc/wbsd.c8
-rw-r--r--include/linux/mmc/mmc.h35
-rw-r--r--include/linux/mmc/protocol.h2
8 files changed, 84 insertions, 76 deletions
diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/au1xmmc.c
index aaf04638054e..227c39a7c1b4 100644
--- a/drivers/mmc/au1xmmc.c
+++ b/drivers/mmc/au1xmmc.c
@@ -194,7 +194,7 @@ static int au1xmmc_send_command(struct au1xmmc_host *host, int wait,
194 194
195 u32 mmccmd = (cmd->opcode << SD_CMD_CI_SHIFT); 195 u32 mmccmd = (cmd->opcode << SD_CMD_CI_SHIFT);
196 196
197 switch(cmd->flags) { 197 switch (mmc_rsp_type(cmd->flags)) {
198 case MMC_RSP_R1: 198 case MMC_RSP_R1:
199 mmccmd |= SD_CMD_RT_1; 199 mmccmd |= SD_CMD_RT_1;
200 break; 200 break;
@@ -483,34 +483,35 @@ static void au1xmmc_cmd_complete(struct au1xmmc_host *host, u32 status)
483 cmd = mrq->cmd; 483 cmd = mrq->cmd;
484 cmd->error = MMC_ERR_NONE; 484 cmd->error = MMC_ERR_NONE;
485 485
486 if ((cmd->flags & MMC_RSP_MASK) == MMC_RSP_SHORT) { 486 if (cmd->flags & MMC_RSP_PRESENT) {
487 487 if (cmd->flags & MMC_RSP_136) {
488 /* Techincally, we should be getting all 48 bits of the response 488 u32 r[4];
489 * (SD_RESP1 + SD_RESP2), but because our response omits the CRC, 489 int i;
490 * our data ends up being shifted 8 bits to the right. In this case, 490
491 * that means that the OSR data starts at bit 31, so we can just 491 r[0] = au_readl(host->iobase + SD_RESP3);
492 * read RESP0 and return that 492 r[1] = au_readl(host->iobase + SD_RESP2);
493 */ 493 r[2] = au_readl(host->iobase + SD_RESP1);
494 494 r[3] = au_readl(host->iobase + SD_RESP0);
495 cmd->resp[0] = au_readl(host->iobase + SD_RESP0); 495
496 } 496 /* The CRC is omitted from the response, so really
497 else if ((cmd->flags & MMC_RSP_MASK) == MMC_RSP_LONG) { 497 * we only got 120 bytes, but the engine expects
498 u32 r[4]; 498 * 128 bits, so we have to shift things up
499 int i; 499 */
500 500
501 r[0] = au_readl(host->iobase + SD_RESP3); 501 for(i = 0; i < 4; i++) {
502 r[1] = au_readl(host->iobase + SD_RESP2); 502 cmd->resp[i] = (r[i] & 0x00FFFFFF) << 8;
503 r[2] = au_readl(host->iobase + SD_RESP1); 503 if (i != 3)
504 r[3] = au_readl(host->iobase + SD_RESP0); 504 cmd->resp[i] |= (r[i + 1] & 0xFF000000) >> 24;
505 505 }
506 /* The CRC is omitted from the response, so really we only got 506 } else {
507 * 120 bytes, but the engine expects 128 bits, so we have to shift 507 /* Techincally, we should be getting all 48 bits of
508 * things up 508 * the response (SD_RESP1 + SD_RESP2), but because
509 */ 509 * our response omits the CRC, our data ends up
510 510 * being shifted 8 bits to the right. In this case,
511 for(i = 0; i < 4; i++) { 511 * that means that the OSR data starts at bit 31,
512 cmd->resp[i] = (r[i] & 0x00FFFFFF) << 8; 512 * so we can just read RESP0 and return that
513 if (i != 3) cmd->resp[i] |= (r[i + 1] & 0xFF000000) >> 24; 513 */
514 cmd->resp[0] = au_readl(host->iobase + SD_RESP0);
514 } 515 }
515 } 516 }
516 517
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index bfca5c176e88..1888060c5e0c 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -211,7 +211,7 @@ int mmc_wait_for_app_cmd(struct mmc_host *host, unsigned int rca,
211 211
212 appcmd.opcode = MMC_APP_CMD; 212 appcmd.opcode = MMC_APP_CMD;
213 appcmd.arg = rca << 16; 213 appcmd.arg = rca << 16;
214 appcmd.flags = MMC_RSP_R1; 214 appcmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
215 appcmd.retries = 0; 215 appcmd.retries = 0;
216 memset(appcmd.resp, 0, sizeof(appcmd.resp)); 216 memset(appcmd.resp, 0, sizeof(appcmd.resp));
217 appcmd.data = NULL; 217 appcmd.data = NULL;
@@ -331,7 +331,7 @@ static int mmc_select_card(struct mmc_host *host, struct mmc_card *card)
331 331
332 cmd.opcode = MMC_SELECT_CARD; 332 cmd.opcode = MMC_SELECT_CARD;
333 cmd.arg = card->rca << 16; 333 cmd.arg = card->rca << 16;
334 cmd.flags = MMC_RSP_R1; 334 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
335 335
336 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES); 336 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
337 if (err != MMC_ERR_NONE) 337 if (err != MMC_ERR_NONE)
@@ -358,7 +358,7 @@ static int mmc_select_card(struct mmc_host *host, struct mmc_card *card)
358 struct mmc_command cmd; 358 struct mmc_command cmd;
359 cmd.opcode = SD_APP_SET_BUS_WIDTH; 359 cmd.opcode = SD_APP_SET_BUS_WIDTH;
360 cmd.arg = SD_BUS_WIDTH_4; 360 cmd.arg = SD_BUS_WIDTH_4;
361 cmd.flags = MMC_RSP_R1; 361 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
362 362
363 err = mmc_wait_for_app_cmd(host, card->rca, &cmd, 363 err = mmc_wait_for_app_cmd(host, card->rca, &cmd,
364 CMD_RETRIES); 364 CMD_RETRIES);
@@ -386,7 +386,7 @@ static void mmc_deselect_cards(struct mmc_host *host)
386 386
387 cmd.opcode = MMC_SELECT_CARD; 387 cmd.opcode = MMC_SELECT_CARD;
388 cmd.arg = 0; 388 cmd.arg = 0;
389 cmd.flags = MMC_RSP_NONE; 389 cmd.flags = MMC_RSP_NONE | MMC_CMD_AC;
390 390
391 mmc_wait_for_cmd(host, &cmd, 0); 391 mmc_wait_for_cmd(host, &cmd, 0);
392 } 392 }
@@ -677,7 +677,7 @@ static void mmc_idle_cards(struct mmc_host *host)
677 677
678 cmd.opcode = MMC_GO_IDLE_STATE; 678 cmd.opcode = MMC_GO_IDLE_STATE;
679 cmd.arg = 0; 679 cmd.arg = 0;
680 cmd.flags = MMC_RSP_NONE; 680 cmd.flags = MMC_RSP_NONE | MMC_CMD_BC;
681 681
682 mmc_wait_for_cmd(host, &cmd, 0); 682 mmc_wait_for_cmd(host, &cmd, 0);
683 683
@@ -738,7 +738,7 @@ static int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
738 738
739 cmd.opcode = MMC_SEND_OP_COND; 739 cmd.opcode = MMC_SEND_OP_COND;
740 cmd.arg = ocr; 740 cmd.arg = ocr;
741 cmd.flags = MMC_RSP_R3; 741 cmd.flags = MMC_RSP_R3 | MMC_CMD_BCR;
742 742
743 for (i = 100; i; i--) { 743 for (i = 100; i; i--) {
744 err = mmc_wait_for_cmd(host, &cmd, 0); 744 err = mmc_wait_for_cmd(host, &cmd, 0);
@@ -766,7 +766,7 @@ static int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
766 766
767 cmd.opcode = SD_APP_OP_COND; 767 cmd.opcode = SD_APP_OP_COND;
768 cmd.arg = ocr; 768 cmd.arg = ocr;
769 cmd.flags = MMC_RSP_R3; 769 cmd.flags = MMC_RSP_R3 | MMC_CMD_BCR;
770 770
771 for (i = 100; i; i--) { 771 for (i = 100; i; i--) {
772 err = mmc_wait_for_app_cmd(host, 0, &cmd, CMD_RETRIES); 772 err = mmc_wait_for_app_cmd(host, 0, &cmd, CMD_RETRIES);
@@ -805,7 +805,7 @@ static void mmc_discover_cards(struct mmc_host *host)
805 805
806 cmd.opcode = MMC_ALL_SEND_CID; 806 cmd.opcode = MMC_ALL_SEND_CID;
807 cmd.arg = 0; 807 cmd.arg = 0;
808 cmd.flags = MMC_RSP_R2; 808 cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR;
809 809
810 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES); 810 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
811 if (err == MMC_ERR_TIMEOUT) { 811 if (err == MMC_ERR_TIMEOUT) {
@@ -835,7 +835,7 @@ static void mmc_discover_cards(struct mmc_host *host)
835 835
836 cmd.opcode = SD_SEND_RELATIVE_ADDR; 836 cmd.opcode = SD_SEND_RELATIVE_ADDR;
837 cmd.arg = 0; 837 cmd.arg = 0;
838 cmd.flags = MMC_RSP_R6; 838 cmd.flags = MMC_RSP_R6 | MMC_CMD_BCR;
839 839
840 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES); 840 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
841 if (err != MMC_ERR_NONE) 841 if (err != MMC_ERR_NONE)
@@ -856,7 +856,7 @@ static void mmc_discover_cards(struct mmc_host *host)
856 } else { 856 } else {
857 cmd.opcode = MMC_SET_RELATIVE_ADDR; 857 cmd.opcode = MMC_SET_RELATIVE_ADDR;
858 cmd.arg = card->rca << 16; 858 cmd.arg = card->rca << 16;
859 cmd.flags = MMC_RSP_R1; 859 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
860 860
861 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES); 861 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
862 if (err != MMC_ERR_NONE) 862 if (err != MMC_ERR_NONE)
@@ -878,7 +878,7 @@ static void mmc_read_csds(struct mmc_host *host)
878 878
879 cmd.opcode = MMC_SEND_CSD; 879 cmd.opcode = MMC_SEND_CSD;
880 cmd.arg = card->rca << 16; 880 cmd.arg = card->rca << 16;
881 cmd.flags = MMC_RSP_R2; 881 cmd.flags = MMC_RSP_R2 | MMC_CMD_AC;
882 882
883 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES); 883 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
884 if (err != MMC_ERR_NONE) { 884 if (err != MMC_ERR_NONE) {
@@ -920,7 +920,7 @@ static void mmc_read_scrs(struct mmc_host *host)
920 920
921 cmd.opcode = MMC_APP_CMD; 921 cmd.opcode = MMC_APP_CMD;
922 cmd.arg = card->rca << 16; 922 cmd.arg = card->rca << 16;
923 cmd.flags = MMC_RSP_R1; 923 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
924 924
925 err = mmc_wait_for_cmd(host, &cmd, 0); 925 err = mmc_wait_for_cmd(host, &cmd, 0);
926 if ((err != MMC_ERR_NONE) || !(cmd.resp[0] & R1_APP_CMD)) { 926 if ((err != MMC_ERR_NONE) || !(cmd.resp[0] & R1_APP_CMD)) {
@@ -932,7 +932,7 @@ static void mmc_read_scrs(struct mmc_host *host)
932 932
933 cmd.opcode = SD_APP_SEND_SCR; 933 cmd.opcode = SD_APP_SEND_SCR;
934 cmd.arg = 0; 934 cmd.arg = 0;
935 cmd.flags = MMC_RSP_R1; 935 cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
936 936
937 memset(&data, 0, sizeof(struct mmc_data)); 937 memset(&data, 0, sizeof(struct mmc_data));
938 938
@@ -1003,7 +1003,7 @@ static void mmc_check_cards(struct mmc_host *host)
1003 1003
1004 cmd.opcode = MMC_SEND_STATUS; 1004 cmd.opcode = MMC_SEND_STATUS;
1005 cmd.arg = card->rca << 16; 1005 cmd.arg = card->rca << 16;
1006 cmd.flags = MMC_RSP_R1; 1006 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
1007 1007
1008 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES); 1008 err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
1009 if (err == MMC_ERR_NONE) 1009 if (err == MMC_ERR_NONE)
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c
index 5b014c370e80..8eb2a2ede64b 100644
--- a/drivers/mmc/mmc_block.c
+++ b/drivers/mmc/mmc_block.c
@@ -171,14 +171,14 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
171 brq.mrq.data = &brq.data; 171 brq.mrq.data = &brq.data;
172 172
173 brq.cmd.arg = req->sector << 9; 173 brq.cmd.arg = req->sector << 9;
174 brq.cmd.flags = MMC_RSP_R1; 174 brq.cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
175 brq.data.timeout_ns = card->csd.tacc_ns * 10; 175 brq.data.timeout_ns = card->csd.tacc_ns * 10;
176 brq.data.timeout_clks = card->csd.tacc_clks * 10; 176 brq.data.timeout_clks = card->csd.tacc_clks * 10;
177 brq.data.blksz_bits = md->block_bits; 177 brq.data.blksz_bits = md->block_bits;
178 brq.data.blocks = req->nr_sectors >> (md->block_bits - 9); 178 brq.data.blocks = req->nr_sectors >> (md->block_bits - 9);
179 brq.stop.opcode = MMC_STOP_TRANSMISSION; 179 brq.stop.opcode = MMC_STOP_TRANSMISSION;
180 brq.stop.arg = 0; 180 brq.stop.arg = 0;
181 brq.stop.flags = MMC_RSP_R1B; 181 brq.stop.flags = MMC_RSP_R1B | MMC_CMD_AC;
182 182
183 if (rq_data_dir(req) == READ) { 183 if (rq_data_dir(req) == READ) {
184 brq.cmd.opcode = brq.data.blocks > 1 ? MMC_READ_MULTIPLE_BLOCK : MMC_READ_SINGLE_BLOCK; 184 brq.cmd.opcode = brq.data.blocks > 1 ? MMC_READ_MULTIPLE_BLOCK : MMC_READ_SINGLE_BLOCK;
@@ -223,7 +223,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
223 223
224 cmd.opcode = MMC_SEND_STATUS; 224 cmd.opcode = MMC_SEND_STATUS;
225 cmd.arg = card->rca << 16; 225 cmd.arg = card->rca << 16;
226 cmd.flags = MMC_RSP_R1; 226 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
227 err = mmc_wait_for_cmd(card->host, &cmd, 5); 227 err = mmc_wait_for_cmd(card->host, &cmd, 5);
228 if (err) { 228 if (err) {
229 printk(KERN_ERR "%s: error %d requesting status\n", 229 printk(KERN_ERR "%s: error %d requesting status\n",
@@ -430,7 +430,7 @@ mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
430 mmc_card_claim_host(card); 430 mmc_card_claim_host(card);
431 cmd.opcode = MMC_SET_BLOCKLEN; 431 cmd.opcode = MMC_SET_BLOCKLEN;
432 cmd.arg = 1 << md->block_bits; 432 cmd.arg = 1 << md->block_bits;
433 cmd.flags = MMC_RSP_R1; 433 cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
434 err = mmc_wait_for_cmd(card->host, &cmd, 5); 434 err = mmc_wait_for_cmd(card->host, &cmd, 5);
435 mmc_card_release_host(card); 435 mmc_card_release_host(card);
436 436
diff --git a/drivers/mmc/mmci.c b/drivers/mmc/mmci.c
index 634ef53e85a5..37ee7f8dc82f 100644
--- a/drivers/mmc/mmci.c
+++ b/drivers/mmc/mmci.c
@@ -124,15 +124,10 @@ mmci_start_command(struct mmci_host *host, struct mmc_command *cmd, u32 c)
124 } 124 }
125 125
126 c |= cmd->opcode | MCI_CPSM_ENABLE; 126 c |= cmd->opcode | MCI_CPSM_ENABLE;
127 switch (cmd->flags & MMC_RSP_MASK) { 127 if (cmd->flags & MMC_RSP_PRESENT) {
128 case MMC_RSP_NONE: 128 if (cmd->flags & MMC_RSP_136)
129 default: 129 c |= MCI_CPSM_LONGRSP;
130 break;
131 case MMC_RSP_LONG:
132 c |= MCI_CPSM_LONGRSP;
133 case MMC_RSP_SHORT:
134 c |= MCI_CPSM_RESPONSE; 130 c |= MCI_CPSM_RESPONSE;
135 break;
136 } 131 }
137 if (/*interrupt*/0) 132 if (/*interrupt*/0)
138 c |= MCI_CPSM_INTERRUPT; 133 c |= MCI_CPSM_INTERRUPT;
diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c
index ee8f8a0420d1..285d7d068097 100644
--- a/drivers/mmc/pxamci.c
+++ b/drivers/mmc/pxamci.c
@@ -178,14 +178,15 @@ static void pxamci_start_cmd(struct pxamci_host *host, struct mmc_command *cmd,
178 if (cmd->flags & MMC_RSP_BUSY) 178 if (cmd->flags & MMC_RSP_BUSY)
179 cmdat |= CMDAT_BUSY; 179 cmdat |= CMDAT_BUSY;
180 180
181 switch (cmd->flags & (MMC_RSP_MASK | MMC_RSP_CRC)) { 181#define RSP_TYPE(x) ((x) & ~(MMC_RSP_BUSY|MMC_RSP_OPCODE))
182 case MMC_RSP_SHORT | MMC_RSP_CRC: 182 switch (RSP_TYPE(mmc_resp_type(cmd))) {
183 case RSP_TYPE(MMC_RSP_R1): /* r1, r1b, r6 */
183 cmdat |= CMDAT_RESP_SHORT; 184 cmdat |= CMDAT_RESP_SHORT;
184 break; 185 break;
185 case MMC_RSP_SHORT: 186 case RSP_TYPE(MMC_RSP_R3):
186 cmdat |= CMDAT_RESP_R3; 187 cmdat |= CMDAT_RESP_R3;
187 break; 188 break;
188 case MMC_RSP_LONG | MMC_RSP_CRC: 189 case RSP_TYPE(MMC_RSP_R2):
189 cmdat |= CMDAT_RESP_R2; 190 cmdat |= CMDAT_RESP_R2;
190 break; 191 break;
191 default: 192 default:
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c
index f25757625361..3be397d436fa 100644
--- a/drivers/mmc/wbsd.c
+++ b/drivers/mmc/wbsd.c
@@ -459,7 +459,7 @@ static void wbsd_send_command(struct wbsd_host *host, struct mmc_command *cmd)
459 /* 459 /*
460 * Do we expect a reply? 460 * Do we expect a reply?
461 */ 461 */
462 if ((cmd->flags & MMC_RSP_MASK) != MMC_RSP_NONE) { 462 if (cmd->flags & MMC_RSP_PRESENT) {
463 /* 463 /*
464 * Read back status. 464 * Read back status.
465 */ 465 */
@@ -476,10 +476,10 @@ static void wbsd_send_command(struct wbsd_host *host, struct mmc_command *cmd)
476 cmd->error = MMC_ERR_BADCRC; 476 cmd->error = MMC_ERR_BADCRC;
477 /* All ok */ 477 /* All ok */
478 else { 478 else {
479 if ((cmd->flags & MMC_RSP_MASK) == MMC_RSP_SHORT) 479 if (cmd->flags & MMC_RSP_136)
480 wbsd_get_short_reply(host, cmd);
481 else
482 wbsd_get_long_reply(host, cmd); 480 wbsd_get_long_reply(host, cmd);
481 else
482 wbsd_get_short_reply(host, cmd);
483 } 483 }
484 } 484 }
485 485
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index ccd3e13de1e8..f38872abc126 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -21,24 +21,35 @@ struct mmc_command {
21 u32 arg; 21 u32 arg;
22 u32 resp[4]; 22 u32 resp[4];
23 unsigned int flags; /* expected response type */ 23 unsigned int flags; /* expected response type */
24#define MMC_RSP_NONE (0 << 0) 24#define MMC_RSP_PRESENT (1 << 0)
25#define MMC_RSP_SHORT (1 << 0) 25#define MMC_RSP_136 (1 << 1) /* 136 bit response */
26#define MMC_RSP_LONG (2 << 0) 26#define MMC_RSP_CRC (1 << 2) /* expect valid crc */
27#define MMC_RSP_MASK (3 << 0) 27#define MMC_RSP_BUSY (1 << 3) /* card may send busy */
28#define MMC_RSP_CRC (1 << 3) /* expect valid crc */ 28#define MMC_RSP_OPCODE (1 << 4) /* response contains opcode */
29#define MMC_RSP_BUSY (1 << 4) /* card may send busy */ 29#define MMC_CMD_MASK (3 << 5) /* command type */
30#define MMC_RSP_OPCODE (1 << 5) /* response contains opcode */ 30#define MMC_CMD_AC (0 << 5)
31#define MMC_CMD_ADTC (1 << 5)
32#define MMC_CMD_BC (2 << 5)
33#define MMC_CMD_BCR (3 << 5)
31 34
32/* 35/*
33 * These are the response types, and correspond to valid bit 36 * These are the response types, and correspond to valid bit
34 * patterns of the above flags. One additional valid pattern 37 * patterns of the above flags. One additional valid pattern
35 * is all zeros, which means we don't expect a response. 38 * is all zeros, which means we don't expect a response.
36 */ 39 */
37#define MMC_RSP_R1 (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_OPCODE) 40#define MMC_RSP_NONE (0)
38#define MMC_RSP_R1B (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_OPCODE|MMC_RSP_BUSY) 41#define MMC_RSP_R1 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
39#define MMC_RSP_R2 (MMC_RSP_LONG|MMC_RSP_CRC) 42#define MMC_RSP_R1B (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE|MMC_RSP_BUSY)
40#define MMC_RSP_R3 (MMC_RSP_SHORT) 43#define MMC_RSP_R2 (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC)
41#define MMC_RSP_R6 (MMC_RSP_SHORT|MMC_RSP_CRC) 44#define MMC_RSP_R3 (MMC_RSP_PRESENT)
45#define MMC_RSP_R6 (MMC_RSP_PRESENT|MMC_RSP_CRC)
46
47#define mmc_resp_type(cmd) ((cmd)->flags & (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY|MMC_RSP_OPCODE))
48
49/*
50 * These are the command types.
51 */
52#define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_TYPE)
42 53
43 unsigned int retries; /* max number of retries */ 54 unsigned int retries; /* max number of retries */
44 unsigned int error; /* command error */ 55 unsigned int error; /* command error */
diff --git a/include/linux/mmc/protocol.h b/include/linux/mmc/protocol.h
index a14dc306545b..81c3f77f652c 100644
--- a/include/linux/mmc/protocol.h
+++ b/include/linux/mmc/protocol.h
@@ -79,7 +79,7 @@
79/* SD commands type argument response */ 79/* SD commands type argument response */
80 /* class 8 */ 80 /* class 8 */
81/* This is basically the same command as for MMC with some quirks. */ 81/* This is basically the same command as for MMC with some quirks. */
82#define SD_SEND_RELATIVE_ADDR 3 /* ac R6 */ 82#define SD_SEND_RELATIVE_ADDR 3 /* bcr R6 */
83 83
84 /* Application commands */ 84 /* Application commands */
85#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */ 85#define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */