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 <patrice.chotard@foss.st.com> Link: https://lore.kernel.org/r/20210603073421.8441-1-patrice.chotard@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
f131767eef
commit
d38fa9a155
@@ -294,7 +294,7 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi,
|
|||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (!op->data.nbytes)
|
if (!op->data.nbytes)
|
||||||
return stm32_qspi_wait_nobusy(qspi);
|
goto wait_nobusy;
|
||||||
|
|
||||||
if (readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF)
|
if (readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF)
|
||||||
goto out;
|
goto out;
|
||||||
@@ -315,6 +315,9 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi,
|
|||||||
out:
|
out:
|
||||||
/* clear flags */
|
/* clear flags */
|
||||||
writel_relaxed(FCR_CTCF | FCR_CTEF, qspi->io_base + QSPI_FCR);
|
writel_relaxed(FCR_CTCF | FCR_CTEF, qspi->io_base + QSPI_FCR);
|
||||||
|
wait_nobusy:
|
||||||
|
if (!err)
|
||||||
|
err = stm32_qspi_wait_nobusy(qspi);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user