aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/core.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@nokia.com>2010-08-24 06:20:26 -0400
committerChris Ball <cjb@laptop.org>2010-10-23 09:11:16 -0400
commit0f8d8ea64ec7c77ca5beb59534d386fe0235961a (patch)
tree8d6aebd250897aa33cb166994720497f40a9aaa6 /drivers/mmc/core/core.c
parentdfc13e8402c75e7c2e0a52e123c0500a3259866b (diff)
mmc: Fixes for Dual Data Rate (DDR) support
The DDR support patch needs the following fixes: - The block driver does not need to know about DDR, any more than it needs to know about bus width. - Not only the card must be switched to DDR mode. The host controller must also be configured, which is done through the 'set_ios()' function. - Do not set the DDR mode state until after the switch command is successful. - Setting block length is not supported in DDR mode. Make that a core function and change the other place it is used (mmc_test) also. Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/core/core.c')
-rw-r--r--drivers/mmc/core/core.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 46029d5c036..7cb352b3b24 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -651,14 +651,23 @@ void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode)
651} 651}
652 652
653/* 653/*
654 * Change data bus width of a host. 654 * Change data bus width and DDR mode of a host.
655 */ 655 */
656void mmc_set_bus_width(struct mmc_host *host, unsigned int width) 656void mmc_set_bus_width_ddr(struct mmc_host *host, unsigned int width, int ddr)
657{ 657{
658 host->ios.bus_width = width; 658 host->ios.bus_width = width;
659 host->ios.ddr = ddr ? MMC_DDR_MODE : MMC_SDR_MODE;
659 mmc_set_ios(host); 660 mmc_set_ios(host);
660} 661}
661 662
663/*
664 * Change data bus width of a host.
665 */
666void mmc_set_bus_width(struct mmc_host *host, unsigned int width)
667{
668 mmc_set_bus_width_ddr(host, width, 0);
669}
670
662/** 671/**
663 * mmc_vdd_to_ocrbitnum - Convert a voltage to the OCR bit number 672 * mmc_vdd_to_ocrbitnum - Convert a voltage to the OCR bit number
664 * @vdd: voltage (mV) 673 * @vdd: voltage (mV)
@@ -1399,6 +1408,21 @@ int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from,
1399} 1408}
1400EXPORT_SYMBOL(mmc_erase_group_aligned); 1409EXPORT_SYMBOL(mmc_erase_group_aligned);
1401 1410
1411int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen)
1412{
1413 struct mmc_command cmd;
1414
1415 if (mmc_card_blockaddr(card) || mmc_card_ddr_mode(card))
1416 return 0;
1417
1418 memset(&cmd, 0, sizeof(struct mmc_command));
1419 cmd.opcode = MMC_SET_BLOCKLEN;
1420 cmd.arg = blocklen;
1421 cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC;
1422 return mmc_wait_for_cmd(card->host, &cmd, 5);
1423}
1424EXPORT_SYMBOL(mmc_set_blocklen);
1425
1402void mmc_rescan(struct work_struct *work) 1426void mmc_rescan(struct work_struct *work)
1403{ 1427{
1404 struct mmc_host *host = 1428 struct mmc_host *host =