Skip to content

Commit 1002c48

Browse files
Christophe Kerelloashishverma2691
authored andcommitted
mmc: mmci: stm32: release the delay block before enabling it
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 <christophe.kerello@foss.st.com> Signed-off-by: Amit Mittal <amit.mittal@st.com>
1 parent 9bb06fd commit 1002c48

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/mmc/host/mmci_stm32_sdmmc.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,10 +535,20 @@ static int sdmmc_dlyb_mp15_prepare(struct mmci_host *host)
535535
static int sdmmc_dlyb_mp25_enable(struct sdmmc_dlyb *dlyb)
536536
{
537537
u32 cr, sr;
538+
int ret;
538539

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

542+
cr &= ~DLYBSD_CR_EN;
543+
writel_relaxed(cr, dlyb->base + SYSCFG_DLYBSD_CR);
544+
545+
ret = readl_relaxed_poll_timeout(dlyb->base + SYSCFG_DLYBSD_SR,
546+
sr, !(sr & DLYBSD_SR_LOCK), 1,
547+
DLYBSD_TIMEOUT_1S_IN_US);
548+
if (ret)
549+
return ret;
550+
551+
cr |= DLYBSD_CR_EN;
542552
writel_relaxed(cr, dlyb->base + SYSCFG_DLYBSD_CR);
543553

544554
return readl_relaxed_poll_timeout(dlyb->base + SYSCFG_DLYBSD_SR,

0 commit comments

Comments
 (0)