linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] spi: fix spi driver for UniPhier SoC
@ 2019-06-26  0:41 Keiji Hayashibara
  2019-06-26  0:41 ` [PATCH 1/2] spi: uniphier: fix timeout error Keiji Hayashibara
  2019-06-26  0:41 ` [PATCH 2/2] spi: uniphier: fix zero-length transfer Keiji Hayashibara
  0 siblings, 2 replies; 5+ messages in thread
From: Keiji Hayashibara @ 2019-06-26  0:41 UTC (permalink / raw)
  To: broonie, yamada.masahiro, linux-spi, linux-arm-kernel
  Cc: jaswinder.singh, linux-kernel, masami.hiramatsu, hayashibara.keiji

This series fixes timeout problem and modifies timeout handling.
The zero-length transfer results in two second timeout
and the transfer speed becomes slow.

Keiji Hayashibara (2):
  spi: uniphier: fix timeout error
  spi: uniphier: fix zero-length transfer

 drivers/spi/spi-uniphier.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 1/2] spi: uniphier: fix timeout error
  2019-06-26  0:41 [PATCH 0/2] spi: fix spi driver for UniPhier SoC Keiji Hayashibara
@ 2019-06-26  0:41 ` Keiji Hayashibara
  2019-06-26 11:32   ` Applied "spi: uniphier: fix timeout error" to the spi tree Mark Brown
  2019-06-26  0:41 ` [PATCH 2/2] spi: uniphier: fix zero-length transfer Keiji Hayashibara
  1 sibling, 1 reply; 5+ messages in thread
From: Keiji Hayashibara @ 2019-06-26  0:41 UTC (permalink / raw)
  To: broonie, yamada.masahiro, linux-spi, linux-arm-kernel
  Cc: jaswinder.singh, linux-kernel, masami.hiramatsu, hayashibara.keiji

Timeout error was silently ignored.
This commit adds timeout error handling and modifies return type of
wait_for_completion_timeout().

Signed-off-by: Keiji Hayashibara <hayashibara.keiji@socionext.com>
---
 drivers/spi/spi-uniphier.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-uniphier.c b/drivers/spi/spi-uniphier.c
index 5a6137f..c3c35c0 100644
--- a/drivers/spi/spi-uniphier.c
+++ b/drivers/spi/spi-uniphier.c
@@ -328,7 +328,8 @@ static int uniphier_spi_transfer_one(struct spi_master *master,
 				     struct spi_transfer *t)
 {
 	struct uniphier_spi_priv *priv = spi_master_get_devdata(master);
-	int status;
+	struct device *dev = master->dev.parent;
+	unsigned long time_left;
 
 	uniphier_spi_setup_transfer(spi, t);
 
@@ -338,13 +339,15 @@ static int uniphier_spi_transfer_one(struct spi_master *master,
 
 	uniphier_spi_irq_enable(spi, SSI_IE_RCIE | SSI_IE_RORIE);
 
-	status = wait_for_completion_timeout(&priv->xfer_done,
-					     msecs_to_jiffies(SSI_TIMEOUT_MS));
+	time_left = wait_for_completion_timeout(&priv->xfer_done,
+					msecs_to_jiffies(SSI_TIMEOUT_MS));
 
 	uniphier_spi_irq_disable(spi, SSI_IE_RCIE | SSI_IE_RORIE);
 
-	if (status < 0)
-		return status;
+	if (!time_left) {
+		dev_err(dev, "transfer timeout.\n");
+		return -ETIMEDOUT;
+	}
 
 	return priv->error;
 }
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/2] spi: uniphier: fix zero-length transfer
  2019-06-26  0:41 [PATCH 0/2] spi: fix spi driver for UniPhier SoC Keiji Hayashibara
  2019-06-26  0:41 ` [PATCH 1/2] spi: uniphier: fix timeout error Keiji Hayashibara
@ 2019-06-26  0:41 ` Keiji Hayashibara
  2019-06-26 11:32   ` Applied "spi: uniphier: fix zero-length transfer" to the spi tree Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Keiji Hayashibara @ 2019-06-26  0:41 UTC (permalink / raw)
  To: broonie, yamada.masahiro, linux-spi, linux-arm-kernel
  Cc: jaswinder.singh, linux-kernel, masami.hiramatsu, hayashibara.keiji

The zero-length transfer results in timeout error because
the transfer doesn't start.
This commit modified to return success in this case.

Signed-off-by: Keiji Hayashibara <hayashibara.keiji@socionext.com>
---
 drivers/spi/spi-uniphier.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/spi/spi-uniphier.c b/drivers/spi/spi-uniphier.c
index c3c35c0..b32c77d 100644
--- a/drivers/spi/spi-uniphier.c
+++ b/drivers/spi/spi-uniphier.c
@@ -331,6 +331,10 @@ static int uniphier_spi_transfer_one(struct spi_master *master,
 	struct device *dev = master->dev.parent;
 	unsigned long time_left;
 
+	/* Terminate and return success for 0 byte length transfer */
+	if (!t->len)
+		return 0;
+
 	uniphier_spi_setup_transfer(spi, t);
 
 	reinit_completion(&priv->xfer_done);
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Applied "spi: uniphier: fix zero-length transfer" to the spi tree
  2019-06-26  0:41 ` [PATCH 2/2] spi: uniphier: fix zero-length transfer Keiji Hayashibara
@ 2019-06-26 11:32   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2019-06-26 11:32 UTC (permalink / raw)
  To: Keiji Hayashibara
  Cc: masami.hiramatsu, hayashibara.keiji, yamada.masahiro,
	linux-kernel, linux-spi, jaswinder.singh, Mark Brown,
	linux-arm-kernel

The patch

   spi: uniphier: fix zero-length transfer

has been applied to the spi tree at

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

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 2b947137f2b8f77474dfe77d68c52778bf6ae453 Mon Sep 17 00:00:00 2001
From: Keiji Hayashibara <hayashibara.keiji@socionext.com>
Date: Wed, 26 Jun 2019 09:41:48 +0900
Subject: [PATCH] spi: uniphier: fix zero-length transfer

The zero-length transfer results in timeout error because
the transfer doesn't start.
This commit modified to return success in this case.

Signed-off-by: Keiji Hayashibara <hayashibara.keiji@socionext.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-uniphier.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/spi/spi-uniphier.c b/drivers/spi/spi-uniphier.c
index c3c35c041ef1..b32c77df5d49 100644
--- a/drivers/spi/spi-uniphier.c
+++ b/drivers/spi/spi-uniphier.c
@@ -331,6 +331,10 @@ static int uniphier_spi_transfer_one(struct spi_master *master,
 	struct device *dev = master->dev.parent;
 	unsigned long time_left;
 
+	/* Terminate and return success for 0 byte length transfer */
+	if (!t->len)
+		return 0;
+
 	uniphier_spi_setup_transfer(spi, t);
 
 	reinit_completion(&priv->xfer_done);
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Applied "spi: uniphier: fix timeout error" to the spi tree
  2019-06-26  0:41 ` [PATCH 1/2] spi: uniphier: fix timeout error Keiji Hayashibara
@ 2019-06-26 11:32   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2019-06-26 11:32 UTC (permalink / raw)
  To: Keiji Hayashibara
  Cc: masami.hiramatsu, hayashibara.keiji, yamada.masahiro,
	linux-kernel, linux-spi, jaswinder.singh, Mark Brown,
	linux-arm-kernel

The patch

   spi: uniphier: fix timeout error

has been applied to the spi tree at

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

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 e4671df0bfd67d4864de014fa1751d5e2a56c7a6 Mon Sep 17 00:00:00 2001
From: Keiji Hayashibara <hayashibara.keiji@socionext.com>
Date: Wed, 26 Jun 2019 09:41:47 +0900
Subject: [PATCH] spi: uniphier: fix timeout error

Timeout error was silently ignored.
This commit adds timeout error handling and modifies return type of
wait_for_completion_timeout().

Signed-off-by: Keiji Hayashibara <hayashibara.keiji@socionext.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-uniphier.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-uniphier.c b/drivers/spi/spi-uniphier.c
index 5a6137fe172d..c3c35c041ef1 100644
--- a/drivers/spi/spi-uniphier.c
+++ b/drivers/spi/spi-uniphier.c
@@ -328,7 +328,8 @@ static int uniphier_spi_transfer_one(struct spi_master *master,
 				     struct spi_transfer *t)
 {
 	struct uniphier_spi_priv *priv = spi_master_get_devdata(master);
-	int status;
+	struct device *dev = master->dev.parent;
+	unsigned long time_left;
 
 	uniphier_spi_setup_transfer(spi, t);
 
@@ -338,13 +339,15 @@ static int uniphier_spi_transfer_one(struct spi_master *master,
 
 	uniphier_spi_irq_enable(spi, SSI_IE_RCIE | SSI_IE_RORIE);
 
-	status = wait_for_completion_timeout(&priv->xfer_done,
-					     msecs_to_jiffies(SSI_TIMEOUT_MS));
+	time_left = wait_for_completion_timeout(&priv->xfer_done,
+					msecs_to_jiffies(SSI_TIMEOUT_MS));
 
 	uniphier_spi_irq_disable(spi, SSI_IE_RCIE | SSI_IE_RORIE);
 
-	if (status < 0)
-		return status;
+	if (!time_left) {
+		dev_err(dev, "transfer timeout.\n");
+		return -ETIMEDOUT;
+	}
 
 	return priv->error;
 }
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-06-26 11:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-26  0:41 [PATCH 0/2] spi: fix spi driver for UniPhier SoC Keiji Hayashibara
2019-06-26  0:41 ` [PATCH 1/2] spi: uniphier: fix timeout error Keiji Hayashibara
2019-06-26 11:32   ` Applied "spi: uniphier: fix timeout error" to the spi tree Mark Brown
2019-06-26  0:41 ` [PATCH 2/2] spi: uniphier: fix zero-length transfer Keiji Hayashibara
2019-06-26 11:32   ` Applied "spi: uniphier: fix zero-length transfer" to the spi tree Mark Brown

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).