[PATCH] mmc: mmci: stm32: reset and restore SDMMC state on system resume
Marek Vasut
marex at nabladev.com
Fri Nov 13 17:00:16 PST 2026
On 11/13/26 5:35 PM, Christophe Kerello wrote:
> On standby exit, the bootrom may reuse the SDMMC instance used as boot
> device, leaving the IP in a state not known by Linux.
>
> STM32 variants do not set pwrreg_nopower, so MMCICLOCK, MMCIDATACTRL and
> MMCIPOWER are neither saved nor restored by mmci_save()/mmci_restore():
> their content is expected to be retained by the hardware.
>
> Add a reset_on_resume variant flag. When set, and if the card is powered
> off and a reset line is available, reset the IP on system resume and
> restore the cached MMCICLOCK, MMCIDATACTRL and MMCIPOWER values.
>
> This is done from a .resume_noirq callback, so that mmci_irq() cannot run
> on a state left by the bootrom once device interrupts are re-enabled. It
> also runs before pm_runtime_force_resume(), which does not resume the
> device if it was already runtime suspended before system suspend. The
> clock is therefore enabled locally for the duration of the sequence.
> Clock and reset errors are reported to the PM core.
>
> Enable the flag for all STM32 SDMMC variants.
>
> Fixes: 46b723dd867d ("mmc: mmci: add stm32 sdmmc variant")
> Cc: stable at vger.kernel.org
> Signed-off-by: Christophe Kerello <christophe.kerello at foss.st.com>
Tested-by: Marek Vasut <marex at nabladev.com>
Thanks
More information about the linux-arm-kernel
mailing list