* [U-Boot] [PATCH v1 1/1] spi: fsl_dspi fix to stop extra transmissions
@ 2019-03-22 14:46 jared.bents at rockwellcollins.com
2019-04-12 5:53 ` Jagan Teki
0 siblings, 1 reply; 3+ messages in thread
From: jared.bents at rockwellcollins.com @ 2019-03-22 14:46 UTC (permalink / raw)
To: u-boot
From: Jared Bents <jared.bents@rockwellcollins.com>
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>
---
drivers/spi/fsl_dspi.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/fsl_dspi.c b/drivers/spi/fsl_dspi.c
index 764c94215e..a68a51945e 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);
--
2.18.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v1 1/1] spi: fsl_dspi fix to stop extra transmissions
2019-03-22 14:46 [U-Boot] [PATCH v1 1/1] spi: fsl_dspi fix to stop extra transmissions jared.bents at rockwellcollins.com
@ 2019-04-12 5:53 ` Jagan Teki
2019-04-12 6:29 ` Jagan Teki
0 siblings, 1 reply; 3+ messages in thread
From: Jagan Teki @ 2019-04-12 5:53 UTC (permalink / raw)
To: u-boot
On Fri, Mar 22, 2019 at 8:59 PM <jared.bents@rockwellcollins.com> wrote:
>
> From: Jared Bents <jared.bents@rockwellcollins.com>
>
> 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v1 1/1] spi: fsl_dspi fix to stop extra transmissions
2019-04-12 5:53 ` Jagan Teki
@ 2019-04-12 6:29 ` Jagan Teki
0 siblings, 0 replies; 3+ messages in thread
From: Jagan Teki @ 2019-04-12 6:29 UTC (permalink / raw)
To: u-boot
On Fri, Apr 12, 2019 at 11:23 AM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> On Fri, Mar 22, 2019 at 8:59 PM <jared.bents@rockwellcollins.com> wrote:
> >
> > From: Jared Bents <jared.bents@rockwellcollins.com>
> >
> > 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>
Applied to u-boot-spi/master
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-12 6:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 14:46 [U-Boot] [PATCH v1 1/1] spi: fsl_dspi fix to stop extra transmissions jared.bents at rockwellcollins.com
2019-04-12 5:53 ` Jagan Teki
2019-04-12 6:29 ` Jagan Teki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.