spi: fsl_dspi fix to stop extra transmissions
PATCH 1/1 spi: fsl_dspi fix to stop extra transmissions
From: Jared Bents <[email protected]>
Update to prevent a byte of zeros being transmitted between each byte in the tx buffer when providing both a tx buffer and a rx buffer.
Signed-off-by Jared Bents <[email protected]>
Cc Prabhakar Kushwaha <[email protected]>
--- drivers/spi/fsl_dspi.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-)
drivers/spi/fsl_dspi.c +26 -4
@@ -273,7 +273,18 @@ static int dspi_xfer(struct fsl_dspi_priv *priv, uint cs, unsigned int bitlen,if (len >1 ) {int tmp_len = len -1 ;while (tmp_len--) { -if (dout !=NULL ) { +if ((dout !=NULL ) && (din !=NULL )) { +if (priv->charbit ==16 ) { +dspi_tx (priv, ctrl, *spi_wr16++); + *spi_rd16++ =dspi_rx (priv); + } +else { +dspi_tx (priv, ctrl, *spi_wr++); + *spi_rd++ =dspi_rx (priv); + } + } + +else if (dout !=NULL ) {if (priv->charbit ==16 )dspi_tx (priv, ctrl, *spi_wr16++);else
@@ -281,7 +292,7 @@ static int dspi_xfer(struct fsl_dspi_priv *priv, uint cs, unsigned int bitlen,dspi_rx (priv); } -if (din !=NULL ) { +else if (din !=NULL ) {dspi_tx (priv, ctrl,DSPI_IDLE_VAL );if (priv->charbit ==16 ) *spi_rd16++ =dspi_rx (priv);
@@ -297,7 +308,18 @@ static int dspi_xfer(struct fsl_dspi_priv *priv, uint cs, unsigned int bitlen, ctrl &= ~DSPI_TFR_CONT ;if (len) { -if (dout !=NULL ) { +if ((dout !=NULL ) && (din !=NULL )) { +if (priv->charbit ==16 ) { +dspi_tx (priv, ctrl, *spi_wr16++); + *spi_rd16++ =dspi_rx (priv); + } +else { +dspi_tx (priv, ctrl, *spi_wr++); + *spi_rd++ =dspi_rx (priv); + } + } + +else if (dout !=NULL ) {if (priv->charbit ==16 )dspi_tx (priv, ctrl, *spi_wr16);else
@@ -305,7 +327,7 @@ static int dspi_xfer(struct fsl_dspi_priv *priv, uint cs, unsigned int bitlen,dspi_rx (priv); } -if (din !=NULL ) { +else if (din !=NULL ) {dspi_tx (priv, ctrl,DSPI_IDLE_VAL );if (priv->charbit ==16 ) *spi_rd16 =dspi_rx (priv);
Signature · 1 line
2.18.0
PATCH 1/1 spi: fsl_dspi fix to stop extra transmissions
Quoted 10 lines · On Fri, Mar 22, 2019 at 8:59 PM <[email protected]> wrote:
From: Jared Bents <[email protected]>
Update to prevent a byte of zeros being transmitted between each byte in the tx buffer when providing both a tx buffer and a rx buffer.
Signed-off-by Jared Bents <[email protected]>Cc Prabhakar Kushwaha <[email protected]>---
Acked-by Jagan Teki <[email protected]>
PATCH 1/1 spi: fsl_dspi fix to stop extra transmissions
Quoted 9 lines · Jagan Teki
Quoted 7 lines · On Fri, Mar 22, 2019 at 8:59 PM <[email protected]> wrote:
From: Jared Bents <[email protected]>
Update to prevent a byte of zeros being transmitted between each byte in the tx buffer when providing both a tx buffer and a rx buffer.
Quoted 5 lines
Quoted 3 lines
Signed-off-by Jared Bents <[email protected]>Cc Prabhakar Kushwaha <[email protected]>---
Acked-by Jagan Teki <[email protected]>
Applied to u-boot-spi/master