Skip to contentSkip to conversation

mxc_spi: bugfix for double incrementing read pointer on unaligned buffers in spi_xchg_single

PATCH Superseded Timo Herbrecher 2 participants 3 messages Oct 7, 2013 – Oct 15, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mxc_spi: bugfix for double incrementing read pointer on unaligned buffers in spi_xchg_single

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.

---
 drivers/spi/mxc_spi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/mxc_spi.c +0 -0
index fd72a65..95dd03f 100644
@@ -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);
                reg_write(&regs->txdata, data);

--
1.7.0.4

#1 lore raw

PATCH v2 1/1 mxc_spi: bugfix for double incrementing read pointer on unaligned buffers in spi_xchg_single

Did you test this on u-boot-spi.git with master-probe branch?

Quoted 27 lines · Timo Herbrecher

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.

---
 drivers/spi/mxc_spi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/mxc_spi.c +1 -1
index fd72a65..95dd03f 100644
@@ -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);
                reg_write(&regs->txdata, data);

--
1.7.0.4

Signature · 8 lines
Thanks,
Jagan.
--------
Jagannadha Sutradharudu Teki,
E: jagannadh.teki at gmail.com, P: +91-9676773388
Engineer - System Software Hacker
U-boot - SPI Custodian and Zynq APSOC
Ln: http://www.linkedin.com/in/jaganteki
#2 lore raw

PATCH v2 1/1 mxc_spi: bugfix for double incrementing read pointer on unaligned buffers in spi_xchg_single

Yes I tested it on the master-probe branch of u-boot-spi.git.

Am 7.10.2013 09:24, schrieb Jagan Teki:

Quoted 34 lines

Did you test this on u-boot-spi.git with master-probe branch?

Quoted 27 lines · Timo Herbrecher

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.

---
 drivers/spi/mxc_spi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/mxc_spi.c +1 -1
index fd72a65..95dd03f 100644
@@ -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);
                reg_write(&regs->txdata, data);

--
1.7.0.4