summaryrefslogtreecommitdiffstats
path: root/drivers/spi/atmel_spi.c
diff options
context:
space:
mode:
authorMichael Grzeschik <m.grzeschik@pengutronix.de>2011-11-24 15:32:39 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-11-25 12:41:18 +0100
commit5da11da840283cc41b5ee71636e7173f8c062e5a (patch)
tree031ff3ce7554ba3ca83fd4e7a21c14d3b629b1b7 /drivers/spi/atmel_spi.c
parent739f9105cceb0321026d58b36732756edb67d0c7 (diff)
downloadbarebox-5da11da840283cc41b5ee71636e7173f8c062e5a.tar.gz
barebox-5da11da840283cc41b5ee71636e7173f8c062e5a.tar.xz
atmel_spi: add mesg->actual_length, so devices can use it for read/write
Without this i.e. the m25p driver is not working properly. Its used to calculate the return value of the read/write function of some devices. If the value is missing, barebox would always miscalculate the next transfer sizes. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/spi/atmel_spi.c')
-rw-r--r--drivers/spi/atmel_spi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index faa03b1c9e..47e6756731 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -190,6 +190,7 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *mesg)
struct spi_transfer *t = NULL;
unsigned int bits = spi->bits_per_word;
+ mesg->actual_length = 0;
ret = master->setup(spi);
if (ret < 0) {
dev_dbg(master->dev, "transfer: master setup failed\n");
@@ -210,6 +211,7 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *mesg)
u32 tx_val;
int i = 0, rx_val;
+ mesg->actual_length += t->len;
if (bits <= 8) {
const u8 *txbuf = t->tx_buf;
u8 *rxbuf = t->rx_buf;