summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMarkus Niebel <Markus.Niebel@tqs.de>2013-12-16 13:40:46 +0100
committerPantelis Antoniou <panto@antoniou-consulting.com>2014-01-09 11:47:51 +0200
commitab71188ce87ebb66192a5bdbbb9d58052bd32d93 (patch)
treed10e2d7d55b842b124087ee019d00d02f9a0af22 /common
parent30e6d979fa9da56a5badcb981cdddd58638d3375 (diff)
mmc: add setdsr support
The eMMC and the SD-Card specifications describe the optional SET_DSR command. During measurements at our lab we found that some cards implementing this feature having really strong driver strengts per default. This can lead to voltage peaks above the specification of the host on signal edges for data sent from a card to the host. Since availability of a given card type may be shorter than the time a certain hardware will be produced it is useful to have support for this command (Alternative would be changing termination resistors and adapting the driver strength of the host to the used card.) Following proposal for an implementation: - new field that reflects CSD field DSR_IMP in struct mmc - new field for design specific DSR value in struct mmc - board code can set DSR value in mmc struct just after registering an controller - mmc_startup sends the the stored DSR value before selecting a card, if DSR_IMP is set Additionally the mmc command is extended to make is possible to play around with different DSR values. The concept was tested on a i.MX53 based platform using a Micron eMMC card where the default DSR is 0x0400 (12mA) but in our design 0x0100 (0x0100) were enough. To use this feature for instance on a mx53loco one have to add a call to mmc_set_dsr() in board_mmc_init() after calling fsl_esdhc_initialize() for the eMMC. Signed-off-by: Markus Niebel <Markus.Niebel@tqs.de> Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_mmc.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index 67a94a74688..da5fef9db9d 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -340,6 +340,28 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
#endif /* CONFIG_SUPPORT_EMMC_BOOT */
}
+
+ else if (argc == 3 && strcmp(argv[1], "setdsr") == 0) {
+ struct mmc *mmc = find_mmc_device(curr_device);
+ u32 val = simple_strtoul(argv[2], NULL, 16);
+ int ret;
+
+ if (!mmc) {
+ printf("no mmc device at slot %x\n", curr_device);
+ return 1;
+ }
+ ret = mmc_set_dsr(mmc, val);
+ printf("set dsr %s\n", (!ret) ? "OK, force rescan" : "ERROR");
+ if (!ret) {
+ mmc->has_init = 0;
+ if (mmc_init(mmc))
+ return 1;
+ else
+ return 0;
+ }
+ return ret;
+ }
+
state = MMC_INVALID;
if (argc == 5 && strcmp(argv[1], "read") == 0)
state = MMC_READ;
@@ -423,5 +445,6 @@ U_BOOT_CMD(
"mmc bootpart <device num> <boot part size MB> <RPMB part size MB>\n"
" - change sizes of boot and RPMB partitions of specified device\n"
#endif
+ "mmc setdsr - set DSR register value\n"
);
#endif /* !CONFIG_GENERIC_MMC */