linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] spi-mxs: Fix chipselect glitch
@ 2024-02-01 13:15 Ralf Schlatterbeck
  2024-02-01 15:38 ` Marc Kleine-Budde
  2024-02-01 17:56 ` Stefan Wahren
  0 siblings, 2 replies; 5+ messages in thread
From: Ralf Schlatterbeck @ 2024-02-01 13:15 UTC (permalink / raw)
  To: Mark Brown, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, Vinod Koul, Miquel Raynal,
	linux-spi, linux-arm-kernel, linux-kernel

There was a change in the mxs-dma engine that uses a new custom flag.
The change was not applied to the mxs spi driver.
This results in chipselect being deasserted too early.
This fixes the chipselect problem by using the new flag in the mxs-spi
driver.

Fixes: ceeeb99cd821 ("dmaengine: mxs: rename custom flag")
Signed-off-by: Ralf Schlatterbeck <rsc@runtux.com>
---
For oscilloscope screenshots and a verbose explanation see my blog post
at https://blog.runtux.com/posts/2024/02/01/

 drivers/spi/spi-mxs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
index 1bf080339b5a..a296050c8bd3 100644
--- a/drivers/spi/spi-mxs.c
+++ b/drivers/spi/spi-mxs.c
@@ -39,6 +39,7 @@
 #include <linux/spi/spi.h>
 #include <linux/spi/mxs-spi.h>
 #include <trace/events/spi.h>
+#include <linux/dma/mxs-dma.h>
 
 #define DRIVER_NAME		"mxs-spi"
 
