Skip to content

Commit be953af

Browse files
Haibo Chenstorulf
authored andcommitted
mmc: sdhci-esdhc-imx: widen auto-tuning window for standard tuning
Expand the auto-tuning window width from 2 to 3 for standard tuning to account for sampling point shifts caused by temperature change. This change is based on hardware recommendation, providing 50% more margin for the auto-tuning logic to locate valid sampling points. 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 d0aac7d commit be953af

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108

109109
#define ESDHC_TUNING_CTRL 0xcc
110110
#define ESDHC_STD_TUNING_EN (1 << 24)
111+
#define ESDHC_TUNING_WINDOW_MASK GENMASK(22, 20)
111112
/* NOTE: the minimum valid tuning start tap for mx6sl is 1 */
112113
#define ESDHC_TUNING_START_TAP_DEFAULT 0x1
113114
#define ESDHC_TUNING_START_TAP_MASK 0x7f
@@ -209,6 +210,8 @@
209210
/* The IP does not have GPIO CD wake capabilities */
210211
#define ESDHC_FLAG_SKIP_CD_WAKE BIT(18)
211212

213+
#define ESDHC_AUTO_TUNING_WINDOW 3
214+
212215
enum wp_types {
213216
ESDHC_WP_NONE, /* no WP, neither controller nor gpio */
214217
ESDHC_WP_CONTROLLER, /* mmc controller internal WP */
@@ -1553,6 +1556,16 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host)
15531556
<< ESDHC_TUNING_STEP_SHIFT;
15541557
}
15551558

1559+
/*
1560+
* Config the tuning window to the hardware suggested value 3.
1561+
* This tuning window is used for auto tuning logic. The default
1562+
* tuning window is 2, here change to 3 make the window a bit
1563+
* wider, give auto tuning enough space to handle the sample
1564+
* point shift cause by temperature change.
1565+
*/
1566+
tmp &= ~ESDHC_TUNING_WINDOW_MASK;
1567+
tmp |= FIELD_PREP(ESDHC_TUNING_WINDOW_MASK, ESDHC_AUTO_TUNING_WINDOW);
1568+
15561569
/* Disable the CMD CRC check for tuning, if not, need to
15571570
* add some delay after every tuning command, because
15581571
* hardware standard tuning logic will directly go to next

0 commit comments

Comments
 (0)