diff mbox series

spi: spi-fsl-dspi: fix broken DSPI_EOQ_MODE

Message ID 20180817235158.5578-1-angelo@sysam.it (mailing list archive)
State Accepted
Commit 5223c9c1cbfc0cd4d0a1b50758e0949af3290fa1
Headers show
Series spi: spi-fsl-dspi: fix broken DSPI_EOQ_MODE | expand

Commit Message

Angelo Dureghello Aug. 17, 2018, 11:51 p.m. UTC
This patch fixes the dspi_eoq_write function used by the
ColdFire mcf5441x family. The 16 bit cmd part must be re-set at
each data transfer.

Also, now that fifo_size variables are used for eoq_read/write,
a proper fifo size must be set (16 slots for the ColdFire dspi
module version).

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
---
 drivers/spi/spi-fsl-dspi.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Esben Haabendal Aug. 18, 2018, 7:44 a.m. UTC | #1
Angelo Dureghello <angelo@sysam.it> writes:

> This patch fixes the dspi_eoq_write function used by the
> ColdFire mcf5441x family. The 16 bit cmd part must be re-set at
> each data transfer.
>
> Also, now that fifo_size variables are used for eoq_read/write,
> a proper fifo size must be set (16 slots for the ColdFire dspi
> module version).
>
> Signed-off-by: Angelo Dureghello <angelo@sysam.it>
> ---
>  drivers/spi/spi-fsl-dspi.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
> index 7cb3ab0a35a0..3082e72e4f6c 100644
> --- a/drivers/spi/spi-fsl-dspi.c
> +++ b/drivers/spi/spi-fsl-dspi.c
> @@ -30,7 +30,11 @@
>  
>  #define DRIVER_NAME "fsl-dspi"
>  
> +#ifdef CONFIG_M5441x
> +#define DSPI_FIFO_SIZE			16
> +#else
>  #define DSPI_FIFO_SIZE			4
> +#endif
>  #define DSPI_DMA_BUFSIZE		(DSPI_FIFO_SIZE * 1024)
>  
>  #define SPI_MCR		0x00
> @@ -623,9 +627,11 @@ static void dspi_tcfq_read(struct fsl_dspi *dspi)
>  static void dspi_eoq_write(struct fsl_dspi *dspi)
>  {
>  	int fifo_size = DSPI_FIFO_SIZE;
> +	u16 xfer_cmd = dspi->tx_cmd;
>  
>  	/* Fill TX FIFO with as many transfers as possible */
>  	while (dspi->len && fifo_size--) {
> +		dspi->tx_cmd = xfer_cmd;
>  		/* Request EOQF for last transfer in FIFO */
>  		if (dspi->len == dspi->bytes_per_word || fifo_size == 0)
>  			dspi->tx_cmd |= SPI_PUSHR_CMD_EOQ;

Acked-by: Esben Haabendal <esben@haabendal.dk>
diff mbox series

Patch

diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index 7cb3ab0a35a0..3082e72e4f6c 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -30,7 +30,11 @@ 
 
 #define DRIVER_NAME "fsl-dspi"
 
+#ifdef CONFIG_M5441x
+#define DSPI_FIFO_SIZE			16
+#else
 #define DSPI_FIFO_SIZE			4
+#endif
 #define DSPI_DMA_BUFSIZE		(DSPI_FIFO_SIZE * 1024)
 
 #define SPI_MCR		0x00
@@ -623,9 +627,11 @@  static void dspi_tcfq_read(struct fsl_dspi *dspi)
 static void dspi_eoq_write(struct fsl_dspi *dspi)
 {
 	int fifo_size = DSPI_FIFO_SIZE;
+	u16 xfer_cmd = dspi->tx_cmd;
 
 	/* Fill TX FIFO with as many transfers as possible */
 	while (dspi->len && fifo_size--) {
+		dspi->tx_cmd = xfer_cmd;
 		/* Request EOQF for last transfer in FIFO */
 		if (dspi->len == dspi->bytes_per_word || fifo_size == 0)
 			dspi->tx_cmd |= SPI_PUSHR_CMD_EOQ;