Skip to contentSkip to conversation

atmel_spi: add mesg->actual_length, so devices can use it for read/write

PATCH In review Michael Grzeschik 4 participants 4 messages Nov 24, 2011 – Jan 2, 2012

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

PATCH 1/1 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.

---
 drivers/spi/atmel_spi.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/spi/atmel_spi.c +2 -0
index faa03b1..47e6756 100644
@@ -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;
Signature · 7 lines
1.7.7.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw
In reply to Michael Grzeschik
Quoted 8 lines · Michael Grzeschik

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.

---

on which platform did you test it?

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#3 lore raw

Hi,

Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines · Michael Grzeschik

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.

---

on which platform did you test it?

I tested it on the pm9g45.

Michael

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox