aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHanumath Prasad <hanumath.prasad@stericsson.com>2010-09-30 17:37:23 -0400
committerChris Ball <cjb@laptop.org>2010-10-23 09:11:16 -0400
commitdfc13e8402c75e7c2e0a52e123c0500a3259866b (patch)
tree29a0f5daeb300da027bb0ed9c042fffd214b078f /drivers
parent99fc5131018cbdc3cf42ce09fb394a4e8b053c74 (diff)
mmc: MMC 4.4 DDR support
Add support for Dual Data Rate MMC cards as defined in the 4.4 specification. Signed-off-by: Hanumath Prasad <hanumath.prasad@stericsson.com> Cc: linux-mmc@vger.kernel.org Acked-by: Linus Walleij <linus.walleij@stericsson.com> Tested-by Zhangfei Gao <zhangfei.gao@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/card/block.c10
-rw-r--r--drivers/mmc/core/mmc.c37
2 files changed, 42 insertions, 5 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 759a105cb216..aab593480975 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -373,7 +373,8 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
373 readcmd = MMC_READ_SINGLE_BLOCK; 373 readcmd = MMC_READ_SINGLE_BLOCK;
374 writecmd = MMC_WRITE_BLOCK; 374 writecmd = MMC_WRITE_BLOCK;
375 } 375 }
376 376 if (mmc_card_ddr_mode(card))
377 brq.data.flags |= MMC_DDR_MODE;
377 if (rq_data_dir(req) == READ) { 378 if (rq_data_dir(req) == READ) {
378 brq.cmd.opcode = readcmd; 379 brq.cmd.opcode = readcmd;
379 brq.data.flags |= MMC_DATA_READ; 380 brq.data.flags |= MMC_DATA_READ;
@@ -655,8 +656,11 @@ mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
655 struct mmc_command cmd; 656 struct mmc_command cmd;
656 int err; 657 int err;
657 658
658 /* Block-addressed cards ignore MMC_SET_BLOCKLEN. */ 659 /*
659 if (mmc_card_blockaddr(card)) 660 * Block-addressed and ddr mode supported cards
661 * ignore MMC_SET_BLOCKLEN.
662 */
663 if (mmc_card_blockaddr(card) || mmc_card_ddr_mode(card))
660 return 0; 664 return 0;
661 665
662 mmc_claim_host(card->host); 666 mmc_claim_host(card->host);
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 6570c03f9c76..66c4a59fee5f 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -258,6 +258,21 @@ static int mmc_read_ext_csd(struct mmc_card *card)
258 } 258 }
259 259
260 switch (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_MASK) { 260 switch (ext_csd[EXT_CSD_CARD_TYPE] & EXT_CSD_CARD_TYPE_MASK) {
261 case EXT_CSD_CARD_TYPE_DDR_52 | EXT_CSD_CARD_TYPE_52 |
262 EXT_CSD_CARD_TYPE_26:
263 card->ext_csd.hs_max_dtr = 52000000;
264 card->ext_csd.card_type = EXT_CSD_CARD_TYPE_DDR_52;
265 break;
266 case EXT_CSD_CARD_TYPE_DDR_1_2V | EXT_CSD_CARD_TYPE_52 |
267 EXT_CSD_CARD_TYPE_26:
268 card->ext_csd.hs_max_dtr = 52000000;
269 card->ext_csd.card_type = EXT_CSD_CARD_TYPE_DDR_1_2V;
270 break;
271 case EXT_CSD_CARD_TYPE_DDR_1_8V | EXT_CSD_CARD_TYPE_52 |
272 EXT_CSD_CARD_TYPE_26:
273 card->ext_csd.hs_max_dtr = 52000000;
274 card->ext_csd.card_type = EXT_CSD_CARD_TYPE_DDR_1_8V;
275 break;
261 case EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26: 276 case EXT_CSD_CARD_TYPE_52 | EXT_CSD_CARD_TYPE_26:
262 card->ext_csd.hs_max_dtr = 52000000; 277 card->ext_csd.hs_max_dtr = 52000000;
263 break; 278 break;
@@ -503,6 +518,18 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
503 mmc_set_clock(host, max_dtr); 518 mmc_set_clock(host, max_dtr);
504 519
505 /* 520 /*
521 * Activate DDR50 mode (if supported).
522 */
523 if (mmc_card_highspeed(card)) {
524 if ((card->ext_csd.card_type & EXT_CSD_CARD_TYPE_DDR_1_8V)
525 && (host->caps & (MMC_CAP_1_8V_DDR)))
526 mmc_card_set_ddr_mode(card);
527 else if ((card->ext_csd.card_type & EXT_CSD_CARD_TYPE_DDR_1_2V)
528 && (host->caps & (MMC_CAP_1_2V_DDR)))
529 mmc_card_set_ddr_mode(card);
530 }
531
532 /*
506 * Activate wide bus (if supported). 533 * Activate wide bus (if supported).
507 */ 534 */
508 if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) && 535 if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) &&
@@ -510,10 +537,16 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
510 unsigned ext_csd_bit, bus_width; 537 unsigned ext_csd_bit, bus_width;
511 538
512 if (host->caps & MMC_CAP_8_BIT_DATA) { 539 if (host->caps & MMC_CAP_8_BIT_DATA) {
513 ext_csd_bit = EXT_CSD_BUS_WIDTH_8; 540 if (mmc_card_ddr_mode(card))
541 ext_csd_bit = EXT_CSD_DDR_BUS_WIDTH_8;
542 else
543 ext_csd_bit = EXT_CSD_BUS_WIDTH_8;
514 bus_width = MMC_BUS_WIDTH_8; 544 bus_width = MMC_BUS_WIDTH_8;
515 } else { 545 } else {
516 ext_csd_bit = EXT_CSD_BUS_WIDTH_4; 546 if (mmc_card_ddr_mode(card))
547 ext_csd_bit = EXT_CSD_DDR_BUS_WIDTH_4;
548 else
549 ext_csd_bit = EXT_CSD_BUS_WIDTH_4;
517 bus_width = MMC_BUS_WIDTH_4; 550 bus_width = MMC_BUS_WIDTH_4;
518 } 551 }
519 552