Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: core: Fix init_card in 52Mhz

Suppose that we got a data crc error, and it triggers the mmc_reset.
mmc_reset will call mmc_send_status to see if HW reset was supported.
before issue CMD13, it will do retune, and if EMMC was in HS400 mode,
it will reduce frequency to 52Mhz firstly, then results in card init
was doing at 52Mhz.
The mmc_send_status was originally only done for mmc_test, should drop
it. And, rename the "eMMC hardware reset" to "Reset test", as we would
also be able to use the test for SD-cards.

Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com>
Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
Fixes: bd11e8bd03ca ("mmc: core: Flag re-tuning is needed on CRC errors")
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Chaotian Jing and committed by
Ulf Hansson
08b137d9 25cb62b7

+3 -13
+3 -6
drivers/mmc/card/mmc_test.c
··· 2263 2263 /* 2264 2264 * eMMC hardware reset. 2265 2265 */ 2266 - static int mmc_test_hw_reset(struct mmc_test_card *test) 2266 + static int mmc_test_reset(struct mmc_test_card *test) 2267 2267 { 2268 2268 struct mmc_card *card = test->card; 2269 2269 struct mmc_host *host = card->host; 2270 2270 int err; 2271 - 2272 - if (!mmc_card_mmc(card) || !mmc_can_reset(card)) 2273 - return RESULT_UNSUP_CARD; 2274 2271 2275 2272 err = mmc_hw_reset(host); 2276 2273 if (!err) ··· 2602 2605 }, 2603 2606 2604 2607 { 2605 - .name = "eMMC hardware reset", 2606 - .run = mmc_test_hw_reset, 2608 + .name = "Reset test", 2609 + .run = mmc_test_reset, 2607 2610 }, 2608 2611 }; 2609 2612
-7
drivers/mmc/core/mmc.c
··· 1924 1924 static int mmc_reset(struct mmc_host *host) 1925 1925 { 1926 1926 struct mmc_card *card = host->card; 1927 - u32 status; 1928 1927 1929 1928 if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset) 1930 1929 return -EOPNOTSUPP; ··· 1935 1936 mmc_set_clock(host, host->f_init); 1936 1937 1937 1938 host->ops->hw_reset(host); 1938 - 1939 - /* If the reset has happened, then a status command will fail */ 1940 - if (!mmc_send_status(card, &status)) { 1941 - mmc_host_clk_release(host); 1942 - return -ENOSYS; 1943 - } 1944 1939 1945 1940 /* Set initial state and call mmc_set_ios */ 1946 1941 mmc_set_initial_state(host);