mirror of https://gitee.com/openkylin/linux.git
spi: spi-zynqmp-gqspi: use wait_for_completion_timeout to make zynqmp_qspi_exec_op not interruptible
When Ctrl+C occurs during the process of zynqmp_qspi_exec_op, the function
wait_for_completion_interruptible_timeout will return a non-zero value
-ERESTARTSYS immediately. This will disrupt the SPI memory operation
because the data transmitting may begin before the command or address
transmitting completes. Use wait_for_completion_timeout to prevent
the process from being interruptible.
This patch fixes the error as below:
root@xilinx-zynqmp:~# flash_erase /dev/mtd3 0 0
Erasing 4 Kibyte @ 3d000 -- 4 % complete
(Press Ctrl+C)
[ 169.581911] zynqmp-qspi ff0f0000.spi: Chip select timed out
[ 170.585907] zynqmp-qspi ff0f0000.spi: Chip select timed out
[ 171.589910] zynqmp-qspi ff0f0000.spi: Chip select timed out
[ 172.593910] zynqmp-qspi ff0f0000.spi: Chip select timed out
[ 173.597907] zynqmp-qspi ff0f0000.spi: Chip select timed out
[ 173.603480] spi-nor spi0.0: Erase operation failed.
[ 173.608368] spi-nor spi0.0: Attempted to modify a protected sector.
Fixes: 1c26372e5a
("spi: spi-zynqmp-gqspi: Update driver to use spi-mem framework")
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Reviewed-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
Link: https://lore.kernel.org/r/20210408040223.23134-2-quanyang.wang@windriver.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
5fed9fe5b4
commit
a16bff68b7
|
@ -973,7 +973,7 @@ static int zynqmp_qspi_exec_op(struct spi_mem *mem,
|
|||
zynqmp_gqspi_write(xqspi, GQSPI_IER_OFST,
|
||||
GQSPI_IER_GENFIFOEMPTY_MASK |
|
||||
GQSPI_IER_TXNOT_FULL_MASK);
|
||||
if (!wait_for_completion_interruptible_timeout
|
||||
if (!wait_for_completion_timeout
|
||||
(&xqspi->data_completion, msecs_to_jiffies(1000))) {
|
||||
err = -ETIMEDOUT;
|
||||
kfree(tmpbuf);
|
||||
|
@ -1001,7 +1001,7 @@ static int zynqmp_qspi_exec_op(struct spi_mem *mem,
|
|||
GQSPI_IER_TXEMPTY_MASK |
|
||||
GQSPI_IER_GENFIFOEMPTY_MASK |
|
||||
GQSPI_IER_TXNOT_FULL_MASK);
|
||||
if (!wait_for_completion_interruptible_timeout
|
||||
if (!wait_for_completion_timeout
|
||||
(&xqspi->data_completion, msecs_to_jiffies(1000))) {
|
||||
err = -ETIMEDOUT;
|
||||
goto return_err;
|
||||
|
@ -1076,7 +1076,7 @@ static int zynqmp_qspi_exec_op(struct spi_mem *mem,
|
|||
GQSPI_IER_RXEMPTY_MASK);
|
||||
}
|
||||
}
|
||||
if (!wait_for_completion_interruptible_timeout
|
||||
if (!wait_for_completion_timeout
|
||||
(&xqspi->data_completion, msecs_to_jiffies(1000)))
|
||||
err = -ETIMEDOUT;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue