diff mbox

[v1,3/3] spi: spi-fsl-dspi: Bug fix incorrect CS de-assert

Message ID 1431511935-19820-1-git-send-email-haikun.wang@freescale.com (mailing list archive)
State Accepted
Commit 9deef024a12ebae4965c89837f662905ac88944b
Headers show

Commit Message

haikun wang May 13, 2015, 10:12 a.m. UTC
SPI chip select signal need to keep asserted between several
spi_transfer in the same spi_message usually.
But the driver will de-assert CS signal and the assert it between
serval spi_transfer in the same spi_message under some condiations.
This patch fix the bug.

Here is an example:
Assume you have two variables like the following,
struct spi_transfer a;
struct spi_transfer b;
if you send a spi_message only includes 'a' first,
and then you send a spi_message includes 'a' and 'b'
but without resetting 'a'.
Driver will de-assert CS and then assert CS between 'a' and 'b'.

Signed-off-by: Haikun Wang <haikun.wang@freescale.com>
---
 drivers/spi/spi-fsl-dspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mark Brown May 21, 2015, 8:54 p.m. UTC | #1
On Wed, May 13, 2015 at 06:12:15PM +0800, Haikun Wang wrote:
> SPI chip select signal need to keep asserted between several
> spi_transfer in the same spi_message usually.
> But the driver will de-assert CS signal and the assert it between
> serval spi_transfer in the same spi_message under some condiations.
> This patch fix the bug.

Applied, thanks.
diff mbox

Patch

diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index f6e2ef9..557842a 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -365,10 +365,10 @@  static int dspi_transfer_one_message(struct spi_master *master,
 		dspi->cur_msg = message;
 		dspi->cur_chip = spi_get_ctldata(spi);
 		dspi->cs = spi->chip_select;
+		dspi->cs_change = 0;
 		if (dspi->cur_transfer->transfer_list.next
 				== &dspi->cur_msg->transfers)
-			transfer->cs_change = 1;
-		dspi->cs_change = transfer->cs_change;
+			dspi->cs_change = 1;
 		dspi->void_write_data = dspi->cur_chip->void_write_data;
 
 		dspi->dataflags = 0;