linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [v2 PATCH 1/2] spi: sh-msiof: fix *info pointer in request_dma()
@ 2019-01-18  9:29 Nguyen An Hoan
  2019-01-18  9:29 ` [v2 PATCH 2/2] spi: sh-msiof: Use DMA if possible Nguyen An Hoan
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Nguyen An Hoan @ 2019-01-18  9:29 UTC (permalink / raw)
  To: linux-renesas-soc, broonie, geert+renesas
  Cc: linux-spi, kuninori.morimoto.gx, magnus.damm,
	yoshihiro.shimoda.uh, h-inayoshi, nv-dung, na-hoan, cv-dong

From: Hoan Nguyen An <na-hoan@jinso.co.jp>

sh_msiof_spi_info *info struct pointer was initialized in the probe() function
no need to get back and keep consistency.

Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>
---
 drivers/spi/spi-sh-msiof.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index d14b407..351470b 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -1206,7 +1206,7 @@ static int sh_msiof_request_dma(struct sh_msiof_spi_priv *p)
 {
 	struct platform_device *pdev = p->pdev;
 	struct device *dev = &pdev->dev;
-	const struct sh_msiof_spi_info *info = dev_get_platdata(dev);
+	const struct sh_msiof_spi_info *info = p->info;
 	unsigned int dma_tx_id, dma_rx_id;
 	const struct resource *res;
 	struct spi_master *master;
-- 
2.7.4


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

* [v2 PATCH 2/2] spi: sh-msiof: Use DMA if possible
  2019-01-18  9:29 [v2 PATCH 1/2] spi: sh-msiof: fix *info pointer in request_dma() Nguyen An Hoan
@ 2019-01-18  9:29 ` Nguyen An Hoan
  2019-01-18 13:18   ` Geert Uytterhoeven
  2019-01-18 18:38   ` Applied "spi: sh-msiof: Use DMA if possible" to the spi tree Mark Brown
  2019-01-18 10:46 ` [v2 PATCH 1/2] spi: sh-msiof: fix *info pointer in request_dma() Geert Uytterhoeven
  2019-01-18 18:38 ` Applied "spi: sh-msiof: fix *info pointer in request_dma()" to the spi tree Mark Brown
  2 siblings, 2 replies; 6+ messages in thread
From: Nguyen An Hoan @ 2019-01-18  9:29 UTC (permalink / raw)
  To: linux-renesas-soc, broonie, geert+renesas
  Cc: linux-spi, kuninori.morimoto.gx, magnus.damm,
	yoshihiro.shimoda.uh, h-inayoshi, nv-dung, na-hoan, cv-dong

From: Hoan Nguyen An <na-hoan@jinso.co.jp>

