All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mx28: fix i.MX28 spi driver
@ 2012-01-14 12:25 Matthias Fuchs
  2012-01-14 14:10 ` Marek Vasut
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Matthias Fuchs @ 2012-01-14 12:25 UTC (permalink / raw)
  To: u-boot

The generic spi flash driver (drivers/mtd/spi/spi_flash.c) uses the
spi low level driver's spi_xfer() function with len=0 to deassert the
SPI flash' chip select. But the i.MX28 spi driver rejects this call
due to len=0.

This patch implements an exception for len=0 with the SPI_XFER_END
flag set. This results in an extra read with the chip select being
deasserted afterwards. There seems to be no way to deassert the signal
by hand.

Signed-off-by: Matthias Fuchs <matthias.fuchs@esd.eu>
---
 drivers/spi/mxs_spi.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
index 4c27fef..adb9ca8 100644
--- a/drivers/spi/mxs_spi.c
+++ b/drivers/spi/mxs_spi.c
@@ -129,9 +129,15 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
 	int len = bitlen / 8;
 	const char *tx = dout;
 	char *rx = din;
-
-	if (bitlen == 0)
-		return 0;
+	char dummy;
+
+	if (bitlen == 0) {
+		if (flags & SPI_XFER_END) {
+			rx = &dummy;
+			len = 1;
+		} else
+			return 0;
+	}
 
 	if (!rx && !tx)
 		return 0;

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

end of thread, other threads:[~2012-01-29  9:12 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-14 12:25 [U-Boot] [PATCH] mx28: fix i.MX28 spi driver Matthias Fuchs
2012-01-14 14:10 ` Marek Vasut
2012-01-14 18:37   ` Matthias Fuchs
2012-01-16 23:33     ` Alexander Keller
2012-01-17 19:34       ` Fabio Estevam
2012-01-14 18:46 ` Fabio Estevam
2012-01-14 18:53   ` Fabio Estevam
2012-01-14 18:54     ` Fabio Estevam
2012-01-14 20:09       ` Matthias Fuchs
2012-01-14 20:14         ` Fabio Estevam
2012-01-15 12:10           ` Matthias Fuchs
2012-01-15 15:28             ` Fabio Estevam
2012-01-15 18:36               ` Matthias Fuchs
2012-01-23 19:52 ` Fabio Estevam
2012-01-23 19:53   ` Marek Vasut
2012-01-24  8:40 ` Stefano Babic
2012-01-28 22:08   ` Fabio Estevam
2012-01-29  9:12     ` Stefano Babic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.