Re: [PATCH] mmc: litex_mmc: Set mandatory idle clocks before CMD0

From: Andy Shevchenko

Date: Tue Apr 21 2026 - 05:04:53 EST


On Tue, Apr 21, 2026 at 5:51 AM Inochi Amaoto <inochiama@xxxxxxxxx> wrote:
>
> The litex_mmc driver assumes the card is already probed in the BIOS
> and skip the phy initialization. This will cause the command fail
> like the following when the old card is unplugged and then insert
> a new card:
>
> [ 62.923593] litex-mmc f0004000.mmc: Command (cmd 8) error, status -110
> [ 62.949717] litex-mmc f0004000.mmc: Command (cmd 55) error, status -110
> [ 62.976606] litex-mmc f0004000.mmc: Command (cmd 55) error, status -110
> [ 63.002516] litex-mmc f0004000.mmc: Command (cmd 55) error, status -110
> [ 63.028442] litex-mmc f0004000.mmc: Command (cmd 55) error, status -110
>
> Add required clock settings and initialization for the CMD 0, so it can
> probe the new card.

...

> static int litex_mmc_send_cmd(struct litex_mmc_host *host,

> int ret;
> u8 evt;
>
> + if (cmd == MMC_GO_IDLE_STATE) {
> + litex_mmc_setclk(host, SD_INIT_CLK_HZ);
> + litex_write8(host->sdphy + LITEX_PHY_INITIALIZE, 1);

> + udelay(SD_INIT_DELAY_US);

Why is it atomic? I see no evidence this function requires an atomic
context. Please, use fsleep().

> + }


--
With Best Regards,
Andy Shevchenko