drivers/mmc: send CMD8 only for SD card in initialization
authorHaojian Zhuang <haojian.zhuang@linaro.org>
Thu, 2 Aug 2018 06:48:17 +0000 (14:48 +0800)
committerHaojian Zhuang <haojian.zhuang@linaro.org>
Fri, 10 Aug 2018 09:11:12 +0000 (17:11 +0800)
Sending CMD8 before CMD1 just causes to fetch data failure in eMMC.
Check whether it's eMMC first. If it's eMMC, send CMD1 command instead.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
drivers/mmc/mmc.c

index 0c9ec1017e30bbe7531a4c26b9c750ca81e4c0f4..c8eac26bebcbec0c1f1ec67683be28de52245103 100644 (file)
@@ -363,8 +363,6 @@ static int mmc_reset_to_idle(void)
 {
        int ret;
 
-       mdelay(1);
-
        /* CMD0: reset to IDLE */
        ret = mmc_send_cmd(MMC_CMD(0), 0, 0, NULL);
        if (ret != 0) {
@@ -413,14 +411,16 @@ static int mmc_enumerate(unsigned int clk, unsigned int bus_width)
 
        mmc_reset_to_idle();
 
-       /* CMD8: Send Interface Condition Command */
-       ret = mmc_send_cmd(MMC_CMD(8), VHS_2_7_3_6_V | CMD8_CHECK_PATTERN,
-                          MMC_RESPONSE_R(7), &resp_data[0]);
-
-       if ((ret == 0) && ((resp_data[0] & 0xffU) == CMD8_CHECK_PATTERN)) {
-               ret = sd_send_op_cond();
-       } else {
+       if (mmc_dev_info->mmc_dev_type == MMC_IS_EMMC) {
                ret = mmc_send_op_cond();
+       } else {
+               /* CMD8: Send Interface Condition Command */
+               ret = mmc_send_cmd(MMC_CMD(8), VHS_2_7_3_6_V | CMD8_CHECK_PATTERN,
+                                  MMC_RESPONSE_R(7), &resp_data[0]);
+
+               if ((ret == 0) && ((resp_data[0] & 0xffU) == CMD8_CHECK_PATTERN)) {
+                       ret = sd_send_op_cond();
+               }
        }
        if (ret != 0) {
                return ret;