diff mbox

spi: mpc512x-psc: optionally keep PSC SS asserted across xfer segmensts

Message ID 1363183063-24947-1-git-send-email-agust@denx.de (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Anatolij Gustschin March 13, 2013, 1:57 p.m. UTC
Some SPI slave devices require asserted chip select signal across
multiple transfer segments of an SPI message. Currently the driver
always de-asserts the internal SS signal for every single transfer
segment of the message and ignores the 'cs_change' flag of the
transfer description. Disable the internal chip select (SS) only
if this is needed and indicated by the 'cs_change' flag.

Without this change, each partial transfer of a surrounding
multi-part SPI transaction might erroneously change the SS
signal, which might prevent slaves from answering the request
that was sent in a previous transfer segment because the
transaction could be considered aborted (SS was de-asserted
before reading the response).

Reported-by: Gerhard Sittig <gerhard.sittig@ifm.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 drivers/spi/spi-mpc512x-psc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Anatolij Gustschin April 1, 2013, 2:19 p.m. UTC | #1
On Mon, 1 Apr 2013 14:30:17 +0100
Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:

> On Wed, Mar 13, 2013 at 02:57:43PM +0100, Anatolij Gustschin wrote:
> > Some SPI slave devices require asserted chip select signal across
> > multiple transfer segments of an SPI message. Currently the driver
> 
> This isn't some devices, it's the standard behaviour for the API -
> drivers and frameworks can split up a SPI transfer into as many pieces
> as amuses them.
> 
> Anyway, applied.

Thanks!

Could you also apply this one ?

https://patchwork.kernel.org/patch/2251911


Thanks,

Anatolij

------------------------------------------------------------------------------
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
diff mbox

Patch

diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
index 6b600a2..dfddf33 100644
--- a/drivers/spi/spi-mpc512x-psc.c
+++ b/drivers/spi/spi-mpc512x-psc.c
@@ -168,7 +168,7 @@  static int mpc512x_psc_spi_transfer_rxtx(struct spi_device *spi,
 
 		for (i = count; i > 0; i--) {
 			data = tx_buf ? *tx_buf++ : 0;
-			if (len == EOFBYTE)
+			if (len == EOFBYTE && t->cs_change)
 				setbits32(&fifo->txcmd, MPC512x_PSC_FIFO_EOF);
 			out_8(&fifo->txdata_8, data);
 			len--;