aboutsummaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/fsl_qspi.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index 1598c4f6989..2c5937509ff 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -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