diff options
author | Jared Bents <jared.bents@rockwellcollins.com> | 2019-03-22 09:46:52 -0500 |
---|---|---|
committer | Jagan Teki <jagan@amarulasolutions.com> | 2019-04-12 11:24:24 +0530 |
commit | 40264c0ca89a6953e05e89b6abe491f4b6e4a149 (patch) | |
tree | 21c5bb92242551370d0f852d8f74f94161b1a43b /drivers | |
parent | 567a3eb7956f98af4ed065499898c6d0ac6443c7 (diff) | |
download | u-boot-40264c0ca89a6953e05e89b6abe491f4b6e4a149.zip u-boot-40264c0ca89a6953e05e89b6abe491f4b6e4a149.tar.gz u-boot-40264c0ca89a6953e05e89b6abe491f4b6e4a149.tar.bz2 |
spi: fsl_dspi fix to stop extra transmissions
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 <jared.bents@rockwellcollins.com>
Cc: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/spi/fsl_dspi.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/drivers/spi/fsl_dspi.c b/drivers/spi/fsl_dspi.c index 764c942..a68a519 100644 --- a/drivers/spi/fsl_dspi.c +++ b/drivers/spi/fsl_dspi.c @@ -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); |