Re: [PATCH] mmc: mmci: stm32: reset and restore SDMMC state on system resume
From: Marek Vasut
Date: Sat Nov 14 2026 - 05:14:12 EST
On 11/13/26 5:35 PM, Christophe Kerello wrote:
On standby exit, the bootrom may reuse the SDMMC instance used as bootTested-by: Marek Vasut <marex@xxxxxxxxxxxx>
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@xxxxxxxxxxxxxxx
Signed-off-by: Christophe Kerello <christophe.kerello@xxxxxxxxxxx>
Thanks