[U-Boot] [PATCH] fsl espi: Fix reading from device

Dale P. Smith dsmith at vtiinstruments.com
Thu Sep 27 00:46:20 CEST 2012


Return the actual bytes read from the device.
---
 drivers/spi/fsl_espi.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c
index a1ebd33..c0348db 100644
--- a/drivers/spi/fsl_espi.c
+++ b/drivers/spi/fsl_espi.c
@@ -291,16 +291,10 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,
 				debug("***spi_xfer:...%08x readed\n", tmpdin);
 			}
 		}
-		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;
-- 
1.7.2.5



More information about the U-Boot mailing list