spi: fsi: Fix spurious timeout
Subsystems (2)
Eddie James
maintainercover spi: fsi: Fix spurious timeout
The driver may return a timeout error even if the status register indicates that the transfer may proceed. Fix this by restructuring the polling loop.
Also include a patch to display the error return code when failing to transfer one message, which would have been very helpful in debugging this issue.
Eddie James (2):
spi: fsi: Fix spurious timeout
spi: core: Display return code when failing to transfer message
drivers/spi/spi-fsi.c | 12 ++++++------ drivers/spi/spi.c | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-)
Signature · 1 line
2.27.0
Eddie James
maintainerPATCH 1/2 spi: fsi: Fix spurious timeout
The driver may return a timeout error even if the status register indicates that the transfer may proceed. Fix this by restructuring the polling loop.
--- drivers/spi/spi-fsi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/spi/spi-fsi.c +6 -6
@@ -319,12 +319,12 @@ static int fsi_spi_transfer_data(struct fsi_spi *ctx, end = jiffies +msecs_to_jiffies (SPI_FSI_STATUS_TIMEOUT_MS );do { +if (time_after (jiffies, end)) +return -ETIMEDOUT ; + rc =fsi_spi_status (ctx, &status,"TX" );if (rc)return rc; - -if (time_after (jiffies, end)) -return -ETIMEDOUT ; }while (status &SPI_FSI_STATUS_TDR_FULL ); sent += nb;
@@ -337,12 +337,12 @@ static int fsi_spi_transfer_data(struct fsi_spi *ctx,while (transfer->len > recv) { end = jiffies +msecs_to_jiffies (SPI_FSI_STATUS_TIMEOUT_MS );do { +if (time_after (jiffies, end)) +return -ETIMEDOUT ; + rc =fsi_spi_status (ctx, &status,"RX" );if (rc)return rc; - -if (time_after (jiffies, end)) -return -ETIMEDOUT ; }while (!(status &SPI_FSI_STATUS_RDR_FULL )); rc =fsi_spi_read_reg (ctx,SPI_FSI_DATA_RX , &in);
Signature · 1 line
2.27.0
Eddie James
maintainerPATCH 2/2 spi: core: Display return code when failing to transfer message
In reply to Eddie JamesAll the other calls to the controller driver display the error return code. The return code is helpful to understand what went wrong, so include it when failing to transfer one message.
--- drivers/spi/spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi.c +2 -1
@@ -1616,7 +1616,8 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread) ret = ctlr->transfer_one_message (ctlr, msg);if (ret) {dev_err (&ctlr->dev, -"failed to transfer one message from queue\n" ); +"failed to transfer one message from queue: %d\n" , + ret); goto out; }
Signature · 1 line
2.27.0
Joel Stanley
AppliedQuoted 11 lines · Eddie James
The driver may return a timeout error even if the status register indicates that the transfer may proceed. Fix this by restructuring the polling loop.
Also include a patch to display the error return code when failing to transfer one message, which would have been very helpful in debugging this issue.Eddie James (2):
spi: fsi: Fix spurious timeout
spi: core: Display return code when failing to transfer message
Applied, thanks.
Quoted 8 lines
drivers/spi/spi-fsi.c | 12 ++++++------ drivers/spi/spi.c | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-)--
2.27.0