]> www.infradead.org Git - users/willy/xarray.git/commit
mmc: sdhci-esdhc-imx: Save tuning value when card stays powered in suspend
authorLuke Wang <ziniu.wang_1@nxp.com>
Fri, 28 Mar 2025 11:25:17 +0000 (19:25 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Wed, 14 May 2025 14:59:16 +0000 (16:59 +0200)
commitc63d25cdc59ae2891b39ba2da950910291d9bcbf
tree4f0c022355925fef942d7f44dcf1e9341bb6c353
parentdfc29a10c43d3f2aec853c9bf8b0d9e8f0251a2f
mmc: sdhci-esdhc-imx: Save tuning value when card stays powered in suspend

For SoCs like i.MX6UL(L/Z) and i.MX7D, USDHC powers off completely during
system power management (PM), causing the internal tuning status to be
lost. To address this, save the tuning value when system suspend and
restore it for any command issued after system resume when re-tuning is
held.

A typical case involves SDIO WiFi devices with the MMC_PM_KEEP_POWER and
MMC_PM_WAKE_SDIO_IRQ flag, which retain power during system PM. To
conserve power, WiFi switches to 1-bit mode and restores 4-bit mode upon
resume. As per the specification, tuning commands are not supported in
1-bit mode. When sending CMD52 to restore 4-bit mode, re-tuning must be
held. However, CMD52 still requires a correct sample point to avoid CRC
errors, necessitating preservation of the previous tuning value.

Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20250328112517.2624806-1-ziniu.wang_1@nxp.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci-esdhc-imx.c