@@ -251,8 +252,9 @@ static int mxs_spi_txrx_dma(struct mxs_spi *spi,
 
 		desc = dmaengine_prep_slave_sg(ssp->dmach,
 				&dma_xfer[sg_count].sg, 1,
-				(flags & TXRX_WRITE) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM,
-				DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+				(flags & TXRX_WRITE)
+				? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM,
+				DMA_PREP_INTERRUPT | MXS_DMA_CTRL_WAIT4END);
 
 		if (!desc) {
 			dev_err(ssp->dev,
-- 
2.20.1

-- 
Dr. Ralf Schlatterbeck                  Tel:   +43/2243/26465-16
Open Source Consulting                  www:   www.runtux.com
Reichergasse 131, A-3411 Weidling       email: office@runtux.com

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

* Re: [PATCH 1/1] spi-mxs: Fix chipselect glitch
  2024-02-01 13:15 [PATCH 1/1] spi-mxs: Fix chipselect glitch Ralf Schlatterbeck
@ 2024-02-01 15:38 ` Marc Kleine-Budde
  2024-02-01 16:30   ` Ralf Schlatterbeck
  2024-02-02 11:54   ` Ralf Schlatterbeck
  2024-02-01 17:56 ` Stefan Wahren
  1 sibling, 2 replies; 5+ messages in thread
From: Marc Kleine-Budde @ 2024-02-01 15:38 UTC (permalink / raw)
  To: Ralf Schlatterbeck
  Cc: Mark Brown, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, Vinod Koul, Miquel Raynal,
	linux-spi, linux-arm-kernel, linux-kernel

On 01.02.2024 14:15:40, Ralf Schlatterbeck wrote:
> There was a change in the mxs-dma engine that uses a new custom flag.
> The change was not applied to the mxs spi driver.
> This results in chipselect being deasserted too early.
> This fixes the chipselect problem by using the new flag in the mxs-spi
> driver.
> 
> Fixes: ceeeb99cd821 ("dmaengine: mxs: rename custom flag")
> Signed-off-by: Ralf Schlatterbeck <rsc@runtux.com>
> ---
> For oscilloscope screenshots and a verbose explanation see my blog post
> at https://blog.runtux.com/posts/2024/02/01/
> 
>  drivers/spi/spi-mxs.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
> index 1bf080339b5a..a296050c8bd3 100644
> --- a/drivers/spi/spi-mxs.c
> +++ b/drivers/spi/spi-mxs.c
> @@ -39,6 +39,7 @@
>  #include <linux/spi/spi.h>
>  #include <linux/spi/mxs-spi.h>
>  #include <trace/events/spi.h>
> +#include <linux/dma/mxs-dma.h>
>  
>  #define DRIVER_NAME		"mxs-spi"
>  
> @@ -251,8 +252,9 @@ static int mxs_spi_txrx_dma(struct mxs_spi *spi,
>  
>  		desc = dmaengine_prep_slave_sg(ssp->dmach,
>  				&dma_xfer[sg_count].sg, 1,
> -				(flags & TXRX_WRITE) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM,
> -				DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
> +				(flags & TXRX_WRITE)
> +				? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM,
> +				DMA_PREP_INTERRUPT | MXS_DMA_CTRL_WAIT4END);

nitpick: Please omit the line break change from this patch.

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

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

* Re: [PATCH 1/1] spi-mxs: Fix chipselect glitch
  2024-02-01 15:38 ` Marc Kleine-Budde
@ 2024-02-01 16:30   ` Ralf Schlatterbeck
  2024-02-02 11:54   ` Ralf Schlatterbeck
  1 sibling, 0 replies; 5+ messages in thread
From: Ralf Schlatterbeck @ 2024-02-01 16:30 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Mark Brown, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, Vinod Koul, Miquel Raynal,
	linux-spi, linux-arm-kernel, linux-kernel

On Thu, Feb 01, 2024 at 04:38:38PM +0100, Marc Kleine-Budde wrote:
> 
> nitpick: Please omit the line break change from this patch.

Thanks for the quick feedback!
I'll make a v2 when tomorrow there are no further comments.

Thanks
Ralf
-- 
Dr. Ralf Schlatterbeck                  Tel:   +43/2243/26465-16
Open Source Consulting                  www:   www.runtux.com
Reichergasse 131, A-3411 Weidling       email: office@runtux.com

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

* Re: [PATCH 1/1] spi-mxs: Fix chipselect glitch
  2024-02-01 13:15 [PATCH 1/1] spi-mxs: Fix chipselect glitch Ralf Schlatterbeck
  2024-02-01 15:38 ` Marc Kleine-Budde
@ 2024-02-01 17:56 ` Stefan Wahren
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Wahren @ 2024-02-01 17:56 UTC (permalink / raw)
  To: Ralf Schlatterbeck, Mark Brown, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Vinod Koul, Miquel Raynal, linux-spi, linux-arm-kernel,
	linux-kernel

Am 01.02.24 um 14:15 schrieb Ralf Schlatterbeck:
> There was a change in the mxs-dma engine that uses a new custom flag.
> The change was not applied to the mxs spi driver.
> This results in chipselect being deasserted too early.
> This fixes the chipselect problem by using the new flag in the mxs-spi
> driver.
>
> Fixes: ceeeb99cd821 ("dmaengine: mxs: rename custom flag")
> Signed-off-by: Ralf Schlatterbeck <rsc@runtux.com>
Tested-by: Stefan Wahren <wahrenst@gmx.net>

Thanks

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

* Re: [PATCH 1/1] spi-mxs: Fix chipselect glitch
  2024-02-01 15:38 ` Marc Kleine-Budde
  2024-02-01 16:30   ` Ralf Schlatterbeck
@ 2024-02-02 11:54   ` Ralf Schlatterbeck
  1 sibling, 0 replies; 5+ messages in thread
From: Ralf Schlatterbeck @ 2024-02-02 11:54 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Mark Brown, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, Vinod Koul, Miquel Raynal,
	linux-spi, linux-arm-kernel, linux-kernel

On Thu, Feb 01, 2024 at 04:38:38PM +0100, Marc Kleine-Budde wrote:

> nitpick: Please omit the line break change from this patch.

I've posted version v2 of the patch without the line break.

Thanks
Ralf
-- 
Dr. Ralf Schlatterbeck                  Tel:   +43/2243/26465-16
Open Source Consulting                  www:   www.runtux.com
Reichergasse 131, A-3411 Weidling       email: office@runtux.com

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

end of thread, other threads:[~2024-02-02 11:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-01 13:15 [PATCH 1/1] spi-mxs: Fix chipselect glitch Ralf Schlatterbeck
2024-02-01 15:38 ` Marc Kleine-Budde
2024-02-01 16:30   ` Ralf Schlatterbeck
2024-02-02 11:54   ` Ralf Schlatterbeck
2024-02-01 17:56 ` Stefan Wahren

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