linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: rockchip: Signal unfinished DMA transfers
@ 2016-06-08  7:32 Tomeu Vizoso
  2016-06-08 10:55 ` Mark Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tomeu Vizoso @ 2016-06-08  7:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Tomeu Vizoso, Shawn Lin, Heiko Stuebner,
	Javier Martinez Canillas, Mark Brown, linux-spi,
	linux-arm-kernel, linux-rockchip

When using DMA, the transfer_one callback should return 1 because the
transfer hasn't finished yet.

A previous commit changed the function to return 0 when the DMA channels
were correctly prepared.

This manifested in Veyron boards with this message:

[ 1.983605] cros-ec-spi spi0.0: EC failed to respond in time

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Fixes: ea9849113343 ("spi: rockchip: check return value of
dmaengine_prep_slave_sg")
Cc: Shawn Lin <shawn.lin@rock-chips.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Javier Martinez Canillas <javier@osg.samsung.com>
---
 drivers/spi/spi-rockchip.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index cd89682065b9..1026e180eed7 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -578,7 +578,7 @@ static int rockchip_spi_transfer_one(
 		struct spi_device *spi,
 		struct spi_transfer *xfer)
 {
-	int ret = 1;
+	int ret = 0;
 	struct rockchip_spi *rs = spi_master_get_devdata(master);
 
 	WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) &&
@@ -627,6 +627,8 @@ static int rockchip_spi_transfer_one(
 			spi_enable_chip(rs, 1);
 			ret = rockchip_spi_prepare_dma(rs);
 		}
+		/* successful DMA prepare means the transfer is in progress */
+		ret = ret ? ret : 1;
 	} else {
 		spi_enable_chip(rs, 1);
 		ret = rockchip_spi_pio_transfer(rs);
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: rockchip: Signal unfinished DMA transfers
  2016-06-08  7:32 [PATCH] spi: rockchip: Signal unfinished DMA transfers Tomeu Vizoso
@ 2016-06-08 10:55 ` Mark Brown
  2016-06-08 10:56 ` Applied "spi: rockchip: Signal unfinished DMA transfers" to the spi tree Mark Brown
  2016-06-08 12:26 ` [PATCH] spi: rockchip: Signal unfinished DMA transfers Heiko Stübner
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2016-06-08 10:55 UTC (permalink / raw)
  To: Tomeu Vizoso
  Cc: linux-kernel, Shawn Lin, Heiko Stuebner,
	Javier Martinez Canillas, linux-spi, linux-arm-kernel,
	linux-rockchip

[-- Attachment #1: Type: text/plain, Size: 233 bytes --]

On Wed, Jun 08, 2016 at 09:32:51AM +0200, Tomeu Vizoso wrote:

> +		/* successful DMA prepare means the transfer is in progress */
> +		ret = ret ? ret : 1;

Please write normal if statements so people can read the code more
easily.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Applied "spi: rockchip: Signal unfinished DMA transfers" to the spi tree
  2016-06-08  7:32 [PATCH] spi: rockchip: Signal unfinished DMA transfers Tomeu Vizoso
  2016-06-08 10:55 ` Mark Brown
@ 2016-06-08 10:56 ` Mark Brown
  2016-06-08 12:26 ` [PATCH] spi: rockchip: Signal unfinished DMA transfers Heiko Stübner
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2016-06-08 10:56 UTC (permalink / raw)
  To: Tomeu Vizoso
  Cc: Mark Brown, linux-kernel, Shawn Lin, Heiko Stuebner,
	Javier Martinez Canillas, Mark Brown, linux-spi,
	linux-arm-kernel, linux-rockchip

The patch

   spi: rockchip: Signal unfinished DMA transfers

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 4f69b8188871c589a5e382f16a018850ec0146ce Mon Sep 17 00:00:00 2001
From: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Date: Wed, 8 Jun 2016 09:32:51 +0200
Subject: [PATCH] spi: rockchip: Signal unfinished DMA transfers

When using DMA, the transfer_one callback should return 1 because the
transfer hasn't finished yet.

A previous commit changed the function to return 0 when the DMA channels
were correctly prepared.

This manifested in Veyron boards with this message:

[ 1.983605] cros-ec-spi spi0.0: EC failed to respond in time

Fixes: ea9849113343 ("spi: rockchip: check return value of dmaengine_prep_slave_sg")
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-rockchip.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index cd89682065b9..1026e180eed7 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -578,7 +578,7 @@ static int rockchip_spi_transfer_one(
 		struct spi_device *spi,
 		struct spi_transfer *xfer)
 {
-	int ret = 1;
+	int ret = 0;
 	struct rockchip_spi *rs = spi_master_get_devdata(master);
 
 	WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) &&
@@ -627,6 +627,8 @@ static int rockchip_spi_transfer_one(
 			spi_enable_chip(rs, 1);
 			ret = rockchip_spi_prepare_dma(rs);
 		}
+		/* successful DMA prepare means the transfer is in progress */
+		ret = ret ? ret : 1;
 	} else {
 		spi_enable_chip(rs, 1);
 		ret = rockchip_spi_pio_transfer(rs);
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: rockchip: Signal unfinished DMA transfers
  2016-06-08  7:32 [PATCH] spi: rockchip: Signal unfinished DMA transfers Tomeu Vizoso
  2016-06-08 10:55 ` Mark Brown
  2016-06-08 10:56 ` Applied "spi: rockchip: Signal unfinished DMA transfers" to the spi tree Mark Brown
@ 2016-06-08 12:26 ` Heiko Stübner
  2 siblings, 0 replies; 4+ messages in thread
From: Heiko Stübner @ 2016-06-08 12:26 UTC (permalink / raw)
  To: Tomeu Vizoso
  Cc: linux-kernel, Shawn Lin, Javier Martinez Canillas, Mark Brown,
	linux-spi, linux-arm-kernel, linux-rockchip

Am Mittwoch, 8. Juni 2016, 09:32:51 schrieb Tomeu Vizoso:
> When using DMA, the transfer_one callback should return 1 because the
> transfer hasn't finished yet.
> 
> A previous commit changed the function to return 0 when the DMA channels
> were correctly prepared.
> 
> This manifested in Veyron boards with this message:
> 
> [ 1.983605] cros-ec-spi spi0.0: EC failed to respond in time
> 
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Fixes: ea9849113343 ("spi: rockchip: check return value of
> dmaengine_prep_slave_sg")
> Cc: Shawn Lin <shawn.lin@rock-chips.com>
> Cc: Heiko Stuebner <heiko@sntech.de>
> Cc: Javier Martinez Canillas <javier@osg.samsung.com>

looks like Mark already applied it, but nevertheless I was able to verify that 
this patch fixes the issue on my veyron jerry chromebook as well, so

Tested-by: Heiko Stuebner <heiko@sntech.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-08 12:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-08  7:32 [PATCH] spi: rockchip: Signal unfinished DMA transfers Tomeu Vizoso
2016-06-08 10:55 ` Mark Brown
2016-06-08 10:56 ` Applied "spi: rockchip: Signal unfinished DMA transfers" to the spi tree Mark Brown
2016-06-08 12:26 ` [PATCH] spi: rockchip: Signal unfinished DMA transfers Heiko Stübner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).