diff options
author | Lei Wen <leiwen@marvell.com> | 2011-09-02 17:34:17 (GMT) |
---|---|---|
committer | Andy Fleming <afleming@freescale.com> | 2011-11-03 07:14:58 (GMT) |
commit | 02f3029f1810b99869254d0cf0a71946a008a728 (patch) | |
tree | ed0ad1fdeea21936fda8ae02b6bac552ad0c3df7 | |
parent | 07133f2e7b671866bcf91ef6926c187c392c7aa1 (diff) | |
download | u-boot-02f3029f1810b99869254d0cf0a71946a008a728.tar.xz |
mmc: retry the cmd8 to meet 74 clocks requirement in the spec
For some controller it has dynamic clock gating, and only toggle out clk
when the first cmd0 send out, while some card strictly obey the 74
clocks rule, the interval may not be sufficient between the cmd0 and
this cmd8, retry to fulfil the clock requirement.
Signed-off-by: Lei Wen <leiwen@marvell.com>
Tested-by: Marek Vasut <marek.vasut@gmail.com>
-rw-r--r-- | drivers/mmc/mmc.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index e5fedb3..3f59687 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1179,7 +1179,7 @@ block_dev_desc_t *mmc_get_dev(int dev) int mmc_init(struct mmc *mmc) { - int err; + int err, retry = 3; if (mmc->has_init) return 0; @@ -1202,7 +1202,19 @@ int mmc_init(struct mmc *mmc) mmc->part_num = 0; /* Test for SD version 2 */ - err = mmc_send_if_cond(mmc); + /* + * retry here for 3 times, as for some controller it has dynamic + * clock gating, and only toggle out clk when the first cmd0 send + * out, while some card strictly obey the 74 clocks rule, the interval + * may not be sufficient between the cmd0 and this cmd8, retry to + * fulfil the clock requirement + */ + do { + err = mmc_send_if_cond(mmc); + } while (--retry > 0 && err); + + if (err) + return err; /* Now try to get the SD card's operating condition */ err = sd_send_op_cond(mmc); |