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

mmc: sdhci-esdhc-imx: Reset before sending tuning command for manual tuning

According to IC suggestion, everytime before sending the tuning command,
need to reset the usdhc, so to reset the tuning circuit, to let every
tuning command work well for the manual tuning method. For standard tuning
method, IC already add the reset operation in the hardware logic.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/1597135057-22272-1-git-send-email-haibo.chen@nxp.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Haibo Chen and committed by
Ulf Hansson
0ac4f496 309de450

+10
+10
drivers/mmc/host/sdhci-esdhc-imx.c
··· 987 987 static void esdhc_prepare_tuning(struct sdhci_host *host, u32 val) 988 988 { 989 989 u32 reg; 990 + u8 sw_rst; 991 + int ret; 990 992 991 993 /* FIXME: delay a bit for card to be ready for next tuning due to errors */ 992 994 mdelay(1); 995 + 996 + /* IC suggest to reset USDHC before every tuning command */ 997 + esdhc_clrset_le(host, 0xff, SDHCI_RESET_ALL, SDHCI_SOFTWARE_RESET); 998 + ret = readb_poll_timeout(host->ioaddr + SDHCI_SOFTWARE_RESET, sw_rst, 999 + !(sw_rst & SDHCI_RESET_ALL), 10, 100); 1000 + if (ret == -ETIMEDOUT) 1001 + dev_warn(mmc_dev(host->mmc), 1002 + "warning! RESET_ALL never complete before sending tuning command\n"); 993 1003 994 1004 reg = readl(host->ioaddr + ESDHC_MIX_CTRL); 995 1005 reg |= ESDHC_MIX_CTRL_EXE_TUNE | ESDHC_MIX_CTRL_SMPCLK_SEL |