2022-05-11 11:19:10

by Patrice CHOTARD

[permalink] [raw]
Subject: [PATCH 0/3] spi: stm32-qspi: flags management fixes

From: Patrice Chotard <[email protected]>

This series update flags management in the following cases:
- In APM mode, don't take care of TCF and TEF flags
- Always check TCF flag in stm32_qspi_wait_cmd()
- Don't check BUSY flag when sending new command

Patrice Chotard (3):
spi: stm32-qspi: Fix wait_cmd timeout in APM mode
spi: stm32-qspi: Always check SR_TCF flags in stm32_qspi_wait_cmd()
spi: stm32-qspi: Remove SR_BUSY bit check before sending command

drivers/spi/spi-stm32-qspi.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)

--
2.25.1



2022-05-11 11:32:17

by Patrice CHOTARD

[permalink] [raw]
Subject: [PATCH 1/3] spi: stm32-qspi: Fix wait_cmd timeout in APM mode

From: Patrice Chotard <[email protected]>

In APM mode, TCF and TEF flags are not set. To avoid timeout in
stm32_qspi_wait_cmd(), don't check if TCF/TEF are set.

Signed-off-by: Patrice Chotard <[email protected]>
Reported-by: [email protected]
---
drivers/spi/spi-stm32-qspi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c
index bf47a1452001..12d8bec35bf6 100644
--- a/drivers/spi/spi-stm32-qspi.c
+++ b/drivers/spi/spi-stm32-qspi.c
@@ -308,7 +308,8 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi,
if (!op->data.nbytes)
goto wait_nobusy;

- if (readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF)
+ if ((readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF) ||
+ qspi->fmode == CCR_FMODE_APM)
goto out;

reinit_completion(&qspi->data_completion);
--
2.25.1


2022-05-11 12:49:39

by Patrice CHOTARD

[permalink] [raw]
Subject: [PATCH 3/3] spi: stm32-qspi: Remove SR_BUSY bit check before sending command

From: Patrice Chotard <[email protected]>

Waiting for SR_BUSY bit when receiving a new command is not needed.
SR_BUSY bit is already managed in the previous command treatment.

Signed-off-by: Patrice Chotard <[email protected]>
---
drivers/spi/spi-stm32-qspi.c | 4 ----
1 file changed, 4 deletions(-)

diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c
index 1660ca5bd1c5..c0239e405c39 100644
--- a/drivers/spi/spi-stm32-qspi.c
+++ b/drivers/spi/spi-stm32-qspi.c
@@ -369,10 +369,6 @@ static int stm32_qspi_send(struct spi_mem *mem, const struct spi_mem_op *op)
op->dummy.buswidth, op->data.buswidth,
op->addr.val, op->data.nbytes);

- err = stm32_qspi_wait_nobusy(qspi);
- if (err)
- goto abort;
-
cr = readl_relaxed(qspi->io_base + QSPI_CR);
cr &= ~CR_PRESC_MASK & ~CR_FSEL;
cr |= FIELD_PREP(CR_PRESC_MASK, flash->presc);
--
2.25.1


2022-05-12 11:16:53

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 0/3] spi: stm32-qspi: flags management fixes

On Wed, 11 May 2022 09:46:41 +0200, [email protected] wrote:
> From: Patrice Chotard <[email protected]>
>
> This series update flags management in the following cases:
> - In APM mode, don't take care of TCF and TEF flags
> - Always check TCF flag in stm32_qspi_wait_cmd()
> - Don't check BUSY flag when sending new command
>
> [...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/3] spi: stm32-qspi: Fix wait_cmd timeout in APM mode
commit: d83d89ea68b4726700fa87b22db075e4217e691c
[2/3] spi: stm32-qspi: Always check SR_TCF flags in stm32_qspi_wait_cmd()
commit: 0cf8d32600cf5660ee45d421f1b6e3a129ca58b6
[3/3] spi: stm32-qspi: Remove SR_BUSY bit check before sending command
commit: ae16cc18f37bcdea7d4ef57a5e526a60b09a1506

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark