[PATCH] mmc: mmci: stm32: handle mmc power up

Ulf Hansson ulf.hansson at oss.qualcomm.com
Wed Nov 11 03:45:15 PST 2026


On Wed, Nov 11, 2026 at 5:14 AM Marek Vasut <marex at nabladev.com> wrote:
>
> On 11/10/26 2:32 PM, Ulf Hansson wrote:
> > On Fri, Oct 30, 2026 at 10:54 PM Marek Vasut <marex at nabladev.com> wrote:
> >>
> >> From: Christophe Kerello <christophe.kerello at foss.st.com>
> >>
> >> Manage MMC POWER UP state like MMC POWER OFF state. In case of low
> >> power use cases, it will avoid random initialization timeout. This
> >> fixes a failure to switch DDR52 eMMC to 8 bit mode due to -EILSEQ
> >> returned from mmc_get_ext_csd() in mmc_compare_ext_csds() called
> >> from mmc_select_bus_width() after Standby1 suspend/resume cycle.
> >>
> >> Fixes: 46b723dd867d ("mmc: mmci: add stm32 sdmmc variant")
> >> Signed-off-by: Christophe Kerello <christophe.kerello at foss.st.com>
> >> Signed-off-by: Marek Vasut <marex at nabladev.com>
> >> ---
> >> Cc: Alexandre Torgue <alexandre.torgue at foss.st.com>
> >> Cc: Christophe Kerello <christophe.kerello at foss.st.com>
> >> Cc: Maxime Coquelin <mcoquelin.stm32 at gmail.com>
> >> Cc: Ulf Hansson <ulfh at kernel.org>
> >> Cc: kernel at dh-electronics.com
> >> Cc: linux-arm-kernel at lists.infradead.org
> >> Cc: linux-kernel at vger.kernel.org
> >> Cc: linux-mmc at vger.kernel.org
> >> Cc: linux-stm32 at st-md-mailman.stormreply.com
> >> ---
> >> Marek: Update commit message
> >> ---
> >>   drivers/mmc/host/mmci_stm32_sdmmc.c | 3 ++-
> >>   1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/mmc/host/mmci_stm32_sdmmc.c b/drivers/mmc/host/mmci_stm32_sdmmc.c
> >> index 9dc51859c2e51..659a5040729e9 100644
> >> --- a/drivers/mmc/host/mmci_stm32_sdmmc.c
> >> +++ b/drivers/mmc/host/mmci_stm32_sdmmc.c
> >> @@ -368,7 +368,8 @@ static void mmci_sdmmc_set_pwrreg(struct mmci_host *host, unsigned int pwr)
> >>          if (dlyb && dlyb->ops->set_input_ck)
> >>                  dlyb->ops->set_input_ck(dlyb);
> >>
> >> -       if (ios.power_mode == MMC_POWER_OFF) {
> >> +       if (ios.power_mode == MMC_POWER_OFF ||
> >> +           ios.power_mode == MMC_POWER_UP) {
> >>                  /* Only a reset could power-off sdmmc */
> >>                  reset_control_assert(host->rst);
> >>                  udelay(2);
> >
> > What exactly will this reset?
> The controller.

Okay, I see.

In that case, this reset also makes us reset preceding updates to any
other registers, for example the clock register. I would not recommend
doing that here, but perhaps there is no better option.

If I may I suggest an alternative solution, perhaps we can manage this
in the ->runtime_resume() callback instead. If the power_mode ==
MMC_POWER_OFF, perhaps do this reset there instead? Would that work?

Anothing thing that caught my eyes was the MCI_STM32_PWR_CYC bit that
gets written at MMC_POWER_OFF. This bit becomes cached in
host->pwr_reg, hence it's also rewritten at MMC_POWER_ON. Is that
intentional?

Kind regards
Uffe



More information about the linux-arm-kernel mailing list