Patchwork [U-Boot] mxc_spi: bugfix for double incrementing read pointer on unaligned buffers in spi_xchg_single

login
register
mail settings
Submitter Timo Herbrecher
Date Aug. 14, 2013, 8:06 a.m.
Message ID <520B3A6D.1010100@gateware.de>
Download mbox | patch
Permalink /patch/266995/
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Comments

Timo Herbrecher - Aug. 14, 2013, 8:06 a.m.
If dout buffer is not 32 bit-aligned or data to transmit is not multiple
of 32 bit the read data pointer is already incremented on single byte reads.

Signed-off-by: Timo Herbrecher <t.herbrecher@gateware.de>
---
 drivers/spi/mxc_spi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

                reg_write(&regs->txdata, data);

Patch

diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index fd72a65..95dd03f 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -255,8 +255,8 @@  int spi_xchg_single(struct spi_slave *slave,
unsigned int bitlen,
                        } else {
                                data = *(u32 *)dout;
                                data = cpu_to_be32(data);
+                               dout += 4;
                        }
-                       dout += 4;
                }
                debug("Sending SPI 0x%x\n", data);