Skip to content

Commit

Permalink
mmc: mmci: stm32: release the delay block before enabling it
Browse files Browse the repository at this point in the history
We must locked the delay block on the last frequency set. To avoid being
locked on a previous frequency used, the delay block is firstly disabled.

Change-Id: I430f3afdd3b46668e879e864091284b567193148
Signed-off-by: Christophe Kerello <[email protected]>
Signed-off-by: Amit Mittal <[email protected]>
  • Loading branch information
Christophe Kerello authored and ashishverma2691 committed Nov 11, 2024
1 parent 9bb06fd commit 1002c48
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion drivers/mmc/host/mmci_stm32_sdmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,20 @@ static int sdmmc_dlyb_mp15_prepare(struct mmci_host *host)
static int sdmmc_dlyb_mp25_enable(struct sdmmc_dlyb *dlyb)
{
u32 cr, sr;
int ret;

cr = readl_relaxed(dlyb->base + SYSCFG_DLYBSD_CR);
cr |= DLYBSD_CR_EN;

cr &= ~DLYBSD_CR_EN;
writel_relaxed(cr, dlyb->base + SYSCFG_DLYBSD_CR);

ret = readl_relaxed_poll_timeout(dlyb->base + SYSCFG_DLYBSD_SR,
sr, !(sr & DLYBSD_SR_LOCK), 1,
DLYBSD_TIMEOUT_1S_IN_US);
if (ret)
return ret;

cr |= DLYBSD_CR_EN;
writel_relaxed(cr, dlyb->base + SYSCFG_DLYBSD_CR);

return readl_relaxed_poll_timeout(dlyb->base + SYSCFG_DLYBSD_SR,
Expand Down

0 comments on commit 1002c48

Please sign in to comment.