Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Patrice Chotard and committed by
Mark Brown
d38fa9a1 f131767e

+4 -1
+4 -1
drivers/spi/spi-stm32-qspi.c
··· 294 294 int err = 0; 295 295 296 296 if (!op->data.nbytes) 297 - return stm32_qspi_wait_nobusy(qspi); 297 + goto wait_nobusy; 298 298 299 299 if (readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF) 300 300 goto out; ··· 315 315 out: 316 316 /* clear flags */ 317 317 writel_relaxed(FCR_CTCF | FCR_CTEF, qspi->io_base + QSPI_FCR); 318 + wait_nobusy: 319 + if (!err) 320 + err = stm32_qspi_wait_nobusy(qspi); 318 321 319 322 return err; 320 323 }