Skip to content

Commit d38fa9a

Browse files
Patrice Chotardbroonie
authored andcommitted
spi: stm32-qspi: Always wait BUSY bit to be cleared in stm32_qspi_wait_cmd()
In U-boot side, an issue has been encountered when QSPI source clock is running at low frequency (24 MHz for example), waiting for TCF bit to be set didn't ensure that all data has been send out the FIFO, we should also wait that BUSY bit is cleared. To prevent similar issue in kernel driver, we implement similar behavior by always waiting BUSY bit to be cleared. Signed-off-by: Patrice Chotard <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent f131767 commit d38fa9a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/spi/spi-stm32-qspi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi,
294294
int err = 0;
295295

296296
if (!op->data.nbytes)
297-
return stm32_qspi_wait_nobusy(qspi);
297+
goto wait_nobusy;
298298

299299
if (readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF)
300300
goto out;
@@ -315,6 +315,9 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi,
315315
out:
316316
/* clear flags */
317317
writel_relaxed(FCR_CTCF | FCR_CTEF, qspi->io_base + QSPI_FCR);
318+
wait_nobusy:
319+
if (!err)
320+
err = stm32_qspi_wait_nobusy(qspi);
318321

319322
return err;
320323
}

0 commit comments

Comments
 (0)