From: Scott Jiang Date: Mon, 23 Apr 2012 22:18:13 +0000 (-0400) Subject: spi/spi-bfin5xx: Fix flush of last bit after each spi transfer X-Git-Tag: firefly_0821_release~3680^2~2987^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2431a8154634027ce3915200699f26fb3725a1f2;p=firefly-linux-kernel-4.4.55.git spi/spi-bfin5xx: Fix flush of last bit after each spi transfer This patch ensures that the last bit of a transfer gets correctly flushed out of the register. Signed-off-by: Scott Jiang Signed-off-by: Grant Likely --- diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c index 432d0190e6ba..9bb4d4af8547 100644 --- a/drivers/spi/spi-bfin5xx.c +++ b/drivers/spi/spi-bfin5xx.c @@ -587,6 +587,7 @@ static void bfin_spi_pump_transfers(unsigned long data) if (message->state == DONE_STATE) { dev_dbg(&drv_data->pdev->dev, "transfer: all done!\n"); message->status = 0; + bfin_spi_flush(drv_data); bfin_spi_giveback(drv_data); return; } @@ -870,8 +871,10 @@ static void bfin_spi_pump_transfers(unsigned long data) message->actual_length += drv_data->len_in_bytes; /* Move to next transfer of this msg */ message->state = bfin_spi_next_transfer(drv_data); - if (drv_data->cs_change) + if (drv_data->cs_change && message->state != DONE_STATE) { + bfin_spi_flush(drv_data); bfin_spi_cs_deactive(drv_data, chip); + } } /* Schedule next transfer tasklet */