From: Joakim Tjernlund Date: Sat, 12 Dec 2015 17:10:38 +0000 Subject: [U-Boot] [PATCH v3] spi: fsl_espi: Return all data read from device unmodified In-Reply-To: <1449886759-23994-1-git-send-email-dsmith@vtiinstruments.com> References: <1371074066-732-1-git-send-email-dsmith@vtiinstruments.com> <1449886759-23994-1-git-send-email-dsmith@vtiinstruments.com> Message-ID: <1449940311.20511.52.camel@infinera.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, 2015-12-11 at 21:19 -0500, Dale P. Smith wrote: > Signed-off-by: Dale P. Smith > --- > Changes for v2: > ???- First attempt at using git format-patch > Changes for v3: > ???- Fix subject. > ???- Add changelog While this is a step in the right direction, this driver needs a rewrite. - The malloc/memcpy crap need to go. - TXing 4 bytes a time while while word size is still one byte makes Not full/Not empty ? HW flags useless. There is no real maintainer of this driver though so I am afraid nobody will do make this happen. > > ?drivers/spi/fsl_espi.c | 10 ++-------- > ?1 file changed, 2 insertions(+), 8 deletions(-) > > diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c > index b1586d1..c84a7ea 100644 > --- a/drivers/spi/fsl_espi.c > +++ b/drivers/spi/fsl_espi.c > @@ -345,17 +345,11 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out, > ? } > ? } > ? } > - if (data_in) { > - memcpy(data_in, buffer + 2 * cmd_len, tran_len); > - if (*buffer == 0x0b) { > - data_in += tran_len; > - data_len -= tran_len; > - *(int *)buffer += tran_len; > - } > - } > ? spi_cs_deactivate(slave); > ? } > ? > + if (data_in) > + memcpy(data_in, buffer + rx_offset, len); > ? free(buffer); > ? return 0; > ?}