spi_qsd: Fix for SPI Operational State Invalid error

This error is reproted randomly when the SPI core is put
into RUN state and occurs when the ACPU clock is low.
When the timer expires, we check again to ensure that the
STATE_VALID bit is set before returning.

CRs-fixed: 304672
Signed-off-by: Harini Jayaraman <harinij@codeaurora.org>
This commit is contained in:
Harini Jayaraman
2011-09-01 12:12:58 -06:00
committed by Bryan Huntsman
parent b823cd5750
commit bcef77324e

View File

@@ -837,14 +837,19 @@ static inline int msm_spi_wait_valid(struct msm_spi *dd)
*/
if (delay < SPI_DELAY_THRESHOLD)
delay = SPI_DELAY_THRESHOLD;
timeout = jiffies + msecs_to_jiffies(delay * SPI_DEFAULT_TIMEOUT);
/* Adding one to round off to the nearest jiffy */
timeout = jiffies + msecs_to_jiffies(delay * SPI_DEFAULT_TIMEOUT) + 1;
while (!msm_spi_is_valid_state(dd)) {
if (time_after(jiffies, timeout)) {
if (!msm_spi_is_valid_state(dd)) {
if (dd->cur_msg)
dd->cur_msg->status = -EIO;
dev_err(dd->dev, "%s: SPI operational state not valid"
"\n", __func__);
return -1;
dev_err(dd->dev, "%s: SPI operational state"
"not valid\n", __func__);
return -ETIMEDOUT;
} else
return 0;
}
/*
* For smaller values of delay, context switch time