Currently, this driver only supports feature for DMA 32-bits.
In this case, only if the data length is divisible by 4 to use
DMA, otherwise PIO will be used. This patch will suggest use
the DMA 32-bits with 4bytes of words, then the remaining data
will be transmitted by PIO mode.

Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>
---
 drivers/spi/spi-sh-msiof.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index 351470b..617cdf3 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -937,17 +937,13 @@ static int sh_msiof_transfer_one(struct spi_master *master,
 		unsigned int l = 0;
 
 		if (tx_buf)
-			l = min(len, p->tx_fifo_size * 4);
+			l = min(round_down(len, 4), p->tx_fifo_size * 4);
 		if (rx_buf)
-			l = min(len, p->rx_fifo_size * 4);
+			l = min(round_down(len, 4), p->rx_fifo_size * 4);
 
 		if (bits <= 8) {
-			if (l & 3)
-				break;
 			copy32 = copy_bswap32;
 		} else if (bits <= 16) {
-			if (l & 3)
-				break;
 			copy32 = copy_wswap32;
 		} else {
 			copy32 = copy_plain32;
-- 
2.7.4


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

* Re: [v2 PATCH 1/2] spi: sh-msiof: fix *info pointer in request_dma()
  2019-01-18  9:29 [v2 PATCH 1/2] spi: sh-msiof: fix *info pointer in request_dma() Nguyen An Hoan
  2019-01-18  9:29 ` [v2 PATCH 2/2] spi: sh-msiof: Use DMA if possible Nguyen An Hoan
@ 2019-01-18 10:46 ` Geert Uytterhoeven
  2019-01-18 18:38 ` Applied "spi: sh-msiof: fix *info pointer in request_dma()" to the spi tree Mark Brown
  2 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2019-01-18 10:46 UTC (permalink / raw)
  To: Nguyen An Hoan
  Cc: Linux-Renesas, Mark Brown, Geert Uytterhoeven, linux-spi,
	Kuninori Morimoto, Magnus Damm, Yoshihiro Shimoda,
	稲吉, Dung:人ソ,
	カオ・ヴァン・ドン

On Fri, Jan 18, 2019 at 10:30 AM Nguyen An Hoan <na-hoan@jinso.co.jp> wrote:
> From: Hoan Nguyen An <na-hoan@jinso.co.jp>
>
> sh_msiof_spi_info *info struct pointer was initialized in the probe() function
> no need to get back and keep consistency.
>
> Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [v2 PATCH 2/2] spi: sh-msiof: Use DMA if possible
  2019-01-18  9:29 ` [v2 PATCH 2/2] spi: sh-msiof: Use DMA if possible Nguyen An Hoan
@ 2019-01-18 13:18   ` Geert Uytterhoeven
  2019-01-18 18:38   ` Applied "spi: sh-msiof: Use DMA if possible" to the spi tree Mark Brown
  1 sibling, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2019-01-18 13:18 UTC (permalink / raw)
  To: Nguyen An Hoan
  Cc: Linux-Renesas, Mark Brown, Geert Uytterhoeven, linux-spi,
	Kuninori Morimoto, Magnus Damm, Yoshihiro Shimoda,
	稲吉, Dung:人ソ,
	カオ・ヴァン・ドン

Hi Hoan-san,

On Fri, Jan 18, 2019 at 10:30 AM Nguyen An Hoan <na-hoan@jinso.co.jp> wrote:
> Currently, this driver only supports feature for DMA 32-bits.
> In this case, only if the data length is divisible by 4 to use
> DMA, otherwise PIO will be used. This patch will suggest use
> the DMA 32-bits with 4bytes of words, then the remaining data
> will be transmitted by PIO mode.
>
> Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>

Thanks for the update!

DMA is now used for the first part, and PIO for the remainder.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Applied "spi: sh-msiof: Use DMA if possible" to the spi tree
  2019-01-18  9:29 ` [v2 PATCH 2/2] spi: sh-msiof: Use DMA if possible Nguyen An Hoan
  2019-01-18 13:18   ` Geert Uytterhoeven
@ 2019-01-18 18:38   ` Mark Brown
  1 sibling, 0 replies; 6+ messages in thread
From: Mark Brown @ 2019-01-18 18:38 UTC (permalink / raw)
  To: Hoan Nguyen An
  Cc: Geert Uytterhoeven, Mark Brown, linux-renesas-soc, broonie,
	geert+renesas, linux-spi, kuninori.morimoto.gx, magnus.damm,
	yoshihiro.shimoda.uh, h-inayoshi, nv-dung, na-hoan, cv-dong,
	linux-spi

The patch

   spi: sh-msiof: Use DMA if possible

has been applied to the spi tree at

   https://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 d05e3eadb1bccbf276742e13b2c898959c310ce6 Mon Sep 17 00:00:00 2001
From: Hoan Nguyen An <na-hoan@jinso.co.jp>
Date: Fri, 18 Jan 2019 18:29:31 +0900
Subject: [PATCH] spi: sh-msiof: Use DMA if possible

Currently, this driver only supports feature for DMA 32-bits.
In this case, only if the data length is divisible by 4 to use
DMA, otherwise PIO will be used. This patch will suggest use
the DMA 32-bits with 4bytes of words, then the remaining data
will be transmitted by PIO mode.

Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-sh-msiof.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index 351470bc020d..617cdf3be050 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -937,17 +937,13 @@ static int sh_msiof_transfer_one(struct spi_master *master,
 		unsigned int l = 0;
 
 		if (tx_buf)
-			l = min(len, p->tx_fifo_size * 4);
+			l = min(round_down(len, 4), p->tx_fifo_size * 4);
 		if (rx_buf)
-			l = min(len, p->rx_fifo_size * 4);
+			l = min(round_down(len, 4), p->rx_fifo_size * 4);
 
 		if (bits <= 8) {
-			if (l & 3)
-				break;
 			copy32 = copy_bswap32;
 		} else if (bits <= 16) {
-			if (l & 3)
-				break;
 			copy32 = copy_wswap32;
 		} else {
 			copy32 = copy_plain32;
-- 
2.20.1


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

* Applied "spi: sh-msiof: fix *info pointer in request_dma()" to the spi tree
  2019-01-18  9:29 [v2 PATCH 1/2] spi: sh-msiof: fix *info pointer in request_dma() Nguyen An Hoan
  2019-01-18  9:29 ` [v2 PATCH 2/2] spi: sh-msiof: Use DMA if possible Nguyen An Hoan
  2019-01-18 10:46 ` [v2 PATCH 1/2] spi: sh-msiof: fix *info pointer in request_dma() Geert Uytterhoeven
@ 2019-01-18 18:38 ` Mark Brown
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2019-01-18 18:38 UTC (permalink / raw)
  To: Hoan Nguyen An
  Cc: Mark Brown, linux-renesas-soc, broonie, geert+renesas, linux-spi,
	kuninori.morimoto.gx, magnus.damm, yoshihiro.shimoda.uh,
	h-inayoshi, nv-dung, na-hoan, cv-dong, linux-spi

The patch

   spi: sh-msiof: fix *info pointer in request_dma()

has been applied to the spi tree at

   https://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 f70351ae06af0ccb1f7f91b86395ae5eba9c3c8c Mon Sep 17 00:00:00 2001
From: Hoan Nguyen An <na-hoan@jinso.co.jp>
Date: Fri, 18 Jan 2019 18:29:30 +0900
Subject: [PATCH] spi: sh-msiof: fix *info pointer in request_dma()

sh_msiof_spi_info *info struct pointer was initialized in the probe() function
no need to get back and keep consistency.

Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-sh-msiof.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index d14b407cc800..351470bc020d 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -1206,7 +1206,7 @@ static int sh_msiof_request_dma(struct sh_msiof_spi_priv *p)
 {
 	struct platform_device *pdev = p->pdev;
 	struct device *dev = &pdev->dev;
-	const struct sh_msiof_spi_info *info = dev_get_platdata(dev);
+	const struct sh_msiof_spi_info *info = p->info;
 	unsigned int dma_tx_id, dma_rx_id;
 	const struct resource *res;
 	struct spi_master *master;
-- 
2.20.1


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

end of thread, other threads:[~2019-01-18 18:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-18  9:29 [v2 PATCH 1/2] spi: sh-msiof: fix *info pointer in request_dma() Nguyen An Hoan
2019-01-18  9:29 ` [v2 PATCH 2/2] spi: sh-msiof: Use DMA if possible Nguyen An Hoan
2019-01-18 13:18   ` Geert Uytterhoeven
2019-01-18 18:38   ` Applied "spi: sh-msiof: Use DMA if possible" to the spi tree Mark Brown
2019-01-18 10:46 ` [v2 PATCH 1/2] spi: sh-msiof: fix *info pointer in request_dma() Geert Uytterhoeven
2019-01-18 18:38 ` Applied "spi: sh-msiof: fix *info pointer in request_dma()" 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).