mmc: core: changes frequency to hs_max_dtr when selecting hs400es
authorxiaoyao <xiaoyao@rock-chips.com>
Thu, 22 Sep 2016 09:21:24 +0000 (17:21 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Fri, 23 Sep 2016 09:08:41 +0000 (17:08 +0800)
Per JESD84-B51 P69, Host need to change frequency to <=52MHz after
setting HS_TIMING to 0x1, and host may changes frequency to <= 200MHz
after setting HS_TIMING to 0x3. It seems there is no difference if
we don't change frequency to <= 52MHz as f_init is already less than
52MHz. But actually it does make difference. When doing compatibility
test we see failures for some eMMC devices without changing the
frequency to hs_max_dtr. And let's read the spec again, we could see
that "Host may changes frequency to 200MHz" implies that it's not
mandatory. But the "Host need to change frequency to <= 52MHz" implies
that we should do this.

Change-Id: I1dc9f5fa8dc217e033fc4b1689ca1b0204c294c0
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: xiaoyao <xiaoyao@rock-chips.com>
drivers/mmc/core/mmc.c

index ed5d54dd7c4ebbb9f95378faa0ac0f1bb222c2b0..3c2c026f66cd1b0c670491cfbafac159d952fa2a 100644 (file)
@@ -1266,6 +1266,8 @@ static int mmc_select_hs400es(struct mmc_card *card)
        if (err)
                goto out_err;
 
+       mmc_set_clock(host, card->ext_csd.hs_max_dtr);
+
        err = mmc_switch_status(card);
        if (err)
                goto out_err;