Skip to content
Snippets Groups Projects
Commit 2638b50b authored by Matthias Fuchs's avatar Matthias Fuchs Committed by Albert ARIBAUD
Browse files

mx28: fix i.MX28 spi driver


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: default avatarMatthias Fuchs <matthias.fuchs@esd.eu>
Tested-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
parent 82182720
No related branches found
No related tags found
No related merge requests found
...@@ -129,9 +129,15 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, ...@@ -129,9 +129,15 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
int len = bitlen / 8; int len = bitlen / 8;
const char *tx = dout; const char *tx = dout;
char *rx = din; char *rx = din;
char dummy;
if (bitlen == 0)
return 0; if (bitlen == 0) {
if (flags & SPI_XFER_END) {
rx = &dummy;
len = 1;
} else
return 0;
}
if (!rx && !tx) if (!rx && !tx)
return 0; return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment