Commit ebf45b7d authored by Feng Tang's avatar Feng Tang Committed by Grant Likely

spi/dw_spi: Fix too short timeout in spi polling loop

The SPI polling loop timeout only works with HZ=100 as the loop was
actually too short.

Also add appropriate cpu_relax() in the busy wait loops...
Signed-off-by: default avatarArjan van de Ven <>
Signed-off-by: default avatarAlan Cox <>
Signed-off-by: default avatarFeng Tang <>
Signed-off-by: default avatarGrant Likely <>
parent 5e8b821d
......@@ -164,20 +164,23 @@ static inline void mrst_spi_debugfs_remove(struct dw_spi *dws)
static void wait_till_not_busy(struct dw_spi *dws)
unsigned long end = jiffies + 1 + usecs_to_jiffies(1000);
unsigned long end = jiffies + 1 + usecs_to_jiffies(5000);
while (time_before(jiffies, end)) {
if (!(dw_readw(dws, sr) & SR_BUSY))
"DW SPI: Status keeps busy for 1000us after a read/write!\n");
"DW SPI: Status keeps busy for 5000us after a read/write!\n");
static void flush(struct dw_spi *dws)
while (dw_readw(dws, sr) & SR_RF_NOT_EMPT)
while (dw_readw(dws, sr) & SR_RF_NOT_EMPT) {
dw_readw(dws, dr);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment