提交 c6d0c5eb 编写于 作者: T Thomas Schaefer 提交者: Jagan Teki

drivers/spi: fsl_qspi: fix read timeout

During QSPI reads, current is_controller_busy function sporadically
fails with -ETIMEDOUT due to fixed number of 5 test loops. Using
timer functions to wait 1000 us instead will fix this.
Signed-off-by: NThomas Schaefer <thomas.schaefer@kontron.com>
Reviewed-by: NFabio Estevam <festevam@gmail.com>
Reviewed-by: NJagan Teki <jagan@amarulasolutions.com>
上级 535b1fdb
......@@ -152,7 +152,7 @@ static inline int is_controller_busy(const struct fsl_qspi_priv *priv)
u32 val;
const u32 mask = QSPI_SR_BUSY_MASK | QSPI_SR_AHB_ACC_MASK |
QSPI_SR_IP_ACC_MASK;
unsigned int retry = 5;
unsigned long timeout = timer_get_us() + 1000;
do {
val = qspi_read32(priv->flags, &priv->regs->sr);
......@@ -160,10 +160,9 @@ static inline int is_controller_busy(const struct fsl_qspi_priv *priv)
if ((~val & mask) == mask)
return 0;
udelay(1);
} while (--retry);
return -ETIMEDOUT;
if (timer_get_us() > timeout )
return -ETIMEDOUT;
} while (1);
}
/* QSPI support swapping the flash read/write data
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册