Skip to content

Commit 16e40e5

Browse files
Haibo Chenstorulf
authored andcommitted
mmc: sdhci-esdhc-imx: disable the CMD CRC check for standard tuning
In current code, we add 1ms dealy after each tuning command for standard tuning method. Adding this 1ms dealy is because USDHC default check the CMD CRC and DATA line. If detect the CMD CRC, USDHC standard tuning IC logic do not wait for the tuning data sending out by the card, trigger the buffer read ready interrupt immediately, and step to next cycle. So when next time the new tuning command send out by USDHC, card may still not send out the tuning data of the upper command,then some eMMC cards may stuck, can't response to any command, block the whole tuning procedure. If do not check the CMD CRC for tuning, then do not has this issue. USDHC will wait for the tuning data of each tuning command and check them. If the tuning data pass the check, it also means the CMD line also okay for tuning. So this patch disable the CMD CRC check for tuning, save some time for the whole tuning procedure. Signed-off-by: Haibo Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 1194be8 commit 16e40e5

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

drivers/mmc/host/sdhci-esdhc-imx.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
/* NOTE: the minimum valid tuning start tap for mx6sl is 1 */
9292
#define ESDHC_TUNING_START_TAP_DEFAULT 0x1
9393
#define ESDHC_TUNING_START_TAP_MASK 0x7f
94+
#define ESDHC_TUNING_CMD_CRC_CHECK_DISABLE (1 << 7)
9495
#define ESDHC_TUNING_STEP_MASK 0x00070000
9596
#define ESDHC_TUNING_STEP_SHIFT 16
9697

@@ -1316,6 +1317,18 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host)
13161317
tmp |= imx_data->boarddata.tuning_step
13171318
<< ESDHC_TUNING_STEP_SHIFT;
13181319
}
1320+
1321+
/* Disable the CMD CRC check for tuning, if not, need to
1322+
* add some delay after every tuning command, because
1323+
* hardware standard tuning logic will directly go to next
1324+
* step once it detect the CMD CRC error, will not wait for
1325+
* the card side to finally send out the tuning data, trigger
1326+
* the buffer read ready interrupt immediately. If usdhc send
1327+
* the next tuning command some eMMC card will stuck, can't
1328+
* response, block the tuning procedure or the first command
1329+
* after the whole tuning procedure always can't get any response.
1330+
*/
1331+
tmp |= ESDHC_TUNING_CMD_CRC_CHECK_DISABLE;
13191332
writel(tmp, host->ioaddr + ESDHC_TUNING_CTRL);
13201333
} else if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING) {
13211334
/*
@@ -1660,8 +1673,6 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
16601673
if (err)
16611674
goto disable_ahb_clk;
16621675

1663-
host->tuning_delay = 1;
1664-
16651676
sdhci_esdhc_imx_hwinit(host);
16661677

16671678
err = sdhci_add_host(host);

0 commit comments

Comments
 (0)