mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] atmel_spi: add mesg->actual_length, so devices can use it for read/write
@ 2011-11-24 14:32 Michael Grzeschik
  2011-11-25 15:11 ` Hubert Feurstein
  2012-01-01  4:46 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Grzeschik @ 2011-11-24 14:32 UTC (permalink / raw)
  To: barebox

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>
---
 drivers/spi/atmel_spi.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index faa03b1..47e6756 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;
-- 
1.7.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-02 10:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-24 14:32 [PATCH] atmel_spi: add mesg->actual_length, so devices can use it for read/write Michael Grzeschik
2011-11-25 15:11 ` Hubert Feurstein
2012-01-01  4:46 ` Jean-Christophe PLAGNIOL-VILLARD
2012-01-02 10:42   ` Michael Grzeschik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox