Re: [PATCH] mmc: mmci: stm32: handle mmc power up
From: Christophe KERELLO
Date: Fri Nov 13 2026 - 15:22:56 EST
Hello Ulf,
On 11/13/26 12:46, Ulf Hansson wrote:
On Thu, Nov 12, 2026 at 7:26 AM Marek Vasut <marex@xxxxxxxxxxxx> wrote:
On 11/11/26 12:45 PM, Ulf Hansson wrote:I think it is a problem, yes. If you have a closer look at what
Hello Ulf,
Does that pose a problem in the MMC_POWER_OFF/UP state ? I agree thisOkay, I see.The controller.- if (ios.power_mode == MMC_POWER_OFF) {What exactly will this reset?
+ 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);
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.
would pose a problem in the MMC_POWER_ON state, but here the card is not ON.
happens in mmci_set_ios(), I think you will agree.
Can you try this?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?
I have sent a new patch based on your proposal:
https://lore.kernel.org/linux-mmc/20261113-fix-resume-reset-v1-1-115b3da5764d@xxxxxxxxxxx/
It works fine on my side.
Hi Marek,
Could you also test it on your board to confirm that it fixes the issue you reported?
Regards,
Christophe Kerello.
Well, we are not power-cycling the card at MMC_POWER_ON, we are turning it on.Anothing thing that caught my eyes was the MCI_STM32_PWR_CYC bit thatI _think_ so, this seems to be used to power cycle the card.
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?
Seems like we could use some support from the ST guys to understand this better.
Kind regards
Uffe