diff options
author | Adrian Hunter <adrian.hunter@nokia.com> | 2010-10-11 05:43:50 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2010-10-23 09:11:16 -0400 |
commit | 49e3b5a44f8abd33c8693edc575c6d06a210d778 (patch) | |
tree | a68dfc6613a17d1c0eb68d87d63a3562eea26a80 | |
parent | 0f8d8ea64ec7c77ca5beb59534d386fe0235961a (diff) |
mmc: refine DDR support
One flaw with DDR support is that MMC core does not inform the driver
which DDR mode it has selected. This patch expands the ios->ddr flag
to do that.
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
-rw-r--r-- | drivers/mmc/core/core.c | 7 | ||||
-rw-r--r-- | drivers/mmc/core/core.h | 3 | ||||
-rw-r--r-- | drivers/mmc/core/mmc.c | 6 | ||||
-rw-r--r-- | include/linux/mmc/host.h | 3 |
4 files changed, 11 insertions, 8 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 7cb352b3b247..3eb7a9be6d8d 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -653,10 +653,11 @@ void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode) | |||
653 | /* | 653 | /* |
654 | * Change data bus width and DDR mode of a host. | 654 | * Change data bus width and DDR mode of a host. |
655 | */ | 655 | */ |
656 | void mmc_set_bus_width_ddr(struct mmc_host *host, unsigned int width, int ddr) | 656 | void mmc_set_bus_width_ddr(struct mmc_host *host, unsigned int width, |
657 | unsigned int ddr) | ||
657 | { | 658 | { |
658 | host->ios.bus_width = width; | 659 | host->ios.bus_width = width; |
659 | host->ios.ddr = ddr ? MMC_DDR_MODE : MMC_SDR_MODE; | 660 | host->ios.ddr = ddr; |
660 | mmc_set_ios(host); | 661 | mmc_set_ios(host); |
661 | } | 662 | } |
662 | 663 | ||
@@ -665,7 +666,7 @@ void mmc_set_bus_width_ddr(struct mmc_host *host, unsigned int width, int ddr) | |||
665 | */ | 666 | */ |
666 | void mmc_set_bus_width(struct mmc_host *host, unsigned int width) | 667 | void mmc_set_bus_width(struct mmc_host *host, unsigned int width) |
667 | { | 668 | { |
668 | mmc_set_bus_width_ddr(host, width, 0); | 669 | mmc_set_bus_width_ddr(host, width, MMC_SDR_MODE); |
669 | } | 670 | } |
670 | 671 | ||
671 | /** | 672 | /** |
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index 13240d128a69..a971b0667aad 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h | |||
@@ -35,7 +35,8 @@ void mmc_set_chip_select(struct mmc_host *host, int mode); | |||
35 | void mmc_set_clock(struct mmc_host *host, unsigned int hz); | 35 | void mmc_set_clock(struct mmc_host *host, unsigned int hz); |
36 | void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode); | 36 | void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode); |
37 | void mmc_set_bus_width(struct mmc_host *host, unsigned int width); | 37 | void mmc_set_bus_width(struct mmc_host *host, unsigned int width); |
38 | void mmc_set_bus_width_ddr(struct mmc_host *host, unsigned int width, int ddr); | 38 | void mmc_set_bus_width_ddr(struct mmc_host *host, unsigned int width, |
39 | unsigned int ddr); | ||
39 | u32 mmc_select_voltage(struct mmc_host *host, u32 ocr); | 40 | u32 mmc_select_voltage(struct mmc_host *host, u32 ocr); |
40 | void mmc_set_timing(struct mmc_host *host, unsigned int timing); | 41 | void mmc_set_timing(struct mmc_host *host, unsigned int timing); |
41 | 42 | ||
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 3ea58ce773ff..df2a817303b4 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -375,7 +375,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
375 | struct mmc_card *oldcard) | 375 | struct mmc_card *oldcard) |
376 | { | 376 | { |
377 | struct mmc_card *card; | 377 | struct mmc_card *card; |
378 | int err, ddr = 0; | 378 | int err, ddr = MMC_SDR_MODE; |
379 | u32 cid[4]; | 379 | u32 cid[4]; |
380 | unsigned int max_dtr; | 380 | unsigned int max_dtr; |
381 | 381 | ||
@@ -523,10 +523,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
523 | if (mmc_card_highspeed(card)) { | 523 | if (mmc_card_highspeed(card)) { |
524 | if ((card->ext_csd.card_type & EXT_CSD_CARD_TYPE_DDR_1_8V) | 524 | if ((card->ext_csd.card_type & EXT_CSD_CARD_TYPE_DDR_1_8V) |
525 | && (host->caps & (MMC_CAP_1_8V_DDR))) | 525 | && (host->caps & (MMC_CAP_1_8V_DDR))) |
526 | ddr = 1; | 526 | ddr = MMC_1_8V_DDR_MODE; |
527 | else if ((card->ext_csd.card_type & EXT_CSD_CARD_TYPE_DDR_1_2V) | 527 | else if ((card->ext_csd.card_type & EXT_CSD_CARD_TYPE_DDR_1_2V) |
528 | && (host->caps & (MMC_CAP_1_2V_DDR))) | 528 | && (host->caps & (MMC_CAP_1_2V_DDR))) |
529 | ddr = 1; | 529 | ddr = MMC_1_2V_DDR_MODE; |
530 | } | 530 | } |
531 | 531 | ||
532 | /* | 532 | /* |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index c4fb1c5efc44..69ee1ebe4302 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
@@ -54,7 +54,8 @@ struct mmc_ios { | |||
54 | unsigned char ddr; /* dual data rate used */ | 54 | unsigned char ddr; /* dual data rate used */ |
55 | 55 | ||
56 | #define MMC_SDR_MODE 0 | 56 | #define MMC_SDR_MODE 0 |
57 | #define MMC_DDR_MODE 1 | 57 | #define MMC_1_2V_DDR_MODE 1 |
58 | #define MMC_1_8V_DDR_MODE 2 | ||
58 | }; | 59 | }; |
59 | 60 | ||
60 | struct mmc_host_ops { | 61 | struct mmc_host_ops { |