@@ -1062,14 +1062,24 @@ static int zynqmp_qspi_wait(struct zynqmp_qspi *xqspi, unsigned long timeout)
{
int ret;
- ret = wait_for_completion_timeout(&xqspi->data_completion, timeout);
- if (ret)
+ /* Only allow interrupting if we can reset the device */
+ if (xqspi->reset)
+ ret = wait_for_completion_interruptible_timeout(&xqspi->data_completion,
+ timeout);
+ else
+ ret = wait_for_completion_timeout(&xqspi->data_completion,
+ timeout);
+ if (ret > 0)
return 0;
- dev_err(xqspi->dev, "Operation timed out\n");
+
+ if (!ret) {
+ dev_err(xqspi->dev, "Operation timed out\n");
+ ret = -ETIMEDOUT;
+ }
/* Attempt to recover as best we can */
zynqmp_qspi_init_hw(xqspi);
- return -ETIMEDOUT;
+ return ret;
}
/**
Some operations (such as reading several megabytes of data from a flash) can take several seconds or more. Users may want to cancel such operations. Allow them to do so now that we have a way to recover. Signed-off-by: Sean Anderson <sean.anderson@linux.dev> --- drivers/spi/spi-zynqmp-gqspi.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)