This is an automated email from the ASF dual-hosted git repository.
GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 15b792685e1 arch/arm/stm32h7: Complete QSPI polling transfers once.
15b792685e1 is described below
commit 15b792685e12f81ea9b5273f6c0362e3efa234b5
Author: yushuailong <[email protected]>
AuthorDate: Thu Nov 19 00:28:25 2026 +0800
arch/arm/stm32h7: Complete QSPI polling transfers once.
The blocking data helpers already wait for TCF, clear it and abort
the peripheral. Do not wait for the cleared flag again in their
callers. Commands without data still wait for their own completion.
Load memory transfer addresses in indirect-write mode before the
receive helper switches to indirect-read mode. This avoids starting
a read with the address from the preceding transaction.
Validated with a FK743M5 AP build and STM32H743 LittleFS hardware
write/read/remount checks. The ASan/UBSan polling regression passed
all five cases; the unpatched version failed four of them.
DMA, interrupt mode and memory-mapped transfers were not exercised.
Assisted-by: Codex:GPT-6
Signed-off-by: yushuailong <[email protected]>
---
arch/arm/src/stm32h7/stm32_qspi.c | 25 ++++---------------------
1 file changed, 4 insertions(+), 21 deletions(-)
diff --git a/arch/arm/src/stm32h7/stm32_qspi.c
b/arch/arm/src/stm32h7/stm32_qspi.c
index 53619b2b9ba..702570f6591 100644
--- a/arch/arm/src/stm32h7/stm32_qspi.c
+++ b/arch/arm/src/stm32h7/stm32_qspi.c
@@ -2167,13 +2167,10 @@ static int qspi_command(struct qspi_dev_s *dev,
}
UP_MB();
- }
- else
- {
- ret = OK;
+ return ret;
}
- /* Wait for Transfer complete, and not busy */
+ /* Commands without data have not waited for completion yet. */
qspi_waitstatusflags(priv, QSPI_SR_TCF, 1);
qspi_waitstatusflags(priv, QSPI_SR_BUSY, 0);
@@ -2315,9 +2312,7 @@ static int qspi_memory(struct qspi_dev_s *dev,
* info
*/
- qspi_ccrconfig(priv, &xctn,
- QSPIMEM_ISWRITE(meminfo->flags) ? CCR_FMODE_INDWR :
- CCR_FMODE_INDRD);
+ qspi_ccrconfig(priv, &xctn, CCR_FMODE_INDWR);
/* Transfer data */
@@ -2333,11 +2328,6 @@ static int qspi_memory(struct qspi_dev_s *dev,
ret = qspi_receive_blocking(priv, &xctn);
}
- /* Wait for Transfer complete, and not busy */
-
- qspi_waitstatusflags(priv, QSPI_SR_TCF, 1);
- qspi_waitstatusflags(priv, QSPI_SR_BUSY, 0);
-
UP_MB();
}
@@ -2346,9 +2336,7 @@ static int qspi_memory(struct qspi_dev_s *dev,
/* Set up the Communications Configuration Register as per command info */
- qspi_ccrconfig(priv, &xctn,
- QSPIMEM_ISWRITE(meminfo->flags) ? CCR_FMODE_INDWR :
- CCR_FMODE_INDRD);
+ qspi_ccrconfig(priv, &xctn, CCR_FMODE_INDWR);
/* Transfer data */
@@ -2364,11 +2352,6 @@ static int qspi_memory(struct qspi_dev_s *dev,
ret = qspi_receive_blocking(priv, &xctn);
}
- /* Wait for Transfer complete, and not busy */
-
- qspi_waitstatusflags(priv, QSPI_SR_TCF, 1);
- qspi_waitstatusflags(priv, QSPI_SR_BUSY, 0);
-
UP_MB();
#endif