Skip to content

Commit

Permalink
spi: stm32-qspi: Always check SR_TCF flags in stm32_qspi_wait_cmd()
Browse files Browse the repository at this point in the history
Currently, SR_TCF flag is checked in case there is data, this criteria
is not correct.

SR_TCF flags is set when programmed number of bytes has been transferred
to the memory device ("bytes" comprised command and data send to the
SPI device).
So even if there is no data, we must check SR_TCF flag.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Link: https://lore.kernel.org/r/20220511074644.558874-3-patrice.chotard@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Patrice Chotard authored and Mark Brown committed May 11, 2022
1 parent d83d89e commit 0cf8d32
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions drivers/spi/spi-stm32-qspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,6 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi,
u32 cr, sr;
int err = 0;

if (!op->data.nbytes)
goto wait_nobusy;

if ((readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF) ||
qspi->fmode == CCR_FMODE_APM)
goto out;
Expand All @@ -328,7 +325,6 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi,
out:
/* clear flags */
writel_relaxed(FCR_CTCF | FCR_CTEF, qspi->io_base + QSPI_FCR);
wait_nobusy:
if (!err)
err = stm32_qspi_wait_nobusy(qspi);

Expand Down

0 comments on commit 0cf8d32

Please sign in to comment.