Skip to content

Commit 0d7831f

Browse files
Haibo Chenstorulf
authored andcommitted
mmc: sdhci-esdhc-imx: explicitly reset tuning circuit via RSTT bit
According to the i.MX Reference Manual, the RSTT bit (SYS_CTRL[28]) is designed to reset the tuning circuit. While the Reference Manual states that clearing EXECUTE_TUNING bit from 1 to 0 in AUTOCMD12_ERR_STATUS can also set RSTT, this mechanism only works when the original EXECUTE_TUNING bit was 1. When the bit is already 0, the tuning circuit reset will not be triggered. This explicit reset approach strengthens the tuning reliability and aligns with the Reference Manual recommendations. Signed-off-by: Haibo Chen <[email protected]> Signed-off-by: Luke Wang <[email protected]> Acked-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 0ea6055 commit 0d7831f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
#define ESDHC_SYS_CTRL_DTOCV_MASK GENMASK(19, 16)
3434
#define ESDHC_SYS_CTRL_IPP_RST_N BIT(23)
35+
#define ESDHC_SYS_CTRL_RESET_TUNING BIT(28)
3536
#define ESDHC_CTRL_D3CD 0x08
3637
#define ESDHC_BURST_LEN_EN_INCR (1 << 27)
3738
/* VENDOR SPEC register */
@@ -1065,7 +1066,7 @@ static void esdhc_reset_tuning(struct sdhci_host *host)
10651066
{
10661067
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
10671068
struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
1068-
u32 ctrl, tuning_ctrl;
1069+
u32 ctrl, tuning_ctrl, sys_ctrl;
10691070
int ret;
10701071

10711072
/* Reset the tuning circuit */
@@ -1089,6 +1090,11 @@ static void esdhc_reset_tuning(struct sdhci_host *host)
10891090
writel(tuning_ctrl, host->ioaddr + ESDHC_TUNING_CTRL);
10901091
}
10911092

1093+
/* set the reset tuning bit */
1094+
sys_ctrl = readl(host->ioaddr + ESDHC_SYSTEM_CONTROL);
1095+
sys_ctrl |= ESDHC_SYS_CTRL_RESET_TUNING;
1096+
writel(sys_ctrl, host->ioaddr + ESDHC_SYSTEM_CONTROL);
1097+
10921098
ctrl = readl(host->ioaddr + SDHCI_AUTO_CMD_STATUS);
10931099
ctrl &= ~ESDHC_MIX_CTRL_SMPCLK_SEL;
10941100
ctrl &= ~ESDHC_MIX_CTRL_EXE_TUNE;

0 commit comments

Comments
 (0)