diff mbox series

spi: rockchip: handle zero length transfers without timing out

Message ID 20210827050357.165409-1-t.schramm@manjaro.org (mailing list archive)
State New, archived
Headers show
Series spi: rockchip: handle zero length transfers without timing out | expand

Commit Message

Tobias Schramm Aug. 27, 2021, 5:03 a.m. UTC
Previously zero length transfers submitted to the Rokchip SPI driver would
time out in the SPI layer. This happens because the SPI peripheral does
not trigger a transfer completion interrupt for zero length transfers.

Fix that by completing zero length transfers immediately at start of
transfer.

Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
---
 drivers/spi/spi-rockchip.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Mark Brown Sept. 3, 2021, 3:18 p.m. UTC | #1
On Fri, 27 Aug 2021 07:03:57 +0200, Tobias Schramm wrote:
> Previously zero length transfers submitted to the Rokchip SPI driver would
> time out in the SPI layer. This happens because the SPI peripheral does
> not trigger a transfer completion interrupt for zero length transfers.
> 
> Fix that by completing zero length transfers immediately at start of
> transfer.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: rockchip: handle zero length transfers without timing out
      commit: 5457773ef99f25fcc4b238ac76b68e28273250f4

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 540861ca2ba3..553b6b9d0222 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -600,6 +600,12 @@  static int rockchip_spi_transfer_one(
 	int ret;
 	bool use_dma;
 
+	/* Zero length transfers won't trigger an interrupt on completion */
+	if (!xfer->len) {
+		spi_finalize_current_transfer(ctlr);
+		return 1;
+	}
+
 	WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) &&
 		(readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY));