Skip to content

Commit 73c2f42

Browse files
Christophe Kerelloashishverma2691
authored andcommitted
spi: stm32-ospi: avoid false timeout expiration
In case of stress test, timeout could occurred. To avoid false timeout, check that the transfer is completed or not. Change-Id: I6684b67faf77d9ea148838c488a979d69b3a16aa Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com> Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/linux-stm32/+/400728 ACI: CITOOLS <MDG-smet-aci-reviews@list.st.com> Tested-by: Jerome BESNARD <jerome.besnard@st.com> Tested-by: Christophe KERELLO <christophe.kerello@st.com> Domain-Review: Christophe KERELLO <christophe.kerello@st.com> Reviewed-by: Christophe KERELLO <christophe.kerello@st.com> ACI: CIBUILD <MDG-smet-aci-builds@list.st.com>
1 parent d73e511 commit 73c2f42

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/spi/spi-stm32-ospi.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,13 @@ static int stm32_ospi_wait_poll_status(struct stm32_ospi *ospi,
200200
writel_relaxed(cr | CR_SMIE, regs_base + OSPI_CR);
201201

202202
if (!wait_for_completion_timeout(&omi->match_completion,
203-
msecs_to_jiffies(ospi->status_timeout)))
204-
return -ETIMEDOUT;
203+
msecs_to_jiffies(ospi->status_timeout))) {
204+
u32 sr = readl_relaxed(regs_base + OSPI_SR);
205+
206+
/* Avoid false timeout */
207+
if (!(sr & SR_SMF))
208+
return -ETIMEDOUT;
209+
}
205210

206211
writel_relaxed(FCR_CSMF, regs_base + OSPI_FCR);
207212

0 commit comments

Comments
 (0)